WP5ContentListener.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) 2003 William Lachance (wrlach@gmail.com)
11  * Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
12  * Copyright (C) 2005-2007 Fridrich Strba (fridrich.strba@bluewin.ch)
13  *
14  * For minor contributions see the git repository.
15  *
16  * Alternatively, the contents of this file may be used under the terms
17  * of the GNU Lesser General Public License Version 2.1 or later
18  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
19  * applicable instead of those above.
20  *
21  * For further information visit http://libwpd.sourceforge.net
22  */
23 
24 /* "This product is not manufactured, approved, or supported by
25  * Corel Corporation or Corel Corporation Limited."
26  */
27 
28 #ifndef WP5CONTENTLISTENER_H
29 #define WP5CONTENTLISTENER_H
30 
31 #include "WP5Listener.h"
32 #include "WPXContentListener.h"
33 #include "WP5SubDocument.h"
34 #include "libwpd_internal.h"
35 #include <memory>
36 #include <vector>
37 
39 {
42  librevenge::RVNGString m_textBuffer;
43  librevenge::RVNGString m_noteReference;
44 
46 
48 };
49 
51 {
52 public:
53  WP5ContentListener(std::list<WPXPageSpan> &pageList, std::vector<WP5SubDocument *> &subDocuments, librevenge::RVNGTextInterface *documentInterface);
54  ~WP5ContentListener() override;
55 
56  void startDocument() override
57  {
59  }
60  void startSubDocument() override
61  {
63  }
64  void setFont(const librevenge::RVNGString &fontName, double fontSize) override;
65  void setTabs(const std::vector<WPXTabStop> &tabStops, unsigned short tabOffset) override;
66  void insertCharacter(unsigned character) override;
67  void insertTab(unsigned char tabType, double tabPosition) override;
68  void insertIndent(unsigned char indentType, double indentPosition) override;
69  void insertEOL() override;
70  void insertBreak(unsigned char breakType) override
71  {
73  }
74  void lineSpacingChange(double lineSpacing) override
75  {
77  }
78  void justificationChange(unsigned char justification) override
79  {
81  }
82  void characterColorChange(unsigned char red, unsigned char green, unsigned char blue) override;
83  void attributeChange(bool isOn, unsigned char attribute) override;
84  void pageMarginChange(unsigned char /* side */, unsigned short /* margin */) override {}
85  void pageFormChange(unsigned short /* length */, unsigned short /* width */, WPXFormOrientation /* orientation */) override {}
86  void marginChange(unsigned char side, unsigned short margin) override;
87  void paragraphMarginChange(unsigned char /* side */, signed short /* margin */) {}
88  void endDocument() override
89  {
91  }
92  void endSubDocument() override
93  {
95  }
96 
97  void defineTable(unsigned char position, unsigned short leftOffset) override;
98  void addTableColumnDefinition(unsigned width, unsigned leftGutter, unsigned rightGutter,
99  unsigned attributes, unsigned char alignment) override;
100  void startTable() override;
101  void insertRow(unsigned short rowHeight, bool isMinimumHeight, bool isHeaderRow) override;
102  void insertCell(unsigned char colSpan, unsigned char rowSpan, unsigned char borderBits,
103  const RGBSColor *cellFgColor, const RGBSColor *cellBgColor,
104  const RGBSColor *cellBorderColor, WPXVerticalAlignment cellVerticalAlignment,
105  bool useCellAttributes, unsigned cellAttributes) override;
106  void endTable() override;
107 
108  void insertNoteReference(const librevenge::RVNGString &noteReference) override;
109  void insertNote(WPXNoteType noteType, const WP5SubDocument *subDocument) override;
110  void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP5SubDocument *subDocument) override;
111  void suppressPageCharacteristics(unsigned char /* suppressCode */) override {}
112 
113  void setDefaultFont(const librevenge::RVNGString &fontName, double fontSize);
114 
115  void boxOn(unsigned char positionAndType, unsigned char alignment, unsigned short width, unsigned short height, unsigned short x, unsigned short y) override;
116  void boxOff() override;
117  void insertGraphicsData(const librevenge::RVNGBinaryData *data) override;
118 
119 protected:
120  void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0) override;
121 
122  void _flushText() override;
123  void _changeList() override {}
124 
125 private:
128  std::unique_ptr<WP5ContentParsingState> m_parseState;
129  std::vector<WP5SubDocument *> &m_subDocuments;
131  librevenge::RVNGString m_defaultFontName;
132 };
133 
134 #endif /* WP5CONTENTLISTENER_H */
135 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
~WP5ContentParsingState()
Definition: WP5ContentListener.cpp:42
void paragraphMarginChange(unsigned char, signed short)
Definition: WP5ContentListener.h:87
Definition: WP5SubDocument.h:33
void insertNoteReference(const librevenge::RVNGString &noteReference) override
Definition: WP5ContentListener.cpp:517
std::vector< WP5SubDocument * > & m_subDocuments
Definition: WP5ContentListener.h:129
void endTable() override
Definition: WP5ContentListener.cpp:353
void insertCell(unsigned char colSpan, unsigned char rowSpan, unsigned char borderBits, const RGBSColor *cellFgColor, const RGBSColor *cellBgColor, const RGBSColor *cellBorderColor, WPXVerticalAlignment cellVerticalAlignment, bool useCellAttributes, unsigned cellAttributes) override
Definition: WP5ContentListener.cpp:330
Definition: WP5Listener.h:39
void _changeList() override
Definition: WP5ContentListener.h:123
void insertIndent(unsigned char indentType, double indentPosition) override
Definition: WP5ContentListener.cpp:168
void endSubDocument() override
Definition: WP5ContentListener.h:92
void insertTab(unsigned char tabType, double tabPosition) override
Definition: WP5ContentListener.cpp:73
void justificationChange(const unsigned char justification)
Definition: WPXContentListener.cpp:1304
void boxOff() override
Definition: WP5ContentListener.cpp:798
void startSubDocument()
Definition: WPXContentListener.cpp:153
void insertGraphicsData(const librevenge::RVNGBinaryData *data) override
Definition: WP5ContentListener.cpp:807
void endDocument()
Definition: WPXContentListener.cpp:159
void lineSpacingChange(double lineSpacing) override
Definition: WP5ContentListener.h:74
WPXTableList m_tableList
Definition: WP5ContentListener.h:45
void addTableColumnDefinition(unsigned width, unsigned leftGutter, unsigned rightGutter, unsigned attributes, unsigned char alignment) override
Definition: WP5ContentListener.cpp:274
void insertBreak(const unsigned char breakType)
Definition: WPXContentListener.cpp:1242
librevenge::RVNGString m_textBuffer
Definition: WP5ContentListener.h:42
void insertRow(unsigned short rowHeight, bool isMinimumHeight, bool isHeaderRow) override
Definition: WP5ContentListener.cpp:320
WPXSubDocumentType
Definition: libwpd_internal.h:111
void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice=0) override
Definition: WP5ContentListener.cpp:559
void justificationChange(unsigned char justification) override
Definition: WP5ContentListener.h:78
Definition: WPXContentListener.h:146
Definition: WPXTable.h:79
void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP5SubDocument *subDocument) override
Definition: WP5ContentListener.cpp:595
void boxOn(unsigned char positionAndType, unsigned char alignment, unsigned short width, unsigned short height, unsigned short x, unsigned short y) override
Definition: WP5ContentListener.cpp:608
void startDocument() override
Definition: WP5ContentListener.h:56
void setFont(const librevenge::RVNGString &fontName, double fontSize) override
Definition: WP5ContentListener.cpp:497
Definition: WP5ContentListener.h:38
WPXFormOrientation
Definition: libwpd_internal.h:105
WP5ContentParsingState()
Definition: WP5ContentListener.cpp:34
void pageMarginChange(unsigned char, unsigned short) override
Definition: WP5ContentListener.h:84
bool m_isFrameOpened
Definition: WP5ContentListener.h:47
Definition: WPXSubDocument.h:34
void defineTable(unsigned char position, unsigned short leftOffset) override
Definition: WP5ContentListener.cpp:239
WPXVerticalAlignment
Definition: libwpd_internal.h:107
librevenge::RVNGString m_defaultFontName
Definition: WP5ContentListener.h:131
void _flushText() override
Definition: WP5ContentListener.cpp:826
void endDocument() override
Definition: WP5ContentListener.h:88
void attributeChange(bool isOn, unsigned char attribute) override
Definition: WP5ContentListener.cpp:371
librevenge::RVNGString m_noteReference
Definition: WP5ContentListener.h:43
void startSubDocument() override
Definition: WP5ContentListener.h:60
void setTabs(const std::vector< WPXTabStop > &tabStops, unsigned short tabOffset) override
Definition: WP5ContentListener.cpp:507
void characterColorChange(unsigned char red, unsigned char green, unsigned char blue) override
Definition: WP5ContentListener.cpp:486
void endSubDocument()
Definition: WPXContentListener.cpp:180
void insertNote(WPXNoteType noteType, const WP5SubDocument *subDocument) override
Definition: WP5ContentListener.cpp:525
Definition: libwpd_internal.h:166
std::unique_ptr< WP5ContentParsingState > m_parseState
Definition: WP5ContentListener.h:128
void startTable() override
Definition: WP5ContentListener.cpp:299
void marginChange(unsigned char side, unsigned short margin) override
Definition: WP5ContentListener.cpp:441
void suppressPageCharacteristics(unsigned char) override
Definition: WP5ContentListener.h:111
Definition: WP5ContentListener.h:50
void startDocument()
Definition: WPXContentListener.cpp:138
WP5ContentListener & operator=(const WP5ContentListener &)
WP5ContentListener(std::list< WPXPageSpan > &pageList, std::vector< WP5SubDocument *> &subDocuments, librevenge::RVNGTextInterface *documentInterface)
Definition: WP5ContentListener.cpp:46
void insertEOL() override
Definition: WP5ContentListener.cpp:226
void lineSpacingChange(const double lineSpacing)
Definition: WPXContentListener.cpp:1296
~WP5ContentListener() override
Definition: WP5ContentListener.cpp:56
void insertBreak(unsigned char breakType) override
Definition: WP5ContentListener.h:70
void pageFormChange(unsigned short, unsigned short, WPXFormOrientation) override
Definition: WP5ContentListener.h:85
void setDefaultFont(const librevenge::RVNGString &fontName, double fontSize)
Definition: WP5ContentListener.cpp:602
double m_defaultFontSize
Definition: WP5ContentListener.h:130
WPXNoteType
Definition: libwpd_internal.h:93
void insertCharacter(unsigned character) override
Definition: WP5ContentListener.cpp:65

Generated for libwpd by doxygen 1.8.14