WPSContentListener Class Referencefinal

#include <WPSContentListener.h>

Inheritance diagram for WPSContentListener:
WPSListener

Public Types

enum  NoteType { FOOTNOTE , ENDNOTE }
 defines the footnote type More...
 

Public Member Functions

 WPSContentListener (std::vector< WPSPageSpan > const &pageList, librevenge::RVNGTextInterface *documentInterface)
 
 ~WPSContentListener () final
 
void setDocumentLanguage (int lcid) final
 
void setMetaData (const librevenge::RVNGPropertyList &list)
 
void startDocument ()
 
void endDocument ()
 
void handleSubDocument (WPSSubDocumentPtr &subDocument, libwps::SubDocumentType subDocumentType)
 
bool isHeaderFooterOpened () const
 
void insertCharacter (uint8_t character) final
 adds a basic character, ..
 
void insertUnicode (uint32_t character) final
 adds an unicode character
 
void insertUnicodeString (librevenge::RVNGString const &str) final
 adds a unicode string
 
void insertTab () final
 adds an unicode character to a string ( with correct encoding ).
 
void insertEOL (bool softBreak=false) final
 
void insertBreak (const uint8_t breakType) final
 
void setFont (const WPSFont &font) final
 set the actual font
 
WPSFont const & getFont () const final
 returns the actual font
 
bool isParagraphOpened () const final
 returns true if a paragraph or a list is opened
 
void setParagraph (const WPSParagraph &para) final
 sets the actual paragraph
 
WPSParagraph const & getParagraph () const final
 returns the actual paragraph
 
void setCurrentList (std::shared_ptr< WPSList > list)
 function to set the actual list
 
std::shared_ptr< WPSListgetCurrentList () const
 returns the current list
 
void insertField (WPSField const &field) final
 adds a field
 
void insertNote (const NoteType noteType, WPSSubDocumentPtr &subDocument)
 adds note
 
void insertLabelNote (const NoteType noteType, librevenge::RVNGString const &label, WPSSubDocumentPtr &subDocument)
 adds a label note
 
void insertComment (WPSSubDocumentPtr &subDocument)
 adds comment
 
void insertPicture (WPSPosition const &pos, const librevenge::RVNGBinaryData &binaryData, std::string const &type="image/pict", librevenge::RVNGPropertyList frameExtras=librevenge::RVNGPropertyList())
 adds a picture in given position
 
void insertObject (WPSPosition const &pos, const WPSEmbeddedObject &obj, librevenge::RVNGPropertyList frameExtras=librevenge::RVNGPropertyList())
 adds an object with replacement picture in given position
 
void insertTextBox (WPSPosition const &pos, WPSSubDocumentPtr subDocument, librevenge::RVNGPropertyList frameExtras=librevenge::RVNGPropertyList())
 adds a textbox in given position
 
bool openGroup (WPSPosition const &pos) final
 open a group
 
void closeGroup () final
 close a group
 
void openTable (std::vector< float > const &colWidth, librevenge::RVNGUnit unit)
 open a table
 
void closeTable ()
 closes this table
 
void openTableRow (float h, librevenge::RVNGUnit unit, bool headerRow=false)
 open a row with given height.
 
void closeTableRow ()
 closes this row
 
void openTableCell (WPSCell const &cell, librevenge::RVNGPropertyList const &extras=librevenge::RVNGPropertyList())
 low level function to define a cell.
 
void closeTableCell ()
 close a cell
 
void addEmptyTableCell (Vec2i const &pos, Vec2i span=Vec2i(1, 1))
 add empty cell
 
bool isSectionOpened () const
 returns true if a section is opened
 
int getSectionNumColumns () const
 returns the actual number of columns ( or 1 if no section is opened )
 
bool openSection (std::vector< int > colsWidth=std::vector< int >(), librevenge::RVNGUnit unit=librevenge::RVNG_INCH)
 open a section if possible
 
bool closeSection ()
 close a section
 
- Public Member Functions inherited from WPSListener
 WPSListener ()
 
virtual ~WPSListener ()
 

Protected Member Functions

