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 #include "KEYTypes.h"
22 
23 namespace libetonyek
24 {
25 
26 struct KEYDictionary;
27 
33 {
34  struct Level
35  {
38 
39  Level();
40  };
41 
42 public:
45 
46  // collector functions
47 
48  virtual void collectCellStyle(const boost::optional<ID_t> &id,
49  const boost::optional<KEYPropertyMap> &props,
50  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
51  bool ref, bool anonymous);
52  virtual void collectCharacterStyle(const boost::optional<ID_t> &id,
53  const boost::optional<KEYPropertyMap> &props,
54  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
55  bool ref, bool anonymous);
56  virtual void collectConnectionStyle(const boost::optional<ID_t> &id,
57  const boost::optional<KEYPropertyMap> &props,
58  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
59  bool ref, bool anonymous);
60  virtual void collectGraphicStyle(const boost::optional<ID_t> &id,
61  const boost::optional<KEYPropertyMap> &props,
62  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
63  bool ref, bool anonymous);
64  virtual void collectLayoutStyle(const boost::optional<ID_t> &id,
65  const boost::optional<KEYPropertyMap> &props,
66  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
67  bool ref, bool anonymous);
68  virtual void collectListStyle(const boost::optional<ID_t> &id,
69  const boost::optional<KEYPropertyMap> &props,
70  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
71  bool ref, bool anonymous);
72  virtual void collectParagraphStyle(const boost::optional<ID_t> &id,
73  const boost::optional<KEYPropertyMap> &props,
74  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
75  bool ref, bool anonymous);
76  virtual void collectPlaceholderStyle(const boost::optional<ID_t> &id,
77  const boost::optional<KEYPropertyMap> &props,
78  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
79  bool ref, bool anonymous);
80  virtual void collectSlideStyle(const boost::optional<ID_t> &id,
81  const boost::optional<KEYPropertyMap> &props,
82  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
83  bool ref, bool anonymous);
84  virtual void collectTabularStyle(const boost::optional<ID_t> &id,
85  const boost::optional<KEYPropertyMap> &props,
86  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
87  bool ref, bool anonymous);
88  virtual void collectVectorStyle(const boost::optional<ID_t> &id,
89  const boost::optional<KEYPropertyMap> &props,
90  const boost::optional<std::string> &ident, const boost::optional<std::string> &parentIdent,
91  bool ref, bool anonymous);
92 
93  virtual void collectGeometry(boost::optional<ID_t> &id,
94  boost::optional<KEYSize> &naturalSize, boost::optional<KEYPosition> &position,
95  boost::optional<double> &angle,
96  boost::optional<double> &shearXAngle, boost::optional<double> &shearYAngle,
97  boost::optional<bool> &horizontalFlip, boost::optional<bool> &verticalFlip,
98  boost::optional<bool> &aspectRatioLocked, boost::optional<bool> &sizesLocked);
99 
100  virtual void collectBezier(const boost::optional<ID_t> &id, const KEYPathPtr_t &path, bool ref);
101  virtual void collectGroup(const boost::optional<ID_t> &id, const KEYGroupPtr_t &group);
102  virtual void collectImage(const boost::optional<ID_t> &id, const KEYImagePtr_t &image);
103  virtual void collectLine(const boost::optional<ID_t> &id, const KEYLinePtr_t &line);
104  virtual void collectShape(const boost::optional<ID_t> &id);
105 
106  virtual void collectBezierPath(const boost::optional<ID_t> &id);
107  virtual void collectPolygonPath(const boost::optional<ID_t> &id, const KEYSize &size, unsigned edges);
108  virtual void collectRoundedRectanglePath(const boost::optional<ID_t> &id, const KEYSize &size, double radius);
109  virtual void collectArrowPath(const boost::optional<ID_t> &id, const KEYSize &size, double headWidth, double stemRelYPos, bool doubleSided);
110  virtual void collectStarPath(const boost::optional<ID_t> &id, const KEYSize &size, unsigned points, double innerRadius);
111  virtual void collectConnectionPath(const boost::optional<ID_t> &id, const KEYSize &size, double middleX, double middleY);
112  virtual void collectCalloutPath(const boost::optional<ID_t> &id, const KEYSize &size, double radius, double tailSize, double tailX, double tailY, bool quoteBubble);
113 
114  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);
115  virtual void collectUnfiltered(const boost::optional<ID_t> &id, const boost::optional<KEYSize> &size, bool ref);
116  virtual void collectFiltered(const boost::optional<ID_t> &id, const boost::optional<KEYSize> &size);
117  virtual void collectLeveled(const boost::optional<ID_t> &id, const boost::optional<KEYSize> &size);
118  virtual void collectFilteredImage(const boost::optional<ID_t> &id, bool ref);
119  virtual void collectMovieMedia(const boost::optional<ID_t> &id);
120  virtual void collectMedia(const boost::optional<ID_t> &id);
121 
122  virtual void collectLayer(const boost::optional<ID_t> &id, bool ref);
123  virtual void collectStylesheet(const boost::optional<ID_t> &id, const boost::optional<ID_t> &parent);
124 
125  virtual void collectText(const boost::optional<ID_t> &style, const std::string &text);
126  virtual void collectTab();
127  virtual void collectLineBreak();
128 
129  virtual void collectTextPlaceholder(const boost::optional<ID_t> &id, bool title, bool ref);
130 
131  virtual void collectTableSizes(const KEYTable::RowSizes_t &rowSizes, const KEYTable::ColumnSizes_t &columnSizes);
132  virtual void collectTableCell(unsigned row, unsigned column, const boost::optional<std::string> &content, unsigned rowSpan, unsigned columnSpan);
133  virtual void collectCoveredTableCell(unsigned row, unsigned column);
134  virtual void collectTableRow();
135  virtual void collectTable();
136 
137  virtual void collectNote();
138 
139  virtual void collectStickyNote();
140 
141  virtual void startPage();
142  virtual void endPage();
143  virtual void startLayer();
144  virtual void endLayer();
145  virtual void startGroup();
146  virtual void endGroup();
147 
148  virtual void startParagraph(const boost::optional<ID_t> &style);
149  virtual void endParagraph();
150  virtual void startText(bool object);
151  virtual void endText();
152 
153  virtual void startLevel();
154  virtual void endLevel();
155 
156 protected:
157  bool isCollecting() const;
158  void setCollecting(bool collecting);
159 
160  const KEYDefaults &getDefaults() const;
161 
162  const KEYLayerPtr_t &getLayer() const;
163  const KEYObjectList_t &getNotes() const;
164  const KEYStickyNotes_t &getStickyNotes() const;
165 
166 private:
169 
171 
172  std::stack<Level> m_levelStack;
173  std::stack<KEYObjectList_t> m_objectsStack;
175 
177 
179 
181  std::deque<KEYStylePtr_t> m_newStyles;
182 
188 
190 
192 
194 
198 };
199 
200 } // namespace libetonyek
201 
202 #endif // KEYCOLLECTORBASE_H_INCLUDED
203 
204 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Definition: KEY2Token.h:220
boost::shared_ptr< KEYGraphicStyle > KEYGraphicStylePtr_t
Definition: KEYStyles_fwd.h:36
std::deque< KEYStickyNote > KEYStickyNotes_t
Definition: KEYTypes.h:183
Definition: KEY2Token.h:1077
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:187
bool m_layerOpened
Definition: KEYCollectorBase.h:196
std::deque< KEYStylePtr_t > m_newStyles
Definition: KEYCollectorBase.h:181
virtual void collectStarPath(const boost::optional< ID_t > &id, const KEYSize &size, unsigned points, double innerRadius)
Definition: KEYCollectorBase.cpp:488
virtual void collectRoundedRectanglePath(const boost::optional< ID_t > &id, const KEYSize &size, double radius)
Definition: KEYCollectorBase.cpp:471
Definition: KEY1Token.h:39
~KEYCollectorBase()
Definition: KEYCollectorBase.cpp:121
virtual void collectTableSizes(const KEYTable::RowSizes_t &rowSizes, const KEYTable::ColumnSizes_t &columnSizes)
Definition: KEYCollectorBase.cpp:754
virtual void collectMovieMedia(const boost::optional< ID_t > &id)
Definition: KEYCollectorBase.cpp:610
Definition: KEY1Token.h:85
Definition: KEYTable.h:20
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:134
KEYMediaContentPtr_t m_currentContent
Definition: KEYCollectorBase.h:187
virtual void endLayer()
Definition: KEYCollectorBase.cpp:863
Definition: KEY2Token.h:366
KEYLayerPtr_t m_currentLayer
Definition: KEYCollectorBase.h:170
KEYDataPtr_t m_currentData
Definition: KEYCollectorBase.h:183
virtual void endPage()
Definition: KEYCollectorBase.cpp:840
const KEYDefaults & getDefaults() const
Definition: KEYCollectorBase.cpp:973
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:173
void setCollecting(bool collecting)
Definition: KEYCollectorBase.cpp:968
virtual void startParagraph(const boost::optional< ID_t > &style)
Definition: KEYCollectorBase.cpp:905
KEYTable m_currentTable
Definition: KEYCollectorBase.h:189
Definition: KEY2Token.h:1113
Definition: KEY2Token.h:1079
Definition: KEY2Token.h:854
KEYMediaContentPtr_t m_currentLeveled
Definition: KEYCollectorBase.h:186
KEYMediaContentPtr_t m_currentFiltered
Definition: KEYCollectorBase.h:185
virtual void collectTab()
Definition: KEYCollectorBase.cpp:688
boost::shared_ptr< KEYData > KEYDataPtr_t
Definition: KEYTypes_fwd.h:33
Implementation of common parts of styles and content collector.
Definition: KEYCollectorBase.h:32
virtual void collectMedia(const boost::optional< ID_t > &id)
Definition: KEYCollectorBase.cpp:625
virtual void collectFiltered(const boost::optional< ID_t > &id, const boost::optional< KEYSize > &size)
Definition: KEYCollectorBase.cpp:550
KEYMediaContentPtr_t m_currentUnfiltered
Definition: KEYCollectorBase.h:184
boost::shared_ptr< KEYMediaContent > KEYMediaContentPtr_t
Definition: KEYTypes_fwd.h:38
virtual void collectLineBreak()
Definition: KEYCollectorBase.cpp:698
const KEYStickyNotes_t & getStickyNotes() const
Definition: KEYCollectorBase.cpp:988
KEYGraphicStylePtr_t graphicStyle
Definition: KEYCollectorBase.h:37
Definition: KEY2Token.h:140
virtual void collectTableRow()
Definition: KEYCollectorBase.cpp:793
boost::shared_ptr< KEYPath > KEYPathPtr_t
Definition: KEYPath_fwd.h:17
Definition: KEY2Token.h:992
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:511
Definition: KEY2Token.h:1078
virtual void startText(bool object)
Start of a block that can contain text.
Definition: KEYCollectorBase.cpp:925
KEYCollectorBase(KEYDictionary &dict, const KEYDefaults &defaults)
Definition: KEYCollectorBase.cpp:97
Definition: KEY2Token.h:796
Definition: KEY2Token.h:910
virtual void collectCoveredTableCell(unsigned row, unsigned column)
Definition: KEYCollectorBase.cpp:787
virtual void endLevel()
Definition: KEYCollectorBase.cpp:954
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:337
virtual void startPage()
Definition: KEYCollectorBase.cpp:834
bool m_collecting
Definition: KEYCollectorBase.h:195
virtual void endGroup()
Definition: KEYCollectorBase.cpp:892
Definition: KEY1Token.h:51
std::deque< double > RowSizes_t
Definition: KEYTable.h:37
KEYDictionary & m_dict
Definition: KEYCollectorBase.h:167
const KEYDefaults & m_defaults
Definition: KEYCollectorBase.h:168
boost::shared_ptr< WPXInputStream > WPXInputStreamPtr_t
Definition: libetonyek_utils.h:88
std::stack< Level > m_levelStack
Definition: KEYCollectorBase.h:172
Definition: KEYCollectorBase.h:34
Definition: KEYTypes.h:27
KEYObjectList_t m_notes
Definition: KEYCollectorBase.h:191
virtual void collectImage(const boost::optional< ID_t > &id, const KEYImagePtr_t &image)
Definition: KEYCollectorBase.cpp:399
virtual void collectTableCell(unsigned row, unsigned column, const boost::optional< std::string > &content, unsigned rowSpan, unsigned columnSpan)
Definition: KEYCollectorBase.cpp:760
virtual void startLevel()
Definition: KEYCollectorBase.cpp:948
KEYGeometryPtr_t geometry
Definition: KEYCollectorBase.h:36
virtual void collectTable()
Definition: KEYCollectorBase.cpp:798
KEYStylesheetPtr_t m_currentStylesheet
Definition: KEYCollectorBase.h:180
Definition: KEY1Token.h:49
virtual void endText()
End of a text block.
Definition: KEYCollectorBase.cpp:937
KEYPlaceholderStylePtr_t m_currentPlaceholderStyle
Definition: KEYCollectorBase.h:178
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:580
virtual void collectLeveled(const boost::optional< ID_t > &id, const boost::optional< KEYSize > &size)
Definition: KEYCollectorBase.cpp:565
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:323
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:309
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:218
KEYPathPtr_t m_currentPath
Definition: KEYCollectorBase.h:174
virtual void collectBezierPath(const boost::optional< ID_t > &id)
Definition: KEYCollectorBase.cpp:460
Definition: KEY2Token.h:325
virtual void collectConnectionPath(const boost::optional< ID_t > &id, const KEYSize &size, double middleX, double middleY)
Definition: KEYCollectorBase.cpp:494
virtual void startGroup()
Definition: KEYCollectorBase.cpp:880
Level()
Definition: KEYCollectorBase.cpp:91
virtual void collectTextPlaceholder(const boost::optional< ID_t > &id, bool title, bool ref)
Definition: KEYCollectorBase.cpp:708
Definition: KEY1Token.h:149
boost::shared_ptr< KEYGeometry > KEYGeometryPtr_t
Definition: KEYTypes_fwd.h:25
Definition: KEYCollector.h:29
const KEYLayerPtr_t & getLayer() const
Definition: KEYCollectorBase.cpp:978
bool isCollecting() const
Definition: KEYCollectorBase.cpp:963
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:283
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:148
Definition: KEY2Token.h:1103
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:351
const KEYObjectList_t & getNotes() const
Definition: KEYCollectorBase.cpp:983
std::deque< double > ColumnSizes_t
Definition: KEYTable.h:36
KEYStickyNotes_t m_stickyNotes
Definition: KEYCollectorBase.h:193
virtual void collectStickyNote()
Definition: KEYCollectorBase.cpp:822
virtual void collectText(const boost::optional< ID_t > &style, const std::string &text)
Definition: KEYCollectorBase.cpp:678
virtual void collectUnfiltered(const boost::optional< ID_t > &id, const boost::optional< KEYSize > &size, bool ref)
Definition: KEYCollectorBase.cpp:530
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:259
virtual void endParagraph()
Definition: KEYCollectorBase.cpp:915
virtual void collectPolygonPath(const boost::optional< ID_t > &id, const KEYSize &size, unsigned edges)
Definition: KEYCollectorBase.cpp:465
Definition: KEY1Token.h:167
Definition: KEY2Token.h:1069
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:245
std::deque< KEYObjectPtr_t > KEYObjectList_t
A list of presentation objects.
Definition: KEYObject.h:48
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:500
virtual void collectStylesheet(const boost::optional< ID_t > &id, const boost::optional< ID_t > &parent)
Definition: KEYCollectorBase.cpp:658
boost::shared_ptr< KEYStylesheet > KEYStylesheetPtr_t
Definition: KEYStylesheet.h:19
std::stack< KEYObjectList_t > m_objectsStack
Definition: KEYCollectorBase.h:173
virtual void collectNote()
Definition: KEYCollectorBase.cpp:813
Definition: KEY2Token.h:997
Definition: KEY1Token.h:75
virtual void collectGroup(const boost::optional< ID_t > &id, const KEYGroupPtr_t &group)
Definition: KEYCollectorBase.cpp:386
virtual void collectLayer(const boost::optional< ID_t > &id, bool ref)
Definition: KEYCollectorBase.cpp:645
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:427
KEYTextPtr_t m_currentText
Definition: KEYCollectorBase.h:176
virtual void startLayer()
Definition: KEYCollectorBase.cpp:846
virtual void collectArrowPath(const boost::optional< ID_t > &id, const KEYSize &size, double headWidth, double stemRelYPos, bool doubleSided)
Definition: KEYCollectorBase.cpp:477
virtual void collectLine(const boost::optional< ID_t > &id, const KEYLinePtr_t &line)
Definition: KEYCollectorBase.cpp:414
int m_groupLevel
Definition: KEYCollectorBase.h:197
virtual void collectBezier(const boost::optional< ID_t > &id, const KEYPathPtr_t &path, bool ref)
Definition: KEYCollectorBase.cpp:380
boost::shared_ptr< KEYLayer > KEYLayerPtr_t
Definition: KEYTypes_fwd.h:60

Generated for libetonyek by doxygen 1.8.6