WP42StylesListener.h Source File documentation

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: */
WPXPageSpan.h
WP42StylesListener::attributeChange
void attributeChange(bool, unsigned char) override
Definition: WP42StylesListener.h:59
FOOTER
@ FOOTER
Definition: libwpd_internal.h:94
WPXPageSpan::setPageSpan
void setPageSpan(const int pageSpan)
Definition: WPXPageSpan.h:178
NEVER
@ NEVER
Definition: libwpd_internal.h:96
WP42StylesListener
Definition: WP42StylesListener.h:40
WPX_HEADER_A
#define WPX_HEADER_A
Definition: WPXFileStructure.h:42
WP42StylesListener::WP42StylesListener
WP42StylesListener(std::list< WPXPageSpan > &pageList)
Definition: WP42StylesListener.cpp:34
WP42StylesListener::suppressPageCharacteristics
void suppressPageCharacteristics(unsigned char suppressCode) override
Definition: WP42StylesListener.cpp:161
WP42StylesListener::m_currentPageHasContent
bool m_currentPageHasContent
Definition: WP42StylesListener.h:72
WPXTable.h
WP42_HEADER_FOOTER_GROUP_ALL_BIT
#define WP42_HEADER_FOOTER_GROUP_ALL_BIT
Definition: WP42FileStructure.h:46
WPXTableList.h
WPX_FOOTER_A
#define WPX_FOOTER_A
Definition: WPXFileStructure.h:44
WPD_DEBUG_MSG
#define WPD_DEBUG_MSG(M)
Definition: libwpd_internal.h:50
WP42StylesListener::m_isSubDocument
bool m_isSubDocument
Definition: WP42StylesListener.h:73
WP42StylesListener::_handleSubDocument
void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice=0)
Definition: WP42StylesListener.cpp:188
WPXSubDocument
Definition: WPXSubDocument.h:37
WPXPageSpan::setMarginRight
void setMarginRight(const double marginRight)
Definition: WPXPageSpan.h:145
HEADER
@ HEADER
Definition: libwpd_internal.h:94
WP42StylesListener::m_tempMarginRight
double m_tempMarginRight
Definition: WP42StylesListener.h:71
WP42StylesListener::endDocument
void endDocument() override
Definition: WP42StylesListener.cpp:47
WP42StylesListener::insertTab
void insertTab(unsigned char, double) override
Definition: WP42StylesListener.h:50
WPX_SOFT_PAGE_BREAK
#define WPX_SOFT_PAGE_BREAK
Definition: libwpd_internal.h:156
WP42StylesListener::endSubDocument
void endSubDocument() override
Definition: WP42StylesListener.cpp:52
WPX_PAGE_BREAK
#define WPX_PAGE_BREAK
Definition: libwpd_internal.h:155
WP42FileStructure.h
libwpd_internal.h
WPXPageSpan::setHeaderFooter
void setHeaderFooter(const WPXHeaderFooterType type, const unsigned char headerFooterType, const WPXHeaderFooterOccurrence occurrence, const std::shared_ptr< WPXSubDocument > &subDocument, WPXTableList tableList)
Definition: WPXPageSpan.cpp:87
ALL
@ ALL
Definition: libwpd_internal.h:96
WPXPageSpan::setMarginLeft
void setMarginLeft(const double marginLeft)
Definition: WPXPageSpan.h:141
WPX_SUBDOCUMENT_HEADER_FOOTER
@ WPX_SUBDOCUMENT_HEADER_FOOTER
Definition: libwpd_internal.h:111
WP42SubDocument.h
WP42StylesListener::startDocument
void startDocument() override
Definition: WP42StylesListener.h:44
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
WPX_FOOTER_B
#define WPX_FOOTER_B
Definition: WPXFileStructure.h:45
EVEN
@ EVEN
Definition: libwpd_internal.h:96
WPXTableList
Definition: WPXTableList.h:36
WP42StylesListener::insertBreak
void insertBreak(unsigned char breakType) override
Definition: WP42StylesListener.cpp:57
WP42StylesListener::m_tempMarginLeft
double m_tempMarginLeft
Definition: WP42StylesListener.h:71
WP42Listener.h
WPXListener::isUndoOn
bool isUndoOn()
Definition: WPXListener.h:40
WPXPageSpan
Definition: WPXPageSpan.h:43
WPXListener::m_pageList
std::list< WPXPageSpan > & m_pageList
Definition: WPXListener.h:49
WPXPageSpan::getHeaderFooterList
const std::vector< WPXHeaderFooter > & getHeaderFooterList() const
Definition: WPXPageSpan.h:114
WP42StylesListener::m_pageListHardPageMark
std::list< WPXPageSpan >::iterator m_pageListHardPageMark
Definition: WP42StylesListener.h:74
ODD
@ ODD
Definition: libwpd_internal.h:96
WP42StylesListener::insertEOL
void insertEOL() override
Definition: WP42StylesListener.h:54
WPXFileStructure.h
WPXStylesListener
Definition: WPXStylesListener.h:34
WP42StylesListener::m_nextPage
WPXPageSpan m_nextPage
Definition: WP42StylesListener.h:70
WP42StylesListener::m_currentPage
WPXPageSpan m_currentPage
Definition: WP42StylesListener.h:70
WP42StylesListener::insertCharacter
void insertCharacter(unsigned) override
Definition: WP42StylesListener.h:46
WPXSubDocumentType
WPXSubDocumentType
Definition: libwpd_internal.h:111
WPX_HEADER_B
#define WPX_HEADER_B
Definition: WPXFileStructure.h:43
WP42Listener
Definition: WP42Listener.h:36
WP42StylesListener::startSubDocument
void startSubDocument() override
Definition: WP42StylesListener.h:45
WPXStylesListener.h
WPXHeaderFooterOccurrence
WPXHeaderFooterOccurrence
Definition: libwpd_internal.h:96
WP42StylesListener.h
WP42SubDocument
Definition: WP42SubDocument.h:34
WP42_HEADER_FOOTER_GROUP_ODD_BIT
#define WP42_HEADER_FOOTER_GROUP_ODD_BIT
Definition: WP42FileStructure.h:47
WPXHeaderFooterType
WPXHeaderFooterType
Definition: libwpd_internal.h:94
WP42_HEADER_FOOTER_GROUP_EVEN_BIT
#define WP42_HEADER_FOOTER_GROUP_EVEN_BIT
Definition: WP42FileStructure.h:48
WPXPageSpan::setHeadFooterSuppression
void setHeadFooterSuppression(const unsigned char headerFooterType, const bool suppress)
Definition: WPXPageSpan.h:125