void _openSection ()
 
void _closeSection ()
 
void _openPageSpan ()
 
void _closePageSpan ()
 
void _updatePageSpanDependent (bool set)
 
void _startSubDocument ()
 
void _endSubDocument ()
 
void _handleFrameParameters (librevenge::RVNGPropertyList &propList, WPSPosition const &pos)
 
bool _openFrame (WPSPosition const &pos, librevenge::RVNGPropertyList extras=librevenge::RVNGPropertyList())
 
void _closeFrame ()
 
void _openParagraph ()
 
void _closeParagraph ()
 
void _appendParagraphProperties (librevenge::RVNGPropertyList &propList, const bool isListElement=false)
 
void _resetParagraphState (const bool isListElement=false)
 
void _openListElement ()
 
void _closeListElement ()
 
void _changeList ()
 
void _openSpan ()
 
void _closeSpan ()
 
void _flushText ()
 
void _flushDeferredTabs ()
 
void _insertBreakIfNecessary (librevenge::RVNGPropertyList &propList)
 
std::shared_ptr< WPSContentParsingState_pushParsingState ()
 creates a new parsing state (copy of the actual state)
 
void _popParsingState ()
 resets the previous parsing state
 

Protected Attributes

std::shared_ptr< WPSDocumentParsingStatem_ds
 
std::shared_ptr< WPSContentParsingStatem_ps
 
std::vector< std::shared_ptr< WPSContentParsingState > > m_psStack
 
librevenge::RVNGTextInterface * m_documentInterface
 

Private Member Functions

 WPSContentListener (const WPSContentListener &)
 
WPSContentListeneroperator= (const WPSContentListener &)
 

Member Enumeration Documentation

◆ NoteType

defines the footnote type

Enumerator
FOOTNOTE 
ENDNOTE 

Constructor & Destructor Documentation

◆ WPSContentListener() [1/2]

WPSContentListener::WPSContentListener ( std::vector< WPSPageSpan > const & pageList,
librevenge::RVNGTextInterface * documentInterface )

◆ ~WPSContentListener()

WPSContentListener::~WPSContentListener ( )
final

◆ WPSContentListener() [2/2]

WPSContentListener::WPSContentListener ( const WPSContentListener & )
private

Member Function Documentation

◆ _appendParagraphProperties()

void WPSContentListener::_appendParagraphProperties ( librevenge::RVNGPropertyList & propList,
const bool isListElement = false )
protected

Referenced by _openListElement(), and _openParagraph().

◆ _changeList()

void WPSContentListener::_changeList ( )
protected

◆ _closeFrame()

void WPSContentListener::_closeFrame ( )
protected

◆ _closeListElement()

void WPSContentListener::_closeListElement ( )
protected

Referenced by _closeParagraph().

◆ _closePageSpan()

void WPSContentListener::_closePageSpan ( )
protected

◆ _closeParagraph()

void WPSContentListener::_closeParagraph ( )
protected

◆ _closeSection()

void WPSContentListener::_closeSection ( )
protected

◆ _closeSpan()

void WPSContentListener::_closeSpan ( )
protected

◆ _endSubDocument()

void WPSContentListener::_endSubDocument ( )
protected

◆ _flushDeferredTabs()

void WPSContentListener::_flushDeferredTabs ( )
protected

◆ _flushText()

void WPSContentListener::_flushText ( )
protected

◆ _handleFrameParameters()

void WPSContentListener::_handleFrameParameters ( librevenge::RVNGPropertyList & propList,
WPSPosition const & pos )
protected

Referenced by _openFrame(), and openGroup().

◆ _insertBreakIfNecessary()

void WPSContentListener::_insertBreakIfNecessary ( librevenge::RVNGPropertyList & propList)
protected

◆ _openFrame()

bool WPSContentListener::_openFrame ( WPSPosition const & pos,
librevenge::RVNGPropertyList extras = librevenge::RVNGPropertyList() )
protected

◆ _openListElement()

void WPSContentListener::_openListElement ( )
protected

Referenced by _openSpan().

◆ _openPageSpan()

void WPSContentListener::_openPageSpan ( )
protected

Referenced by _openSection().

◆ _openParagraph()

void WPSContentListener::_openParagraph ( )
protected

◆ _openSection()

void WPSContentListener::_openSection ( )
protected

◆ _openSpan()

◆ _popParsingState()

void WPSContentListener::_popParsingState ( )
protected

resets the previous parsing state

Referenced by closeGroup(), closeTable(), and handleSubDocument().

◆ _pushParsingState()

std::shared_ptr< WPSContentParsingState > WPSContentListener::_pushParsingState ( )
protected

creates a new parsing state (copy of the actual state)

Returns
the old one

Referenced by handleSubDocument(), openGroup(), and openTable().

◆ _resetParagraphState()

void WPSContentListener::_resetParagraphState ( const bool isListElement = false)
protected

Referenced by _openListElement(), and _openParagraph().

◆ _startSubDocument()

void WPSContentListener::_startSubDocument ( )
protected

◆ _updatePageSpanDependent()

void WPSContentListener::_updatePageSpanDependent ( bool set)
protected

◆ addEmptyTableCell()

void WPSContentListener::addEmptyTableCell ( Vec2i const & pos,
Vec2i span = Vec2i(1,1) )

add empty cell

◆ closeGroup()

void WPSContentListener::closeGroup ( )
finalvirtual

close a group

Implements WPSListener.

◆ closeSection()

bool WPSContentListener::closeSection ( )

close a section

◆ closeTable()

void WPSContentListener::closeTable ( )

closes this table

Referenced by _endSubDocument(), and endDocument().

◆ closeTableCell()

void WPSContentListener::closeTableCell ( )

close a cell

Referenced by addEmptyTableCell(), and openTableCell().

◆ closeTableRow()

void WPSContentListener::closeTableRow ( )

closes this row

◆ endDocument()

void WPSContentListener::endDocument ( )

◆ getCurrentList()

std::shared_ptr< WPSList > WPSContentListener::getCurrentList ( ) const

returns the current list

Referenced by setParagraph().

◆ getFont()

WPSFont const & WPSContentListener::getFont ( ) const
finalvirtual

returns the actual font

Implements WPSListener.

◆ getParagraph()

WPSParagraph const & WPSContentListener::getParagraph ( ) const
finalvirtual

returns the actual paragraph

Implements WPSListener.

◆ getSectionNumColumns()

int WPSContentListener::getSectionNumColumns ( ) const

returns the actual number of columns ( or 1 if no section is opened )

◆ handleSubDocument()

void WPSContentListener::handleSubDocument ( WPSSubDocumentPtr & subDocument,
libwps::SubDocumentType subDocumentType )

◆ insertBreak()

void WPSContentListener::insertBreak ( const uint8_t breakType)
finalvirtual

Implements WPSListener.

◆ insertCharacter()

void WPSContentListener::insertCharacter ( uint8_t character)
finalvirtual

adds a basic character, ..

Implements WPSListener.

◆ insertComment()

void WPSContentListener::insertComment ( WPSSubDocumentPtr & subDocument)

adds comment

◆ insertEOL()

void WPSContentListener::insertEOL ( bool softBreak = false)
finalvirtual

Implements WPSListener.

◆ insertField()

void WPSContentListener::insertField ( WPSField const & field)
finalvirtual

adds a field

Implements WPSListener.

◆ insertLabelNote()

void WPSContentListener::insertLabelNote ( const NoteType noteType,
librevenge::RVNGString const & label,
WPSSubDocumentPtr & subDocument )

adds a label note

Must not happen excepted in corrupted document, so we do the minimum. Note that we have no choice, either we begin by closing the paragraph, ... or we reprogram handleSubDocument.

Referenced by insertNote().

◆ insertNote()

void WPSContentListener::insertNote ( const NoteType noteType,
WPSSubDocumentPtr & subDocument )

adds note

◆ insertObject()

void WPSContentListener::insertObject ( WPSPosition const & pos,
const WPSEmbeddedObject & obj,
librevenge::RVNGPropertyList frameExtras = librevenge::RVNGPropertyList() )

