- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

WP5ContentListener.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) 2003 Marc Maurer (uwog@uwog.net)
12 * Copyright (C) 2005-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 WP5CONTENTLISTENER_H
29 #define WP5CONTENTLISTENER_H
30
31 #include "WP5Listener.h"
32 #include "WPXContentListener.h"
33 #include "WP5SubDocument.h"
34 #include "libwpd_internal.h"
35 #include <vector>
36
37 typedef struct _WP5ContentParsingState WP5ContentParsingState;
38 struct _WP5ContentParsingState
39 {
40 _WP5ContentParsingState();
41 ~_WP5ContentParsingState();
42 librevenge::RVNGString m_textBuffer;
43 librevenge::RVNGString m_noteReference;
44
45 WPXTableList m_tableList;
46
47 bool m_isFrameOpened;
48 };
49
50 class WP5ContentListener : public WP5Listener, protected WPXContentListener
51 {
52 public:
53 WP5ContentListener(std::list<WPXPageSpan> &pageList, std::vector<WP5SubDocument *> &subDocuments, librevenge::RVNGTextInterface *documentInterface);
54 ~WP5ContentListener();
55
56 void startDocument()
57 {
58 WPXContentListener::startDocument();
59 }
60 void startSubDocument()
61 {
62 WPXContentListener::startSubDocument();
63 }
64 void setFont(const librevenge::RVNGString &fontName, double fontSize);
65 void setTabs(const std::vector<WPXTabStop> &tabStops, unsigned short tabOffset);
66 void insertCharacter(unsigned character);
67 void insertTab(unsigned char tabType, double tabPosition);
68 void insertIndent(unsigned char indentType, double indentPosition);
69 void insertEOL();
70 void insertBreak(unsigned char breakType)
71 {
72 WPXContentListener::insertBreak(breakType);
73 }
74 void lineSpacingChange(double lineSpacing)
75 {
76 WPXContentListener::lineSpacingChange(lineSpacing);
77 }
78 void justificationChange(unsigned char justification)
79 {
80 WPXContentListener::justificationChange(justification);
81 }
82 void characterColorChange(unsigned char red, unsigned char green, unsigned char blue);
83 void attributeChange(bool isOn, unsigned char attribute);
84 void pageMarginChange(unsigned char /* side */, unsigned short /* margin */) {}
85 void pageFormChange(unsigned short /* length */, unsigned short /* width */, WPXFormOrientation /* orientation */) {}
86 void marginChange(unsigned char side, unsigned short margin);
87 void paragraphMarginChange(unsigned char /* side */, signed short /* margin */) {}
88 void endDocument()
89 {
90 WPXContentListener::endDocument();
91 }
92 void endSubDocument()
93 {
94 WPXContentListener::endSubDocument();
95 }
96
97 void defineTable(unsigned char position, unsigned short leftOffset);
98 void addTableColumnDefinition(unsigned width, unsigned leftGutter, unsigned rightGutter,
99 unsigned attributes, unsigned char alignment);
100 void startTable();
101 void insertRow(unsigned short rowHeight, bool isMinimumHeight, bool isHeaderRow);
102 void insertCell(unsigned char colSpan, unsigned char rowSpan, unsigned char borderBits,
103 const RGBSColor *cellFgColor, const RGBSColor *cellBgColor,
104 const RGBSColor *cellBorderColor, WPXVerticalAlignment cellVerticalAlignment,
105 bool useCellAttributes, unsigned cellAttributes);
106 void endTable();
107
108 void insertNoteReference(const librevenge::RVNGString &noteReference);
109 void insertNote(WPXNoteType noteType, const WP5SubDocument *subDocument);
110 void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP5SubDocument *subDocument);
111 void suppressPageCharacteristics(unsigned char /* suppressCode */) {}
112
113 void setDefaultFont(const librevenge::RVNGString &fontName, double fontSize);
114
115 void boxOn(unsigned char positionAndType, unsigned char alignment, unsigned short width, unsigned short height, unsigned short x, unsigned short y);
116 virtual void boxOff();
117 virtual void insertGraphicsData(const librevenge::RVNGBinaryData *data);
118
119 protected:
120 void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0);
121
122 void _flushText();
123 void _changeList() {}
124
125 private:
126 WP5ContentListener(const WP5ContentListener &);
127 WP5ContentListener &operator=(const WP5ContentListener &);
128 WP5ContentParsingState *m_parseState;
129 std::vector<WP5SubDocument *> &m_subDocuments;
130 double m_defaultFontSize;
131 librevenge::RVNGString m_defaultFontName;
132 };
133
134 #endif /* WP5CONTENTLISTENER_H */
135 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WP5ContentListener::insertNoteReference
void insertNoteReference(const librevenge::RVNGString &noteReference)
Definition: WP5ContentListener.cpp:518
WP5ContentListener::endSubDocument
void endSubDocument()
Definition: WP5ContentListener.h:92
WP5ContentListener::paragraphMarginChange
void paragraphMarginChange(unsigned char, signed short)
Definition: WP5ContentListener.h:87
WP5SubDocument
Definition: WP5SubDocument.h:33
_WP5ContentParsingState
Definition: WP5ContentListener.h:38
WP5ContentListener::m_subDocuments
std::vector< WP5SubDocument * > & m_subDocuments
Definition: WP5ContentListener.h:129
WP5SubDocument.h
WP5Listener
Definition: WP5Listener.h:39
WP5ContentListener::attributeChange
void attributeChange(bool isOn, unsigned char attribute)
Definition: WP5ContentListener.cpp:372
WP5ContentListener::startDocument
void startDocument()
Definition: WP5ContentListener.h:56
WPXContentListener::justificationChange
void justificationChange(const unsigned char justification)
Definition: WPXContentListener.cpp:1309
WPXContentListener::startSubDocument
void startSubDocument()
Definition: WPXContentListener.cpp:157
WPXContentListener::endDocument
void endDocument()
Definition: WPXContentListener.cpp:163
WP5ContentListener::startSubDocument
void startSubDocument()
Definition: WP5ContentListener.h:60
WP5ContentListener::insertBreak
void insertBreak(unsigned char breakType)
Definition: WP5ContentListener.h:70
WP5ContentListener::boxOff
virtual void boxOff()
Definition: WP5ContentListener.cpp:800
WPXContentListener::insertBreak
void insertBreak(const unsigned char breakType)
Definition: WPXContentListener.cpp:1247
libwpd_internal.h
WPXSubDocumentType
WPXSubDocumentType
Definition: libwpd_internal.h:111
WP5ContentListener::marginChange
void marginChange(unsigned char side, unsigned short margin)
Definition: WP5ContentListener.cpp:442
WP5ContentListener::justificationChange
void justificationChange(unsigned char justification)
Definition: WP5ContentListener.h:78
WP5ContentListener::~WP5ContentListener
~WP5ContentListener()
Definition: WP5ContentListener.cpp:56
WP5ContentListener::boxOn
void boxOn(unsigned char positionAndType, unsigned char alignment, unsigned short width, unsigned short height, unsigned short x, unsigned short y)
Definition: WP5ContentListener.cpp:610
_RGBSColor
Definition: libwpd_internal.h:167
WPXContentListener
Definition: WPXContentListener.h:147
WP5ContentListener::suppressPageCharacteristics
void suppressPageCharacteristics(unsigned char)
Definition: WP5ContentListener.h:111
_WP5ContentParsingState::m_isFrameOpened
bool m_isFrameOpened
Definition: WP5ContentListener.h:47
WPXTableList
Definition: WPXTable.h:81
WPXContentListener.h
WP5Listener.h
WP5ContentListener::pageFormChange
void pageFormChange(unsigned short, unsigned short, WPXFormOrientation)
Definition: WP5ContentListener.h:85
WP5ContentListener::insertRow
void insertRow(unsigned short rowHeight, bool isMinimumHeight, bool isHeaderRow)
Definition: WP5ContentListener.cpp:321
WP5ContentListener::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)
Definition: WP5ContentListener.cpp:331
WP5ContentListener::headerFooterGroup
void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, WP5SubDocument *subDocument)
Definition: WP5ContentListener.cpp:597
_WP5ContentParsingState::~_WP5ContentParsingState
~_WP5ContentParsingState()
Definition: WP5ContentListener.cpp:42
_WP5ContentParsingState::_WP5ContentParsingState
_WP5ContentParsingState()
Definition: WP5ContentListener.cpp:34
_WP5ContentParsingState::m_noteReference
librevenge::RVNGString m_noteReference
Definition: WP5ContentListener.h:43
WP5ContentListener::lineSpacingChange
void lineSpacingChange(double lineSpacing)
Definition: WP5ContentListener.h:74
_WP5ContentParsingState::m_tableList
WPXTableList m_tableList
Definition: WP5ContentListener.h:45
WPXFormOrientation
WPXFormOrientation
Definition: libwpd_internal.h:105
WPXSubDocument
Definition: WPXSubDocument.h:34
WPXVerticalAlignment
WPXVerticalAlignment
Definition: libwpd_internal.h:107
WP5ContentListener::insertNote
void insertNote(WPXNoteType noteType, const WP5SubDocument *subDocument)
Definition: WP5ContentListener.cpp:526
WP5ContentListener::_flushText
void _flushText()
Definition: WP5ContentListener.cpp:828
WP5ContentListener::_changeList
void _changeList()
Definition: WP5ContentListener.h:123
WP5ContentListener::m_defaultFontName
librevenge::RVNGString m_defaultFontName
Definition: WP5ContentListener.h:131
WP5ContentListener::characterColorChange
void characterColorChange(unsigned char red, unsigned char green, unsigned char blue)
Definition: WP5ContentListener.cpp:487
_WP5ContentParsingState::m_textBuffer
librevenge::RVNGString m_textBuffer
Definition: WP5ContentListener.h:42
WP5ContentListener::startTable
void startTable()
Definition: WP5ContentListener.cpp:300
WP5ContentListener::insertCharacter
void insertCharacter(unsigned character)
Definition: WP5ContentListener.cpp:66
WP5ContentListener::defineTable
void defineTable(unsigned char position, unsigned short leftOffset)
Definition: WP5ContentListener.cpp:240
WPXContentListener::endSubDocument
void endSubDocument()
Definition: WPXContentListener.cpp:184
WP5ContentListener::endDocument
void endDocument()
Definition: WP5ContentListener.h:88
WP5ContentListener::insertGraphicsData
virtual void insertGraphicsData(const librevenge::RVNGBinaryData *data)
Definition: WP5ContentListener.cpp:809
WP5ContentListener::setTabs
void setTabs(const std::vector< WPXTabStop > &tabStops, unsigned short tabOffset)
Definition: WP5ContentListener.cpp:508
WP5ContentListener::endTable
void endTable()
Definition: WP5ContentListener.cpp:354
WP5ContentListener::insertTab
void insertTab(unsigned char tabType, double tabPosition)
Definition: WP5ContentListener.cpp:74
WP5ContentListener::pageMarginChange
void pageMarginChange(unsigned char, unsigned short)
Definition: WP5ContentListener.h:84
WP5ContentListener::insertEOL
void insertEOL()
Definition: WP5ContentListener.cpp:227
WP5ContentListener::_handleSubDocument
void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice=0)
Definition: WP5ContentListener.cpp:560
WP5ContentListener::addTableColumnDefinition
void addTableColumnDefinition(unsigned width, unsigned leftGutter, unsigned rightGutter, unsigned attributes, unsigned char alignment)
Definition: WP5ContentListener.cpp:275
WP5ContentListener
Definition: WP5ContentListener.h:50
WPXContentListener::startDocument
void startDocument()
Definition: WPXContentListener.cpp:142
WP5ContentListener::operator=
WP5ContentListener & operator=(const WP5ContentListener &)
WPXContentListener::lineSpacingChange
void lineSpacingChange(const double lineSpacing)
Definition: WPXContentListener.cpp:1301
WP5ContentListener::m_parseState
WP5ContentParsingState * m_parseState
Definition: WP5ContentListener.h:128
WP5ContentListener::WP5ContentListener
WP5ContentListener(std::list< WPXPageSpan > &pageList, std::vector< WP5SubDocument * > &subDocuments, librevenge::RVNGTextInterface *documentInterface)
Definition: WP5ContentListener.cpp:46
WP5ContentListener::insertIndent
void insertIndent(unsigned char indentType, double indentPosition)
Definition: WP5ContentListener.cpp:169
WP5ContentListener::setDefaultFont
void setDefaultFont(const librevenge::RVNGString &fontName, double fontSize)
Definition: WP5ContentListener.cpp:604
WP5ContentListener::m_defaultFontSize
double m_defaultFontSize
Definition: WP5ContentListener.h:130
WP5ContentListener::setFont
void setFont(const librevenge::RVNGString &fontName, double fontSize)
Definition: WP5ContentListener.cpp:498
WPXNoteType
WPXNoteType
Definition: libwpd_internal.h:93