WP3ContentListener.h
Go to the documentation of this file.
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* libwpd
* Version: MPL 2.0 / LGPLv2.1+
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Major Contributor(s):
* Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2005-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms
* of the GNU Lesser General Public License Version 2.1 or later
* (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
* applicable instead of those above.
*
* For further information visit http://libwpd.sourceforge.net
*/
/* "This product is not manufactured, approved, or supported by
* Corel Corporation or Corel Corporation Limited."
*/
#ifndef WP3CONTENTLISTENER_H
#define WP3CONTENTLISTENER_H
#include <memory>
#include "WP3Listener.h"
#include "WPXContentListener.h"
#include "WP3SubDocument.h"
struct WP3ContentParsingState
{
WP3ContentParsingState();
~WP3ContentParsingState();
unsigned short m_colSpan;
unsigned short m_rowSpan;
librevenge::RVNGString m_textBuffer;
std::unique_ptr<RGBSColor> m_cellFillColor;
librevenge::RVNGString m_noteReference;
WPXTableList m_tableList;
private:
WP3ContentParsingState(const WP3ContentParsingState &);
WP3ContentParsingState &operator=(const WP3ContentParsingState &);
};
class WP3ContentListener : public WP3Listener, protected WPXContentListener
{
public:
WP3ContentListener(std::list<WPXPageSpan> &pageList, librevenge::RVNGTextInterface *documentInterface);
~WP3ContentListener() override;
void startDocument() override
{
WPXContentListener::startDocument();
}
void startSubDocument() override
{
WPXContentListener::startSubDocument();
}
void insertCharacter(unsigned character) override;
void insertTab() override;
void insertTab(unsigned char tabType, double tabPosition) override;
void insertBreak(unsigned char breakType) override
{
WPXContentListener::insertBreak(breakType);
}
void insertEOL() override;
void attributeChange(bool isOn, unsigned char attribute) override;
void lineSpacingChange(double lineSpacing) override
{
WPXContentListener::lineSpacingChange(lineSpacing);
}
void pageMarginChange(unsigned char /* side */, unsigned short /* margin */) override {}
void pageFormChange(unsigned short /* length */, unsigned short /* width */, WPXFormOrientation /* orientation */) override {}
void marginChange(unsigned char side, unsigned short margin) override;
void indentFirstLineChange(double offset) override;
void setTabs(bool isRelative, const std::vector<WPXTabStop> tabStops) override;
void columnChange(WPXTextColumnType columnType, unsigned char numColumns, const std::vector<double> &columnWidth,
const std::vector<bool> &isFixedWidth) override;
void endDocument() override
{
WPXContentListener::endDocument();
}
void endSubDocument() override
{
WPXContentListener::endSubDocument();
}
void defineTable(unsigned char position, unsigned short leftOffset) override;
void addTableColumnDefinition(unsigned width, unsigned leftGutter, unsigned rightGutter,
unsigned attributes, unsigned char alignment) override;
void startTable() override;
void insertRow();
void insertCell();
void closeCell() override;
void closeRow() override;
void setTableCellSpan(unsigned short colSpan, unsigned short rowSpan) override;
void setTableCellFillColor(const RGBSColor *cellFillColor) override;
void endTable() override;
void undoChange(unsigned char undoType, unsigned short undoLevel) override;
void justificationChange(unsigned char justification) override;
void setTextColor(const RGBSColor *fontColor) override;
void setTextFont(const librevenge::RVNGString &fontName) override;
void setFontSize(unsigned short fontSize) override;
void insertPageNumber(const librevenge::RVNGString &pageNumber) override;
void insertNoteReference(const librevenge::RVNGString &noteReference) override;
void insertNote(WPXNoteType noteType, const WP3SubDocument *subDocument) override;
void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, const std::shared_ptr<WP3SubDocument> &subDocument) override;
void suppressPage(unsigned short /* suppressCode */) override {}
void backTab() override;
void leftIndent() override;
void leftIndent(double offset) override;
void leftRightIndent() override;
void leftRightIndent(double offset) override;
void insertPicture(double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn,
unsigned short figureFlags, const librevenge::RVNGBinaryData &binaryData) override;
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) override;
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) override;
protected:
void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0) override;
void _openParagraph() override;
void _flushText() override;
void _changeList() override {}
void _handleFrameParameters(librevenge::RVNGPropertyList &propList, double height, double width, double verticalOffset, double horizontalOffset, unsigned char leftColumn, unsigned char rightColumn,
unsigned short figureFlags);
private:
WP3ContentListener(const WP3ContentListener &);
WP3ContentListener &operator=(const WP3ContentListener &);
std::unique_ptr<WP3ContentParsingState> m_parseState;
};
#endif /* WP3CONTENTLISTENER_H */
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WP3Listener.h
WP3SubDocument.h
WPXContentListener.h
WP3ContentListener::attributeChange
void attributeChange(bool isOn, unsigned char attribute) override
Definition WP3ContentListener.cpp:313
WP3ContentListener::insertBreak
void insertBreak(unsigned char breakType) override
Definition WP3ContentListener.h:69
WP3ContentListener::startTable
void startTable() override
Definition WP3ContentListener.cpp:217
WP3ContentListener::setFontSize
void setFontSize(unsigned short fontSize) override
Definition WP3ContentListener.cpp:588
WP3ContentListener::indentFirstLineChange
void indentFirstLineChange(double offset) override
Definition WP3ContentListener.cpp:467
WP3ContentListener::insertRow
void insertRow()
Definition WP3ContentListener.cpp:238
WP3ContentListener::~WP3ContentListener
~WP3ContentListener() override
Definition WP3ContentListener.cpp:58
WP3ContentListener::setTextFont
void setTextFont(const librevenge::RVNGString &fontName) override
Definition WP3ContentListener.cpp:578
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) override
Definition WP3ContentListener.cpp:839
WP3ContentListener::addTableColumnDefinition
void addTableColumnDefinition(unsigned width, unsigned leftGutter, unsigned rightGutter, unsigned attributes, unsigned char alignment) override
Definition WP3ContentListener.cpp:192
WP3ContentListener::defineTable
void defineTable(unsigned char position, unsigned short leftOffset) override
Definition WP3ContentListener.cpp:157
WP3ContentListener::closeRow
void closeRow() override
Definition WP3ContentListener.cpp:272
WP3ContentListener::setTableCellFillColor
void setTableCellFillColor(const RGBSColor *cellFillColor) override
Definition WP3ContentListener.cpp:291
WP3ContentListener::closeCell
void closeCell() override
Definition WP3ContentListener.cpp:261
WP3ContentListener::m_parseState
std::unique_ptr< WP3ContentParsingState > m_parseState
Definition WP3ContentListener.h:141
WP3ContentListener::_flushText
void _flushText() override
Definition WP3ContentListener.cpp:1180
WP3ContentListener::suppressPage
void suppressPage(unsigned short) override
Definition WP3ContentListener.h:115
WP3ContentListener::justificationChange
void justificationChange(unsigned char justification) override
Definition WP3ContentListener.cpp:437
WP3ContentListener::insertNote
void insertNote(WPXNoteType noteType, const WP3SubDocument *subDocument) override
Definition WP3ContentListener.cpp:616
WP3ContentListener::insertTab
void insertTab() override
Definition WP3ContentListener.cpp:78
WP3ContentListener::startSubDocument
void startSubDocument() override
Definition WP3ContentListener.h:62
WP3ContentListener::insertCell
void insertCell()
Definition WP3ContentListener.cpp:244
WP3ContentListener::WP3ContentListener
WP3ContentListener(const WP3ContentListener &)
WP3ContentListener::setTableCellSpan
void setTableCellSpan(unsigned short colSpan, unsigned short rowSpan) override
Definition WP3ContentListener.cpp:282
WP3ContentListener::endTable
void endTable() override
Definition WP3ContentListener.cpp:297
WP3ContentListener::insertNoteReference
void insertNoteReference(const librevenge::RVNGString &noteReference) override
Definition WP3ContentListener.cpp:608
WP3ContentListener::backTab
void backTab() override
Definition WP3ContentListener.cpp:650
WP3ContentListener::leftRightIndent
void leftRightIndent() override
Definition WP3ContentListener.cpp:726
WP3ContentListener::headerFooterGroup
void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, const std::shared_ptr< WP3SubDocument > &subDocument) override
Definition WP3ContentListener.cpp:1155
WP3ContentListener::undoChange
void undoChange(unsigned char undoType, unsigned short undoLevel) override
Definition WP3ContentListener.cpp:384
WP3ContentListener::leftIndent
void leftIndent() override
Definition WP3ContentListener.cpp:670
WP3ContentListener::pageFormChange
void pageFormChange(unsigned short, unsigned short, WPXFormOrientation) override
Definition WP3ContentListener.h:80
WP3ContentListener::lineSpacingChange
void lineSpacingChange(double lineSpacing) override
Definition WP3ContentListener.h:75
WP3ContentListener::startDocument
void startDocument() override
Definition WP3ContentListener.h:58
WP3ContentListener::marginChange
void marginChange(unsigned char side, unsigned short margin) override
Definition WP3ContentListener.cpp:392
WP3ContentListener::WP3ContentListener
WP3ContentListener(std::list< WPXPageSpan > &pageList, librevenge::RVNGTextInterface *documentInterface)
Definition WP3ContentListener.cpp:51
WP3ContentListener::_handleSubDocument
void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice=0) override
Definition WP3ContentListener.cpp:1110
WP3ContentListener::endDocument
void endDocument() override
Definition WP3ContentListener.h:86
WP3ContentListener::setTextColor
void setTextColor(const RGBSColor *fontColor) override
Definition WP3ContentListener.cpp:568
WP3ContentListener::insertEOL
void insertEOL() override
Definition WP3ContentListener.cpp:132
WP3ContentListener::operator=
WP3ContentListener & operator=(const WP3ContentListener &)
WP3ContentListener::insertCharacter
void insertCharacter(unsigned character) override
Definition WP3ContentListener.cpp:67
WP3ContentListener::_changeList
void _changeList() override
Definition WP3ContentListener.h:133
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:872
WP3ContentListener::columnChange
void columnChange(WPXTextColumnType columnType, unsigned char numColumns, const std::vector< double > &columnWidth, const std::vector< bool > &isFixedWidth) override
Definition WP3ContentListener.cpp:490
WP3ContentListener::endSubDocument
void endSubDocument() override
Definition WP3ContentListener.h:90
WP3ContentListener::_openParagraph
void _openParagraph() override
Definition WP3ContentListener.cpp:1159
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) override
Definition WP3ContentListener.cpp:807
WP3ContentListener::setTabs
void setTabs(bool isRelative, const std::vector< WPXTabStop > tabStops) override
Definition WP3ContentListener.cpp:481
WP3ContentListener::insertPageNumber
void insertPageNumber(const librevenge::RVNGString &pageNumber) override
Definition WP3ContentListener.cpp:598
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) override
Definition WP3ContentListener.cpp:786
WP3ContentListener::pageMarginChange
void pageMarginChange(unsigned char, unsigned short) override
Definition WP3ContentListener.h:79
WP3Listener::WP3Listener
WP3Listener()
Definition WP3Listener.cpp:30
WP3SubDocument
Definition WP3SubDocument.h:34
WPXContentListener::lineSpacingChange
void lineSpacingChange(const double lineSpacing)
Definition WPXContentListener.cpp:1296
WPXContentListener::endSubDocument
void endSubDocument()
Definition WPXContentListener.cpp:180
WPXContentListener::endDocument
void endDocument()
Definition WPXContentListener.cpp:159
WPXContentListener::insertBreak
void insertBreak(const unsigned char breakType)
Definition WPXContentListener.cpp:1242
WPXContentListener::startSubDocument
void startSubDocument()
Definition WPXContentListener.cpp:153
WPXContentListener::WPXContentListener
WPXContentListener(std::list< WPXPageSpan > &pageList, librevenge::RVNGTextInterface *documentInterface)
Definition WPXContentListener.cpp:126
WPXContentListener::startDocument
void startDocument()
Definition WPXContentListener.cpp:138
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
WP3ContentParsingState::m_cellFillColor
std::unique_ptr< RGBSColor > m_cellFillColor
Definition WP3ContentListener.h:43
WP3ContentParsingState::WP3ContentParsingState
WP3ContentParsingState(const WP3ContentParsingState &)
WP3ContentParsingState::operator=
WP3ContentParsingState & operator=(const WP3ContentParsingState &)
WP3ContentParsingState::m_rowSpan
unsigned short m_rowSpan
Definition WP3ContentListener.h:41
WP3ContentParsingState::m_colSpan
unsigned short m_colSpan
Definition WP3ContentListener.h:40
WP3ContentParsingState::m_noteReference
librevenge::RVNGString m_noteReference
Definition WP3ContentListener.h:44
WP3ContentParsingState::~WP3ContentParsingState
~WP3ContentParsingState()
Definition WP3ContentListener.cpp:47
WP3ContentParsingState::m_tableList
WPXTableList m_tableList
Definition WP3ContentListener.h:46
WP3ContentParsingState::m_textBuffer
librevenge::RVNGString m_textBuffer
Definition WP3ContentListener.h:42
WP3ContentParsingState::WP3ContentParsingState
WP3ContentParsingState()
Definition WP3ContentListener.cpp:37