KEYCollectorBase.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 KEYCOLLECTORBASE_H_INCLUDED
11 #define KEYCOLLECTORBASE_H_INCLUDED
12 
13 #include <deque>
14 #include <stack>
15 
16 #include "KEYCollector.h"
17 #include "KEYObject.h"
18 #include "KEYStyle.h"
19 #include "KEYStylesheet.h"
20 #include "KEYText_fwd.h"
21 
22 namespace libetonyek
23 {
24 
25 struct KEYDictionary;
26 
32 {
33  struct Level
34  {
37 
38  Level();
39  };
40 
41 public:
44 
45  // collector functions
46 
47  virtual void collectCellStyle(const boost::optional<ID_t> &id,
48  const boost::optional<KEYPropertyMap> &props,
49  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
50  bool ref, bool anonymous);
51  virtual void collectCharacterStyle(const boost::optional<ID_t> &id,
52  const boost::optional<KEYPropertyMap> &props,
53  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
54  bool ref, bool anonymous);
55  virtual void collectConnectionStyle(const boost::optional<ID_t> &id,
56  const boost::optional<KEYPropertyMap> &props,
57  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
58  bool ref, bool anonymous);
59  virtual void collectGraphicStyle(const boost::optional<ID_t> &id,
60  const boost::optional<KEYPropertyMap> &props,
61  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
62  bool ref, bool anonymous);
63  virtual void collectLayoutStyle(const boost::optional<ID_t> &id,
64  const boost::optional<KEYPropertyMap> &props,
65  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
66  bool ref, bool anonymous);
67  virtual void collectListStyle(const boost::optional<ID_t> &id,
68  const boost::optional<KEYPropertyMap> &props,
69  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
70  bool ref, bool anonymous);
71  virtual void collectParagraphStyle(const boost::optional<ID_t> &id,
72  const boost::optional<KEYPropertyMap> &props,
73  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
74  bool ref, bool anonymous);
75  virtual void collectPlaceholderStyle(const boost::optional<ID_t> &id,
76  const boost::optional<KEYPropertyMap> &props,
77  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
78  bool ref, bool anonymous);
79  virtual void collectSlideStyle(const boost::optional<ID_t> &id,
80  const boost::optional<KEYPropertyMap> &props,
81  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
82  bool ref, bool anonymous);
83  virtual void collectTabularStyle(const boost::optional<ID_t> &id,
84  const boost::optional<KEYPropertyMap> &props,
85  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
86  bool ref, bool anonymous);
87  virtual void collectVectorStyle(const boost::optional<ID_t> &id,
88  const boost::optional<KEYPropertyMap> &props,
89  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
90  bool ref, bool anonymous);
91 
92  virtual void collectGeometry(boost::optional<ID_t> &id,
93  boost::optional<KEYSize> &naturalSize, boost::optional<KEYPosition> &position,
94  boost::optional<double> &angle,
95  boost::optional<double> &shearXAngle, boost::optional<double> &shearYAngle,
96  boost::optional<bool> &horizontalFlip, boost::optional<bool> &verticalFlip,
97  boost::optional<bool> &aspectRatioLocked, boost::optional<bool> &sizesLocked);
98 
99  virtual void collectBezier(const boost::optional<ID_t> &id, const KEYPathPtr_t &path, bool ref);
100  virtual void collectGroup(const boost::optional<ID_t> &id, const KEYGroupPtr_t &group);
101  virtual void collectImage(const boost::optional<ID_t> &id, const KEYImagePtr_t &image);
102  virtual void collectLine(const boost::optional<ID_t> &id, const KEYLinePtr_t &line);
103  virtual void collectShape(const boost::optional<ID_t> &id);
104 
105  virtual void collectBezierPath(const boost::optional<ID_t> &id);
106  virtual void collectPolygonPath(const boost::optional<ID_t> &id, const KEYSize &size, unsigned edges);
107  virtual void collectRoundedRectanglePath(const boost::optional<ID_t> &id, const KEYSize &size, double radius);
108  virtual void collectArrowPath(const boost::optional<ID_t> &id, const KEYSize &size, double headWidth, double stemRelYPos, bool doubleSided);
109  virtual void collectStarPath(const boost::optional<ID_t> &id, const KEYSize &size, unsigned points, double innerRadius);
110  virtual void collectConnectionPath(const boost::optional<ID_t> &id, const KEYSize &size, double middleX, double middleY);
111  virtual void collectCalloutPath(const boost::optional<ID_t> &id, const KEYSize &size, double radius, double tailSize, double tailX, double tailY, bool quoteBubble);
112 
113  virtual void collectData(const boost::optional<ID_t> &id, const WPXInputStreamPtr_t &stream, const boost::optional<std::string> &displayName, const boost::optional<unsigned> &type, bool ref);
114  virtual void collectUnfiltered(const boost::optional<ID_t> &id, const boost::optional<KEYSize> &size, bool ref);
115  virtual void collectFiltered(const boost::optional<ID_t> &id, const boost::optional<KEYSize> &size);
116  virtual void collectLeveled(const boost::optional<ID_t> &id, const boost::optional<KEYSize> &size);
117  virtual void collectFilteredImage(const boost::optional<ID_t> &id, bool ref);
118  virtual void collectMovieMedia(const boost::optional<ID_t> &id);
119  virtual void collectMedia(const boost::optional<ID_t> &id);
120 
121  virtual void collectLayer(const boost::optional<ID_t> &id, bool ref);
122  virtual void collectStylesheet(const boost::optional<ID_t> &id, const boost::optional<ID_t> &parent);
123 
124  virtual void collectText(const boost::optional<ID_t> &style, const std::string &text);
125  virtual void collectTab();
126  virtual void collectLineBreak();
127 
128  virtual void collectTextPlaceholder(const boost::optional<ID_t> &id, bool title, bool ref);
129 
130  virtual void startLayer();
131  virtual void endLayer();
132  virtual void startGroup();
133  virtual void endGroup();
134 
135  virtual void startParagraph(const boost::optional<ID_t> &style);
136  virtual void endParagraph();
137  virtual void startText();
138  virtual void endText();
139 
140  virtual void startLevel();
141  virtual void endLevel();
142 
143 protected:
144  bool isCollecting() const;
145  void setCollecting(bool collecting);
146 
147  const KEYDefaults &getDefaults() const;
148 
149  const KEYLayerPtr_t &getLayer() const;
150 
151 private:
154 
156 
157  std::stack<Level> m_levelStack;
158  std::stack<KEYObjectList_t> m_objectsStack;
160 
162 
164 
166  std::deque<KEYStylePtr_t> m_newStyles;
167 
173 
177 };
178 
179 } // namespace libetonyek
180 
181 #endif // KEYCOLLECTORBASE_H_INCLUDED
182 
183 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Definition: KEY2Token.h:220
boost::shared_ptr< KEYGraphicStyle > KEYGraphicStylePtr_t
Definition: KEYStyles_fwd.h:36
Definition: KEY2Token.h:1076
virtual void collectGraphicStyle(const boost::optional< ID_t > &id, const boost::optional< KEYPropertyMap > &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent, bool ref, bool anonymous)
Definition: KEYCollectorBase.cpp:180
bool m_layerOpened
Definition: KEYCollectorBase.h:175
std::deque< KEYStylePtr_t > m_newStyles
Definition: KEYCollectorBase.h:166
virtual void collectStarPath(const boost::optional< ID_t > &id, const KEYSize &size, unsigned points, double innerRadius)
Definition: KEYCollectorBase.cpp:478
virtual void collectRoundedRectanglePath(const boost::optional< ID_t > &id, const KEYSize &size, double radius)
Definition: KEYCollectorBase.cpp:461
~KEYCollectorBase()
Definition: KEYCollectorBase.cpp:114
virtual void collectMovieMedia(const boost::optional< ID_t > &id)
Definition: KEYCollectorBase.cpp:600
Definition: KEY1Token.h:85
virtual void collectCellStyle(const boost::optional< ID_t > &id, const boost::optional< KEYPropertyMap > &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent, bool ref, bool anonymous)
Definition: KEYCollectorBase.cpp:127
KEYMediaContentPtr_t m_currentContent
Definition: KEYCollectorBase.h:172
virtual void endLayer()
Definition: KEYCollectorBase.cpp:761
Definition: KEY2Token.h:366
KEYLayerPtr_t m_currentLayer
Definition: KEYCollectorBase.h:155
KEYDataPtr_t m_currentData
Definition: KEYCollectorBase.h:168
const KEYDefaults & getDefaults() const
Definition: KEYCollectorBase.cpp:871
virtual void collectConnectionStyle(const boost::optional< ID_t > &id, const boost::optional< KEYPropertyMap > &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent, bool ref, bool anonymous)
Definition: KEYCollectorBase.cpp:166
void setCollecting(bool collecting)
Definition: KEYCollectorBase.cpp:866
virtual void startParagraph(const boost::optional< ID_t > &style)
Definition: KEYCollectorBase.cpp:803
Definition: KEY2Token.h:1112
Definition: KEY2Token.h:1078
Definition: KEY2Token.h:853
KEYMediaContentPtr_t m_currentLeveled
Definition: KEYCollectorBase.h:171
KEYMediaContentPtr_t m_currentFiltered
Definition: KEYCollectorBase.h:170
virtual void collectTab()
Definition: KEYCollectorBase.cpp:678
boost::shared_ptr< KEYData > KEYDataPtr_t
Definition: KEYTypes_fwd.h:33
Implementation of common parts of styles and content collector.
Definition: KEYCollectorBase.h:31
virtual void collectMedia(const boost::optional< ID_t > &id)
Definition: KEYCollectorBase.cpp:615
virtual void collectFiltered(const boost::optional< ID_t > &id, const boost::optional< KEYSize > &size)
Definition: KEYCollectorBase.cpp:540
KEYMediaContentPtr_t m_currentUnfiltered
Definition: KEYCollectorBase.h:169
boost::shared_ptr< KEYMediaContent > KEYMediaContentPtr_t
Definition: KEYTypes_fwd.h:38
virtual void collectLineBreak()
Definition: KEYCollectorBase.cpp:688
KEYGraphicStylePtr_t graphicStyle
Definition: KEYCollectorBase.h:36
boost::shared_ptr< KEYPath > KEYPathPtr_t
Definition: KEYPath_fwd.h:17
Definition: KEY2Token.h:991
virtual void startText()
Start of a block that can contain text.
Definition: KEYCollectorBase.cpp:823
boost::shared_ptr< KEYText > KEYTextPtr_t
Definition: KEYText_fwd.h:16
virtual void collectData(const boost::optional< ID_t > &id, const WPXInputStreamPtr_t &stream, const boost::optional< std::string > &displayName, const boost::optional< unsigned > &type, bool ref)
Definition: KEYCollectorBase.cpp:501
Definition: KEY2Token.h:1077
KEYCollectorBase(KEYDictionary &dict, const KEYDefaults &defaults)
Definition: KEYCollectorBase.cpp:92
Definition: KEY2Token.h:795
Definition: KEY2Token.h:909
virtual void endLevel()
Definition: KEYCollectorBase.cpp:852
virtual void collectVectorStyle(const boost::optional< ID_t > &id, const boost::optional< KEYPropertyMap > &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent, bool ref, bool anonymous)
Definition: KEYCollectorBase.cpp:330
bool m_collecting
Definition: KEYCollectorBase.h:174
virtual void endGroup()
Definition: KEYCollectorBase.cpp:790
Definition: KEY1Token.h:51
KEYDictionary & m_dict
Definition: KEYCollectorBase.h:152
const KEYDefaults & m_defaults
Definition: KEYCollectorBase.h:153
boost::shared_ptr< WPXInputStream > WPXInputStreamPtr_t
Definition: libetonyek_utils.h:88
std::stack< Level > m_levelStack
Definition: KEYCollectorBase.h:157
Definition: KEYCollectorBase.h:33
Definition: KEYTypes.h:27
virtual void collectImage(const boost::optional< ID_t > &id, const KEYImagePtr_t &image)
Definition: KEYCollectorBase.cpp:392
virtual void startLevel()
Definition: KEYCollectorBase.cpp:846
KEYGeometryPtr_t geometry
Definition: KEYCollectorBase.h:35
KEYStylesheetPtr_t m_currentStylesheet
Definition: KEYCollectorBase.h:165
Definition: KEY1Token.h:49
virtual void endText()
End of a text block.
Definition: KEYCollectorBase.cpp:835
KEYPlaceholderStylePtr_t m_currentPlaceholderStyle
Definition: KEYCollectorBase.h:163
boost::shared_ptr< KEYPlaceholderStyle > KEYPlaceholderStylePtr_t
Definition: KEYStyles_fwd.h:56
Definition: KEY1Token.h:42
Definition: KEY1Token.h:92
virtual void collectFilteredImage(const boost::optional< ID_t > &id, bool ref)
Definition: KEYCollectorBase.cpp:570
virtual void collectLeveled(const boost::optional< ID_t > &id, const boost::optional< KEYSize > &size)
Definition: KEYCollectorBase.cpp:555
boost::shared_ptr< KEYImage > KEYImagePtr_t
Definition: KEYTypes_fwd.h:43
A dictionary of all referenceable entities in the presentation.
Definition: KEYDictionary.h:35
virtual void collectTabularStyle(const boost::optional< ID_t > &id, const boost::optional< KEYPropertyMap > &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent, bool ref, bool anonymous)
Definition: KEYCollectorBase.cpp:316
virtual void collectSlideStyle(const boost::optional< ID_t > &id, const boost::optional< KEYPropertyMap > &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent, bool ref, bool anonymous)
Definition: KEYCollectorBase.cpp:302
Definition: KEY1Token.h:72
boost::shared_ptr< KEYLine > KEYLinePtr_t
Definition: KEYTypes_fwd.h:29
virtual void collectLayoutStyle(const boost::optional< ID_t > &id, const boost::optional< KEYPropertyMap > &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent, bool ref, bool anonymous)
Definition: KEYCollectorBase.cpp:211
KEYPathPtr_t m_currentPath
Definition: KEYCollectorBase.h:159
virtual void collectBezierPath(const boost::optional< ID_t > &id)
Definition: KEYCollectorBase.cpp:450
Definition: KEY2Token.h:325
virtual void collectConnectionPath(const boost::optional< ID_t > &id, const KEYSize &size, double middleX, double middleY)
Definition: KEYCollectorBase.cpp:484
virtual void startGroup()
Definition: KEYCollectorBase.cpp:778
Level()
Definition: KEYCollectorBase.cpp:86
virtual void collectTextPlaceholder(const boost::optional< ID_t > &id, bool title, bool ref)
Definition: KEYCollectorBase.cpp:698
Definition: KEY1Token.h:149
boost::shared_ptr< KEYGeometry > KEYGeometryPtr_t
Definition: KEYTypes_fwd.h:25
Definition: KEYCollector.h:28
const KEYLayerPtr_t & getLayer() const
Definition: KEYCollectorBase.cpp:876
bool isCollecting() const
Definition: KEYCollectorBase.cpp:861
virtual void collectPlaceholderStyle(const boost::optional< ID_t > &id, const boost::optional< KEYPropertyMap > &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent, bool ref, bool anonymous)
Definition: KEYCollectorBase.cpp:276
virtual void collectCharacterStyle(const boost::optional< ID_t > &id, const boost::optional< KEYPropertyMap > &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent, bool ref, bool anonymous)
Definition: KEYCollectorBase.cpp:141
Definition: KEY2Token.h:1102
virtual void collectGeometry(boost::optional< ID_t > &id, boost::optional< KEYSize > &naturalSize, boost::optional< KEYPosition > &position, boost::optional< double > &angle, boost::optional< double > &shearXAngle, boost::optional< double > &shearYAngle, boost::optional< bool > &horizontalFlip, boost::optional< bool > &verticalFlip, boost::optional< bool > &aspectRatioLocked, boost::optional< bool > &sizesLocked)
Definition: KEYCollectorBase.cpp:344
virtual void collectText(const boost::optional< ID_t > &style, const std::string &text)
Definition: KEYCollectorBase.cpp:668
virtual void collectUnfiltered(const boost::optional< ID_t > &id, const boost::optional< KEYSize > &size, bool ref)
Definition: KEYCollectorBase.cpp:520
virtual void collectParagraphStyle(const boost::optional< ID_t > &id, const boost::optional< KEYPropertyMap > &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent, bool ref, bool anonymous)
Definition: KEYCollectorBase.cpp:252
virtual void endParagraph()
Definition: KEYCollectorBase.cpp:813
virtual void collectPolygonPath(const boost::optional< ID_t > &id, const KEYSize &size, unsigned edges)
Definition: KEYCollectorBase.cpp:455
Definition: KEY1Token.h:167
A representation of default values for various parts of the format.
Definition: KEYDefaults.h:30
virtual void collectListStyle(const boost::optional< ID_t > &id, const boost::optional< KEYPropertyMap > &props, const boost::optional< std::string > &ident, const boost::optional< std::string > &parentIdent, bool ref, bool anonymous)
Definition: KEYCollectorBase.cpp:238
virtual void collectCalloutPath(const boost::optional< ID_t > &id, const KEYSize &size, double radius, double tailSize, double tailX, double tailY, bool quoteBubble)
Definition: KEYCollectorBase.cpp:490
virtual void collectStylesheet(const boost::optional< ID_t > &id, const boost::optional< ID_t > &parent)
Definition: KEYCollectorBase.cpp:648
boost::shared_ptr< KEYStylesheet > KEYStylesheetPtr_t
Definition: KEYStylesheet.h:19
std::stack< KEYObjectList_t > m_objectsStack
Definition: KEYCollectorBase.h:158
Definition: KEY2Token.h:996
Definition: KEY1Token.h:75
virtual void collectGroup(const boost::optional< ID_t > &id, const KEYGroupPtr_t &group)
Definition: KEYCollectorBase.cpp:379
virtual void collectLayer(const boost::optional< ID_t > &id, bool ref)
Definition: KEYCollectorBase.cpp:635
Definition: KEY2Token.h:357
boost::shared_ptr< KEYGroup > KEYGroupPtr_t
Definition: KEYTypes_fwd.h:56
virtual void collectShape(const boost::optional< ID_t > &id)
Definition: KEYCollectorBase.cpp:420
KEYTextPtr_t m_currentText
Definition: KEYCollectorBase.h:161
virtual void startLayer()
Definition: KEYCollectorBase.cpp:744
virtual void collectArrowPath(const boost::optional< ID_t > &id, const KEYSize &size, double headWidth, double stemRelYPos, bool doubleSided)
Definition: KEYCollectorBase.cpp:467
virtual void collectLine(const boost::optional< ID_t > &id, const KEYLinePtr_t &line)
Definition: KEYCollectorBase.cpp:407
int m_groupLevel
Definition: KEYCollectorBase.h:176
virtual void collectBezier(const boost::optional< ID_t > &id, const KEYPathPtr_t &path, bool ref)
Definition: KEYCollectorBase.cpp:373
boost::shared_ptr< KEYLayer > KEYLayerPtr_t
Definition: KEYTypes_fwd.h:60

Generated for libetonyek by doxygen 1.8.5