WP3ContentListener.h Source File documentation

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