#include <MWAWContentListener.hxx>
Public Types | |
| enum | BreakType { PageBreak = 0, SoftPageBreak, ColumnBreak } |
Public Member Functions | |
| MWAWContentListener (MWAWParserState &parserState, std::vector< MWAWPageSpan > const &pageList, WPXDocumentInterface *documentInterface) | |
| constructor | |
| virtual | ~MWAWContentListener () |
| destructor | |
| void | setDocumentLanguage (std::string locale) |
| sets the documents language | |
| void | startDocument () |
| starts the document | |
| void | endDocument (bool sendDelayedSubDoc=true) |
| ends the document | |
| void | handleSubDocument (MWAWSubDocumentPtr subDocument, libmwaw::SubDocumentType subDocumentType) |
| function called to add a subdocument | |
| bool | isSubDocumentOpened (libmwaw::SubDocumentType &subdocType) const |
| returns try if a subdocument is open | |
| bool | isPageSpanOpened () const |
| returns true if a page is opened | |
| MWAWPageSpan const & | getPageSpan () |
| returns the current page span | |
| bool | insertHeader (MWAWSubDocumentPtr subDocument, WPXPropertyList const &extras) |
| insert a header | |
| bool | insertFooter (MWAWSubDocumentPtr subDocument, WPXPropertyList const &extras) |
| insert a footer | |
| bool | isHeaderFooterOpened () const |
| returns true if the header/footer is open | |
| void | insertChar (uint8_t character) |
| adds a basic character, .. | |
| void | insertCharacter (unsigned char c) |
| insert a character using the font converter to find the utf8 character | |
| int | insertCharacter (unsigned char c, MWAWInputStreamPtr &input, long endPos=-1) |
| insert a character using the font converter to find the utf8 character and if needed, input to read extra character. | |
| void | insertUnicode (uint32_t character) |
| adds an unicode character. | |
| void | insertUnicodeString (WPXString const &str) |
| adds a unicode string | |
| void | insertTab () |
| adds a tab | |
| void | insertEOL (bool softBreak=false) |
| adds an end of line ( by default an hard one) | |
| void | insertBreak (BreakType breakType) |
| inserts a break type: ColumBreak, PageBreak, .. | |
| void | setFont (MWAWFont const &font) |
| sets the font | |
| MWAWFont const & | getFont () const |
| returns the actual font | |
| bool | isParagraphOpened () const |
| returns true if a paragraph or a list is opened | |
| void | setParagraph (MWAWParagraph const ¶graph) |
| sets the paragraph | |
| MWAWParagraph const & | getParagraph () const |
| returns the actual paragraph | |
| void | insertField (MWAWField const &field) |
| adds a field type | |
| void | insertNote (MWAWNote const ¬e, MWAWSubDocumentPtr &subDocument) |
| insert a note | |
| void | insertComment (MWAWSubDocumentPtr &subDocument) |
| adds comment | |
| void | insertPicture (MWAWPosition const &pos, const WPXBinaryData &binaryData, std::string type="image/pict", WPXPropertyList frameExtras=WPXPropertyList()) |
| adds a picture in given position | |
| void | insertTextBox (MWAWPosition const &pos, MWAWSubDocumentPtr subDocument, WPXPropertyList frameExtras=WPXPropertyList(), WPXPropertyList textboxExtras=WPXPropertyList()) |
| adds a textbox in given position | |
| void | openTable (std::vector< float > const &colWidth, WPXUnit unit, WPXPropertyList tableExtras=WPXPropertyList()) |
| open a table | |
| void | closeTable () |
| closes this table | |
| void | openTableRow (float h, WPXUnit unit, bool headerRow=false) |
| open a row with given height ( if h < 0.0, set min-row-height = -h ) | |
| void | closeTableRow () |
| closes this row | |
| void | openTableCell (MWAWCell const &cell, WPXPropertyList const &extras) |
| 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 | |
| MWAWSection const & | getSection () const |
| returns the actual section | |
| bool | openSection (MWAWSection const §ion) |
| open a section if possible | |
| bool | closeSection () |
| close a section | |
Protected Member Functions | |
| void | _openSection () |
| void | _closeSection () |
| void | _openPageSpan (bool sendHeaderFooters=true) |
| void | _closePageSpan () |
| void | _startSubDocument () |
| void | _endSubDocument () |
| void | _handleFrameParameters (WPXPropertyList &propList, MWAWPosition const &pos) |
| bool | openFrame (MWAWPosition const &pos, WPXPropertyList extras=WPXPropertyList()) |
| void | closeFrame () |
| void | _openParagraph () |
| void | _closeParagraph () |
| void | _appendParagraphProperties (WPXPropertyList &propList, const bool isListElement=false) |
| void | _resetParagraphState (const bool isListElement=false) |
| void | _openListElement () |
| open a list level | |
| void | _closeListElement () |
| close a list level | |
| void | _changeList () |
| update the list so that it corresponds to the actual level | |
| int | _getListId () const |
| low level: find a list id which corresponds to actual list and a change of level. | |
| void | _openSpan () |
| void | _closeSpan () |
| void | _flushText () |
| void | _flushDeferredTabs () |
| void | _insertBreakIfNecessary (WPXPropertyList &propList) |
| shared_ptr < MWAWContentListenerInternal::State > | _pushParsingState () |
| creates a new parsing state (copy of the actual state) | |
| void | _popParsingState () |
| resets the previous parsing state | |
Protected Attributes | |
| shared_ptr < MWAWContentListenerInternal::DocumentState > | m_ds |
| the main parse state | |
| shared_ptr < MWAWContentListenerInternal::State > | m_ps |
| the actual local parse state | |
| std::vector< shared_ptr < MWAWContentListenerInternal::State > > | m_psStack |
| stack of local state | |
| MWAWParserState & | m_parserState |
| the parser state | |
| WPXDocumentInterface * | m_documentInterface |
| the document interface | |
Private Member Functions | |
| MWAWContentListener (const MWAWContentListener &) | |
| MWAWContentListener & | operator= (const MWAWContentListener &) |
| MWAWContentListener::MWAWContentListener | ( | MWAWParserState & | parserState, |
| std::vector< MWAWPageSpan > const & | pageList, | ||
| WPXDocumentInterface * | documentInterface | ||
| ) |
constructor
|
virtual |
destructor
|
private |
|
protected |
Referenced by _openListElement(), and _openParagraph().
|
protected |
update the list so that it corresponds to the actual level
Referenced by _closeSection(), _endSubDocument(), _openSpan(), closeTableCell(), endDocument(), and insertNote().
|
protected |
close a list level
Referenced by _closeParagraph().
|
protected |
Referenced by _closeListElement(), _closeParagraph(), endDocument(), and insertBreak().
|
protected |
Referenced by _changeList(), _closeSection(), _endSubDocument(), closeTableCell(), endDocument(), insertBreak(), insertEOL(), insertNote(), and openTable().
|
protected |
Referenced by _closePageSpan(), _openListElement(), _openParagraph(), closeSection(), endDocument(), and handleSubDocument().
|
protected |
Referenced by _closeListElement(), _closeParagraph(), _flushDeferredTabs(), insertComment(), insertNote(), and setFont().
|
protected |
Referenced by closeTable(), and handleSubDocument().
|
protected |
Referenced by insertChar(), insertEOL(), insertField(), insertTab(), insertUnicode(), and insertUnicodeString().
|
protected |
Referenced by _closeSpan(), insertComment(), insertEOL(), insertField(), insertNote(), insertTab(), and openFrame().
|
protected |
low level: find a list id which corresponds to actual list and a change of level.
Referenced by _changeList().
|
protected |
Referenced by openFrame().
|
protected |
Referenced by _appendParagraphProperties().
|
protected |
open a list level
Referenced by _openSpan().
|
protected |
Referenced by _openSection(), endDocument(), and getPageSpan().
|
protected |
Referenced by _openSpan(), insertComment(), insertNote(), and openFrame().
|
protected |
Referenced by _changeList(), _openListElement(), _openParagraph(), and openSection().
|
protected |
Referenced by _flushDeferredTabs(), endDocument(), handleSubDocument(), insertBreak(), insertChar(), insertEOL(), insertField(), insertUnicode(), insertUnicodeString(), and openFrame().
|
protected |
resets the previous parsing state
Referenced by closeTable(), and handleSubDocument().
|
protected |
creates a new parsing state (copy of the actual state)
Referenced by handleSubDocument(), and openTable().
|
protected |
Referenced by _openListElement(), and _openParagraph().
|
protected |
Referenced by handleSubDocument(), and openTable().
add empty cell
|
protected |
| bool MWAWContentListener::closeSection | ( | ) |
close a section
| void MWAWContentListener::closeTable | ( | ) |
closes this table
Referenced by _endSubDocument(), and endDocument().
| void MWAWContentListener::closeTableCell | ( | ) |
close a cell
Referenced by addEmptyTableCell(), and openTableCell().
| void MWAWContentListener::closeTableRow | ( | ) |
closes this row
| void MWAWContentListener::endDocument | ( | bool | sendDelayedSubDoc = true | ) |
ends the document
| MWAWFont const & MWAWContentListener::getFont | ( | ) | const |
returns the actual font
| MWAWPageSpan const & MWAWContentListener::getPageSpan | ( | ) |
returns the current page span
Referenced by _openPageSpan().
| MWAWParagraph const & MWAWContentListener::getParagraph | ( | ) | const |
returns the actual paragraph
| MWAWSection const & MWAWContentListener::getSection | ( | ) | const |
returns the actual section
| void MWAWContentListener::handleSubDocument | ( | MWAWSubDocumentPtr | subDocument, |
| libmwaw::SubDocumentType | subDocumentType | ||
| ) |
function called to add a subdocument
Referenced by insertComment(), insertFooter(), insertHeader(), and insertNote().
| void MWAWContentListener::insertBreak | ( | MWAWContentListener::BreakType | breakType | ) |
inserts a break type: ColumBreak, PageBreak, ..
| void MWAWContentListener::insertChar | ( | uint8_t | character | ) |
adds a basic character, ..
Referenced by insertCharacter().
| void MWAWContentListener::insertCharacter | ( | unsigned char | c | ) |
insert a character using the font converter to find the utf8 character
| int MWAWContentListener::insertCharacter | ( | unsigned char | c, |
| MWAWInputStreamPtr & | input, | ||
| long | endPos = -1 |
||
| ) |
insert a character using the font converter to find the utf8 character and if needed, input to read extra character.
| void MWAWContentListener::insertComment | ( | MWAWSubDocumentPtr & | subDocument | ) |
adds comment
| void MWAWContentListener::insertEOL | ( | bool | softBreak = false | ) |
adds an end of line ( by default an hard one)
Referenced by MWAWHeaderFooter::insertPageNumberParagraph().
| void MWAWContentListener::insertField | ( | MWAWField const & | field | ) |
adds a field type
Referenced by MWAWHeaderFooter::insertPageNumberParagraph().
| bool MWAWContentListener::insertFooter | ( | MWAWSubDocumentPtr | subDocument, |
| WPXPropertyList const & | extras | ||
| ) |
insert a footer
Referenced by MWAWHeaderFooter::send().
| bool MWAWContentListener::insertHeader | ( | MWAWSubDocumentPtr | subDocument, |
| WPXPropertyList const & | extras | ||
| ) |
insert a header
Referenced by MWAWHeaderFooter::send().
| void MWAWContentListener::insertNote | ( | MWAWNote const & | note, |
| MWAWSubDocumentPtr & | subDocument | ||
| ) |
insert a 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.
| void MWAWContentListener::insertPicture | ( | MWAWPosition const & | pos, |
| const WPXBinaryData & | binaryData, | ||
| std::string | type = "image/pict", |
||
| WPXPropertyList | frameExtras = WPXPropertyList() |
||
| ) |
adds a picture in given position
| void MWAWContentListener::insertTab | ( | ) |
adds a tab
| void MWAWContentListener::insertTextBox | ( | MWAWPosition const & | pos, |
| MWAWSubDocumentPtr | subDocument, | ||
| WPXPropertyList | frameExtras = WPXPropertyList(), |
||
| WPXPropertyList | textboxExtras = WPXPropertyList() |
||
| ) |
adds a textbox in given position
| void MWAWContentListener::insertUnicode | ( | uint32_t | character | ) |
adds an unicode character.
By convention if character=0xfffd(undef), no character is added
Referenced by insertChar(), and insertCharacter().
| void MWAWContentListener::insertUnicodeString | ( | WPXString const & | str | ) |
adds a unicode string
Referenced by insertField().
| bool MWAWContentListener::isHeaderFooterOpened | ( | ) | const |
returns true if the header/footer is open
| bool MWAWContentListener::isPageSpanOpened | ( | ) | const |
returns true if a page is opened
| bool MWAWContentListener::isParagraphOpened | ( | ) | const |
returns true if a paragraph or a list is opened
Referenced by MWAWHeaderFooter::insertPageNumberParagraph().
| bool MWAWContentListener::isSectionOpened | ( | ) | const |
returns true if a section is opened
| bool MWAWContentListener::isSubDocumentOpened | ( | libmwaw::SubDocumentType & | subdocType | ) | const |
returns try if a subdocument is open
|
protected |
| bool MWAWContentListener::openSection | ( | MWAWSection const & | section | ) |
open a section if possible
| void MWAWContentListener::openTable | ( | std::vector< float > const & | colWidth, |
| WPXUnit | unit, | ||
| WPXPropertyList | tableExtras = WPXPropertyList() |
||
| ) |
open a table
| void MWAWContentListener::openTableCell | ( | MWAWCell const & | cell, |
| WPXPropertyList const & | extras | ||
| ) |
low level function to define a cell.
| cell | the cell position, alignement, ... |
| extras | to be used to pass extra data, for instance spreadsheet data |
| void MWAWContentListener::openTableRow | ( | float | h, |
| WPXUnit | unit, | ||
| bool | headerRow = false |
||
| ) |
open a row with given height ( if h < 0.0, set min-row-height = -h )
|
private |
| void MWAWContentListener::setDocumentLanguage | ( | std::string | locale | ) |
sets the documents language
| void MWAWContentListener::setFont | ( | MWAWFont const & | font | ) |
sets the font
Referenced by _flushDeferredTabs(), and MWAWHeaderFooter::insertPageNumberParagraph().
| void MWAWContentListener::setParagraph | ( | MWAWParagraph const & | paragraph | ) |
sets the paragraph
Referenced by MWAWHeaderFooter::insertPageNumberParagraph().
| void MWAWContentListener::startDocument | ( | ) |
starts the document
Referenced by _openPageSpan().
|
protected |
the document interface
Referenced by _changeList(), _closeListElement(), _closePageSpan(), _closeParagraph(), _closeSection(), _closeSpan(), _flushDeferredTabs(), _flushText(), _openListElement(), _openPageSpan(), _openParagraph(), _openSection(), _openSpan(), addEmptyTableCell(), closeFrame(), closeTable(), closeTableCell(), closeTableRow(), endDocument(), insertComment(), insertEOL(), insertField(), insertFooter(), insertHeader(), insertNote(), openFrame(), openTable(), openTableCell(), openTableRow(), and startDocument().
|
protected |
the main parse state
Referenced by _openPageSpan(), _startSubDocument(), endDocument(), handleSubDocument(), insertFooter(), insertHeader(), insertNote(), isHeaderFooterOpened(), openFrame(), setDocumentLanguage(), and startDocument().
|
protected |
the parser state
Referenced by _changeList(), _getListId(), _openSpan(), and insertCharacter().
|
protected |
the actual local parse state
Referenced by _appendParagraphProperties(), _changeList(), _closeListElement(), _closePageSpan(), _closeParagraph(), _closeSection(), _closeSpan(), _endSubDocument(), _flushDeferredTabs(), _flushText(), _getListId(), _insertBreakIfNecessary(), _openListElement(), _openPageSpan(), _openParagraph(), _openSection(), _openSpan(), _popParsingState(), _pushParsingState(), _resetParagraphState(), _startSubDocument(), addEmptyTableCell(), closeFrame(), closeSection(), closeTable(), closeTableCell(), closeTableRow(), endDocument(), getFont(), getPageSpan(), getParagraph(), getSection(), handleSubDocument(), insertBreak(), insertChar(), insertCharacter(), insertComment(), insertEOL(), insertNote(), insertTab(), insertUnicode(), insertUnicodeString(), isPageSpanOpened(), isParagraphOpened(), isSectionOpened(), isSubDocumentOpened(), openFrame(), openSection(), openTable(), openTableCell(), openTableRow(), setFont(), and setParagraph().
|
protected |
stack of local state
Referenced by _popParsingState(), and _pushParsingState().