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 openPageGroup(const boost::optional<int> &page);
53  void closePageGroup();
54 
55  // helper functions
56 
57  void openSection(const std::string &style, double width, double height, double horizontalMargin, double verticalMargin);
58  void closeSection();
59 
60  void openAttachments();
61  void closeAttachments();
62 
64 
65 private:
66  virtual void drawTable();
67  virtual void drawMedia(double x, double y, double w, double h, const std::string &mimetype, const librevenge::RVNGBinaryData &data);
68  virtual void fillShapeProperties(librevenge::RVNGPropertyList &props);
69  virtual void drawTextBox(const IWORKTextPtr_t &text, const glm::dmat3 &trafo, const IWORKGeometryPtr_t &boundingBox);
70 
71  void flushPageSpan(bool writeEmpty = true);
73 
74 private:
77 
79 
81  int m_page;
82 
83  // FIXME: This is a clumsy workaround.
84  boost::optional<IWORKPosition> m_attachmentPosition;
86 };
87 
88 } // namespace libetonyek
89 
90 #endif // PAGCOLLECTOR_H_INCLUDED
91 
92 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Definition: IWORKBezierElement.cpp:18
int m_page
Definition: PAGCollector.h:81
void closePageGroup()
Definition: PAGCollector.cpp:188
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:301
boost::shared_ptr< IWORKStyle > IWORKStylePtr_t
Definition: IWORKStyle_fwd.h:21
Definition: IWORKToken.h:223
void openPageGroup(const boost::optional< int > &page)
Definition: PAGCollector.cpp:179
bool m_firstPageSpan
Definition: PAGCollector.h:76
Definition: PAGTypes.h:26
unsigned IWORKOutputID_t
Definition: IWORKTypes_fwd.h:27
Definition: KEY2Token.h:44
virtual void drawMedia(double x, double y, double w, double h, const std::string &mimetype, const librevenge::RVNGBinaryData &data)
Definition: PAGCollector.cpp:220
Definition: IWORKToken.h:355
PAGFootnoteKind
Definition: PAGEnum.h:16
void collectAttachment(const IWORKOutputID_t &id, bool block)
Definition: IWORKToken.h:312
bool m_inAttachments
Definition: PAGCollector.h:85
void collectTextBody()
Definition: PAGCollector.cpp:125
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:40
Definition: IWORKToken.h:270
Definition: IWORKDocumentInterface.h:18
double x
Definition: IWORKShape.cpp:42
void closeSection()
Definition: PAGCollector.cpp:162
void collectAttachmentPosition(const IWORKPosition &position)
Definition: PAGCollector.cpp:132
boost::optional< IWORKPosition > m_attachmentPosition
Definition: PAGCollector.h:84
void collectPublicationInfo(const PAGPublicationInfo &pubInfo)
Definition: PAGCollector.cpp:120
boost::optional< double > m_height
Definition: PAGCollector.h:33
Definition: IWORKToken.h:254
Section m_currentSection
Definition: PAGCollector.h:75
void clear()
Definition: PAGCollector.cpp:100
PAGPublicationInfo m_pubInfo
Definition: PAGCollector.h:78
Definition: IWORKCollector.h:41
virtual void drawTextBox(const IWORKTextPtr_t &text, const glm::dmat3 &trafo, const IWORKGeometryPtr_t &boundingBox)
Definition: PAGCollector.cpp:262
virtual void drawTable()
Definition: PAGCollector.cpp:200
Definition: IWORKToken.h:313
PageGroupsMap_t m_pageGroups
Definition: PAGCollector.h:80
Definition: IWORKToken.h:354
Section()
Definition: PAGCollector.cpp:91
Definition: IWORKTypes.h:46
void closeAttachments()
Definition: PAGCollector.cpp:173
void writePageGroupsObjects()
Definition: PAGCollector.cpp:354
Definition: IWORKToken.h:95
virtual void fillShapeProperties(librevenge::RVNGPropertyList &props)
Definition: PAGCollector.cpp:256
Definition: NUM1Token.h:34
Definition: IWORKToken.h:252
void openAttachments()
Definition: PAGCollector.cpp:167
IWORKStylePtr_t m_style
Definition: PAGCollector.h:31
PAGCollector(IWORKDocumentInterface *document)
Definition: PAGCollector.cpp:109
void openSection(const std::string &style, double width, double height, double horizontalMargin, double verticalMargin)
Definition: PAGCollector.cpp:137
boost::shared_ptr< IWORKText > IWORKTextPtr_t
Definition: IWORKText_fwd.h:18
Definition: PAGCollector.h:25
boost::optional< double > m_horizontalMargin
Definition: PAGCollector.h:34
PAGFootnoteKind getFootnoteKind() const
Definition: PAGCollector.cpp:360

Generated for libetonyek by doxygen 1.8.14