- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

WP3ContentListener.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) 2005-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 WP3CONTENTLISTENER_H
28 #define WP3CONTENTLISTENER_H
29
30 #include "WP3Listener.h"
31 #include "WPXContentListener.h"
32 #include "WP3SubDocument.h"
33
34 struct WP3ContentParsingState
35 {
36 WP3ContentParsingState();
37 ~WP3ContentParsingState();
38 unsigned short m_colSpan;
39 unsigned short m_rowSpan;
40 librevenge::RVNGString m_textBuffer;
41 RGBSColor *m_cellFillColor;
42 librevenge::RVNGString m_noteReference;
43
44 WPXTableList m_tableList;
45 private:
46 WP3ContentParsingState(const WP3ContentParsingState &);
47 WP3ContentParsingState &operator=(const WP3ContentParsingState &);
48 };
49
50 class WP3ContentListener : public WP3Listener, protected WPXContentListener
51 {
52 public:
53 WP3ContentListener(std::list<WPXPageSpan> &pageList, std::vector<WP3SubDocument *> &subDocuments, librevenge::RVNGTextInterface *documentInterface);
54 ~WP3ContentListener();
55
56 void startDocument()
57 {
58 WPXContentListener::startDocument();
59 }
60 void startSubDocument()
61 {
62 WPXContentListener::startSubDocument();
63 }
64 void insertCharacter(unsigned character);
65 void insertTab();
66 void insertTab(unsigned char tabType, double tabPosition);
67 void insertBreak(unsigned char breakType)
68 {
69 WPXContentListener::insertBreak(breakType);
70 }
71 void insertEOL();
72 void attributeChange(bool isOn, unsigned char attribute);
73 void lineSpacingChange(double lineSpacing)
74 {
75 WPXContentListener::lineSpacingChange(lineSpacing);
76 }
77 void pageMarginChange(unsigned char /* side */, unsigned short /* margin */) {}
78 void pageFormChange(unsigned short /* length */, unsigned short /* width */, WPXFormOrientation /* orientation */) {}
79 void marginChange(unsigned char side, unsigned short margin);
80 void indentFirstLineChange(double offset);
81 void setTabs(bool isRelative, const std::vector<WPXTabStop> tabStops);
82 void columnChange(WPXTextColumnType columnType, unsigned char numColumns, const std::vector<double> &columnWidth,
83 const std::vector<bool> &isFixedWidth);
84 void endDocument()
85 {
86 WPXContentListener::endDocument();
87 }
88 void endSubDocument()
89 {
90 WPXContentListener::endSubDocument();
91 }
92
93 void defineTable(unsigned char position, unsigned short leftOffset);
94 void addTableColumnDefinition(unsigned width, unsigned leftGutter, unsigned rightGutter,
95 unsigned attributes, unsigned char alignment);
96 void startTable();
97 void insertRow();
98 void insertCell();
99 void closeCell();
100 void closeRow();
101 void setTableCellSpan(unsigned short colSpan, unsigned short rowSpan);
102 void setTableCellFillColor(const RGBSColor *cellFillColor);
103 void endTable();
104 void undoChange(unsigned char undoType, unsigned short undoLevel);
105 void justificationChange(unsigned char justification);
106 void setTextColor(const RGBSColor *fontColor);
107 void setTextFont(const librevenge::RVNGString &fontName);
108 void setFontSize(unsigned short fontSize);
109 void insertPageNumber(const librevenge::RVNGString &pageNumber);
110 void insertNoteReference(const librevenge::RVNGString &noteReference);
111 void insertNote(WPXNoteType noteType, const WP3SubDocument *subDocument);
112 void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP3SubDocument *subDocument);
113 void suppressPage(unsigned short /* suppressCode */) {}
114 void backTab();
115 void leftIndent();
116 void leftIndent(double offset);
117 void leftRightIndent();
118 void leftRightIndent(double offset);
119 void insertPicture(double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn,
120 unsigned short figureFlags, const librevenge::RVNGBinaryData &binaryData);
121 void insertTextBox(double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn,
122 unsigned short figureFlags, const WP3SubDocument *subDocument, const WP3SubDocument *caption);
123 void insertWP51Table(double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn,
124 unsigned short figureFlags, const WP3SubDocument *subDocument, const WP3SubDocument *caption);
125
126 protected:
127 void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0);
128 void _openParagraph();
129
130 void _flushText();
131 void _changeList() {}
132
133 void _handleFrameParameters(librevenge::RVNGPropertyList &propList, double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn,
134 unsigned short figureFlags);
135
136 private:
137 WP3ContentListener(const WP3ContentListener &);
138 WP3ContentListener &operator=(const WP3ContentListener &);
139 WP3ContentParsingState *m_parseState;
140 std::vector<WP3SubDocument *> &m_subDocuments;
141 };
142
143 #endif /* WP3CONTENTLISTENER_H */
144 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WP3Listener
Definition: WP3Listener.h:37
WP3SubDocument.h
WP3ContentParsingState::WP3ContentParsingState
WP3ContentParsingState()
Definition: WP3ContentListener.cpp:37
WPXContentListener::startSubDocument
void startSubDocument()
Definition: WPXContentListener.cpp:157
WPXContentListener::endDocument
void endDocument()
Definition: WPXContentListener.cpp:163
WP3ContentListener::startSubDocument
void startSubDocument()
Definition: WP3ContentListener.h:60
WPXTextColumnType
WPXTextColumnType
Definition: libwpd_internal.h:103
WP3ContentParsingState
Definition: WP3ContentListener.h:34
WP3ContentParsingState::m_textBuffer
librevenge::RVNGString m_textBuffer
Definition: WP3ContentListener.h:40
WP3ContentParsingState::m_noteReference
librevenge::RVNGString m_noteReference
Definition: WP3ContentListener.h:42
WPXContentListener::insertBreak
void insertBreak(const unsigned char breakType)
Definition: WPXContentListener.cpp:1247
WP3ContentListener::lineSpacingChange
void lineSpacingChange(double lineSpacing)
Definition: WP3ContentListener.h:73
WP3Listener.h
WPXSubDocumentType
WPXSubDocumentType
Definition: libwpd_internal.h:105
WP3ContentParsingState::~WP3ContentParsingState
~WP3ContentParsingState()
Definition: WP3ContentListener.cpp:47
WP3ContentListener::endSubDocument
void endSubDocument()
Definition: WP3ContentListener.h:88
WP3ContentListener::m_subDocuments
std::vector< WP3SubDocument * > & m_subDocuments
Definition: WP3ContentListener.h:140
WP3ContentListener::pageMarginChange
void pageMarginChange(unsigned char, unsigned short)
Definition: WP3ContentListener.h:77
WPXContentListener
Definition: WPXContentListener.h:145
WPXTableList
Definition: WPXTable.h:79
WPXContentListener.h
WP3ContentParsingState::m_colSpan
unsigned short m_colSpan
Definition: WP3ContentListener.h:38
WP3ContentListener::insertBreak
void insertBreak(unsigned char breakType)
Definition: WP3ContentListener.h:67
WP3ContentListener::startDocument
void startDocument()
Definition: WP3ContentListener.h:56
WP3ContentParsingState::m_cellFillColor
RGBSColor * m_cellFillColor
Definition: WP3ContentListener.h:41
WPXFormOrientation
WPXFormOrientation
Definition: libwpd_internal.h:99
WPXSubDocument
Definition: WPXSubDocument.h:34
WP3ContentListener::pageFormChange
void pageFormChange(unsigned short, unsigned short, WPXFormOrientation)
Definition: WP3ContentListener.h:78
WP3ContentListener
Definition: WP3ContentListener.h:50
WPXContentListener::endSubDocument
void endSubDocument()
Definition: WPXContentListener.cpp:184
RGBSColor
Definition: libwpd_internal.h:160
WP3ContentParsingState::m_tableList
WPXTableList m_tableList
Definition: WP3ContentListener.h:44
WP3ContentParsingState::operator=
WP3ContentParsingState & operator=(const WP3ContentParsingState &)
WP3ContentParsingState::m_rowSpan
unsigned short m_rowSpan
Definition: WP3ContentListener.h:39
WPXContentListener::startDocument
void startDocument()
Definition: WPXContentListener.cpp:142
WP3ContentListener::_changeList
void _changeList()
Definition: WP3ContentListener.h:131
WP3ContentListener::m_parseState
WP3ContentParsingState * m_parseState
Definition: WP3ContentListener.h:139
WPXContentListener::lineSpacingChange
void lineSpacingChange(const double lineSpacing)
Definition: WPXContentListener.cpp:1301
WP3SubDocument
Definition: WP3SubDocument.h:33
WP3ContentListener::suppressPage
void suppressPage(unsigned short)
Definition: WP3ContentListener.h:113
WP3ContentListener::endDocument
void endDocument()
Definition: WP3ContentListener.h:84
WPXNoteType
WPXNoteType
Definition: libwpd_internal.h:87