WP42ContentListener.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 WP42CONTENTLISTENER_H
29 #define WP42CONTENTLISTENER_H
30
31 #include <memory>
32
33 #include "WP42Listener.h"
34 #include "WP42SubDocument.h"
35 #include "WPXContentListener.h"
36 #include <libwpd/libwpd.h>
37
38 struct WP42ContentParsingState
39 {
40 WP42ContentParsingState();
41 ~WP42ContentParsingState();
42 librevenge::RVNGString m_textBuffer;
43 };
44
45 class WP42ContentListener : public WP42Listener, protected WPXContentListener
46 {
47 public:
48 WP42ContentListener(std::list<WPXPageSpan> &pageList, librevenge::RVNGTextInterface *documentInterface);
49 ~WP42ContentListener() override;
50
51 void startDocument() override
52 {
53 WPXContentListener::startDocument();
54 }
55 void startSubDocument() override
56 {
57 WPXContentListener::startSubDocument();
58 }
59 void insertCharacter(unsigned character) override;
60 void insertTab(unsigned char tabType, double tabPosition) override;
61 void insertBreak(unsigned char breakType) override
62 {
63 WPXContentListener::insertBreak(breakType);
64 }
65 void insertEOL() override;
66 void attributeChange(bool isOn, unsigned char attribute) override;
67 void marginReset(unsigned char leftMargin, unsigned char rightMargin) override;
68 void headerFooterGroup(unsigned char headerFooterDefinition, const std::shared_ptr<WP42SubDocument> &subDocument) override;
69 void suppressPageCharacteristics(unsigned char /* suppressCode */) override {}
70 void endDocument() override
71 {
72 WPXContentListener::endDocument();
73 }
74 void endSubDocument() override
75 {
76 WPXContentListener::endSubDocument();
77 }
78
79 protected:
80 void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0) override;
81
82 void _flushText() override;
83 void _changeList() override {}
84
85 private:
86 WP42ContentListener(const WP42ContentListener &);
87 WP42ContentListener &operator=(const WP42ContentListener &);
88 std::unique_ptr<WP42ContentParsingState> m_parseState;
89 };
90
91 #endif /* WP42LISTENER_H */
92 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WP42Listener.h
WP42SubDocument.h
WPXContentListener.h
WP42ContentListener
Definition: WP42ContentListener.h:46
WP42ContentListener::WP42ContentListener
WP42ContentListener(std::list< WPXPageSpan > &pageList, librevenge::RVNGTextInterface *documentInterface)
Definition: WP42ContentListener.cpp:44
WP42ContentListener::startSubDocument
void startSubDocument() override
Definition: WP42ContentListener.h:55
WP42ContentListener::attributeChange
void attributeChange(bool isOn, unsigned char attribute) override
Definition: WP42ContentListener.cpp:97
WP42ContentListener::marginReset
void marginReset(unsigned char leftMargin, unsigned char rightMargin) override
Definition: WP42ContentListener.cpp:146
WP42ContentListener::startDocument
void startDocument() override
Definition: WP42ContentListener.h:51
WP42ContentListener::headerFooterGroup
void headerFooterGroup(unsigned char headerFooterDefinition, const std::shared_ptr< WP42SubDocument > &subDocument) override
Definition: WP42ContentListener.cpp:159
WP42ContentListener::endSubDocument
void endSubDocument() override
Definition: WP42ContentListener.h:74
WP42ContentListener::_flushText
void _flushText() override
Definition: WP42ContentListener.cpp:197
WP42ContentListener::WP42ContentListener
WP42ContentListener(const WP42ContentListener &)
WP42ContentListener::insertTab
void insertTab(unsigned char tabType, double tabPosition) override
Definition: WP42ContentListener.cpp:70
WP42ContentListener::m_parseState
std::unique_ptr< WP42ContentParsingState > m_parseState
Definition: WP42ContentListener.h:88
WP42ContentListener::suppressPageCharacteristics
void suppressPageCharacteristics(unsigned char) override
Definition: WP42ContentListener.h:69
WP42ContentListener::~WP42ContentListener
~WP42ContentListener() override
Definition: WP42ContentListener.cpp:54
WP42ContentListener::_handleSubDocument
void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice=0) override
Definition: WP42ContentListener.cpp:163
WP42ContentListener::operator=
WP42ContentListener & operator=(const WP42ContentListener &)
WP42ContentListener::_changeList
void _changeList() override
Definition: WP42ContentListener.h:83
WP42ContentListener::insertCharacter
void insertCharacter(unsigned character) override
Definition: WP42ContentListener.cpp:59
WP42ContentListener::endDocument
void endDocument() override
Definition: WP42ContentListener.h:70
WP42ContentListener::insertBreak
void insertBreak(unsigned char breakType) override
Definition: WP42ContentListener.h:61
WP42ContentListener::insertEOL
void insertEOL() override
Definition: WP42ContentListener.cpp:83
WP42Listener
Definition: WP42Listener.h:36
WPXContentListener
Definition: WPXContentListener.h:148
WPXContentListener::endSubDocument
void endSubDocument()
Definition: WPXContentListener.cpp:181
WPXContentListener::endDocument
void endDocument()
Definition: WPXContentListener.cpp:160
WPXContentListener::insertBreak
void insertBreak(const unsigned char breakType)
Definition: WPXContentListener.cpp:1243
WPXContentListener::startSubDocument
void startSubDocument()
Definition: WPXContentListener.cpp:154
WPXContentListener::startDocument
void startDocument()
Definition: WPXContentListener.cpp:139
WPXSubDocument
Definition: WPXSubDocument.h:37
WPXTableList
Definition: WPXTableList.h:36
libwpd.h
WPXSubDocumentType
WPXSubDocumentType
Definition: libwpd_internal.h:111
WP42ContentParsingState
Definition: WP42ContentListener.h:39
WP42ContentParsingState::~WP42ContentParsingState
~WP42ContentParsingState()
Definition: WP42ContentListener.cpp:39
WP42ContentParsingState::WP42ContentParsingState
WP42ContentParsingState()
Definition: WP42ContentListener.cpp:34
WP42ContentParsingState::m_textBuffer
librevenge::RVNGString m_textBuffer
Definition: WP42ContentListener.h:42