- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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