WPSContentListener Class Reference documentation

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
WPSContentListener Class Referencefinal

`#include <WPSContentListener.h>`

Inheritance diagram for WPSContentListener:

## 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< WPSList > | getCurrentList () 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 ()
virtual void | setDocumentLanguage (int lcid)=0
virtual void | insertCharacter (uint8_t character)=0
| adds a basic character, ..
virtual void | insertUnicode (uint32_t character)=0
| adds an unicode character
virtual void | insertUnicodeString (librevenge::RVNGString const &str)=0
| adds a unicode string
virtual void | insertTab ()=0
| adds an unicode character to a string ( with correct encoding ).
virtual void | insertEOL (bool softBreak=false)=0
virtual void | insertBreak (const uint8_t breakType)=0
virtual void | setFont (const WPSFont &font)=0
| set the actual font
virtual WPSFont const & | getFont () const =0
| returns the actual font
virtual bool | isParagraphOpened () const =0
| returns true if a paragraph or a list is opened
virtual void | setParagraph (const WPSParagraph &para)=0
| sets the actual paragraph
virtual WPSParagraph const & | getParagraph () const =0
| returns the actual paragraph
virtual bool | openGroup (WPSPosition const &pos)=0
| open a group
virtual void | closeGroup ()=0
| close a group
virtual void | insertField (WPSField const &field)=0
| adds a field

## 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< WPSDocumentParsingState > | m_ds
std::shared_ptr< WPSContentParsingState > | m_ps
std::vector< std::shared_ptr< WPSContentParsingState > > | m_psStack
librevenge::RVNGTextInterface * | m_documentInterface

## Private Member Functions
| WPSContentListener (const WPSContentListener &)
WPSContentListener & | operator= (const WPSContentListener &)

## Member Enumeration Documentation

## ◆ NoteType

enum WPSContentListener::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

Referenced by _closeSection(), _endSubDocument(), _openSpan(), closeTableCell(), endDocument(), and insertLabelNote().

## ◆ _closeFrame()

void WPSContentListener::_closeFrame | ( |  | ) |
| protected

Referenced by insertObject(), insertPicture(), and insertTextBox().

## ◆ _closeListElement()

void WPSContentListener::_closeListElement | ( |  | ) |
| protected

Referenced by _closeParagraph().

## ◆ _closePageSpan()

void WPSContentListener::_closePageSpan | ( |  | ) |
| protected

Referenced by _closeListElement(), _closeParagraph(), endDocument(), and insertBreak().

## ◆ _closeParagraph()

void WPSContentListener::_closeParagraph | ( |  | ) |
| protected

Referenced by _changeList(), _closeSection(), _endSubDocument(), closeTableCell(), endDocument(), insertBreak(), insertEOL(), insertLabelNote(), and openTable().

## ◆ _closeSection()

void WPSContentListener::_closeSection | ( |  | ) |
| protected

Referenced by _closePageSpan(), _openListElement(), _openParagraph(), closeSection(), endDocument(), and handleSubDocument().

## ◆ _closeSpan()

void WPSContentListener::_closeSpan | ( |  | ) |
| protected

Referenced by _closeListElement(), _closeParagraph(), _flushDeferredTabs(), insertComment(), insertLabelNote(), and setFont().

## ◆ _endSubDocument()

void WPSContentListener::_endSubDocument | ( |  | ) |
| protected

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

## ◆ _flushDeferredTabs()

void WPSContentListener::_flushDeferredTabs | ( |  | ) |
| protected

Referenced by insertCharacter(), insertEOL(), insertTab(), insertUnicode(), and insertUnicodeString().

## ◆ _flushText()

void WPSContentListener::_flushText | ( |  | ) |
| protected

Referenced by _closeSpan(), _openFrame(), insertComment(), insertEOL(), insertField(), insertLabelNote(), insertTab(), and openGroup().

## ◆ _handleFrameParameters()

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

Referenced by _openFrame(), and openGroup().

## ◆ _insertBreakIfNecessary()

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

Referenced by _appendParagraphProperties().

## ◆ _openFrame()

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

