WP42StylesListener.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 WP42STYLESLISTENER_H
29 #define WP42STYLESLISTENER_H
30
31 #include "WP42Listener.h"
32 #include "WP42SubDocument.h"
33 #include "WPXStylesListener.h"
34 #include <vector>
35 #include "WPXPageSpan.h"
36 #include "WPXTable.h"
37 #include "WPXTableList.h"
38
39 class WP42StylesListener : public WP42Listener, protected WPXStylesListener
40 {
41 public:
42 explicit WP42StylesListener(std::list<WPXPageSpan> &pageList);
43
44 void startDocument() override {}
45 void startSubDocument() override {}
46 void insertCharacter(unsigned /* character */) override
47 {
48 if (!isUndoOn()) m_currentPageHasContent = true;
49 }
50 void insertTab(unsigned char /* tabType */, double /* tabPosition */) override
51 {
52 if (!isUndoOn()) m_currentPageHasContent = true;
53 }
54 void insertEOL() override
55 {
56 if (!isUndoOn()) m_currentPageHasContent = true;
57 }
58 void insertBreak(unsigned char breakType) override;
59 void attributeChange(bool /* isOn */, unsigned char /* attribute */) override {}
60 void marginReset(unsigned char /* leftMargin */, unsigned char /* rightMargin */) override {}
61 void headerFooterGroup(unsigned char headerFooterDefinition, const std::shared_ptr<WP42SubDocument> &subDocument) override;
62 void suppressPageCharacteristics(unsigned char suppressCode) override;
63 void endDocument() override;
64 void endSubDocument() override;
65
66 protected:
67 void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0);
68
69 private:
70 WPXPageSpan m_currentPage, m_nextPage;
71 double m_tempMarginLeft, m_tempMarginRight;
72 bool m_currentPageHasContent;
73 bool m_isSubDocument;
74 std::list<WPXPageSpan>::iterator m_pageListHardPageMark;
75 };
76
77 #endif /* WP42STYLESLISTENER_H */
78 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WP42Listener.h
WP42SubDocument.h
WPXPageSpan.h
WPXStylesListener.h
WPXTableList.h
WPXTable.h
WP42Listener
Definition: WP42Listener.h:36
WP42StylesListener
Definition: WP42StylesListener.h:40
WP42StylesListener::m_tempMarginRight
double m_tempMarginRight
Definition: WP42StylesListener.h:71
WP42StylesListener::insertEOL
void insertEOL() override
Definition: WP42StylesListener.h:54
WP42StylesListener::attributeChange
void attributeChange(bool, unsigned char) override
Definition: WP42StylesListener.h:59
WP42StylesListener::startDocument
void startDocument() override
Definition: WP42StylesListener.h:44
WP42StylesListener::m_currentPage
WPXPageSpan m_currentPage
Definition: WP42StylesListener.h:70
WP42StylesListener::m_pageListHardPageMark
std::list< WPXPageSpan >::iterator m_pageListHardPageMark
Definition: WP42StylesListener.h:74
WP42StylesListener::insertBreak
void insertBreak(unsigned char breakType) override
Definition: WP42StylesListener.cpp:57
WP42StylesListener::m_tempMarginLeft
double m_tempMarginLeft
Definition: WP42StylesListener.h:71
WP42StylesListener::insertTab
void insertTab(unsigned char, double) override
Definition: WP42StylesListener.h:50
WP42StylesListener::startSubDocument
void startSubDocument() override
Definition: WP42StylesListener.h:45
WP42StylesListener::endDocument
void endDocument() override
Definition: WP42StylesListener.cpp:47
WP42StylesListener::m_isSubDocument
bool m_isSubDocument
Definition: WP42StylesListener.h:73
WP42StylesListener::WP42StylesListener
WP42StylesListener(std::list< WPXPageSpan > &pageList)
Definition: WP42StylesListener.cpp:34
WP42StylesListener::endSubDocument
void endSubDocument() override
Definition: WP42StylesListener.cpp:52
WP42StylesListener::insertCharacter
void insertCharacter(unsigned) override
Definition: WP42StylesListener.h:46
WP42StylesListener::m_nextPage
WPXPageSpan m_nextPage
Definition: WP42StylesListener.h:70
WP42StylesListener::_handleSubDocument
void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice=0)
Definition: WP42StylesListener.cpp:188
WP42StylesListener::m_currentPageHasContent
bool m_currentPageHasContent
Definition: WP42StylesListener.h:72
WP42StylesListener::marginReset
void marginReset(unsigned char, unsigned char) override
Definition: WP42StylesListener.h:60
WP42StylesListener::headerFooterGroup
void headerFooterGroup(unsigned char headerFooterDefinition, const std::shared_ptr< WP42SubDocument > &subDocument) override
Definition: WP42StylesListener.cpp:118
WP42StylesListener::suppressPageCharacteristics
void suppressPageCharacteristics(unsigned char suppressCode) override
Definition: WP42StylesListener.cpp:161
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