WP1ContentListener.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-2006 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 WP1CONTENTLISTENER_H
29 #define WP1CONTENTLISTENER_H
30 
31 #include <memory>
32 
33 #include "WP1Listener.h"
34 #include "WPXContentListener.h"
35 
36 class WP1SubDocument;
37 
39 {
42  librevenge::RVNGString m_textBuffer;
45 private:
48 };
49 
51 {
52 public:
53  WP1ContentListener(std::list<WPXPageSpan> &pageList, std::vector<WP1SubDocument *> &subDocuments, librevenge::RVNGTextInterface *documentInterface);
54  ~WP1ContentListener() override;
55 
56  void startDocument() override
57  {
59  }
60  void startSubDocument() override
61  {
63  }
64  void insertCharacter(unsigned character) override;
65  void insertExtendedCharacter(unsigned char extendedCharacter) override;
66  void insertTab() override;
67  void insertBreak(unsigned char breakType) override
68  {
70  }
71  void insertEOL() override;
72  void insertNote(WPXNoteType noteType, WP1SubDocument *subDocument) override;
73  void attributeChange(bool isOn, unsigned char attribute) override;
74  void fontPointSize(unsigned char pointSize) override;
75  void fontId(unsigned short id) override;
76  void marginReset(unsigned short leftMargin, unsigned short rightMargin) override;
77  void topMarginSet(unsigned short /* topMargin */) override {}
78  void bottomMarginSet(unsigned short /* bottomMargin */) override {}
79  void leftIndent(unsigned short leftMarginOffset) override;
80  void leftRightIndent(unsigned short leftRightMarginOffset) override;
81  void leftMarginRelease(unsigned short release) override;
82  void setTabs(const std::vector<WPXTabStop> &tabStops) override;
83  void headerFooterGroup(unsigned char headerFooterDefinition, WP1SubDocument *subDocument) override;
84  void suppressPageCharacteristics(unsigned char /* suppressCode */) override {}
85  void justificationChange(unsigned char justification) override;
86  void lineSpacingChange(unsigned char spacing) override
87  {
88  WPXContentListener::lineSpacingChange((double)((double)spacing/2.0));
89  }
90  void flushRightOn() override;
91  void flushRightOff() override {}
92  void centerOn() override;
93  void centerOff() override {}
94  void endDocument() override
95  {
97  }
98  void endSubDocument() override
99  {
101  }
102  void insertPicture(unsigned short width, unsigned short height, const librevenge::RVNGBinaryData &binaryData) override;
103 
104 protected:
106  void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0) override;
107 
108  void _flushText() override;
109  void _changeList() override {}
110 
111 private:
112  std::unique_ptr<WP1ContentParsingState> m_parseState;
113  std::vector<WP1SubDocument *> &m_subDocuments;
116 };
117 
118 #endif /* WP1LISTENER_H */
119 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
void _changeList() override
Definition: WP1ContentListener.h:109
Definition: WP1Listener.h:37
void attributeChange(bool isOn, unsigned char attribute) override
Definition: WP1ContentListener.cpp:171
void fontPointSize(unsigned char pointSize) override
Definition: WP1ContentListener.cpp:216
Definition: WP1ContentListener.h:38
std::unique_ptr< WP1ContentParsingState > m_parseState
Definition: WP1ContentListener.h:112
void marginReset(unsigned short leftMargin, unsigned short rightMargin) override
Definition: WP1ContentListener.cpp:387
int m_endNoteNumber
Definition: WP1ContentListener.h:44
WP1ContentParsingState()
Definition: WP1ContentListener.cpp:35
void startSubDocument()
Definition: WPXContentListener.cpp:153
void leftMarginRelease(unsigned short release) override
Definition: WP1ContentListener.cpp:452
void endDocument()
Definition: WPXContentListener.cpp:159
WP1ContentListener(std::list< WPXPageSpan > &pageList, std::vector< WP1SubDocument *> &subDocuments, librevenge::RVNGTextInterface *documentInterface)
Definition: WP1ContentListener.cpp:48
Definition: WP1SubDocument.h:33
void headerFooterGroup(unsigned char headerFooterDefinition, WP1SubDocument *subDocument) override
Definition: WP1ContentListener.cpp:493
void lineSpacingChange(unsigned char spacing) override
Definition: WP1ContentListener.h:86
void _flushText() override
Definition: WP1ContentListener.cpp:592
void insertBreak(const unsigned char breakType)
Definition: WPXContentListener.cpp:1242
WPXSubDocumentType
Definition: libwpd_internal.h:111
void flushRightOff() override
Definition: WP1ContentListener.h:91
void insertEOL() override
Definition: WP1ContentListener.cpp:114
Definition: WPXContentListener.h:146
void insertCharacter(unsigned character) override
Definition: WP1ContentListener.cpp:63
Definition: WPXTable.h:79
void insertBreak(unsigned char breakType) override
Definition: WP1ContentListener.h:67
void bottomMarginSet(unsigned short) override
Definition: WP1ContentListener.h:78
~WP1ContentParsingState()
Definition: WP1ContentListener.cpp:43
void centerOn() override
Definition: WP1ContentListener.cpp:522
void suppressPageCharacteristics(unsigned char) override
Definition: WP1ContentListener.h:84
void startSubDocument() override
Definition: WP1ContentListener.h:60
void leftIndent(unsigned short leftMarginOffset) override
Definition: WP1ContentListener.cpp:412
Definition: WP1ContentListener.h:50
WP1ContentListener & operator=(WP1ContentListener &)
Definition: WPXSubDocument.h:34
void flushRightOn() override
Definition: WP1ContentListener.cpp:508
void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice=0) override
Definition: WP1ContentListener.cpp:558
void setTabs(const std::vector< WPXTabStop > &tabStops) override
Definition: WP1ContentListener.cpp:499
WP1ContentParsingState & operator=(const WP1ContentParsingState &)
~WP1ContentListener() override
Definition: WP1ContentListener.cpp:58
void fontId(unsigned short id) override
Definition: WP1ContentListener.cpp:226
void endSubDocument()
Definition: WPXContentListener.cpp:180
int m_footNoteNumber
Definition: WP1ContentListener.h:44
void insertExtendedCharacter(unsigned char extendedCharacter) override
Definition: WP1ContentListener.cpp:79
void leftRightIndent(unsigned short leftRightMarginOffset) override
Definition: WP1ContentListener.cpp:430
void endDocument() override
Definition: WP1ContentListener.h:94
void insertPicture(unsigned short width, unsigned short height, const librevenge::RVNGBinaryData &binaryData) override
Definition: WP1ContentListener.cpp:536
std::vector< WP1SubDocument * > & m_subDocuments
Definition: WP1ContentListener.h:113
librevenge::RVNGString m_textBuffer
Definition: WP1ContentListener.h:42
int m_numDeferredTabs
Definition: WP1ContentListener.h:43
void startDocument()
Definition: WPXContentListener.cpp:138
void justificationChange(unsigned char justification) override
Definition: WP1ContentListener.cpp:471
void lineSpacingChange(const double lineSpacing)
Definition: WPXContentListener.cpp:1296
void insertTab() override
Definition: WP1ContentListener.cpp:96
void topMarginSet(unsigned short) override
Definition: WP1ContentListener.h:77
void startDocument() override
Definition: WP1ContentListener.h:56
WPXNoteType
Definition: libwpd_internal.h:93
void insertNote(WPXNoteType noteType, WP1SubDocument *subDocument) override
Definition: WP1ContentListener.cpp:132
void endSubDocument() override
Definition: WP1ContentListener.h:98
void centerOff() override
Definition: WP1ContentListener.h:93

Generated for libwpd by doxygen 1.8.14