WP1ContentListener.h Source File documentation

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
38 struct WP1ContentParsingState
39 {
40 WP1ContentParsingState();
41 ~WP1ContentParsingState();
42 librevenge::RVNGString m_textBuffer;
43 int m_numDeferredTabs;
44 int m_footNoteNumber, m_endNoteNumber;
45 private:
46 WP1ContentParsingState(const WP1ContentParsingState &);
47 WP1ContentParsingState &operator=(const WP1ContentParsingState &);
48 };
49
50 class WP1ContentListener : public WP1Listener, protected WPXContentListener
51 {
52 public:
53 WP1ContentListener(std::list<WPXPageSpan> &pageList, librevenge::RVNGTextInterface *documentInterface);
54 ~WP1ContentListener() override;
55
56 void startDocument() override
57 {
58 WPXContentListener::startDocument();
59 }
60 void startSubDocument() override
61 {
62 WPXContentListener::startSubDocument();
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 {
69 WPXContentListener::insertBreak(breakType);
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, const std::shared_ptr<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 {
96 WPXContentListener::endDocument();
97 }
98 void endSubDocument() override
99 {
100 WPXContentListener::endSubDocument();
101 }
102 void insertPicture(unsigned short width, unsigned short height, const librevenge::RVNGBinaryData &binaryData) override;
103
104 protected:
105 using WPXContentListener::lineSpacingChange;
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 WP1ContentListener(const WP1ContentListener &);
114 WP1ContentListener &operator=(WP1ContentListener &);
115 };
116
117 #endif /* WP1LISTENER_H */
118 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WPXContentListener::_closeSpan
void _closeSpan()
Definition: WPXContentListener.cpp:899
WP1ContentListener::insertBreak
void insertBreak(unsigned char breakType) override
Definition: WP1ContentListener.h:67
WPXContentListener::endDocument
void endDocument()
Definition: WPXContentListener.cpp:159
WP1ContentListener::lineSpacingChange
void lineSpacingChange(unsigned char spacing) override
Definition: WP1ContentListener.h:86
WPXContentListener::_closeListElement
void _closeListElement()
Definition: WPXContentListener.cpp:772
WP1_ATTRIBUTE_SHADOW
#define WP1_ATTRIBUTE_SHADOW
Definition: WP1FileStructure.h:38
WPXContentListener::lineSpacingChange
void lineSpacingChange(const double lineSpacing)
Definition: WPXContentListener.cpp:1296
WPX_SUPERSCRIPT_BIT
#define WPX_SUPERSCRIPT_BIT
Definition: libwpd_internal.h:119
WPXContentListener::_openSpan
void _openSpan()
Definition: WPXContentListener.cpp:791
WPX_REDLINE_BIT
#define WPX_REDLINE_BIT
Definition: libwpd_internal.h:124
WP1ContentListener::justificationChange
void justificationChange(unsigned char justification) override
Definition: WP1ContentListener.cpp:470
WPXContentListener::_openParagraph
virtual void _openParagraph()
Definition: WPXContentListener.cpp:496
WP1ContentListener::operator=
WP1ContentListener & operator=(WP1ContentListener &)
WP1ContentListener::startDocument
void startDocument() override
Definition: WP1ContentListener.h:56
WP1ContentListener::WP1ContentListener
WP1ContentListener(const WP1ContentListener &)
WP1ContentListener::flushRightOn
void flushRightOn() override
Definition: WP1ContentListener.cpp:505
WP1ContentListener::~WP1ContentListener
~WP1ContentListener() override
Definition: WP1ContentListener.cpp:57
WPX_PARAGRAPH_JUSTIFICATION_RIGHT
#define WPX_PARAGRAPH_JUSTIFICATION_RIGHT
Definition: libwpd_internal.h:137
WP1ContentParsingState::m_numDeferredTabs
int m_numDeferredTabs
Definition: WP1ContentListener.h:43
WP1ContentListener::endSubDocument
void endSubDocument() override
Definition: WP1ContentListener.h:98
WPX_UNDERLINE_BIT
#define WPX_UNDERLINE_BIT
Definition: libwpd_internal.h:128
WP1ContentListener::fontId
void fontId(unsigned short id) override
Definition: WP1ContentListener.cpp:225
WP1_ATTRIBUTE_UNDERLINE
#define WP1_ATTRIBUTE_UNDERLINE
Definition: WP1FileStructure.h:36
WP1ContentListener::insertNote
void insertNote(WPXNoteType noteType, WP1SubDocument *subDocument) override
Definition: WP1ContentListener.cpp:131
WP1ContentListener::_changeList
void _changeList() override
Definition: WP1ContentListener.h:109
WP1ContentListener::insertExtendedCharacter
void insertExtendedCharacter(unsigned char extendedCharacter) override
Definition: WP1ContentListener.cpp:78
WP1_ATTRIBUTE_BOLD
#define WP1_ATTRIBUTE_BOLD
Definition: WP1FileStructure.h:34
WP1ContentListener::WP1ContentListener
WP1ContentListener(std::list< WPXPageSpan > &pageList, librevenge::RVNGTextInterface *documentInterface)
Definition: WP1ContentListener.cpp:48
WPX_SHADOW_BIT
#define WPX_SHADOW_BIT
Definition: libwpd_internal.h:123
WPXContentListener::endSubDocument
void endSubDocument()
Definition: WPXContentListener.cpp:180
WPXSubDocument
Definition: WPXSubDocument.h:37
WP1ContentListener::bottomMarginSet
void bottomMarginSet(unsigned short) override
Definition: WP1ContentListener.h:78
WP1ContentListener::leftRightIndent
void leftRightIndent(unsigned short leftRightMarginOffset) override
Definition: WP1ContentListener.cpp:429
WP1ContentListener::insertPicture
void insertPicture(unsigned short width, unsigned short height, const librevenge::RVNGBinaryData &binaryData) override
Definition: WP1ContentListener.cpp:533
WPX_SUBSCRIPT_BIT
#define WPX_SUBSCRIPT_BIT
Definition: libwpd_internal.h:120
WP1_ATTRIBUTE_ITALICS
#define WP1_ATTRIBUTE_ITALICS
Definition: WP1FileStructure.h:35
WP1_ATTRIBUTE_OUTLINE
#define WP1_ATTRIBUTE_OUTLINE
Definition: WP1FileStructure.h:37
WPXContentListener::_closeParagraph
void _closeParagraph()
Definition: WPXContentListener.cpp:725
WP1ContentParsingState::m_textBuffer
librevenge::RVNGString m_textBuffer
Definition: WP1ContentListener.h:42
WPX_SUBDOCUMENT_NOTE
@ WPX_SUBDOCUMENT_NOTE
Definition: libwpd_internal.h:111
WP1FileStructure.h
WPXContentListener::m_ps
std::unique_ptr< WPXContentParsingState > m_ps
Definition: WPXContentListener.h:162
WP1_ATTRIBUTE_REDLINE
#define WP1_ATTRIBUTE_REDLINE
Definition: WP1FileStructure.h:41
WP1ContentParsingState::WP1ContentParsingState
WP1ContentParsingState(const WP1ContentParsingState &)
libwpd_internal.h
WPXNoteType
WPXNoteType
Definition: libwpd_internal.h:93
WP1_ATTRIBUTE_SUBSCRIPT
#define WP1_ATTRIBUTE_SUBSCRIPT
Definition: WP1FileStructure.h:40
WP1Listener
Definition: WP1Listener.h:39
WPXContentListener::startDocument
void startDocument()
Definition: WPXContentListener.cpp:138
WP1Listener.h
WPX_BOLD_BIT
#define WPX_BOLD_BIT
Definition: libwpd_internal.h:126
WP1ContentParsingState::m_footNoteNumber
int m_footNoteNumber
Definition: WP1ContentListener.h:44
WPXContentListener
Definition: WPXContentListener.h:148
WP1ContentParsingState::operator=
WP1ContentParsingState & operator=(const WP1ContentParsingState &)
WP1ContentListener::centerOff
void centerOff() override
Definition: WP1ContentListener.h:93
WPXContentListener::insertBreak
void insertBreak(const unsigned char breakType)
Definition: WPXContentListener.cpp:1242
WP1ContentListener::topMarginSet
void topMarginSet(unsigned short) override
Definition: WP1ContentListener.h:77
WPXContentListener::m_documentInterface
librevenge::RVNGTextInterface * m_documentInterface
Definition: WPXContentListener.h:163
WPXContentListener::_mapNonUnicodeCharacter
unsigned _mapNonUnicodeCharacter(unsigned character)
Definition: WPXContentListener.cpp:1450
WP1ContentListener::insertTab
void insertTab() override
Definition: WP1ContentListener.cpp:95
WPXContentListener::handleSubDocument
void handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice)
Creates an new document state.
Definition: WPXContentListener.cpp:1195
WP1ContentListener::endDocument
void endDocument() override
Definition: WP1ContentListener.h:94
WP1ContentListener::insertEOL
void insertEOL() override
Definition: WP1ContentListener.cpp:113
WP1_ATTRIBUTE_STRIKE_OUT
#define WP1_ATTRIBUTE_STRIKE_OUT
Definition: WP1FileStructure.h:42
WPXTableList
Definition: WPXTableList.h:36
WPX_ITALICS_BIT
#define WPX_ITALICS_BIT
Definition: libwpd_internal.h:122
WP1ContentListener::m_parseState
std::unique_ptr< WP1ContentParsingState > m_parseState
Definition: WP1ContentListener.h:112
WP1ContentListener
Definition: WP1ContentListener.h:51
WP1ContentListener::attributeChange
void attributeChange(bool isOn, unsigned char attribute) override
Definition: WP1ContentListener.cpp:170
WPXContentListener::startSubDocument
void startSubDocument()
Definition: WPXContentListener.cpp:153
macRomanCharacterMap
const unsigned macRomanCharacterMap[]
Definition: libwpd_internal.cpp:1353
WPX_PARAGRAPH_JUSTIFICATION_LEFT
#define WPX_PARAGRAPH_JUSTIFICATION_LEFT
Definition: libwpd_internal.h:134
WP1ContentParsingState
Definition: WP1ContentListener.h:39
WPXContentListener::_closeSection
void _closeSection()
Definition: WPXContentListener.cpp:233
WPXListener::isUndoOn
bool isUndoOn()
Definition: WPXListener.h:40
WP1ContentListener::_flushText
void _flushText() override
Definition: WP1ContentListener.cpp:589
WP1ContentListener::startSubDocument
void startSubDocument() override
Definition: WP1ContentListener.h:60
WPX_PARAGRAPH_JUSTIFICATION_CENTER
#define WPX_PARAGRAPH_JUSTIFICATION_CENTER
Definition: libwpd_internal.h:136
WP1ContentListener::headerFooterGroup
void headerFooterGroup(unsigned char headerFooterDefinition, const std::shared_ptr< WP1SubDocument > &subDocument) override
Definition: WP1ContentListener.cpp:492
WPX_OUTLINE_BIT
#define WPX_OUTLINE_BIT
Definition: libwpd_internal.h:121
WP1ContentListener::leftIndent
void leftIndent(unsigned short leftMarginOffset) override
Definition: WP1ContentListener.cpp:411
WPX_STRIKEOUT_BIT
#define WPX_STRIKEOUT_BIT
Definition: libwpd_internal.h:127
WP1ContentListener::_handleSubDocument
void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice=0) override
Definition: WP1ContentListener.cpp:555
WP1ContentParsingState::WP1ContentParsingState
WP1ContentParsingState()
Definition: WP1ContentListener.cpp:35
WPXSubDocumentType
WPXSubDocumentType
Definition: libwpd_internal.h:111
WPX_PARAGRAPH_JUSTIFICATION_FULL
#define WPX_PARAGRAPH_JUSTIFICATION_FULL
Definition: libwpd_internal.h:135
WP1_ATTRIBUTE_SUPERSCRIPT
#define WP1_ATTRIBUTE_SUPERSCRIPT
Definition: WP1FileStructure.h:39
WP1ContentListener.h
WP1SubDocument.h
WP1SubDocument
Definition: WP1SubDocument.h:34
WP1ContentListener::flushRightOff
void flushRightOff() override
Definition: WP1ContentListener.h:91
WP1ContentParsingState::~WP1ContentParsingState
~WP1ContentParsingState()
Definition: WP1ContentListener.cpp:43
appendUCS4
void appendUCS4(librevenge::RVNGString &str, unsigned ucs4)
Definition: libwpd_internal.cpp:154
WP1ContentListener::setTabs
void setTabs(const std::vector< WPXTabStop > &tabStops) override
Definition: WP1ContentListener.cpp:496
WPXContentListener::_insertText
void _insertText(const librevenge::RVNGString &textBuffer)
Definition: WPXContentListener.cpp:624
WP1ContentParsingState::m_endNoteNumber
int m_endNoteNumber
Definition: WP1ContentListener.h:44
WP1ContentListener::fontPointSize
void fontPointSize(unsigned char pointSize) override
Definition: WP1ContentListener.cpp:215
WP1ContentListener::insertCharacter
void insertCharacter(unsigned character) override
Definition: WP1ContentListener.cpp:62
WP1ContentListener::marginReset
void marginReset(unsigned short leftMargin, unsigned short rightMargin) override
Definition: WP1ContentListener.cpp:386
FOOTNOTE
@ FOOTNOTE
Definition: libwpd_internal.h:93
WP1ContentListener::suppressPageCharacteristics
void suppressPageCharacteristics(unsigned char) override
Definition: WP1ContentListener.h:84
WP1ContentListener::centerOn
void centerOn() override
Definition: WP1ContentListener.cpp:519
WP1ContentListener::leftMarginRelease
void leftMarginRelease(unsigned short release) override
Definition: WP1ContentListener.cpp:451
WPXContentListener.h