WP5StylesListener.h Source File documentation

WP5StylesListener.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-2007 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 WP5STYLESLISTENER_H
29 #define WP5STYLESLISTENER_H
30
31 #include "WP5Listener.h"
32 #include "WPXStylesListener.h"
33 #include <list>
34 #include "WPXPageSpan.h"
35 #include "WPXTable.h"
36 #include "WP5SubDocument.h"
37 #include "WPXTableList.h"
38
39 class WP5StylesListener : public WP5Listener, protected WPXStylesListener
40 {
41 public:
42 WP5StylesListener(std::list<WPXPageSpan> &pageList, WPXTableList tableList);
43
44 void startDocument() override {}
45 void startSubDocument() override {}
46 void setFont(const librevenge::RVNGString & /* fontName */, double /* fontSize */) override {}
47 void setTabs(const std::vector<WPXTabStop> & /* tabStops */, unsigned short /* tabOffset */) override {}
48 void insertCharacter(unsigned /* character */) override
49 {
50 /*if (!isUndoOn())*/ m_currentPageHasContent = true;
51 }
52 void insertTab(unsigned char /* tabType */, double /* tabPosition */) override
53 {
54 /*if (!isUndoOn())*/ m_currentPageHasContent = true;
55 }
56 void insertIndent(unsigned char /* indentType */, double /* indentPosition */) override
57 {
58 /*if (!isUndoOn())*/ m_currentPageHasContent = true;
59 }
60 void characterColorChange(unsigned char /* red */, unsigned char /* green */, unsigned char /* blue */) override {}
61 void insertEOL() override
62 {
63 /*if (!isUndoOn())*/ m_currentPageHasContent = true;
64 }
65 void insertBreak(unsigned char breakType) override;
66 void attributeChange(bool /* isOn */, unsigned char /* attribute */) override {}
67 void lineSpacingChange(double /* lineSpacing */) override {}
68 void justificationChange(unsigned char /* justification */) override {}
69 void pageMarginChange(unsigned char side, unsigned short margin) override;
70 void pageFormChange(unsigned short length, unsigned short width, WPXFormOrientation orientation) override;
71 void marginChange(unsigned char side, unsigned short margin) override;
72 void endDocument() override;
73 void endSubDocument() override;
74
75 void defineTable(unsigned char /* position */, unsigned short /* leftOffset */) override {}
76 void addTableColumnDefinition(unsigned /* width */, unsigned /* leftGutter */, unsigned /* rightGutter */,
77 unsigned /* attributes */, unsigned char /* alignment */) override {}
78 void startTable() override;
79 void insertRow(unsigned short rowHeight, bool isMinimumHeight, bool isHeaderRow) override;
80 void insertCell(unsigned char colSpan, unsigned char rowSpan, unsigned char borderBits,
81 const RGBSColor *cellFgColor, const RGBSColor *cellBgColor,
82 const RGBSColor *cellBorderColor, WPXVerticalAlignment cellVerticalAlignment,
83 bool useCellAttributes, unsigned cellAttributes) override;
84 void endTable() override {}
85
86 void insertNoteReference(const librevenge::RVNGString & /* noteReference */) override {}
87 void insertNote(WPXNoteType /* noteType */, const WP5SubDocument * /* subDocument */) override {}
88 void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, const std::shared_ptr<WP5SubDocument> &subDocument) override;
89 void suppressPageCharacteristics(unsigned char suppressCode) override;
90
91 void boxOn(unsigned char /* positionAndType */, unsigned char /* alignment */, unsigned short /* width */, unsigned short /* height */, unsigned short /* x */, unsigned short /* y */) override {}
92 void boxOff() override {}
93 void insertGraphicsData(const librevenge::RVNGBinaryData * /* data */) override {}
94
95 protected:
96 void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0);
97
98 private:
99 WP5StylesListener(const WP5StylesListener &);
100 WP5StylesListener &operator=(const WP5StylesListener &);
101 WPXPageSpan m_currentPage, m_nextPage;
102
103 WPXTableList m_tableList;
104 std::shared_ptr<WPXTable> m_currentTable;
105 double m_tempMarginLeft, m_tempMarginRight;
106 bool m_currentPageHasContent;
107 bool m_isSubDocument;
108 std::list<WPXPageSpan>::iterator m_pageListHardPageMark;
109 };
110
111 #endif /* WP5STYLESLISTENER_H */
112 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WP5_PAGE_GROUP_SUPPRESS_HEADER_A
#define WP5_PAGE_GROUP_SUPPRESS_HEADER_A
Definition: WP5FileStructure.h:84
WP5StylesListener::m_isSubDocument
bool m_isSubDocument
Definition: WP5StylesListener.h:107
WPXPageSpan.h
WPXPageSpan::setMarginBottom
void setMarginBottom(const double marginBottom)
Definition: WPXPageSpan.h:153
WP5StylesListener::attributeChange
void attributeChange(bool, unsigned char) override
Definition: WP5StylesListener.h:66
FOOTER
@ FOOTER
Definition: libwpd_internal.h:94
WPXPageSpan::setPageSpan
void setPageSpan(const int pageSpan)
Definition: WPXPageSpan.h:178
WP5StylesListener::headerFooterGroup
void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, const std::shared_ptr< WP5SubDocument > &subDocument) override
Definition: WP5StylesListener.cpp:198
WP5StylesListener::insertNoteReference
void insertNoteReference(const librevenge::RVNGString &) override
Definition: WP5StylesListener.h:86
NEVER
@ NEVER
Definition: libwpd_internal.h:96
WP5StylesListener::endTable
void endTable() override
Definition: WP5StylesListener.h:84
WP5StylesListener::m_tableList
WPXTableList m_tableList
Definition: WP5StylesListener.h:103
WPX_HEADER_A
#define WPX_HEADER_A
Definition: WPXFileStructure.h:42
WP5StylesListener::m_currentPageHasContent
bool m_currentPageHasContent
Definition: WP5StylesListener.h:106
WPXVerticalAlignment
WPXVerticalAlignment
Definition: libwpd_internal.h:107
WP5StylesListener::insertTab
void insertTab(unsigned char, double) override
Definition: WP5StylesListener.h:52
WP5StylesListener::justificationChange
void justificationChange(unsigned char) override
Definition: WP5StylesListener.h:68
WP5StylesListener::m_tempMarginRight
double m_tempMarginRight
Definition: WP5StylesListener.h:105
WPXFormOrientation
WPXFormOrientation
Definition: libwpd_internal.h:105
WPXTable.h
WP5StylesListener::insertCharacter
void insertCharacter(unsigned) override
Definition: WP5StylesListener.h:48
WP5StylesListener::startTable
void startTable() override
Definition: WP5StylesListener.cpp:259
RGBSColor
Definition: libwpd_internal.h:167
WP5StylesListener::boxOn
void boxOn(unsigned char, unsigned char, unsigned short, unsigned short, unsigned short, unsigned short) override
Definition: WP5StylesListener.h:91
WP5StylesListener::m_tempMarginLeft
double m_tempMarginLeft
Definition: WP5StylesListener.h:105
WPX_RIGHT
#define WPX_RIGHT
Definition: libwpd_internal.h:161
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
WP5_PAGE_GROUP_SUPPRESS_HEADER_B
#define WP5_PAGE_GROUP_SUPPRESS_HEADER_B
Definition: WP5FileStructure.h:85
WPXSubDocument
Definition: WPXSubDocument.h:37
WPX_LEFT
#define WPX_LEFT
Definition: libwpd_internal.h:160
WPXPageSpan::setMarginRight
void setMarginRight(const double marginRight)
Definition: WPXPageSpan.h:145
HEADER
@ HEADER
Definition: libwpd_internal.h:94
WPX_TOP
#define WPX_TOP
Definition: libwpd_internal.h:163
WP5StylesListener::lineSpacingChange
void lineSpacingChange(double) override
Definition: WP5StylesListener.h:67
WPX_SOFT_PAGE_BREAK
#define WPX_SOFT_PAGE_BREAK
Definition: libwpd_internal.h:156
WPX_PAGE_BREAK
#define WPX_PAGE_BREAK
Definition: libwpd_internal.h:155
libwpd_internal.h
WP5StylesListener::m_currentTable
std::shared_ptr< WPXTable > m_currentTable
Definition: WP5StylesListener.h:104
WP5Listener
Definition: WP5Listener.h:41
WPXNoteType
WPXNoteType
Definition: libwpd_internal.h:93
WP5_HEADER_FOOTER_GROUP_ALL_BIT
#define WP5_HEADER_FOOTER_GROUP_ALL_BIT
Definition: WP5FileStructure.h:100
WP5StylesListener::boxOff
void boxOff() override
Definition: WP5StylesListener.h:92
WP5StylesListener::WP5StylesListener
WP5StylesListener(std::list< WPXPageSpan > &pageList, WPXTableList tableList)
Definition: WP5StylesListener.cpp:35
WP5StylesListener::startSubDocument
void startSubDocument() override
Definition: WP5StylesListener.h:45
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
WP5StylesListener::m_pageListHardPageMark
std::list< WPXPageSpan >::iterator m_pageListHardPageMark
Definition: WP5StylesListener.h:108
ALL
@ ALL
Definition: libwpd_internal.h:96
WPXPageSpan::getMarginRight
double getMarginRight() const
Definition: WPXPageSpan.h:74
WPXPageSpan::setMarginLeft
void setMarginLeft(const double marginLeft)
Definition: WPXPageSpan.h:141
WP5StylesListener::m_currentPage
WPXPageSpan m_currentPage
Definition: WP5StylesListener.h:101
WP5StylesListener::insertIndent
void insertIndent(unsigned char, double) override
Definition: WP5StylesListener.h:56
WPX_SUBDOCUMENT_HEADER_FOOTER
@ WPX_SUBDOCUMENT_HEADER_FOOTER
Definition: libwpd_internal.h:111
WPX_NUM_WPUS_PER_INCH
#define WPX_NUM_WPUS_PER_INCH
Definition: WPXFileStructure.h:30
WPXTableList::add
void add(const std::shared_ptr< WPXTable > &table)
Definition: WPXTableList.h:44
WP5StylesListener::insertGraphicsData
void insertGraphicsData(const librevenge::RVNGBinaryData *) override
Definition: WP5StylesListener.h:93
WP5_HEADER_FOOTER_GROUP_FOOTER_B
#define WP5_HEADER_FOOTER_GROUP_FOOTER_B
Definition: WP5FileStructure.h:98
WPXPageSpan::setFormWidth
void setFormWidth(const double formWidth)
Definition: WPXPageSpan.h:133
WP5_PAGE_GROUP_SUPPRESS_FOOTER_A
#define WP5_PAGE_GROUP_SUPPRESS_FOOTER_A
Definition: WP5FileStructure.h:86
WPX_FOOTER_B
#define WPX_FOOTER_B
Definition: WPXFileStructure.h:45
EVEN
@ EVEN
Definition: libwpd_internal.h:96
WPXTableList
Definition: WPXTableList.h:36
WP5Listener.h
WPXListener::isUndoOn
bool isUndoOn()
Definition: WPXListener.h:40
WP5StylesListener::endSubDocument
void endSubDocument() override
Definition: WP5StylesListener.cpp:55
WP5SubDocument
Definition: WP5SubDocument.h:34
WP5StylesListener::WP5StylesListener
WP5StylesListener(const WP5StylesListener &)
WPX_BOTTOM
#define WPX_BOTTOM
Definition: libwpd_internal.h:164
WPXPageSpan::setMarginTop
void setMarginTop(const double marginTop)
Definition: WPXPageSpan.h:149
WP5StylesListener::setTabs
void setTabs(const std::vector< WPXTabStop > &, unsigned short) override
Definition: WP5StylesListener.h:47
WPXPageSpan
Definition: WPXPageSpan.h:43
WP5FileStructure.h
WP5_HEADER_FOOTER_GROUP_HEADER_B
#define WP5_HEADER_FOOTER_GROUP_HEADER_B
Definition: WP5FileStructure.h:96
WP5StylesListener::setFont
void setFont(const librevenge::RVNGString &, double) override
Definition: WP5StylesListener.h:46
WP5StylesListener::pageFormChange
void pageFormChange(unsigned short length, unsigned short width, WPXFormOrientation orientation) override
Definition: WP5StylesListener.cpp:135
WPXListener::m_pageList
std::list< WPXPageSpan > & m_pageList
Definition: WPXListener.h:49
WP5StylesListener::marginChange
void marginChange(unsigned char side, unsigned short margin) override
Definition: WP5StylesListener.cpp:151
WP5_HEADER_FOOTER_GROUP_ODD_BIT
#define WP5_HEADER_FOOTER_GROUP_ODD_BIT
Definition: WP5FileStructure.h:101
WPXPageSpan::getHeaderFooterList
const std::vector< WPXHeaderFooter > & getHeaderFooterList() const
Definition: WPXPageSpan.h:114
WP5_HEADER_FOOTER_GROUP_EVEN_BIT
#define WP5_HEADER_FOOTER_GROUP_EVEN_BIT
Definition: WP5FileStructure.h:102
ODD
@ ODD
Definition: libwpd_internal.h:96
WPXFileStructure.h
WP5StylesListener::addTableColumnDefinition
void addTableColumnDefinition(unsigned, unsigned, unsigned, unsigned, unsigned char) override
Definition: WP5StylesListener.h:76
WPXPageSpan::setFormLength
void setFormLength(const double formLength)
Definition: WPXPageSpan.h:129
WP5StylesListener::insertCell
void insertCell(unsigned char colSpan, unsigned char rowSpan, unsigned char borderBits, const RGBSColor *cellFgColor, const RGBSColor *cellBgColor, const RGBSColor *cellBorderColor, WPXVerticalAlignment cellVerticalAlignment, bool useCellAttributes, unsigned cellAttributes) override
Definition: WP5StylesListener.cpp:280
WPXStylesListener
Definition: WPXStylesListener.h:34
WP5StylesListener
Definition: WP5StylesListener.h:40
WP5StylesListener::insertRow
void insertRow(unsigned short rowHeight, bool isMinimumHeight, bool isHeaderRow) override
Definition: WP5StylesListener.cpp:269
WPXSubDocumentType
WPXSubDocumentType
Definition: libwpd_internal.h:111
WP5StylesListener::suppressPageCharacteristics
void suppressPageCharacteristics(unsigned char suppressCode) override
Definition: WP5StylesListener.cpp:243
WP5StylesListener::insertBreak
void insertBreak(unsigned char breakType) override
Definition: WP5StylesListener.cpp:60
WPX_HEADER_B
#define WPX_HEADER_B
Definition: WPXFileStructure.h:43
WP5SubDocument.h
WPXStylesListener.h
WP5StylesListener::insertEOL
void insertEOL() override
Definition: WP5StylesListener.h:61
WP5StylesListener::_handleSubDocument
void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice=0)
Definition: WP5StylesListener.cpp:294
WP5StylesListener::characterColorChange
void characterColorChange(unsigned char, unsigned char, unsigned char) override
Definition: WP5StylesListener.h:60
WP5StylesListener::pageMarginChange
void pageMarginChange(unsigned char side, unsigned short margin) override
Definition: WP5StylesListener.cpp:116
WPXHeaderFooterOccurrence
WPXHeaderFooterOccurrence
Definition: libwpd_internal.h:96
WP5StylesListener::endDocument
void endDocument() override
Definition: WP5StylesListener.cpp:50
WP5StylesListener.h
WP5StylesListener::operator=
WP5StylesListener & operator=(const WP5StylesListener &)
WP5StylesListener::startDocument
void startDocument() override
Definition: WP5StylesListener.h:44
WPXPageSpan::getMarginLeft
double getMarginLeft() const
Definition: WPXPageSpan.h:70
WP5StylesListener::insertNote
void insertNote(WPXNoteType, const WP5SubDocument *) override
Definition: WP5StylesListener.h:87
WP5_PAGE_GROUP_SUPPRESS_FOOTER_B
#define WP5_PAGE_GROUP_SUPPRESS_FOOTER_B
Definition: WP5FileStructure.h:87
WP5StylesListener::m_nextPage
WPXPageSpan m_nextPage
Definition: WP5StylesListener.h:101
WPXPageSpan::setFormOrientation
void setFormOrientation(const WPXFormOrientation formOrientation)
Definition: WPXPageSpan.h:137
ParseException
Definition: libwpd_internal.h:213
WPXHeaderFooterType
WPXHeaderFooterType
Definition: libwpd_internal.h:94
WP5StylesListener::defineTable
void defineTable(unsigned char, unsigned short) override
Definition: WP5StylesListener.h:75
WPXPageSpan::setHeadFooterSuppression
void setHeadFooterSuppression(const unsigned char headerFooterType, const bool suppress)
Definition: WPXPageSpan.h:125