WPSContentListener Class Reference documentation

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

`#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)
virtual | ~WPSContentListener ()
void | setDocumentLanguage (int lcid)
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)
| adds a basic character, .. More...
void | insertUnicode (uint32_t character)
| adds an unicode character More...
void | insertUnicodeString (librevenge::RVNGString const &str)
| adds a unicode string More...
void | insertTab ()
| adds an unicode character to a string ( with correct encoding ). More...
void | insertEOL (bool softBreak=false)
void | insertBreak (const uint8_t breakType)
void | setFont (const WPSFont &font)
| set the actual font More...
WPSFont const & | getFont () const
| returns the actual font More...
bool | isParagraphOpened () const
| returns true if a paragraph or a list is opened More...
void | setParagraph (const WPSParagraph &para)
| sets the actual paragraph More...
WPSParagraph const & | getParagraph () const
| returns the actual paragraph More...
void | setCurrentList (shared_ptr< WPSList > list)
| function to set the actual list More...
shared_ptr< WPSList > | getCurrentList () const
| returns the current list More...
void | insertField (WPSField const &field)
| adds a field More...
void | insertNote (const NoteType noteType, WPSSubDocumentPtr &subDocument)
| adds note More...
void | insertLabelNote (const NoteType noteType, librevenge::RVNGString const &label, WPSSubDocumentPtr &subDocument)
| adds a label note More...
void | insertComment (WPSSubDocumentPtr &subDocument)
| adds comment More...
void | insertPicture (WPSPosition const &pos, const librevenge::RVNGBinaryData &binaryData, std::string type="image/pict", librevenge::RVNGPropertyList frameExtras=librevenge::RVNGPropertyList())
| adds a picture in given position More...
void | insertObject (WPSPosition const &pos, const WPSEmbeddedObject &obj, librevenge::RVNGPropertyList frameExtras=librevenge::RVNGPropertyList())
| adds an object with replacement picture in given position More...
void | insertTextBox (WPSPosition const &pos, WPSSubDocumentPtr subDocument, librevenge::RVNGPropertyList frameExtras=librevenge::RVNGPropertyList())
| adds a textbox in given position More...
void | openTable (std::vector< float > const &colWidth, librevenge::RVNGUnit unit)
| open a table More...
void | closeTable ()
| closes this table More...
void | openTableRow (float h, librevenge::RVNGUnit unit, bool headerRow=false)
| open a row with given height. More...
void | closeTableRow ()
| closes this row More...
void | openTableCell (WPSCell const &cell, librevenge::RVNGPropertyList const &extras=librevenge::RVNGPropertyList())
| low level function to define a cell. More...
void | closeTableCell ()
| close a cell More...
void | addEmptyTableCell (Vec2i const &pos, Vec2i span=Vec2i(1, 1))
| add empty cell More...
bool | isSectionOpened () const
| returns true if a section is opened More...
int | getSectionNumColumns () const
| returns the actual number of columns ( or 1 if no section is opened ) More...
bool | openSection (std::vector< int > colsWidth=std::vector< int >(), librevenge::RVNGUnit unit=librevenge::RVNG_INCH)
| open a section if possible More...
bool | closeSection ()
| close a section More...
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)
shared_ptr< WPSContentParsingState > | _pushParsingState ()
| creates a new parsing state (copy of the actual state) More...
void | _popParsingState ()
| resets the previous parsing state More...

## Protected Attributes
shared_ptr< WPSDocumentParsingState > | m_ds
shared_ptr< WPSContentParsingState > | m_ps
std::vector< shared_ptr< WPSContentParsingState > > | m_psStack
librevenge::RVNGTextInterface * | m_documentInterface

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

## Member Enumeration Documentation

enum WPSContentListener::NoteType

defines the footnote type

Enumerator
FOOTNOTE |
ENDNOTE |

## Constructor & Destructor Documentation

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

WPSContentListener::~WPSContentListener | ( |  | ) |
| virtual

WPSContentListener::WPSContentListener | ( | const WPSContentListener & |  | ) |
| private

## Member Function Documentation

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

Referenced by _openListElement(), _openParagraph(), and _resetParagraphState().

void WPSContentListener::_changeList | ( |  | ) |
| protected

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

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

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

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

Referenced by _closeParagraph().

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

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

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

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

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

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

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

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

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

Referenced by closeTable(), and handleSubDocument().

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

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

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

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

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

Referenced by _closeFrame(), and _openFrame().

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

Referenced by _appendParagraphProperties().

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

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

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

Referenced by _openSpan().

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

Referenced by _openSection().

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

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

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

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

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

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

void WPSContentListener::_popParsingState | ( |  | ) |
| protected

resets the previous parsing state

Referenced by closeTable(), and handleSubDocument().

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

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

Returns
  the old one

Referenced by handleSubDocument(), and openTable().

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

Referenced by _openListElement(), and _openParagraph().

void WPSContentListener::_startSubDocument | ( |  | ) |
| protected

Referenced by handleSubDocument(), and openTable().

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

Referenced by _openPageSpan(), and WPSContentListener().

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

add empty cell

bool WPSContentListener::closeSection | ( |  | ) |

close a section

void WPSContentListener::closeTable | ( |  | ) |

closes this table

Referenced by _endSubDocument(), and endDocument().

void WPSContentListener::closeTableCell | ( |  | ) |

close a cell

Referenced by addEmptyTableCell(), openTableCell(), and WPS8TableInternal::Cell::send().

void WPSContentListener::closeTableRow | ( |  | ) |

closes this row

void WPSContentListener::endDocument | ( |  | ) |

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

returns the current list

Referenced by setParagraph().

WPSFont const & WPSContentListener::getFont | ( |  | ) | const
| virtual

returns the actual font

Implements WPSListener.

WPSParagraph const & WPSContentListener::getParagraph | ( |  | ) | const
| virtual

returns the actual paragraph

Implements WPSListener.

int WPSContentListener::getSectionNumColumns | ( |  | ) | const

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

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

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

void WPSContentListener::insertBreak | ( | const uint8_t | breakType | ) |
| virtual

Implements WPSListener.

void WPSContentListener::insertCharacter | ( | uint8_t | character | ) |
| virtual

adds a basic character, ..

Implements WPSListener.

void WPSContentListener::insertComment | ( | WPSSubDocumentPtr & | subDocument | ) |

adds comment

void WPSContentListener::insertEOL | ( | bool | softBreak = `false` | ) |
| virtual

Implements WPSListener.

void WPSContentListener::insertField | ( | WPSField const & | field | ) |
| virtual

adds a field

Implements WPSListener.

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().

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

adds note

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

adds an object with replacement picture in given position

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

adds a picture in given position

Referenced by insertTextBox().

void WPSContentListener::insertTab | ( |  | ) |
| virtual

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

Implements WPSListener.

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

adds a textbox in given position

Referenced by insertComment().

void WPSContentListener::insertUnicode | ( | uint32_t | character | ) |
| virtual

adds an unicode character

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

Implements WPSListener.

Referenced by insertCharacter().

void WPSContentListener::insertUnicodeString | ( | librevenge::RVNGString const & | str | ) |
| virtual

adds a unicode string

Implements WPSListener.

Referenced by insertField().

bool WPSContentListener::isHeaderFooterOpened | ( |  | ) | const

bool WPSContentListener::isParagraphOpened | ( |  | ) | const
| virtual

returns true if a paragraph or a list is opened

Implements WPSListener.

bool WPSContentListener::isSectionOpened | ( |  | ) | const

returns true if a section is opened

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

open a section if possible

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

open a table

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

Referenced by WPS8TableInternal::Cell::send().

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

open a row with given height.

If h<0, use min-row-heigth

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

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

function to set the actual list

Referenced by setParagraph().

void WPSContentListener::setDocumentLanguage | ( | int | lcid | ) |
| virtual

Implements WPSListener.

void WPSContentListener::setFont | ( | const WPSFont & | font | ) |
| virtual

set the actual font

Implements WPSListener.

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

void WPSContentListener::setParagraph | ( | const WPSParagraph & | para | ) |
| virtual

sets the actual paragraph

Implements WPSListener.

void WPSContentListener::startDocument | ( |  | ) |

Referenced by _openPageSpan().

## Member Data Documentation

librevenge::RVNGTextInterface* WPSContentListener::m_documentInterface
| protected

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

shared_ptr<WPSDocumentParsingState> WPSContentListener::m_ds
| protected

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

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(), closeSection(), closeTable(), closeTableCell(), closeTableRow(), endDocument(), getCurrentList(), getFont(), getParagraph(), getSectionNumColumns(), handleSubDocument(), insertBreak(), insertCharacter(), insertComment(), insertEOL(), insertLabelNote(), insertNote(), insertTab(), insertUnicode(), insertUnicodeString(), isParagraphOpened(), isSectionOpened(), openSection(), openTable(), openTableCell(), openTableRow(), setCurrentList(), setFont(), and setParagraph().

std::vector<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