PAGCollector.h Source File documentation

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
18namespace libetonyek
19{
20
21class IWORKDocumentInterface;
22
23 class PAGCollector : public IWORKCollector
24{
25 typedef std::map<unsigned, IWORKOutputID_t> PageGroupsMap_t;
26
27public:
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 startDocument();
46 void setPageDimensions(const IWORKPrintInfo &dimensions);
47
48 void openSection(const std::string &style); // probably better to look for the style in the calling function
49 void openSection(const IWORKStylePtr_t &style);
50 void closeSection();
51
52 void sendAnnotation(const std::string &name);
53
54 PAGFootnoteKind getFootnoteKind() const;
55
56private:
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
69private:
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: */
IWORKCollector.h
y
double y
Definition: IWORKShape.cpp:47
x
double x
Definition: IWORKShape.cpp:46
PAGTypes.h
libetonyek::IWORKCollector
Definition: IWORKCollector.h:42
libetonyek::IWORKDocumentInterface
Definition: IWORKDocumentInterface.h:19
libetonyek::PAGCollector
Definition: PAGCollector.h:24
libetonyek::PAGCollector::startDocument
void startDocument()
Definition: PAGCollector.cpp:145
libetonyek::PAGCollector::collectPublicationInfo
void collectPublicationInfo(const PAGPublicationInfo &pubInfo)
Definition: PAGCollector.cpp:128
libetonyek::PAGCollector::createFrameStylesForTextBox
bool createFrameStylesForTextBox() const override
Definition: PAGCollector.h:60
libetonyek::PAGCollector::m_firstPageSpan
bool m_firstPageSpan
Definition: PAGCollector.h:72
libetonyek::PAGCollector::m_attachmentPosition
boost::optional< IWORKPosition > m_attachmentPosition
Definition: PAGCollector.h:80
libetonyek::PAGCollector::collectAttachment
void collectAttachment(const IWORKOutputID_t &id, bool block)
libetonyek::PAGCollector::flushPageSpan
void flushPageSpan(bool writeEmpty=true)
Definition: PAGCollector.cpp:365
libetonyek::PAGCollector::setPageDimensions
void setPageDimensions(const IWORKPrintInfo &dimensions)
Definition: PAGCollector.cpp:150
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:331
libetonyek::PAGCollector::closePageGroup
void closePageGroup()
Definition: PAGCollector.cpp:213
libetonyek::PAGCollector::closeSection
void closeSection()
Definition: PAGCollector.cpp:180
libetonyek::PAGCollector::drawTable
void drawTable() override
Definition: PAGCollector.cpp:225
libetonyek::PAGCollector::sendAnnotation
void sendAnnotation(const std::string &name)
Definition: PAGCollector.cpp:185
libetonyek::PAGCollector::fillShapeProperties
void fillShapeProperties(librevenge::RVNGPropertyList &props) override
Definition: PAGCollector.cpp:314
libetonyek::PAGCollector::PageGroupsMap_t
std::map< unsigned, IWORKOutputID_t > PageGroupsMap_t
Definition: PAGCollector.h:25
libetonyek::PAGCollector::m_page
int m_page
Definition: PAGCollector.h:77
libetonyek::PAGCollector::writePageGroupsObjects
void writePageGroupsObjects()
Definition: PAGCollector.cpp:446
libetonyek::PAGCollector::openPageGroup
void openPageGroup(const boost::optional< int > &page)
Definition: PAGCollector.cpp:204
libetonyek::PAGCollector::PAGCollector
PAGCollector(IWORKDocumentInterface *document)
Definition: PAGCollector.cpp:93
libetonyek::PAGCollector::collectTextBody
void collectTextBody()
Definition: PAGCollector.cpp:133
libetonyek::PAGCollector::collectAttachmentPosition
void collectAttachmentPosition(const IWORKPosition &position)
Definition: PAGCollector.cpp:140
libetonyek::PAGCollector::getFootnoteKind
PAGFootnoteKind getFootnoteKind() const
Definition: PAGCollector.cpp:452
libetonyek::PAGCollector::m_currentSectionStyle
IWORKStylePtr_t m_currentSectionStyle
Definition: PAGCollector.h:71
libetonyek::PAGCollector::collectAnnotation
void collectAnnotation(const std::string &name)
Definition: PAGCollector.cpp:106
libetonyek::PAGCollector::m_annotations
PAGAnnotationMap_t m_annotations
Definition: PAGCollector.h:81
libetonyek::PAGCollector::m_pageDimensions
boost::optional< IWORKPrintInfo > m_pageDimensions
Definition: PAGCollector.h:70
libetonyek::PAGCollector::openSection
void openSection(const std::string &style)
Definition: PAGCollector.cpp:155
libetonyek::PAGCollector::drawMedia
void drawMedia(double x, double y, const librevenge::RVNGPropertyList &data) override
Definition: PAGCollector.cpp:283
libetonyek::PAGCollector::m_pubInfo
PAGPublicationInfo m_pubInfo
Definition: PAGCollector.h:74
libetonyek::PAGCollector::m_pageGroups
PageGroupsMap_t m_pageGroups
Definition: PAGCollector.h:76
libetonyek::IWORKToken::string
@ string
Definition: IWORKToken.h:418
libetonyek::IWORKToken::text
@ text
Definition: IWORKToken.h:472
libetonyek::IWORKToken::position
@ position
Definition: IWORKToken.h:375
libetonyek::IWORKToken::data
@ data
Definition: IWORKToken.h:178
libetonyek::IWORKToken::style
@ style
Definition: IWORKToken.h:421
libetonyek::IWORKToken::name
@ name
Definition: IWORKToken.h:585
libetonyek::KEY2Token::page
@ page
Definition: KEY2Token.h:69
libetonyek::NUM1Token::document
@ document
Definition: NUM1Token.h:34
libetonyek
Definition: IWORKBezierElement.cpp:21
libetonyek::IWORKOutputID_t
unsigned IWORKOutputID_t
Definition: IWORKTypes_fwd.h:28
libetonyek::IWORKTextPtr_t
std::shared_ptr< IWORKText > IWORKTextPtr_t
Definition: IWORKText_fwd.h:20
libetonyek::PAGFootnoteKind
PAGFootnoteKind
Definition: PAGEnum.h:17
libetonyek::IWORKGeometryPtr_t
std::shared_ptr< IWORKGeometry > IWORKGeometryPtr_t
Definition: IWORKTypes_fwd.h:41
libetonyek::IWORKStylePtr_t
std::shared_ptr< IWORKStyle > IWORKStylePtr_t
Definition: IWORKStyle_fwd.h:21
libetonyek::PAGAnnotationMap_t
std::unordered_map< std::string, IWORKOutputElements > PAGAnnotationMap_t
Definition: PAGTypes.h:26
libetonyek::IWORKPosition
Definition: IWORKTypes.h:53
libetonyek::IWORKPrintInfo
Definition: IWORKTypes.h:409
libetonyek::PAGPublicationInfo
Definition: PAGTypes.h:29