KEYCollector.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libetonyek project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef KEYCOLLECTOR_H_INCLUDED
00011 #define KEYCOLLECTOR_H_INCLUDED
00012 
00013 #include <deque>
00014 
00015 #include "IWORKCollector.h"
00016 #include "IWORKPath_fwd.h"
00017 #include "IWORKStyle_fwd.h"
00018 #include "KEYTypes.h"
00019 #include "KEYTypes_fwd.h"
00020 
00021 namespace libetonyek
00022 {
00023 
00024 class KEYCollector : public IWORKCollector
00025 {
00026 public:
00027   explicit KEYCollector(IWORKDocumentInterface *document);
00028   ~KEYCollector();
00029 
00030   // collector functions
00031 
00032   void collectPresentationSize(const IWORKSize &size);
00033 
00034   KEYLayerPtr_t collectLayer();
00035   void insertLayer(const KEYLayerPtr_t &layer);
00036   void collectPage();
00037 
00038   KEYPlaceholderPtr_t collectTextPlaceholder(const IWORKStylePtr_t &style, bool title);
00039   void insertTextPlaceholder(const KEYPlaceholderPtr_t &placeholder);
00040 
00041   void collectNote();
00042 
00043   void collectStickyNote();
00044 
00045   void setSlideStyle(const IWORKStylePtr_t &style);
00046 
00047   // helper functions
00048 
00049   void startDocument();
00050   void endDocument();
00051 
00052   void startSlides();
00053   void endSlides();
00054   void startThemes();
00055   void endThemes();
00056 
00057   void startPage();
00058   void endPage();
00059   void startLayer();
00060   void endLayer();
00061 
00062 protected:
00063   bool m_paint;
00064 
00065 private:
00066   struct Slide
00067   {
00068     IWORKOutputElements m_content;
00069     IWORKStylePtr_t m_style;
00070   };
00071 
00072 private:
00073   virtual void drawTable();
00074   virtual void drawMedia(double x, double y, double w, double h, const std::string &mimetype, const librevenge::RVNGBinaryData &data);
00075   virtual void fillShapeProperties(librevenge::RVNGPropertyList &props);
00076   virtual void drawTextBox(const IWORKTextPtr_t &text, const glm::dmat3 &trafo, const IWORKGeometryPtr_t &boundingBox);
00077 
00078   void writeSlide(const Slide &slide);
00079 
00080 private:
00081   IWORKSize m_size;
00082 
00083   std::deque<Slide> m_slides;
00084   IWORKOutputElements m_notes;
00085   IWORKOutputElements m_stickyNotes;
00086 
00087   bool m_pageOpened;
00088   bool m_layerOpened;
00089   int m_layerCount;
00090 };
00091 
00092 } // namespace libetonyek
00093 
00094 #endif // KEYCOLLECTOR_H_INCLUDED
00095 
00096 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */