This class contents the main functions needed to create a Word processing Document. More...
#include <MWAWTextListener.hxx>
Public Member Functions | |
| MWAWTextListener (MWAWParserState &parserState, std::vector< MWAWPageSpan > const &pageList, librevenge::RVNGTextInterface *documentInterface) | |
| constructor | |
| virtual | ~MWAWTextListener () |
| destructor | |
| Type | getType () const |
| returns the listener type | |
| void | setDocumentLanguage (std::string locale) |
| sets the documents language | |
| void | startDocument () |
| starts the document | |
| void | endDocument (bool sendDelayedSubDoc=true) |
| ends the document | |
| bool | isDocumentStarted () const |
| returns true if a document is opened | |
| 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 | openFrame (MWAWPosition const &pos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle()) |
| tries to open a frame | |
| void | closeFrame () |
| tries to close the last open frame | |
| bool | canWriteText () const |
| returns true if we can add text data | |
| bool | isPageSpanOpened () const |
| returns true if a page is opened | |
| MWAWPageSpan const & | getPageSpan () |
| returns the current page span | |
| bool | insertHeader (MWAWSubDocumentPtr subDocument, librevenge::RVNGPropertyList const &extras) |
| insert a header | |
| bool | insertFooter (MWAWSubDocumentPtr subDocument, librevenge::RVNGPropertyList 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 (librevenge::RVNGString 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 | 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 | openLink (MWAWLink const &link) |
| open a link | |
| void | closeLink () |
| close a link | |
| void | insertNote (MWAWNote const ¬e, MWAWSubDocumentPtr &subDocument) |
| insert a note | |
| void | insertComment (MWAWSubDocumentPtr &subDocument) |
| adds comment | |
| void | insertPicture (MWAWPosition const &pos, const librevenge::RVNGBinaryData &binaryData, std::string type="image/pict", MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle()) |
| adds a picture in given position | |
| void | insertPicture (MWAWPosition const &pos, MWAWGraphicShape const &shape, MWAWGraphicStyle const &style) |
| adds a shape picture in given position | |
| void | insertTextBox (MWAWPosition const &pos, MWAWSubDocumentPtr subDocument, MWAWGraphicStyle const &frameStyle=MWAWGraphicStyle::emptyStyle()) |
| adds a textbox in given position | |
| void | openTable (MWAWTable const &table) |
| open a table | |
| void | closeTable () |
| closes this table | |
| void | openTableRow (float h, librevenge::RVNGUnit 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) |
| open a cell | |
| void | closeTableCell () |
| close a cell | |
| void | addEmptyTableCell (MWAWVec2i const &pos, MWAWVec2i span=MWAWVec2i(1, 1)) |
| add empty cell | |
| bool | canOpenSectionAddBreak () const |
| returns true if we can add open a section, add page break, ... | |
| 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 | |
| void | insertBreak (BreakType breakType) |
| inserts a break type: ColumBreak, PageBreak, .. | |
Protected Member Functions | |
| void | _openSection () |
| does open a section (low level) | |
| void | _closeSection () |
| does close a section (low level) | |
| void | _openPageSpan (bool sendHeaderFooters=true) |
| does open a new page (low level) | |
| void | _closePageSpan () |
| does close a page (low level) | |
| void | _startSubDocument () |
| void | _endSubDocument () |
| void | _handleFrameParameters (librevenge::RVNGPropertyList &propList, MWAWPosition const &pos) |
| void | _openParagraph () |
| void | _closeParagraph () |
| void | _appendParagraphProperties (librevenge::RVNGPropertyList &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 () |
| low level: the function which opens a new span property | |
| void | _closeSpan () |
| low level: the function which closes the last opened span property | |
| void | _flushText () |
| low level: flush the deferred text | |
| void | _flushDeferredTabs () |
| low level: flush the deferred tabs | |
| void | _insertBreakIfNecessary (librevenge::RVNGPropertyList &propList) |
| shared_ptr < MWAWTextListenerInternal::State > | _pushParsingState () |
| creates a new parsing state (copy of the actual state) | |
| void | _popParsingState () |
| resets the previous parsing state | |
Protected Attributes | |
| shared_ptr < MWAWTextListenerInternal::DocumentState > | m_ds |
| the main parse state | |
| shared_ptr < MWAWTextListenerInternal::State > | m_ps |
| the actual local parse state | |
| std::vector< shared_ptr < MWAWTextListenerInternal::State > > | m_psStack |
| stack of local state | |
| MWAWParserState & | m_parserState |
| the parser state | |
| librevenge::RVNGTextInterface * | m_documentInterface |
| the document interface | |
Private Member Functions | |
| MWAWTextListener (const MWAWTextListener &) | |
| copy constructor (unimplemented) | |
| MWAWTextListener & | operator= (const MWAWTextListener &) |
| operator= (unimplemented) | |
This class contents the main functions needed to create a Word processing Document.
| MWAWTextListener::MWAWTextListener | ( | MWAWParserState & | parserState, |
| std::vector< MWAWPageSpan > const & | pageList, | ||
| librevenge::RVNGTextInterface * | documentInterface | ||
| ) |
constructor
| MWAWTextListener::~MWAWTextListener | ( | ) | [virtual] |
destructor
| MWAWTextListener::MWAWTextListener | ( | const MWAWTextListener & | ) | [private] |
copy constructor (unimplemented)
| void MWAWTextListener::_appendParagraphProperties | ( | librevenge::RVNGPropertyList & | propList, |
| const bool | isListElement = false |
||
| ) | [protected] |
Referenced by _openListElement(), and _openParagraph().
| void MWAWTextListener::_changeList | ( | ) | [protected] |
update the list so that it corresponds to the actual level
Referenced by _closeSection(), _endSubDocument(), _openSpan(), closeTableCell(), endDocument(), and insertNote().
| void MWAWTextListener::_closeListElement | ( | ) | [protected] |
close a list level
Referenced by _closeParagraph().
| void MWAWTextListener::_closePageSpan | ( | ) | [protected] |
does close a page (low level)
Referenced by _closeListElement(), _closeParagraph(), endDocument(), and insertBreak().
| void MWAWTextListener::_closeParagraph | ( | ) | [protected] |
Referenced by _changeList(), _closeSection(), _endSubDocument(), closeTableCell(), endDocument(), insertBreak(), insertEOL(), insertNote(), and openTable().
| void MWAWTextListener::_closeSection | ( | ) | [protected] |
does close a section (low level)
Referenced by _closePageSpan(), _openListElement(), _openParagraph(), closeSection(), endDocument(), and handleSubDocument().
| void MWAWTextListener::_closeSpan | ( | ) | [protected] |
low level: the function which closes the last opened span property
Referenced by _closeListElement(), _closeParagraph(), _flushDeferredTabs(), closeLink(), insertComment(), insertNote(), and setFont().
| void MWAWTextListener::_endSubDocument | ( | ) | [protected] |
Referenced by closeTable(), and handleSubDocument().
| void MWAWTextListener::_flushDeferredTabs | ( | ) | [protected] |
low level: flush the deferred tabs
Referenced by insertChar(), insertEOL(), insertField(), insertTab(), insertUnicode(), and insertUnicodeString().
| void MWAWTextListener::_flushText | ( | ) | [protected] |
low level: flush the deferred text
Referenced by _closeSpan(), insertComment(), insertEOL(), insertField(), insertNote(), insertTab(), and openFrame().
| int MWAWTextListener::_getListId | ( | ) | const [protected] |
low level: find a list id which corresponds to actual list and a change of level.
Referenced by _changeList().
| void MWAWTextListener::_handleFrameParameters | ( | librevenge::RVNGPropertyList & | propList, |
| MWAWPosition const & | pos | ||
| ) | [protected] |
Referenced by openFrame().
| void MWAWTextListener::_insertBreakIfNecessary | ( | librevenge::RVNGPropertyList & | propList | ) | [protected] |
Referenced by _appendParagraphProperties().
| void MWAWTextListener::_openListElement | ( | ) | [protected] |
open a list level
Referenced by _openSpan().
| void MWAWTextListener::_openPageSpan | ( | bool | sendHeaderFooters = true | ) | [protected] |
does open a new page (low level)
Referenced by _openSection(), endDocument(), and getPageSpan().
| void MWAWTextListener::_openParagraph | ( | ) | [protected] |
Referenced by _openSpan(), insertComment(), insertNote(), and openFrame().
| void MWAWTextListener::_openSection | ( | ) | [protected] |
does open a section (low level)
Referenced by _changeList(), _openListElement(), _openParagraph(), and openSection().
| void MWAWTextListener::_openSpan | ( | ) | [protected] |
low level: the function which opens a new span property
Referenced by _flushDeferredTabs(), endDocument(), handleSubDocument(), insertBreak(), insertChar(), insertEOL(), insertField(), insertUnicode(), insertUnicodeString(), openFrame(), and openLink().
| void MWAWTextListener::_popParsingState | ( | ) | [protected] |
resets the previous parsing state
Referenced by closeLink(), closeTable(), and handleSubDocument().
| shared_ptr< MWAWTextListenerInternal::State > MWAWTextListener::_pushParsingState | ( | ) | [protected] |
creates a new parsing state (copy of the actual state)
Referenced by handleSubDocument(), openLink(), and openTable().
| void MWAWTextListener::_resetParagraphState | ( | const bool | isListElement = false | ) | [protected] |
Referenced by _openListElement(), and _openParagraph().
| void MWAWTextListener::_startSubDocument | ( | ) | [protected] |
Referenced by handleSubDocument(), and openTable().
| void MWAWTextListener::addEmptyTableCell | ( | MWAWVec2i const & | pos, |
| MWAWVec2i | span = MWAWVec2i(1,1) |
||
| ) | [virtual] |
add empty cell
Implements MWAWListener.
| bool MWAWTextListener::canOpenSectionAddBreak | ( | ) | const [virtual] |
returns true if we can add open a section, add page break, ...
Implements MWAWListener.
| bool MWAWTextListener::canWriteText | ( | ) | const [inline, virtual] |
returns true if we can add text data
Implements MWAWListener.
| void MWAWTextListener::closeFrame | ( | ) | [virtual] |
tries to close the last open frame
Implements MWAWListener.
| void MWAWTextListener::closeLink | ( | ) | [virtual] |
close a link
Implements MWAWListener.
| bool MWAWTextListener::closeSection | ( | ) | [virtual] |
close a section
Implements MWAWListener.
| void MWAWTextListener::closeTable | ( | ) | [virtual] |
| void MWAWTextListener::closeTableCell | ( | ) | [virtual] |
| void MWAWTextListener::closeTableRow | ( | ) | [virtual] |
closes this row
Implements MWAWListener.
| void MWAWTextListener::endDocument | ( | bool | sendDelayedSubDoc = true | ) | [virtual] |
ends the document
Implements MWAWListener.
| MWAWFont const & MWAWTextListener::getFont | ( | ) | const [virtual] |
returns the actual font
Implements MWAWListener.
| MWAWPageSpan const & MWAWTextListener::getPageSpan | ( | ) | [virtual] |
returns the current page span
Implements MWAWListener.
| MWAWParagraph const & MWAWTextListener::getParagraph | ( | ) | const [virtual] |
returns the actual paragraph
Implements MWAWListener.
| MWAWSection const & MWAWTextListener::getSection | ( | ) | const [virtual] |
returns the actual section
Implements MWAWListener.
| Type MWAWTextListener::getType | ( | ) | const [inline, virtual] |
returns the listener type
Implements MWAWListener.
| void MWAWTextListener::handleSubDocument | ( | MWAWSubDocumentPtr | subDocument, |
| libmwaw::SubDocumentType | subDocumentType | ||
| ) | [virtual] |
function called to add a subdocument
Implements MWAWListener.
Referenced by insertComment(), insertFooter(), insertHeader(), and insertNote().
| void MWAWTextListener::insertBreak | ( | MWAWTextListener::BreakType | breakType | ) | [virtual] |
inserts a break type: ColumBreak, PageBreak, ..
Implements MWAWListener.
| void MWAWTextListener::insertChar | ( | uint8_t | character | ) | [virtual] |
| void MWAWTextListener::insertCharacter | ( | unsigned char | c | ) | [virtual] |
insert a character using the font converter to find the utf8 character
Implements MWAWListener.
| int MWAWTextListener::insertCharacter | ( | unsigned char | c, |
| MWAWInputStreamPtr & | input, | ||
| long | endPos = -1 |
||
| ) | [virtual] |
insert a character using the font converter to find the utf8 character and if needed, input to read extra character.
Implements MWAWListener.
| void MWAWTextListener::insertComment | ( | MWAWSubDocumentPtr & | subDocument | ) | [virtual] |
adds comment
Implements MWAWListener.
| void MWAWTextListener::insertEOL | ( | bool | softBreak = false | ) | [virtual] |
adds an end of line ( by default an hard one)
Implements MWAWListener.
| void MWAWTextListener::insertField | ( | MWAWField const & | field | ) | [virtual] |
adds a field type
Implements MWAWListener.
| bool MWAWTextListener::insertFooter | ( | MWAWSubDocumentPtr | subDocument, |
| librevenge::RVNGPropertyList const & | extras | ||
| ) | [virtual] |
insert a footer
Implements MWAWListener.
| bool MWAWTextListener::insertHeader | ( | MWAWSubDocumentPtr | subDocument, |
| librevenge::RVNGPropertyList const & | extras | ||
| ) | [virtual] |
insert a header
Implements MWAWListener.
| void MWAWTextListener::insertNote | ( | MWAWNote const & | note, |
| MWAWSubDocumentPtr & | subDocument | ||
| ) | [virtual] |
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.
Implements MWAWListener.
| void MWAWTextListener::insertPicture | ( | MWAWPosition const & | pos, |
| const librevenge::RVNGBinaryData & | binaryData, | ||
| std::string | type = "image/pict", |
||
| MWAWGraphicStyle const & | style = MWAWGraphicStyle::emptyStyle() |
||
| ) | [virtual] |
adds a picture in given position
Implements MWAWListener.
| void MWAWTextListener::insertPicture | ( | MWAWPosition const & | pos, |
| MWAWGraphicShape const & | shape, | ||
| MWAWGraphicStyle const & | style | ||
| ) | [virtual] |
adds a shape picture in given position
Implements MWAWListener.
| void MWAWTextListener::insertTab | ( | ) | [virtual] |
adds a tab
Implements MWAWListener.
| void MWAWTextListener::insertTextBox | ( | MWAWPosition const & | pos, |
| MWAWSubDocumentPtr | subDocument, | ||
| MWAWGraphicStyle const & | frameStyle = MWAWGraphicStyle::emptyStyle() |
||
| ) | [virtual] |
adds a textbox in given position
Implements MWAWListener.
| void MWAWTextListener::insertUnicode | ( | uint32_t | character | ) | [virtual] |
adds an unicode character.
By convention if character=0xfffd(undef), no character is added
Implements MWAWListener.
Referenced by insertChar(), and insertCharacter().
| void MWAWTextListener::insertUnicodeString | ( | librevenge::RVNGString const & | str | ) | [virtual] |
| bool MWAWTextListener::isDocumentStarted | ( | ) | const [virtual] |
| bool MWAWTextListener::isHeaderFooterOpened | ( | ) | const [virtual] |
returns true if the header/footer is open
Implements MWAWListener.
| bool MWAWTextListener::isPageSpanOpened | ( | ) | const [virtual] |
returns true if a page is opened
Implements MWAWListener.
| bool MWAWTextListener::isParagraphOpened | ( | ) | const [virtual] |
returns true if a paragraph or a list is opened
Implements MWAWListener.
| bool MWAWTextListener::isSectionOpened | ( | ) | const [virtual] |
returns true if a section is opened
Implements MWAWListener.
| bool MWAWTextListener::isSubDocumentOpened | ( | libmwaw::SubDocumentType & | subdocType | ) | const [virtual] |
returns try if a subdocument is open
Implements MWAWListener.
| bool MWAWTextListener::openFrame | ( | MWAWPosition const & | pos, |
| MWAWGraphicStyle const & | style = MWAWGraphicStyle::emptyStyle() |
||
| ) | [virtual] |
tries to open a frame
Implements MWAWListener.
| void MWAWTextListener::openLink | ( | MWAWLink const & | link | ) | [virtual] |
open a link
Implements MWAWListener.
| bool MWAWTextListener::openSection | ( | MWAWSection const & | section | ) | [virtual] |
open a section if possible
Implements MWAWListener.
| void MWAWTextListener::openTable | ( | MWAWTable const & | table | ) | [virtual] |
open a table
Implements MWAWListener.
| void MWAWTextListener::openTableCell | ( | MWAWCell const & | cell | ) | [virtual] |
open a cell
Implements MWAWListener.
| void MWAWTextListener::openTableRow | ( | float | h, |
| librevenge::RVNGUnit | unit, | ||
| bool | headerRow = false |
||
| ) | [virtual] |
open a row with given height ( if h < 0.0, set min-row-height = -h )
Implements MWAWListener.
| MWAWTextListener& MWAWTextListener::operator= | ( | const MWAWTextListener & | ) | [private] |
operator= (unimplemented)
| void MWAWTextListener::setDocumentLanguage | ( | std::string | locale | ) | [virtual] |
sets the documents language
Implements MWAWListener.
| void MWAWTextListener::setFont | ( | MWAWFont const & | font | ) | [virtual] |
| void MWAWTextListener::setParagraph | ( | MWAWParagraph const & | paragraph | ) | [virtual] |
sets the paragraph
Implements MWAWListener.
| void MWAWTextListener::startDocument | ( | ) | [virtual] |
librevenge::RVNGTextInterface* MWAWTextListener::m_documentInterface [protected] |
the document interface
Referenced by _changeList(), _closeListElement(), _closePageSpan(), _closeParagraph(), _closeSection(), _closeSpan(), _flushDeferredTabs(), _flushText(), _openListElement(), _openPageSpan(), _openParagraph(), _openSection(), _openSpan(), addEmptyTableCell(), closeFrame(), closeLink(), closeTable(), closeTableCell(), closeTableRow(), endDocument(), insertComment(), insertEOL(), insertField(), insertFooter(), insertHeader(), insertNote(), openFrame(), openLink(), openTable(), openTableCell(), openTableRow(), and startDocument().
shared_ptr<MWAWTextListenerInternal::DocumentState> MWAWTextListener::m_ds [protected] |
the main parse state
Referenced by _appendParagraphProperties(), _changeList(), _openPageSpan(), _startSubDocument(), endDocument(), getPageSpan(), handleSubDocument(), insertFooter(), insertHeader(), insertNote(), isDocumentStarted(), isHeaderFooterOpened(), openFrame(), setDocumentLanguage(), and startDocument().
MWAWParserState& MWAWTextListener::m_parserState [protected] |
the parser state
Referenced by _changeList(), _getListId(), _openSpan(), insertCharacter(), and openTableCell().
shared_ptr<MWAWTextListenerInternal::State> MWAWTextListener::m_ps [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(), canOpenSectionAddBreak(), closeFrame(), closeLink(), closeSection(), closeTable(), closeTableCell(), closeTableRow(), endDocument(), getFont(), getPageSpan(), getParagraph(), getSection(), handleSubDocument(), insertBreak(), insertChar(), insertCharacter(), insertComment(), insertEOL(), insertNote(), insertTab(), insertUnicode(), insertUnicodeString(), isPageSpanOpened(), isParagraphOpened(), isSectionOpened(), isSubDocumentOpened(), openFrame(), openLink(), openSection(), openTable(), openTableCell(), openTableRow(), setFont(), and setParagraph().
std::vector<shared_ptr<MWAWTextListenerInternal::State> > MWAWTextListener::m_psStack [protected] |
stack of local state
Referenced by _popParsingState(), and _pushParsingState().