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
36class 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;
45private:
46 WP1ContentParsingState(const WP1ContentParsingState &);
47 WP1ContentParsingState &operator=(const WP1ContentParsingState &);
48};
49
50 class WP1ContentListener : public WP1Listener, protected WPXContentListener
51{
52public:
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
104protected:
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
111private:
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: */
WP1Listener.h
WPXContentListener.h
WP1ContentListener::attributeChange
void attributeChange(bool isOn, unsigned char attribute) override
Definition WP1ContentListener.cpp:170
WP1ContentListener::justificationChange
void justificationChange(unsigned char justification) override
Definition WP1ContentListener.cpp:470
WP1ContentListener::flushRightOff
void flushRightOff() override
Definition WP1ContentListener.h:91
WP1ContentListener::suppressPageCharacteristics
void suppressPageCharacteristics(unsigned char) override
Definition WP1ContentListener.h:84
WP1ContentListener::lineSpacingChange
void lineSpacingChange(unsigned char spacing) override
Definition WP1ContentListener.h:86
WP1ContentListener::insertPicture
void insertPicture(unsigned short width, unsigned short height, const librevenge::RVNGBinaryData &binaryData) override
Definition WP1ContentListener.cpp:533
WP1ContentListener::endSubDocument
void endSubDocument() override
Definition WP1ContentListener.h:98
WP1ContentListener::leftIndent
void leftIndent(unsigned short leftMarginOffset) override
Definition WP1ContentListener.cpp:411
WP1ContentListener::leftRightIndent
void leftRightIndent(unsigned short leftRightMarginOffset) override
Definition WP1ContentListener.cpp:429
WP1ContentListener::_handleSubDocument
void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice=0) override
Definition WP1ContentListener.cpp:555
WP1ContentListener::insertExtendedCharacter
void insertExtendedCharacter(unsigned char extendedCharacter) override
Definition WP1ContentListener.cpp:78
WP1ContentListener::endDocument
void endDocument() override
Definition WP1ContentListener.h:94
WP1ContentListener::_changeList
void _changeList() override
Definition WP1ContentListener.h:109
WP1ContentListener::marginReset
void marginReset(unsigned short leftMargin, unsigned short rightMargin) override
Definition WP1ContentListener.cpp:386
WP1ContentListener::insertTab
void insertTab() override
Definition WP1ContentListener.cpp:95
WP1ContentListener::centerOn
void centerOn() override
Definition WP1ContentListener.cpp:519
WP1ContentListener::insertCharacter
void insertCharacter(unsigned character) override
Definition WP1ContentListener.cpp:62
WP1ContentListener::WP1ContentListener
WP1ContentListener(const WP1ContentListener &)
WP1ContentListener::bottomMarginSet
void bottomMarginSet(unsigned short) override
Definition WP1ContentListener.h:78
WP1ContentListener::fontPointSize
void fontPointSize(unsigned char pointSize) override
Definition WP1ContentListener.cpp:215
WP1ContentListener::insertNote
void insertNote(WPXNoteType noteType, WP1SubDocument *subDocument) override
Definition WP1ContentListener.cpp:131
WP1ContentListener::flushRightOn
void flushRightOn() override
Definition WP1ContentListener.cpp:505
WP1ContentListener::m_parseState
std::unique_ptr< WP1ContentParsingState > m_parseState
Definition WP1ContentListener.h:112
WP1ContentListener::startSubDocument
void startSubDocument() override
Definition WP1ContentListener.h:60
WP1ContentListener::topMarginSet
void topMarginSet(unsigned short) override
Definition WP1ContentListener.h:77
WP1ContentListener::operator=
WP1ContentListener & operator=(WP1ContentListener &)
WP1ContentListener::setTabs
void setTabs(const std::vector< WPXTabStop > &tabStops) override
Definition WP1ContentListener.cpp:496
WP1ContentListener::fontId
void fontId(unsigned short id) override
Definition WP1ContentListener.cpp:225
WP1ContentListener::insertBreak
void insertBreak(unsigned char breakType) override
Definition WP1ContentListener.h:67
WP1ContentListener::headerFooterGroup
void headerFooterGroup(unsigned char headerFooterDefinition, const std::shared_ptr< WP1SubDocument > &subDocument) override
Definition WP1ContentListener.cpp:492
WP1ContentListener::startDocument
void startDocument() override
Definition WP1ContentListener.h:56
WP1ContentListener::~WP1ContentListener
~WP1ContentListener() override
Definition WP1ContentListener.cpp:57
WP1ContentListener::centerOff
void centerOff() override
Definition WP1ContentListener.h:93
WP1ContentListener::insertEOL
void insertEOL() override
Definition WP1ContentListener.cpp:113
WP1ContentListener::_flushText
void _flushText() override
Definition WP1ContentListener.cpp:589
WP1ContentListener::WP1ContentListener
WP1ContentListener(std::list< WPXPageSpan > &pageList, librevenge::RVNGTextInterface *documentInterface)
Definition WP1ContentListener.cpp:48
WP1ContentListener::leftMarginRelease
void leftMarginRelease(unsigned short release) override
Definition WP1ContentListener.cpp:451
WP1Listener::WP1Listener
WP1Listener()
Definition WP1Listener.cpp:30
WP1SubDocument
Definition WP1SubDocument.h:34
WPXContentListener::lineSpacingChange
void lineSpacingChange(const double lineSpacing)
Definition WPXContentListener.cpp:1296
WPXContentListener::endSubDocument
void endSubDocument()
Definition WPXContentListener.cpp:180
WPXContentListener::endDocument
void endDocument()
Definition WPXContentListener.cpp:159
WPXContentListener::insertBreak
void insertBreak(const unsigned char breakType)
Definition WPXContentListener.cpp:1242
WPXContentListener::startSubDocument
void startSubDocument()
Definition WPXContentListener.cpp:153
WPXContentListener::WPXContentListener
WPXContentListener(std::list< WPXPageSpan > &pageList, librevenge::RVNGTextInterface *documentInterface)
Definition WPXContentListener.cpp:126
WPXContentListener::startDocument
void startDocument()
Definition WPXContentListener.cpp:138
WPXSubDocument
Definition WPXSubDocument.h:37
WPXTableList
Definition WPXTableList.h:36
WPXSubDocumentType
WPXSubDocumentType
Definition libwpd_internal.h:111
WPXNoteType
WPXNoteType
Definition libwpd_internal.h:93
WP1ContentParsingState::m_numDeferredTabs
int m_numDeferredTabs
Definition WP1ContentListener.h:43
WP1ContentParsingState::~WP1ContentParsingState
~WP1ContentParsingState()
Definition WP1ContentListener.cpp:43
WP1ContentParsingState::m_footNoteNumber
int m_footNoteNumber
Definition WP1ContentListener.h:44
WP1ContentParsingState::WP1ContentParsingState
WP1ContentParsingState(const WP1ContentParsingState &)
WP1ContentParsingState::operator=
WP1ContentParsingState & operator=(const WP1ContentParsingState &)
WP1ContentParsingState::m_endNoteNumber
int m_endNoteNumber
Definition WP1ContentListener.h:44
WP1ContentParsingState::WP1ContentParsingState
WP1ContentParsingState()
Definition WP1ContentListener.cpp:35
WP1ContentParsingState::m_textBuffer
librevenge::RVNGString m_textBuffer
Definition WP1ContentListener.h:42