WP3ContentListener.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libwpd
3  * Version: MPL 2.0 / LGPLv2.1+
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  * Major Contributor(s):
10  * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
11  * Copyright (C) 2005-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
12  *
13  * For minor contributions see the git repository.
14  *
15  * Alternatively, the contents of this file may be used under the terms
16  * of the GNU Lesser General Public License Version 2.1 or later
17  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
18  * applicable instead of those above.
19  *
20  * For further information visit http://libwpd.sourceforge.net
21  */
22 
23 /* "This product is not manufactured, approved, or supported by
24  * Corel Corporation or Corel Corporation Limited."
25  */
26 
27 #ifndef WP3CONTENTLISTENER_H
28 #define WP3CONTENTLISTENER_H
29 
30 #include <memory>
31 
32 #include "WP3Listener.h"
33 #include "WPXContentListener.h"
34 #include "WP3SubDocument.h"
35 
37 {
40  unsigned short m_colSpan;
41  unsigned short m_rowSpan;
42  librevenge::RVNGString m_textBuffer;
43  std::unique_ptr<RGBSColor> m_cellFillColor;
44  librevenge::RVNGString m_noteReference;
45 
47 private:
50 };
51 
53 {
54 public:
55  WP3ContentListener(std::list<WPXPageSpan> &pageList, std::vector<WP3SubDocument *> &subDocuments, librevenge::RVNGTextInterface *documentInterface);
56  ~WP3ContentListener() override;
57 
58  void startDocument() override
59  {
61  }
62  void startSubDocument() override
63  {
65  }
66  void insertCharacter(unsigned character) override;
67  void insertTab() override;
68  void insertTab(unsigned char tabType, double tabPosition) override;
69  void insertBreak(unsigned char breakType) override
70  {
72  }
73  void insertEOL() override;
74  void attributeChange(bool isOn, unsigned char attribute) override;
75  void lineSpacingChange(double lineSpacing) override
76  {
78  }
79  void pageMarginChange(unsigned char /* side */, unsigned short /* margin */) override {}
80  void pageFormChange(unsigned short /* length */, unsigned short /* width */, WPXFormOrientation /* orientation */) override {}
81  void marginChange(unsigned char side, unsigned short margin) override;
82  void indentFirstLineChange(double offset) override;
83  void setTabs(bool isRelative, const std::vector<WPXTabStop> tabStops) override;
84  void columnChange(WPXTextColumnType columnType, unsigned char numColumns, const std::vector<double> &columnWidth,
85  const std::vector<bool> &isFixedWidth) override;
86  void endDocument() override
87  {
89  }
90  void endSubDocument() override
91  {
93  }
94 
95  void defineTable(unsigned char position, unsigned short leftOffset) override;
96  void addTableColumnDefinition(unsigned width, unsigned leftGutter, unsigned rightGutter,
97  unsigned attributes, unsigned char alignment) override;
98  void startTable() override;
99  void insertRow();
100  void insertCell();
101  void closeCell() override;
102  void closeRow() override;
103  void setTableCellSpan(unsigned short colSpan, unsigned short rowSpan) override;
104  void setTableCellFillColor(const RGBSColor *cellFillColor) override;
105  void endTable() override;
106  void undoChange(unsigned char undoType, unsigned short undoLevel) override;
107  void justificationChange(unsigned char justification) override;
108  void setTextColor(const RGBSColor *fontColor) override;
109  void setTextFont(const librevenge::RVNGString &fontName) override;
110  void setFontSize(unsigned short fontSize) override;
111  void insertPageNumber(const librevenge::RVNGString &pageNumber) override;
112  void insertNoteReference(const librevenge::RVNGString &noteReference) override;
113  void insertNote(WPXNoteType noteType, const WP3SubDocument *subDocument) override;
114  void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP3SubDocument *subDocument) override;
115  void suppressPage(unsigned short /* suppressCode */) override {}
116  void backTab() override;
117  void leftIndent() override;
118  void leftIndent(double offset) override;
119  void leftRightIndent() override;
120  void leftRightIndent(double offset) override;
121  void insertPicture(double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn,
122  unsigned short figureFlags, const librevenge::RVNGBinaryData &binaryData) override;
123  void insertTextBox(double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn,
124  unsigned short figureFlags, const WP3SubDocument *subDocument, const WP3SubDocument *caption) override;
125  void insertWP51Table(double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn,
126  unsigned short figureFlags, const WP3SubDocument *subDocument, const WP3SubDocument *caption) override;
127 
128 protected:
129  void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0) override;
130  void _openParagraph() override;
131 
132  void _flushText() override;
133  void _changeList() override {}
134 
135  void _handleFrameParameters(librevenge::RVNGPropertyList &propList, double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn,
136  unsigned short figureFlags);
137 
138 private:
141  std::unique_ptr<WP3ContentParsingState> m_parseState;
142  std::vector<WP3SubDocument *> &m_subDocuments;
143 };
144 
145 #endif /* WP3CONTENTLISTENER_H */
146 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
void setTextFont(const librevenge::RVNGString &fontName) override
Definition: WP3ContentListener.cpp:579
void setTextColor(const RGBSColor *fontColor) override
Definition: WP3ContentListener.cpp:569
void closeCell() override
Definition: WP3ContentListener.cpp:262
void suppressPage(unsigned short) override
Definition: WP3ContentListener.h:115
Definition: WP3Listener.h:37
void _handleFrameParameters(librevenge::RVNGPropertyList &propList, double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn, unsigned short figureFlags)
Definition: WP3ContentListener.cpp:873
void pageMarginChange(unsigned char, unsigned short) override
Definition: WP3ContentListener.h:79
void endSubDocument() override
Definition: WP3ContentListener.h:90
void insertCell()
Definition: WP3ContentListener.cpp:245
void marginChange(unsigned char side, unsigned short margin) override
Definition: WP3ContentListener.cpp:393
WP3ContentParsingState()
Definition: WP3ContentListener.cpp:37
void endTable() override
Definition: WP3ContentListener.cpp:298
void insertPicture(double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn, unsigned short figureFlags, const librevenge::RVNGBinaryData &binaryData) override
Definition: WP3ContentListener.cpp:787
void startSubDocument()
Definition: WPXContentListener.cpp:153
void endDocument() override
Definition: WP3ContentListener.h:86
WP3ContentListener(std::list< WPXPageSpan > &pageList, std::vector< WP3SubDocument *> &subDocuments, librevenge::RVNGTextInterface *documentInterface)
Definition: WP3ContentListener.cpp:51
void endDocument()
Definition: WPXContentListener.cpp:159
void insertPageNumber(const librevenge::RVNGString &pageNumber) override
Definition: WP3ContentListener.cpp:599
WPXTextColumnType
Definition: libwpd_internal.h:109
Definition: WP3ContentListener.h:36
void defineTable(unsigned char position, unsigned short leftOffset) override
Definition: WP3ContentListener.cpp:158
librevenge::RVNGString m_textBuffer
Definition: WP3ContentListener.h:42
void insertTab() override
Definition: WP3ContentListener.cpp:79
void insertTextBox(double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn, unsigned short figureFlags, const WP3SubDocument *subDocument, const WP3SubDocument *caption) override
Definition: WP3ContentListener.cpp:808
void pageFormChange(unsigned short, unsigned short, WPXFormOrientation) override
Definition: WP3ContentListener.h:80
librevenge::RVNGString m_noteReference
Definition: WP3ContentListener.h:44
void insertBreak(const unsigned char breakType)
Definition: WPXContentListener.cpp:1242
void _changeList() override
Definition: WP3ContentListener.h:133
WPXSubDocumentType
Definition: libwpd_internal.h:111
void insertCharacter(unsigned character) override
Definition: WP3ContentListener.cpp:68
WP3ContentListener & operator=(const WP3ContentListener &)
~WP3ContentParsingState()
Definition: WP3ContentListener.cpp:47
void closeRow() override
Definition: WP3ContentListener.cpp:273
void undoChange(unsigned char undoType, unsigned short undoLevel) override
Definition: WP3ContentListener.cpp:385
std::vector< WP3SubDocument * > & m_subDocuments
Definition: WP3ContentListener.h:142
void setTableCellSpan(unsigned short colSpan, unsigned short rowSpan) override
Definition: WP3ContentListener.cpp:283
Definition: WPXContentListener.h:146
std::unique_ptr< RGBSColor > m_cellFillColor
Definition: WP3ContentListener.h:43
Definition: WPXTable.h:79
void insertEOL() override
Definition: WP3ContentListener.cpp:133
~WP3ContentListener() override
Definition: WP3ContentListener.cpp:59
void lineSpacingChange(double lineSpacing) override
Definition: WP3ContentListener.h:75
void setTabs(bool isRelative, const std::vector< WPXTabStop > tabStops) override
Definition: WP3ContentListener.cpp:482
void _flushText() override
Definition: WP3ContentListener.cpp:1183
void startTable() override
Definition: WP3ContentListener.cpp:218
unsigned short m_colSpan
Definition: WP3ContentListener.h:40
void setFontSize(unsigned short fontSize) override
Definition: WP3ContentListener.cpp:589
void leftIndent() override
Definition: WP3ContentListener.cpp:671
WPXFormOrientation
Definition: libwpd_internal.h:105
void insertBreak(unsigned char breakType) override
Definition: WP3ContentListener.h:69
Definition: WPXSubDocument.h:34
void attributeChange(bool isOn, unsigned char attribute) override
Definition: WP3ContentListener.cpp:314
void insertRow()
Definition: WP3ContentListener.cpp:239
void startDocument() override
Definition: WP3ContentListener.h:58
void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice=0) override
Definition: WP3ContentListener.cpp:1111
void backTab() override
Definition: WP3ContentListener.cpp:651
std::unique_ptr< WP3ContentParsingState > m_parseState
Definition: WP3ContentListener.h:141
void leftRightIndent() override
Definition: WP3ContentListener.cpp:727
void insertNoteReference(const librevenge::RVNGString &noteReference) override
Definition: WP3ContentListener.cpp:609
void justificationChange(unsigned char justification) override
Definition: WP3ContentListener.cpp:438
Definition: WP3ContentListener.h:52
void endSubDocument()
Definition: WPXContentListener.cpp:180
Definition: libwpd_internal.h:166
WPXTableList m_tableList
Definition: WP3ContentListener.h:46
void addTableColumnDefinition(unsigned width, unsigned leftGutter, unsigned rightGutter, unsigned attributes, unsigned char alignment) override
Definition: WP3ContentListener.cpp:193
void insertWP51Table(double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn, unsigned short figureFlags, const WP3SubDocument *subDocument, const WP3SubDocument *caption) override
Definition: WP3ContentListener.cpp:840
WP3ContentParsingState & operator=(const WP3ContentParsingState &)
void insertNote(WPXNoteType noteType, const WP3SubDocument *subDocument) override
Definition: WP3ContentListener.cpp:617
void _openParagraph() override
Definition: WP3ContentListener.cpp:1162
void setTableCellFillColor(const RGBSColor *cellFillColor) override
Definition: WP3ContentListener.cpp:292
unsigned short m_rowSpan
Definition: WP3ContentListener.h:41
void columnChange(WPXTextColumnType columnType, unsigned char numColumns, const std::vector< double > &columnWidth, const std::vector< bool > &isFixedWidth) override
Definition: WP3ContentListener.cpp:491
void startDocument()
Definition: WPXContentListener.cpp:138
void lineSpacingChange(const double lineSpacing)
Definition: WPXContentListener.cpp:1296
void startSubDocument() override
Definition: WP3ContentListener.h:62
Definition: WP3SubDocument.h:33
void indentFirstLineChange(double offset) override
Definition: WP3ContentListener.cpp:468
WPXNoteType
Definition: libwpd_internal.h:93
void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP3SubDocument *subDocument) override
Definition: WP3ContentListener.cpp:1156

Generated for libwpd by doxygen 1.8.14