PAGCollector.h Source File documentation

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

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