Referenced by insertObject(), insertPicture(), and insertTextBox().

## ◆ _openListElement()

void WPSContentListener::_openListElement | ( |  | ) |
| protected

Referenced by _openSpan().

## ◆ _openPageSpan()

void WPSContentListener::_openPageSpan | ( |  | ) |
| protected

Referenced by _openSection().

## ◆ _openParagraph()

void WPSContentListener::_openParagraph | ( |  | ) |
| protected

Referenced by _openFrame(), _openSpan(), insertComment(), insertLabelNote(), and openGroup().

## ◆ _openSection()

void WPSContentListener::_openSection | ( |  | ) |
| protected

Referenced by _changeList(), _openListElement(), _openParagraph(), and openSection().

## ◆ _openSpan()

void WPSContentListener::_openSpan | ( |  | ) |
| protected

Referenced by _flushDeferredTabs(), _openFrame(), endDocument(), handleSubDocument(), insertBreak(), insertCharacter(), insertEOL(), insertField(), insertUnicode(), insertUnicodeString(), and openGroup().

## ◆ _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

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

## ◆ _updatePageSpanDependent()

void WPSContentListener::_updatePageSpanDependent | ( | bool | set | ) |
| protected

Referenced by _openPageSpan(), and WPSContentListener().

## ◆ 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
| ) |  |

Referenced by insertComment(), insertLabelNote(), insertTextBox(), and WPSPageSpan::sendHeaderFooters().

## ◆ 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

  cell | the cell position, alignement, ...
  extras | to be used to pass extra data, for instance spreadsheet data

## ◆ 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

librevenge::RVNGTextInterface* WPSContentListener::m_documentInterface
| protected

Referenced by _changeList(), _closeFrame(), _closeListElement(), _closePageSpan(), _closeParagraph(), _closeSection(), _closeSpan(), _flushDeferredTabs(), _flushText(), _openFrame(), _openListElement(), _openPageSpan(), _openParagraph(), _openSection(), _openSpan(), addEmptyTableCell(), closeGroup(), closeTable(), closeTableCell(), closeTableRow(), endDocument(), insertComment(), insertEOL(), insertField(), insertLabelNote(), insertObject(), insertPicture(), insertTextBox(), openGroup(), openTable(), openTableCell(), openTableRow(), and startDocument().

## ◆ m_ds

std::shared_ptr<WPSDocumentParsingState> WPSContentListener::m_ds
| protected

Referenced by _appendParagraphProperties(), _changeList(), _openPageSpan(), _startSubDocument(), endDocument(), handleSubDocument(), insertLabelNote(), isHeaderFooterOpened(), openGroup(), setCurrentList(), setDocumentLanguage(), setMetaData(), and startDocument().

## ◆ m_ps

std::shared_ptr<WPSContentParsingState> WPSContentListener::m_ps
| protected

Referenced by _appendParagraphProperties(), _changeList(), _closeFrame(), _closeListElement(), _closePageSpan(), _closeParagraph(), _closeSection(), _closeSpan(), _endSubDocument(), _flushDeferredTabs(), _flushText(), _handleFrameParameters(), _insertBreakIfNecessary(), _openFrame(), _openListElement(), _openPageSpan(), _openParagraph(), _openSection(), _openSpan(), _popParsingState(), _pushParsingState(), _resetParagraphState(), _startSubDocument(), addEmptyTableCell(), closeGroup(), closeSection(), closeTable(), closeTableCell(), closeTableRow(), endDocument(), getCurrentList(), getFont(), getParagraph(), getSectionNumColumns(), handleSubDocument(), insertBreak(), insertCharacter(), insertComment(), insertEOL(), insertLabelNote(), insertNote(), insertTab(), insertUnicode(), insertUnicodeString(), isParagraphOpened(), isSectionOpened(), openGroup(), openSection(), openTable(), openTableCell(), openTableRow(), setCurrentList(), setFont(), and setParagraph().

## ◆ m_psStack

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

Referenced by _popParsingState(), and _pushParsingState().

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

- WPSContentListener.h
- WPSContentListener.cpp