PAGCollector.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3  * This file is part of the libetonyek project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #ifndef PAGCOLLECTOR_H_INCLUDED
11 #define PAGCOLLECTOR_H_INCLUDED
12 
13 #include <map>
14 
15 #include "IWORKCollector.h"
16 #include "PAGTypes.h"
17 
18 namespace libetonyek
19 {
20 
21 class IWORKDocumentInterface;
22 
24 {
25  struct Section
26  {
27  Section();
28 
29  void clear();
30 
32  boost::optional<double> m_width;
33  boost::optional<double> m_height;
34  boost::optional<double> m_horizontalMargin;
35  boost::optional<double> m_verticalMargin;
36  };
37 
38  typedef std::map<unsigned, IWORKOutputID_t> PageGroupsMap_t;
39 
40 public:
42 
43  // collector functions
44 
45  void collectPublicationInfo(const PAGPublicationInfo &pubInfo);
46 
47  void collectTextBody();
48 
49  void collectAttachment(const IWORKOutputID_t &id, bool block);
51 
52  void collectFootnote(const std::string &mark);
53  void insertFootnote();
54 
55  void openPageGroup(const boost::optional<int> &page);
56  void closePageGroup();
57 
58  // helper functions
59 
60  void openSection(const std::string &style, double width, double height, double horizontalMargin, double verticalMargin);
61  void closeSection();
62 
63  void openAttachments();
64  void closeAttachments();
65 
66 private:
67  virtual void drawTable();
68  virtual void drawMedia(double x, double y, double w, double h, const std::string &mimetype, const librevenge::RVNGBinaryData &data);
69  virtual void fillShapeProperties(librevenge::RVNGPropertyList &props);
70  virtual void drawTextBox(const IWORKTextPtr_t &text, const glm::dmat3 &trafo, const IWORKGeometryPtr_t &boundingBox);
71 
72  void flushPageSpan(bool writeEmpty = true);
74 
75 private:
78 
79  std::deque<IWORKOutputElements> m_footnotes;
80  std::deque<IWORKOutputElements>::const_iterator m_nextFootnote;
81 
83 
84  PageGroupsMap_t m_pageGroups;
85  int m_page;
86 
87  // FIXME: This is a clumsy workaround.
88  boost::optional<IWORKPosition> m_attachmentPosition;
90 };
91 
92 } // namespace libetonyek
93 
94 #endif // PAGCOLLECTOR_H_INCLUDED
95 
96 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
std::deque< IWORKOutputElements >::const_iterator m_nextFootnote
Definition: PAGCollector.h:80
Definition: IWORKBezierElement.cpp:18
Definition: IWORKToken.h:239
int m_page
Definition: PAGCollector.h:85
Definition: IWORKToken.h:262
void closePageGroup()
Definition: PAGCollector.cpp:238
Definition: PAGCollector.h:23
double y
Definition: IWORKShape.cpp:43
boost::optional< double > m_verticalMargin
Definition: PAGCollector.h:35
void flushPageSpan(bool writeEmpty=true)
Definition: PAGCollector.cpp:350
boost::shared_ptr< IWORKStyle > IWORKStylePtr_t
Definition: IWORKStyle_fwd.h:21
void openPageGroup(const boost::optional< int > &page)
Definition: PAGCollector.cpp:229
bool m_firstPageSpan
Definition: PAGCollector.h:77
Definition: PAGTypes.h:24
unsigned IWORKOutputID_t
Definition: IWORKTypes_fwd.h:26
virtual void drawMedia(double x, double y, double w, double h, const std::string &mimetype, const librevenge::RVNGBinaryData &data)
Definition: PAGCollector.cpp:269
Definition: KEY2Token.h:45
void collectAttachment(const IWORKOutputID_t &id, bool block)
Definition: PAGCollector.cpp:133
bool m_inAttachments
Definition: PAGCollector.h:89
void collectTextBody()
Definition: PAGCollector.cpp:126
Definition: IWORKToken.h:177
std::map< unsigned, IWORKOutputID_t > PageGroupsMap_t
Definition: PAGCollector.h:38
boost::optional< double > m_width
Definition: PAGCollector.h:32
boost::shared_ptr< IWORKGeometry > IWORKGeometryPtr_t
Definition: IWORKTypes_fwd.h:33
Definition: IWORKToken.h:154
Definition: IWORKToken.h:179
Definition: IWORKDocumentInterface.h:18
double x
Definition: IWORKShape.cpp:42
void closeSection()
Definition: PAGCollector.cpp:212
Definition: IWORKToken.h:194
void collectAttachmentPosition(const IWORKPosition &position)
Definition: PAGCollector.cpp:144
boost::optional< IWORKPosition > m_attachmentPosition
Definition: PAGCollector.h:88
void collectPublicationInfo(const PAGPublicationInfo &pubInfo)
Definition: PAGCollector.cpp:121
boost::optional< double > m_height
Definition: PAGCollector.h:33
Definition: IWORKToken.h:67
Section m_currentSection
Definition: PAGCollector.h:76
void clear()
Definition: PAGCollector.cpp:99
PAGPublicationInfo m_pubInfo
Definition: PAGCollector.h:82
Definition: IWORKToken.h:261
Definition: IWORKCollector.h:40
std::deque< IWORKOutputElements > m_footnotes
Definition: PAGCollector.h:79
void insertFootnote()
Definition: PAGCollector.cpp:149
virtual void drawTextBox(const IWORKTextPtr_t &text, const glm::dmat3 &trafo, const IWORKGeometryPtr_t &boundingBox)
Definition: PAGCollector.cpp:311
virtual void drawTable()
Definition: PAGCollector.cpp:250
Definition: IWORKToken.h:230
PageGroupsMap_t m_pageGroups
Definition: PAGCollector.h:84
Definition: IWORKToken.h:229
Section()
Definition: PAGCollector.cpp:90
Definition: IWORKTypes.h:43
void closeAttachments()
Definition: PAGCollector.cpp:223
void writePageGroupsObjects()
Definition: PAGCollector.cpp:405
virtual void fillShapeProperties(librevenge::RVNGPropertyList &props)
Definition: PAGCollector.cpp:305
void collectFootnote(const std::string &mark)
Definition: PAGCollector.cpp:161
void openAttachments()
Definition: PAGCollector.cpp:217
Definition: NUM1Token.h:34
IWORKStylePtr_t m_style
Definition: PAGCollector.h:31
PAGCollector(IWORKDocumentInterface *document)
Definition: PAGCollector.cpp:108
void openSection(const std::string &style, double width, double height, double horizontalMargin, double verticalMargin)
Definition: PAGCollector.cpp:187
boost::shared_ptr< IWORKText > IWORKTextPtr_t
Definition: IWORKText_fwd.h:18
Definition: PAGCollector.h:25
boost::optional< double > m_horizontalMargin
Definition: PAGCollector.h:34

Generated for libetonyek by doxygen 1.8.11