WP1StylesListener.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) 2004 Marc Maurer (uwog@uwog.net)
12 * Copyright (C) 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 WP1STYLESLISTENER_H
29 #define WP1STYLESLISTENER_H
30
31 #include "WP1Listener.h"
32 #include "WP1SubDocument.h"
33 #include "WPXStylesListener.h"
34 #include <memory>
35 #include "WPXPageSpan.h"
36 #include "WPXTable.h"
37 #include "WPXTableList.h"
38
39 class WP1StylesListener : public WP1Listener, protected WPXStylesListener
40 {
41 public:
42 explicit WP1StylesListener(std::list<WPXPageSpan> &pageList);
43 ~WP1StylesListener() override {}
44
45 void startDocument() override {}
46 void startSubDocument() override {}
47 void insertCharacter(unsigned /* character */) override
48 {
49 if (!isUndoOn()) m_currentPageHasContent = true;
50 }
51 void insertExtendedCharacter(unsigned char /* extendedCharacter */) override
52 {
53 if (!isUndoOn()) m_currentPageHasContent = true;
54 }
55 void insertTab() override
56 {
57 if (!isUndoOn()) m_currentPageHasContent = true;
58 }
59 void insertEOL() override
60 {
61 if (!isUndoOn()) m_currentPageHasContent = true;
62 }
63 void insertBreak(unsigned char breakType) override;
64 void insertNote(WPXNoteType /* noteType */, WP1SubDocument * /* subDocument */) override {}
65 void attributeChange(bool /* isOn */, unsigned char /* attribute */) override {}
66 void fontPointSize(unsigned char /* pointSize */) override {}
67 void fontId(unsigned short /* id */) override {}
68 void marginReset(unsigned short leftMargin, unsigned short rightMargin) override;
69 void topMarginSet(unsigned short topMargin) override;
70 void bottomMarginSet(unsigned short bottomMargin) override;
71 void leftIndent(unsigned short /* leftMarginOffset */) override
72 {
73 if (!isUndoOn()) m_currentPageHasContent = true;
74 }
75 void leftRightIndent(unsigned short /* leftRightMarginOffset */) override
76 {
77 if (!isUndoOn()) m_currentPageHasContent = true;
78 }
79 void leftMarginRelease(unsigned short /* release */) override {}
80 void setTabs(const std::vector<WPXTabStop> & /* tabStops */) override {}
81 void headerFooterGroup(unsigned char headerFooterDefinition, const std::shared_ptr<WP1SubDocument> &subDocument) override;
82 void suppressPageCharacteristics(unsigned char suppressCode) override;
83 void justificationChange(unsigned char /* justification */) override {}
84 void lineSpacingChange(unsigned char /* spacing */) override {}
85 void flushRightOn() override {}
86 void flushRightOff() override {}
87 void centerOn() override {}
88 void centerOff() override {}
89 void endDocument() override;
90 void endSubDocument() override;
91 void insertPicture(unsigned short /* width */, unsigned short /* height */, const librevenge::RVNGBinaryData & /* binaryData */) override {}
92
93 protected:
94 void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0);
95
96 private:
97 WPXPageSpan m_currentPage, m_nextPage;
98 double m_tempMarginLeft, m_tempMarginRight;
99 bool m_currentPageHasContent;
100 bool m_isSubDocument;
101 std::list<WPXPageSpan>::iterator m_pageListHardPageMark;
102 };
103
104 #endif /* WP1STYLESLISTENER_H */
105 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WP1Listener.h
WP1SubDocument.h
WPXPageSpan.h
WPXStylesListener.h
WPXTableList.h
WPXTable.h
WP1Listener
Definition: WP1Listener.h:39
WP1StylesListener
Definition: WP1StylesListener.h:40
WP1StylesListener::m_currentPage
WPXPageSpan m_currentPage
Definition: WP1StylesListener.h:97
WP1StylesListener::insertPicture
void insertPicture(unsigned short, unsigned short, const librevenge::RVNGBinaryData &) override
Definition: WP1StylesListener.h:91
WP1StylesListener::~WP1StylesListener
~WP1StylesListener() override
Definition: WP1StylesListener.h:43
WP1StylesListener::leftIndent
void leftIndent(unsigned short) override
Definition: WP1StylesListener.h:71
WP1StylesListener::startSubDocument
void startSubDocument() override
Definition: WP1StylesListener.h:46
WP1StylesListener::insertExtendedCharacter
void insertExtendedCharacter(unsigned char) override
Definition: WP1StylesListener.h:51
WP1StylesListener::bottomMarginSet
void bottomMarginSet(unsigned short bottomMargin) override
Definition: WP1StylesListener.cpp:174
WP1StylesListener::centerOn
void centerOn() override
Definition: WP1StylesListener.h:87
WP1StylesListener::setTabs
void setTabs(const std::vector< WPXTabStop > &) override
Definition: WP1StylesListener.h:80
WP1StylesListener::insertBreak
void insertBreak(unsigned char breakType) override
Definition: WP1StylesListener.cpp:56
WP1StylesListener::m_tempMarginLeft
double m_tempMarginLeft
Definition: WP1StylesListener.h:98
WP1StylesListener::centerOff
void centerOff() override
Definition: WP1StylesListener.h:88
WP1StylesListener::justificationChange
void justificationChange(unsigned char) override
Definition: WP1StylesListener.h:83
WP1StylesListener::headerFooterGroup
void headerFooterGroup(unsigned char headerFooterDefinition, const std::shared_ptr< WP1SubDocument > &subDocument) override
Definition: WP1StylesListener.cpp:184
WP1StylesListener::startDocument
void startDocument() override
Definition: WP1StylesListener.h:45
WP1StylesListener::endSubDocument
void endSubDocument() override
Definition: WP1StylesListener.cpp:51
WP1StylesListener::insertCharacter
void insertCharacter(unsigned) override
Definition: WP1StylesListener.h:47
WP1StylesListener::endDocument
void endDocument() override
Definition: WP1StylesListener.cpp:46
WP1StylesListener::fontPointSize
void fontPointSize(unsigned char) override
Definition: WP1StylesListener.h:66
WP1StylesListener::insertEOL
void insertEOL() override
Definition: WP1StylesListener.h:59
WP1StylesListener::flushRightOff
void flushRightOff() override
Definition: WP1StylesListener.h:86
WP1StylesListener::leftRightIndent
void leftRightIndent(unsigned short) override
Definition: WP1StylesListener.h:75
WP1StylesListener::leftMarginRelease
void leftMarginRelease(unsigned short) override
Definition: WP1StylesListener.h:79
WP1StylesListener::insertTab
void insertTab() override
Definition: WP1StylesListener.h:55
WP1StylesListener::m_nextPage
WPXPageSpan m_nextPage
Definition: WP1StylesListener.h:97
WP1StylesListener::_handleSubDocument
void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice=0)
Definition: WP1StylesListener.cpp:249
WP1StylesListener::attributeChange
void attributeChange(bool, unsigned char) override
Definition: WP1StylesListener.h:65
WP1StylesListener::WP1StylesListener
WP1StylesListener(std::list< WPXPageSpan > &pageList)
Definition: WP1StylesListener.cpp:33
WP1StylesListener::topMarginSet
void topMarginSet(unsigned short topMargin) override
Definition: WP1StylesListener.cpp:164
WP1StylesListener::lineSpacingChange
void lineSpacingChange(unsigned char) override
Definition: WP1StylesListener.h:84
WP1StylesListener::m_pageListHardPageMark
std::list< WPXPageSpan >::iterator m_pageListHardPageMark
Definition: WP1StylesListener.h:101
WP1StylesListener::insertNote
void insertNote(WPXNoteType, WP1SubDocument *) override
Definition: WP1StylesListener.h:64
WP1StylesListener::flushRightOn
void flushRightOn() override
Definition: WP1StylesListener.h:85
WP1StylesListener::fontId
void fontId(unsigned short) override
Definition: WP1StylesListener.h:67
WP1StylesListener::marginReset
void marginReset(unsigned short leftMargin, unsigned short rightMargin) override
Definition: WP1StylesListener.cpp:116
WP1StylesListener::m_currentPageHasContent
bool m_currentPageHasContent
Definition: WP1StylesListener.h:99
WP1StylesListener::suppressPageCharacteristics
void suppressPageCharacteristics(unsigned char suppressCode) override
Definition: WP1StylesListener.cpp:227
WP1StylesListener::m_tempMarginRight
double m_tempMarginRight
Definition: WP1StylesListener.h:98
WP1StylesListener::m_isSubDocument
bool m_isSubDocument
Definition: WP1StylesListener.h:100
WP1SubDocument
Definition: WP1SubDocument.h:34
WPXListener::isUndoOn
bool isUndoOn()
Definition: WPXListener.h:40
WPXPageSpan
Definition: WPXPageSpan.h:43
WPXStylesListener
Definition: WPXStylesListener.h:34
WPXSubDocument
Definition: WPXSubDocument.h:37
WPXTableList
Definition: WPXTableList.h:36
WPXSubDocumentType
WPXSubDocumentType
Definition: libwpd_internal.h:111
WPXNoteType
WPXNoteType
Definition: libwpd_internal.h:93