adds an object with replacement picture in given position

◆ insertPicture()

void WPSContentListener::insertPicture ( WPSPosition const & pos,
const librevenge::RVNGBinaryData & binaryData,
std::string const & type = "image/pict",
librevenge::RVNGPropertyList frameExtras = librevenge::RVNGPropertyList() )

adds a picture in given position

◆ insertTab()

void WPSContentListener::insertTab ( )
finalvirtual

adds an unicode character to a string ( with correct encoding ).

Implements WPSListener.

◆ insertTextBox()

void WPSContentListener::insertTextBox ( WPSPosition const & pos,
WPSSubDocumentPtr subDocument,
librevenge::RVNGPropertyList frameExtras = librevenge::RVNGPropertyList() )

adds a textbox in given position

◆ insertUnicode()

void WPSContentListener::insertUnicode ( uint32_t character)
finalvirtual

adds an unicode character

by convention if character=0xfffd(undef), no character is added

Implements WPSListener.

Referenced by insertCharacter().

◆ insertUnicodeString()

void WPSContentListener::insertUnicodeString ( librevenge::RVNGString const & str)
finalvirtual

adds a unicode string

Implements WPSListener.

Referenced by insertField().

◆ isHeaderFooterOpened()

bool WPSContentListener::isHeaderFooterOpened ( ) const

◆ isParagraphOpened()

bool WPSContentListener::isParagraphOpened ( ) const
finalvirtual

returns true if a paragraph or a list is opened

Implements WPSListener.

◆ isSectionOpened()

bool WPSContentListener::isSectionOpened ( ) const

returns true if a section is opened

◆ openGroup()

bool WPSContentListener::openGroup ( WPSPosition const & pos)
finalvirtual

open a group

Implements WPSListener.

◆ openSection()

bool WPSContentListener::openSection ( std::vector< int > colsWidth = std::vector<int>(),
librevenge::RVNGUnit unit = librevenge::RVNG_INCH )

open a section if possible

◆ openTable()

void WPSContentListener::openTable ( std::vector< float > const & colWidth,
librevenge::RVNGUnit unit )

open a table

◆ openTableCell()

void WPSContentListener::openTableCell ( WPSCell const & cell,
librevenge::RVNGPropertyList const & extras = librevenge::RVNGPropertyList() )

low level function to define a cell.

Parameters
cellthe cell position, alignement, ...
extrasto be used to pass extra data, for instance spreadsheet data

Referenced by WPS8TableInternal::Cell::send(), and XYWriteParserInternal::Cell::send().

◆ openTableRow()

void WPSContentListener::openTableRow ( float h,
librevenge::RVNGUnit unit,
bool headerRow = false )

open a row with given height.

If h<0, use min-row-heigth

◆ operator=()

WPSContentListener & WPSContentListener::operator= ( const WPSContentListener & )
private

◆ setCurrentList()

void WPSContentListener::setCurrentList ( std::shared_ptr< WPSList > list)

function to set the actual list

Referenced by setParagraph().

◆ setDocumentLanguage()

void WPSContentListener::setDocumentLanguage ( int lcid)
finalvirtual

Implements WPSListener.

◆ setFont()

void WPSContentListener::setFont ( const WPSFont & font)
finalvirtual

set the actual font

Implements WPSListener.

◆ setMetaData()

void WPSContentListener::setMetaData ( const librevenge::RVNGPropertyList & list)

◆ setParagraph()

void WPSContentListener::setParagraph ( const WPSParagraph & para)
finalvirtual

sets the actual paragraph

Implements WPSListener.

◆ startDocument()

void WPSContentListener::startDocument ( )

Referenced by _openPageSpan().

Member Data Documentation

◆ m_documentInterface

◆ m_ds

◆ m_ps

◆ m_psStack

std::vector<std::shared_ptr<WPSContentParsingState> > WPSContentListener::m_psStack
protected

The documentation for this class was generated from the following files:

Generated on Thu Jul 18 2024 00:00:00 for libwps by doxygen 1.12.0