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 typedef std::map<unsigned, IWORKOutputID_t> PageGroupsMap_t;
26
27 public:
28 explicit PAGCollector(IWORKDocumentInterface *document);
29
30 // collector functions
31
32 void collectPublicationInfo(const PAGPublicationInfo &pubInfo);
33
34 void collectTextBody();
35
36 void collectAttachment(const IWORKOutputID_t &id, bool block);
37 void collectAttachmentPosition(const IWORKPosition &position);
38
39 void collectAnnotation(const std::string &name);
40
41 void openPageGroup(const boost::optional<int> &page);
42 void closePageGroup();
43
44 // helper functions
45 void setPageDimensions(const IWORKPrintInfo &dimensions);
46
47 void openSection(const std::string &style); // probably better to look for the style in the calling function
48 void openSection(const IWORKStylePtr_t &style);
49 void closeSection();
50
51 void sendAnnotation(const std::string &name);
52
53 PAGFootnoteKind getFootnoteKind() const;
54
55 private:
56 void drawShape(const IWORKShapePtr_t &shape) override;
57 void drawTable() override;
58 void drawMedia(double x, double y, const librevenge::RVNGPropertyList &data) override;
59 void fillShapeProperties(librevenge::RVNGPropertyList &props) override;
60 bool createFrameStylesForTextBox() const override
61 {
62 return true;
63 }
64 void drawTextBox(const IWORKTextPtr_t &text, const glm::dmat3 &trafo, const IWORKGeometryPtr_t &boundingBox, const librevenge::RVNGPropertyList &style) override;
65
66 void flushPageSpan(bool writeEmpty = true);
67 void writePageGroupsObjects();
68
69 private:
70 boost::optional<IWORKPrintInfo> m_pageDimensions;
71 IWORKStylePtr_t m_currentSectionStyle;
72 bool m_firstPageSpan;
73
74 PAGPublicationInfo m_pubInfo;
75
76 PageGroupsMap_t m_pageGroups;
77 int m_page;
78
79 // FIXME: This is a clumsy workaround.
80 boost::optional<IWORKPosition> m_attachmentPosition;
81 PAGAnnotationMap_t m_annotations;
82 };
83
84 } // namespace libetonyek
85
86 #endif // PAGCOLLECTOR_H_INCLUDED
87
88 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libetonyek::IWORKPrintInfo
Definition: IWORKTypes.h:407
libetonyek::IWORKGeometryPtr_t
std::shared_ptr< IWORKGeometry > IWORKGeometryPtr_t
Definition: IWORKTypes_fwd.h:41
libetonyek
Definition: IWORKBezierElement.cpp:20
libetonyek::PAGCollector::m_page
int m_page
Definition: PAGCollector.h:77
libetonyek::PAGCollector::closePageGroup
void closePageGroup()
Definition: PAGCollector.cpp:208
libetonyek::PAGCollector::fillShapeProperties
void fillShapeProperties(librevenge::RVNGPropertyList &props) override
Definition: PAGCollector.cpp:348
libetonyek::PAGCollector
Definition: PAGCollector.h:23
y
double y
Definition: IWORKShape.cpp:46
libetonyek::PAGCollector::flushPageSpan
void flushPageSpan(bool writeEmpty=true)
Definition: PAGCollector.cpp:390
libetonyek::PAGAnnotationMap_t
std::unordered_map< std::string, IWORKOutputElements > PAGAnnotationMap_t
Definition: PAGTypes.h:26
libetonyek::IWORKToken::position
Definition: IWORKToken.h:368
libetonyek::PAGCollector::openPageGroup
void openPageGroup(const boost::optional< int > &page)
Definition: PAGCollector.cpp:199
libetonyek::PAGCollector::m_firstPageSpan
bool m_firstPageSpan
Definition: PAGCollector.h:72
libetonyek::PAGPublicationInfo
Definition: PAGTypes.h:28
libetonyek::IWORKOutputID_t
unsigned IWORKOutputID_t
Definition: IWORKTypes_fwd.h:28
libetonyek::KEY2Token::page
Definition: KEY2Token.h:69
libetonyek::IWORKToken::shape
Definition: IWORKToken.h:394
libetonyek::IWORKStylePtr_t
std::shared_ptr< IWORKStyle > IWORKStylePtr_t
Definition: IWORKStyle_fwd.h:21
libetonyek::PAGFootnoteKind
PAGFootnoteKind
Definition: PAGEnum.h:16
libetonyek::PAGCollector::m_pageDimensions
boost::optional< IWORKPrintInfo > m_pageDimensions
Definition: PAGCollector.h:70
libetonyek::PAGCollector::collectAttachment
void collectAttachment(const IWORKOutputID_t &id, bool block)
libetonyek::PAGCollector::collectTextBody
void collectTextBody()
Definition: PAGCollector.cpp:133
libetonyek::PAGCollector::PageGroupsMap_t
std::map< unsigned, IWORKOutputID_t > PageGroupsMap_t
Definition: PAGCollector.h:25
libetonyek::IWORKToken::text
Definition: IWORKToken.h:465
libetonyek::PAGCollector::setPageDimensions
void setPageDimensions(const IWORKPrintInfo &dimensions)
Definition: PAGCollector.cpp:145
libetonyek::IWORKDocumentInterface
Definition: IWORKDocumentInterface.h:18
x
double x
Definition: IWORKShape.cpp:45
libetonyek::PAGCollector::closeSection
void closeSection()
Definition: PAGCollector.cpp:175
libetonyek::PAGCollector::openSection
void openSection(const std::string &style)
Definition: PAGCollector.cpp:150
libetonyek::PAGCollector::drawTable
void drawTable() override
Definition: PAGCollector.cpp:220
libetonyek::PAGCollector::collectAttachmentPosition
void collectAttachmentPosition(const IWORKPosition &position)
Definition: PAGCollector.cpp:140
libetonyek::PAGCollector::m_attachmentPosition
boost::optional< IWORKPosition > m_attachmentPosition
Definition: PAGCollector.h:80
PAGTypes.h
libetonyek::PAGCollector::collectPublicationInfo
void collectPublicationInfo(const PAGPublicationInfo &pubInfo)
Definition: PAGCollector.cpp:128
libetonyek::IWORKToken::style
Definition: IWORKToken.h:414
libetonyek::PAGCollector::m_pubInfo
PAGPublicationInfo m_pubInfo
Definition: PAGCollector.h:74
libetonyek::PAGCollector::drawShape
void drawShape(const IWORKShapePtr_t &shape) override
Definition: PAGCollector.cpp:272
libetonyek::IWORKCollector
Definition: IWORKCollector.h:41
libetonyek::PAGCollector::sendAnnotation
void sendAnnotation(const std::string &name)
Definition: PAGCollector.cpp:180
name
const char * name
Definition: IWORKToken.cpp:43
libetonyek::IWORKTextPtr_t
std::shared_ptr< IWORKText > IWORKTextPtr_t
Definition: IWORKText_fwd.h:18
libetonyek::PAGCollector::drawTextBox
void drawTextBox(const IWORKTextPtr_t &text, const glm::dmat3 &trafo, const IWORKGeometryPtr_t &boundingBox, const librevenge::RVNGPropertyList &style) override
Definition: PAGCollector.cpp:356
libetonyek::PAGCollector::m_pageGroups
PageGroupsMap_t m_pageGroups
Definition: PAGCollector.h:76
libetonyek::IWORKPosition
Definition: IWORKTypes.h:52
libetonyek::PAGCollector::writePageGroupsObjects
void writePageGroupsObjects()
Definition: PAGCollector.cpp:460
libetonyek::PAGCollector::createFrameStylesForTextBox
bool createFrameStylesForTextBox() const override
Definition: PAGCollector.h:60
libetonyek::PAGCollector::drawMedia
void drawMedia(double x, double y, const librevenge::RVNGPropertyList &data) override
Definition: PAGCollector.cpp:311
libetonyek::IWORKToken::data
Definition: IWORKToken.h:174
libetonyek::NUM1Token::document
Definition: NUM1Token.h:34
libetonyek::IWORKToken::string
Definition: IWORKToken.h:411
libetonyek::PAGCollector::PAGCollector
PAGCollector(IWORKDocumentInterface *document)
Definition: PAGCollector.cpp:93
libetonyek::IWORKShapePtr_t
std::shared_ptr< IWORKShape > IWORKShapePtr_t
Definition: IWORKShape.h:38
libetonyek::PAGCollector::collectAnnotation
void collectAnnotation(const std::string &name)
Definition: PAGCollector.cpp:106
IWORKCollector.h
libetonyek::PAGCollector::m_currentSectionStyle
IWORKStylePtr_t m_currentSectionStyle
Definition: PAGCollector.h:71
libetonyek::PAGCollector::m_annotations
PAGAnnotationMap_t m_annotations
Definition: PAGCollector.h:81
libetonyek::PAGCollector::getFootnoteKind
PAGFootnoteKind getFootnoteKind() const
Definition: PAGCollector.cpp:466