/src/libetonyek/src/lib/PAGCollector.h
Line | Count | Source |
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 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 | | |
56 | | private: |
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 | 0 | { |
62 | 0 | return true; |
63 | 0 | } |
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: */ |