WP3StylesListener.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) 2004 Marc Maurer (uwog@uwog.net)
11 * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
12 *
13 * For minor contributions see the git repository.
14 *
15 * Alternatively, the contents of this file may be used under the terms
16 * of the GNU Lesser General Public License Version 2.1 or later
17 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
18 * applicable instead of those above.
19 *
20 * For further information visit http://libwpd.sourceforge.net
21 */
22
23 /* "This product is not manufactured, approved, or supported by
24 * Corel Corporation or Corel Corporation Limited."
25 */
26
27 #ifndef WP3STYLESLISTENER_H
28 #define WP3STYLESLISTENER_H
29
30 #include "WP3Listener.h"
31 #include "WPXStylesListener.h"
32 #include "WPXPageSpan.h"
33 #include "WPXTable.h"
34 #include "WPXTableList.h"
35
36 class WP3StylesListener : public WP3Listener, protected WPXStylesListener
37 {
38 public:
39 WP3StylesListener(std::list<WPXPageSpan> &pageList, WPXTableList tableList);
40
41 void startDocument() override {}
42 void startSubDocument() override {}
43 void insertCharacter(unsigned /* character */) override
44 {
45 if (!isUndoOn()) m_currentPageHasContent = true;
46 }
47 void insertTab() override
48 {
49 if (!isUndoOn()) m_currentPageHasContent = true;
50 }
51 void insertTab(unsigned char /* tabType */, double /* tabPosition */) override
52 {
53 if (!isUndoOn()) m_currentPageHasContent = true;
54 }
55 void insertEOL() override
56 {
57 if (!isUndoOn()) m_currentPageHasContent = true;
58 }
59 void insertBreak(unsigned char breakType) override;
60 void attributeChange(bool /* isOn */, unsigned char /* attribute */) override {}
61 void lineSpacingChange(double /* lineSpacing */) override {}
62 void justificationChange(unsigned char /* justification */) override {}
63 void pageMarginChange(unsigned char side, unsigned short margin) override;
64 void pageFormChange(unsigned short length, unsigned short width, WPXFormOrientation orientation) override;
65 void marginChange(unsigned char side, unsigned short margin) override;
66 void indentFirstLineChange(double /* offset */) override {}
67 void setTabs(bool /* isRelative */, const std::vector<WPXTabStop> /* tabStops */) override {}
68 void columnChange(WPXTextColumnType /* columnType */, unsigned char /* numColumns */,
69 const std::vector<double> & /* columnWidth */, const std::vector<bool> & /* isFixedWidth */) override {}
70 void endDocument() override;
71 void endSubDocument() override;
72
73 void defineTable(unsigned char /* position */, unsigned short /* leftOffset */) override {}
74 void addTableColumnDefinition(unsigned /* width */, unsigned /* leftGutter */, unsigned /* rightGutter */,
75 unsigned /* attributes */, unsigned char /* alignment */) override {}
76 void startTable() override;
77 void closeCell() override {}
78 void closeRow() override {}
79 void setTableCellSpan(unsigned short /* colSpan */, unsigned short /* rowSpan */) override {}
80 void setTableCellFillColor(const RGBSColor * /* cellFillColor */) override {}
81 void endTable() override {}
82 void undoChange(unsigned char undoType, unsigned short undoLevel) override;
83 void setTextColor(const RGBSColor * /* fontColor */) override {}
84 void setTextFont(const librevenge::RVNGString & /* fontName */) override {}
85 void setFontSize(unsigned short /* fontSize */) override {}
86 void insertPageNumber(const librevenge::RVNGString & /* pageNumber */) override {}
87 void insertNoteReference(const librevenge::RVNGString & /* noteReference */) override {}
88 void insertNote(WPXNoteType /* noteType */, const WP3SubDocument * /* subDocument */) override
89 {
90 if (!isUndoOn()) m_currentPageHasContent = true;
91 }
92 void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, const std::shared_ptr<WP3SubDocument> &subDocument) override;
93 void suppressPage(unsigned short suppressCode) override;
94 void backTab() override
95 {
96 if (!isUndoOn()) m_currentPageHasContent = true;
97 }
98 void leftIndent() override {}
99 void leftIndent(double /* offset */) override {}
100 void leftRightIndent() override {}
101 void leftRightIndent(double /* offset */) override {}
102 void insertPicture(double /* height */, double /* width */, double /* verticalOffset */, double /* horizontalOffset */, unsigned char /* leftColumn */, unsigned char /* rightColumn */,
103 unsigned short /* figureFlags */, const librevenge::RVNGBinaryData & /* binaryData */) override {}
104 void insertTextBox(double /* height */, double /* width */, double /* verticalOffset */, double /* horizontalOffset */, unsigned char /* leftColumn */, unsigned char /* rightColumn */,
105 unsigned short /* figureFlags */, const WP3SubDocument * /* subDocument */, const WP3SubDocument * /* caption */) override {}
106 void insertWP51Table(double /* height */, double /* width */, double /* verticalOffset */, double /* horizontalOffset */, unsigned char /* leftColumn */, unsigned char /* rightColumn */,
107 unsigned short /* figureFlags */, const WP3SubDocument * /* subDocument */, const WP3SubDocument * /* caption */) override {}
108
109 protected:
110 void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice = 0);
111
112 private:
113 WP3StylesListener(const WP3StylesListener &);
114 WP3StylesListener &operator=(const WP3StylesListener &);
115 WPXPageSpan m_currentPage;
116
117 WPXTableList m_tableList;
118 std::shared_ptr<WPXTable> m_currentTable;
119 double m_tempMarginLeft, m_tempMarginRight;
120 bool m_currentPageHasContent;
121 bool m_isSubDocument;
122 std::list<WPXPageSpan>::iterator m_pageListHardPageMark;
123 };
124
125 #endif /* WP3STYLESLISTENER_H */
126 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WP3Listener.h
WPXPageSpan.h
WPXStylesListener.h
WPXTableList.h
WPXTable.h
WP3Listener
Definition: WP3Listener.h:39
WP3StylesListener
Definition: WP3StylesListener.h:37
WP3StylesListener::insertCharacter
void insertCharacter(unsigned) override
Definition: WP3StylesListener.h:43
WP3StylesListener::closeRow
void closeRow() override
Definition: WP3StylesListener.h:78
WP3StylesListener::setFontSize
void setFontSize(unsigned short) override
Definition: WP3StylesListener.h:85
WP3StylesListener::backTab
void backTab() override
Definition: WP3StylesListener.h:94
WP3StylesListener::insertNote
void insertNote(WPXNoteType, const WP3SubDocument *) override
Definition: WP3StylesListener.h:88
WP3StylesListener::startSubDocument
void startSubDocument() override
Definition: WP3StylesListener.h:42
WP3StylesListener::endTable
void endTable() override
Definition: WP3StylesListener.h:81
WP3StylesListener::undoChange
void undoChange(unsigned char undoType, unsigned short undoLevel) override
Definition: WP3StylesListener.cpp:101
WP3StylesListener::insertEOL
void insertEOL() override
Definition: WP3StylesListener.h:55
WP3StylesListener::leftIndent
void leftIndent(double) override
Definition: WP3StylesListener.h:99
WP3StylesListener::setTableCellSpan
void setTableCellSpan(unsigned short, unsigned short) override
Definition: WP3StylesListener.h:79
WP3StylesListener::_handleSubDocument
void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, int nextTableIndice=0)
Definition: WP3StylesListener.cpp:254
WP3StylesListener::m_tempMarginLeft
double m_tempMarginLeft
Definition: WP3StylesListener.h:119
WP3StylesListener::lineSpacingChange
void lineSpacingChange(double) override
Definition: WP3StylesListener.h:61
WP3StylesListener::m_currentPageHasContent
bool m_currentPageHasContent
Definition: WP3StylesListener.h:120
WP3StylesListener::m_isSubDocument
bool m_isSubDocument
Definition: WP3StylesListener.h:121
WP3StylesListener::headerFooterGroup
void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, const std::shared_ptr< WP3SubDocument > &subDocument) override
Definition: WP3StylesListener.cpp:192
WP3StylesListener::insertBreak
void insertBreak(unsigned char breakType) override
Definition: WP3StylesListener.cpp:61
WP3StylesListener::operator=
WP3StylesListener & operator=(const WP3StylesListener &)
WP3StylesListener::leftIndent
void leftIndent() override
Definition: WP3StylesListener.h:98
WP3StylesListener::setTabs
void setTabs(bool, const std::vector< WPXTabStop >) override
Definition: WP3StylesListener.h:67
WP3StylesListener::startTable
void startTable() override
Definition: WP3StylesListener.cpp:244
WP3StylesListener::endDocument
void endDocument() override
Definition: WP3StylesListener.cpp:49
WP3StylesListener::closeCell
void closeCell() override
Definition: WP3StylesListener.h:77
WP3StylesListener::m_tableList
WPXTableList m_tableList
Definition: WP3StylesListener.h:117
WP3StylesListener::leftRightIndent
void leftRightIndent(double) override
Definition: WP3StylesListener.h:101
WP3StylesListener::m_currentTable
std::shared_ptr< WPXTable > m_currentTable
Definition: WP3StylesListener.h:118
WP3StylesListener::marginChange
void marginChange(unsigned char side, unsigned short margin) override
Definition: WP3StylesListener.cpp:131
WP3StylesListener::insertPageNumber
void insertPageNumber(const librevenge::RVNGString &) override
Definition: WP3StylesListener.h:86
WP3StylesListener::m_pageListHardPageMark
std::list< WPXPageSpan >::iterator m_pageListHardPageMark
Definition: WP3StylesListener.h:122
WP3StylesListener::insertTab
void insertTab(unsigned char, double) override
Definition: WP3StylesListener.h:51
WP3StylesListener::insertWP51Table
void insertWP51Table(double, double, double, double, unsigned char, unsigned char, unsigned short, const WP3SubDocument *, const WP3SubDocument *) override
Definition: WP3StylesListener.h:106
WP3StylesListener::attributeChange
void attributeChange(bool, unsigned char) override
Definition: WP3StylesListener.h:60
WP3StylesListener::defineTable
void defineTable(unsigned char, unsigned short) override
Definition: WP3StylesListener.h:73
WP3StylesListener::startDocument
void startDocument() override
Definition: WP3StylesListener.h:41
WP3StylesListener::indentFirstLineChange
void indentFirstLineChange(double) override
Definition: WP3StylesListener.h:66
WP3StylesListener::insertTextBox
void insertTextBox(double, double, double, double, unsigned char, unsigned char, unsigned short, const WP3SubDocument *, const WP3SubDocument *) override
Definition: WP3StylesListener.h:104
WP3StylesListener::insertNoteReference
void insertNoteReference(const librevenge::RVNGString &) override
Definition: WP3StylesListener.h:87
WP3StylesListener::insertTab
void insertTab() override
Definition: WP3StylesListener.h:47
WP3StylesListener::pageFormChange
void pageFormChange(unsigned short length, unsigned short width, WPXFormOrientation orientation) override
Definition: WP3StylesListener.cpp:177
WP3StylesListener::suppressPage
void suppressPage(unsigned short suppressCode) override
Definition: WP3StylesListener.cpp:228
WP3StylesListener::addTableColumnDefinition
void addTableColumnDefinition(unsigned, unsigned, unsigned, unsigned, unsigned char) override
Definition: WP3StylesListener.h:74
WP3StylesListener::setTextFont
void setTextFont(const librevenge::RVNGString &) override
Definition: WP3StylesListener.h:84
WP3StylesListener::endSubDocument
void endSubDocument() override
Definition: WP3StylesListener.cpp:55
WP3StylesListener::insertPicture
void insertPicture(double, double, double, double, unsigned char, unsigned char, unsigned short, const librevenge::RVNGBinaryData &) override
Definition: WP3StylesListener.h:102
WP3StylesListener::WP3StylesListener
WP3StylesListener(std::list< WPXPageSpan > &pageList, WPXTableList tableList)
Definition: WP3StylesListener.cpp:34
WP3StylesListener::columnChange
void columnChange(WPXTextColumnType, unsigned char, const std::vector< double > &, const std::vector< bool > &) override
Definition: WP3StylesListener.h:68
WP3StylesListener::setTableCellFillColor
void setTableCellFillColor(const RGBSColor *) override
Definition: WP3StylesListener.h:80
WP3StylesListener::WP3StylesListener
WP3StylesListener(const WP3StylesListener &)
WP3StylesListener::m_tempMarginRight
double m_tempMarginRight
Definition: WP3StylesListener.h:119
WP3StylesListener::m_currentPage
WPXPageSpan m_currentPage
Definition: WP3StylesListener.h:115
WP3StylesListener::leftRightIndent
void leftRightIndent() override
Definition: WP3StylesListener.h:100
WP3StylesListener::setTextColor
void setTextColor(const RGBSColor *) override
Definition: WP3StylesListener.h:83
WP3StylesListener::pageMarginChange
void pageMarginChange(unsigned char side, unsigned short margin) override
Definition: WP3StylesListener.cpp:112
WP3StylesListener::justificationChange
void justificationChange(unsigned char) override
Definition: WP3StylesListener.h:62
WP3SubDocument
Definition: WP3SubDocument.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
WPXFormOrientation
WPXFormOrientation
Definition: libwpd_internal.h:105
WPXTextColumnType
WPXTextColumnType
Definition: libwpd_internal.h:109
WPXSubDocumentType
WPXSubDocumentType
Definition: libwpd_internal.h:111
WPXNoteType
WPXNoteType
Definition: libwpd_internal.h:93
RGBSColor
Definition: libwpd_internal.h:167