WP5ContentListener.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) 2003 William Lachance (wrlach@gmail.com)
* Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2005-2007 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 WP5CONTENTLISTENER_H
#define WP5CONTENTLISTENER_H
#include "WP5Listener.h"
#include "WPXContentListener.h"
#include "WP5SubDocument.h"
#include "libwpd_internal.h"
#include <memory>
struct WP5ContentParsingState
{
WP5ContentParsingState();
~WP5ContentParsingState();
librevenge::RVNGString m_textBuffer;
librevenge::RVNGString m_noteReference;
WPXTableList m_tableList;
bool m_isFrameOpened;
};
class WP5ContentListener : public WP5Listener, protected WPXContentListener
{
public:
WP5ContentListener(std::list<WPXPageSpan> &pageList, librevenge::RVNGTextInterface *documentInterface);
~WP5ContentListener() override;
void startDocument() override
{
WPXContentListener::startDocument();
}
void startSubDocument() override
{
WPXContentListener::startSubDocument();
}
void setFont(const librevenge::RVNGString &fontName, double fontSize) override;
void setTabs(const std::vector<WPXTabStop> &tabStops, unsigned short tabOffset) override;
void insertCharacter(unsigned character) override;
void insertTab(unsigned char tabType, double tabPosition) override;
void insertIndent(unsigned char indentType, double indentPosition) override;
void insertEOL() override;
void insertBreak(unsigned char breakType) override
{
WPXContentListener::insertBreak(breakType);
}
void lineSpacingChange(double lineSpacing) override
{
WPXContentListener::lineSpacingChange(lineSpacing);
}
void justificationChange(unsigned char justification) override
{
WPXContentListener::justificationChange(justification);
}
void characterColorChange(unsigned char red, unsigned char green, unsigned char blue) override;
void attributeChange(bool isOn, unsigned char attribute) override;
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 paragraphMarginChange(unsigned char /* side */, signed short /* margin */) {}
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(unsigned short rowHeight, bool isMinimumHeight, bool isHeaderRow) override;
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) override;
void endTable() override;
void insertNoteReference(const librevenge::RVNGString &noteReference) override;
void insertNote(WPXNoteType noteType, const WP5SubDocument *subDocument) override;
void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, const std::shared_ptr<WP5SubDocument> &subDocument) override;
void suppressPageCharacteristics(unsigned char /* suppressCode */) override {}
void setDefaultFont(const librevenge::RVNGString &fontName, double fontSize);
void boxOn(unsigned char positionAndType, unsigned char alignment, unsigned short width, unsigned short height, unsigned short x, unsigned short y) override;
void boxOff() override;
void insertGraphicsData(const librevenge::RVNGBinaryData *data) override;
protected:
void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice = 0) override;
void _flushText() override;
void _changeList() override {}
private:
WP5ContentListener(const WP5ContentListener &);
WP5ContentListener &operator=(const WP5ContentListener &);
std::unique_ptr<WP5ContentParsingState> m_parseState;
double m_defaultFontSize;
librevenge::RVNGString m_defaultFontName;
};
#endif /* WP5CONTENTLISTENER_H */
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WP5Listener.h
WP5SubDocument.h
WPXContentListener.h
WP5ContentListener::setTabs
void setTabs(const std::vector< WPXTabStop > &tabStops, unsigned short tabOffset) override
Definition WP5ContentListener.cpp:506
WP5ContentListener::m_defaultFontSize
double m_defaultFontSize
Definition WP5ContentListener.h:128
WP5ContentListener::suppressPageCharacteristics
void suppressPageCharacteristics(unsigned char) override
Definition WP5ContentListener.h:110
WP5ContentListener::startTable
void startTable() override
Definition WP5ContentListener.cpp:298
WP5ContentListener::insertEOL
void insertEOL() override
Definition WP5ContentListener.cpp:225
WP5ContentListener::boxOn
void boxOn(unsigned char positionAndType, unsigned char alignment, unsigned short width, unsigned short height, unsigned short x, unsigned short y) override
Definition WP5ContentListener.cpp:605
WP5ContentListener::marginChange
void marginChange(unsigned char side, unsigned short margin) override
Definition WP5ContentListener.cpp:440
WP5ContentListener::addTableColumnDefinition
void addTableColumnDefinition(unsigned width, unsigned leftGutter, unsigned rightGutter, unsigned attributes, unsigned char alignment) override
Definition WP5ContentListener.cpp:273
WP5ContentListener::attributeChange
void attributeChange(bool isOn, unsigned char attribute) override
Definition WP5ContentListener.cpp:370
WP5ContentListener::endDocument
void endDocument() override
Definition WP5ContentListener.h:87
WP5ContentListener::insertNoteReference
void insertNoteReference(const librevenge::RVNGString &noteReference) override
Definition WP5ContentListener.cpp:516
WP5ContentListener::startDocument
void startDocument() override
Definition WP5ContentListener.h:55
WP5ContentListener::insertTab
void insertTab(unsigned char tabType, double tabPosition) override
Definition WP5ContentListener.cpp:72
WP5ContentListener::defineTable
void defineTable(unsigned char position, unsigned short leftOffset) override
Definition WP5ContentListener.cpp:238
WP5ContentListener::insertNote
void insertNote(WPXNoteType noteType, const WP5SubDocument *subDocument) override
Definition WP5ContentListener.cpp:524
WP5ContentListener::setDefaultFont
void setDefaultFont(const librevenge::RVNGString &fontName, double fontSize)
Definition WP5ContentListener.cpp:599
WP5ContentListener::insertRow
void insertRow(unsigned short rowHeight, bool isMinimumHeight, bool isHeaderRow) override
Definition WP5ContentListener.cpp:319
WP5ContentListener::_changeList
void _changeList() override
Definition WP5ContentListener.h:122
WP5ContentListener::m_parseState
std::unique_ptr< WP5ContentParsingState > m_parseState
Definition WP5ContentListener.h:127
WP5ContentListener::~WP5ContentListener
~WP5ContentListener() override
Definition WP5ContentListener.cpp:55
WP5ContentListener::headerFooterGroup
void headerFooterGroup(unsigned char headerFooterType, unsigned char occurrenceBits, const std::shared_ptr< WP5SubDocument > &subDocument) override
Definition WP5ContentListener.cpp:594
WP5ContentListener::paragraphMarginChange
void paragraphMarginChange(unsigned char, signed short)
Definition WP5ContentListener.h:86
WP5ContentListener::setFont
void setFont(const librevenge::RVNGString &fontName, double fontSize) override
Definition WP5ContentListener.cpp:496
WP5ContentListener::justificationChange
void justificationChange(unsigned char justification) override
Definition WP5ContentListener.h:77
WP5ContentListener::insertCharacter
void insertCharacter(unsigned character) override
Definition WP5ContentListener.cpp:64
WP5ContentListener::m_defaultFontName
librevenge::RVNGString m_defaultFontName
Definition WP5ContentListener.h:129
WP5ContentListener::characterColorChange
void characterColorChange(unsigned char red, unsigned char green, unsigned char blue) override
Definition WP5ContentListener.cpp:485
WP5ContentListener::_handleSubDocument
void _handleSubDocument(const WPXSubDocument *subDocument, WPXSubDocumentType subDocumentType, WPXTableList tableList, unsigned nextTableIndice=0) override
Definition WP5ContentListener.cpp:558
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) override
Definition WP5ContentListener.cpp:329
WP5ContentListener::endSubDocument
void endSubDocument() override
Definition WP5ContentListener.h:91
WP5ContentListener::insertIndent
void insertIndent(unsigned char indentType, double indentPosition) override
Definition WP5ContentListener.cpp:167
WP5ContentListener::_flushText
void _flushText() override
Definition WP5ContentListener.cpp:823
WP5ContentListener::WP5ContentListener
WP5ContentListener(std::list< WPXPageSpan > &pageList, librevenge::RVNGTextInterface *documentInterface)
Definition WP5ContentListener.cpp:46
WP5ContentListener::pageFormChange
void pageFormChange(unsigned short, unsigned short, WPXFormOrientation) override
Definition WP5ContentListener.h:84
WP5ContentListener::operator=
WP5ContentListener & operator=(const WP5ContentListener &)
WP5ContentListener::pageMarginChange
void pageMarginChange(unsigned char, unsigned short) override
Definition WP5ContentListener.h:83
WP5ContentListener::insertGraphicsData
void insertGraphicsData(const librevenge::RVNGBinaryData *data) override
Definition WP5ContentListener.cpp:804
WP5ContentListener::boxOff
void boxOff() override
Definition WP5ContentListener.cpp:795
WP5ContentListener::lineSpacingChange
void lineSpacingChange(double lineSpacing) override
Definition WP5ContentListener.h:73
WP5ContentListener::endTable
void endTable() override
Definition WP5ContentListener.cpp:352
WP5ContentListener::startSubDocument
void startSubDocument() override
Definition WP5ContentListener.h:59
WP5ContentListener::WP5ContentListener
WP5ContentListener(const WP5ContentListener &)
WP5ContentListener::insertBreak
void insertBreak(unsigned char breakType) override
Definition WP5ContentListener.h:69
WP5Listener::WP5Listener
WP5Listener()
Definition WP5Listener.cpp:34
WP5SubDocument
Definition WP5SubDocument.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::justificationChange
void justificationChange(const unsigned char justification)
Definition WPXContentListener.cpp:1304
WPXContentListener::startDocument
void startDocument()
Definition WPXContentListener.cpp:138
WPXSubDocument
Definition WPXSubDocument.h:37
WPXTableList
Definition WPXTableList.h:36
libwpd_internal.h
WPXFormOrientation
WPXFormOrientation
Definition libwpd_internal.h:105
WPXSubDocumentType
WPXSubDocumentType
Definition libwpd_internal.h:111
WPXVerticalAlignment
WPXVerticalAlignment
Definition libwpd_internal.h:107
WPXNoteType
WPXNoteType
Definition libwpd_internal.h:93
RGBSColor
Definition libwpd_internal.h:167
WP5ContentParsingState::m_isFrameOpened
bool m_isFrameOpened
Definition WP5ContentListener.h:46
WP5ContentParsingState::WP5ContentParsingState
WP5ContentParsingState()
Definition WP5ContentListener.cpp:34
WP5ContentParsingState::m_noteReference
librevenge::RVNGString m_noteReference
Definition WP5ContentListener.h:42
WP5ContentParsingState::~WP5ContentParsingState
~WP5ContentParsingState()
Definition WP5ContentListener.cpp:42
WP5ContentParsingState::m_textBuffer
librevenge::RVNGString m_textBuffer
Definition WP5ContentListener.h:41
WP5ContentParsingState::m_tableList
WPXTableList m_tableList
Definition WP5ContentListener.h:44