MWAWContentListener Class Reference

This class contents the main functions needed to create a Writer Document. More...

#include <MWAWContentListener.hxx>

Inheritance diagram for MWAWContentListener:
MWAWListener

List of all members.

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
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 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, 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 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 &paragraph)
 sets the paragraph
MWAWParagraph const & getParagraph () const
 returns the actual paragraph
void insertField (MWAWField const &field)
 adds a field type
void insertNote (MWAWNote const &note, 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 insertPicture (MWAWPosition const &pos, MWAWGraphicShape const &shape, MWAWGraphicStyle const &style)
 adds a shape 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 (MWAWTable const &table, 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)
 open a cell
void closeTableCell ()
 close a cell
void addEmptyTableCell (Vec2i const &pos, Vec2i span=Vec2i(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 &section)
 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 ()
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
MWAWParserStatem_parserState
 the parser state
WPXDocumentInterface * m_documentInterface
 the document interface

Private Member Functions

 MWAWContentListener (const MWAWContentListener &)
MWAWContentListeneroperator= (const MWAWContentListener &)

Detailed Description

This class contents the main functions needed to create a Writer Document.


Constructor & Destructor Documentation

MWAWContentListener::MWAWContentListener ( MWAWParserState parserState,
std::vector< MWAWPageSpan > const &  pageList,
WPXDocumentInterface *  documentInterface 
)

constructor


Member Function Documentation

void MWAWContentListener::_appendParagraphProperties ( WPXPropertyList &  propList,
const bool  isListElement = false 
) [protected]

Referenced by _openListElement(), and _openParagraph().

void MWAWContentListener::_changeList ( ) [protected]

update the list so that it corresponds to the actual level

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

close a list level

Referenced by _closeParagraph().

Referenced by closeTable(), and handleSubDocument().

int MWAWContentListener::_getListId ( ) const [protected]

low level: find a list id which corresponds to actual list and a change of level.

Note:
called when the list id is not set

Referenced by _changeList().

void MWAWContentListener::_handleFrameParameters ( WPXPropertyList &  propList,
MWAWPosition const &  pos 
) [protected]

Referenced by openFrame().

void MWAWContentListener::_insertBreakIfNecessary ( WPXPropertyList &  propList) [protected]

open a list level

Referenced by _openSpan().

void MWAWContentListener::_openPageSpan ( bool  sendHeaderFooters = true) [protected]

resets the previous parsing state

Referenced by closeTable(), and handleSubDocument().

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

Returns:
the old one

Referenced by handleSubDocument(), and openTable().

void MWAWContentListener::_resetParagraphState ( const bool  isListElement = false) [protected]

Referenced by _openListElement(), and _openParagraph().

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

add empty cell

returns true if we can add open a section, add page break, ...

Implements MWAWListener.

bool MWAWContentListener::canWriteText ( ) const [inline, virtual]

returns true if we can add text data

Implements MWAWListener.

void MWAWContentListener::closeFrame ( ) [protected]

close a section

Implements MWAWListener.

closes this table

Referenced by _endSubDocument(), and endDocument().

close a cell

Referenced by addEmptyTableCell(), and openTableCell().

closes this row

void MWAWContentListener::endDocument ( bool  sendDelayedSubDoc = true)

ends the document

MWAWFont const & MWAWContentListener::getFont ( ) const [virtual]

returns the actual font

Implements MWAWListener.

returns the current page span

Note:
this forces the opening of a new page if no page is opened.

Referenced by _openPageSpan().

MWAWParagraph const & MWAWContentListener::getParagraph ( ) const [virtual]

returns the actual paragraph

Implements MWAWListener.

MWAWSection const & MWAWContentListener::getSection ( ) const [virtual]

returns the actual section

Implements MWAWListener.

function called to add a subdocument

Referenced by insertComment(), insertFooter(), insertHeader(), and insertNote().

inserts a break type: ColumBreak, PageBreak, ..

Implements MWAWListener.

void MWAWContentListener::insertChar ( uint8_t  character) [virtual]

adds a basic character, ..

Implements MWAWListener.

Referenced by insertCharacter().

void MWAWContentListener::insertCharacter ( unsigned char  c) [virtual]

insert a character using the font converter to find the utf8 character

Implements MWAWListener.

int MWAWContentListener::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.

Returns:
the number of extra character read

Implements MWAWListener.

adds comment

void MWAWContentListener::insertEOL ( bool  softBreak = false) [virtual]

adds an end of line ( by default an hard one)

Implements MWAWListener.

Referenced by MWAWHeaderFooter::insertPageNumberParagraph().

void MWAWContentListener::insertField ( MWAWField const &  field) [virtual]

adds a field type

Implements MWAWListener.

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::insertPicture ( MWAWPosition const &  pos,
MWAWGraphicShape const &  shape,
MWAWGraphicStyle const &  style 
)

adds a shape picture in given position

void MWAWContentListener::insertTab ( ) [virtual]

adds a tab

Implements MWAWListener.

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) [virtual]

adds an unicode character.

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

Implements MWAWListener.

Referenced by insertChar(), and insertCharacter().

void MWAWContentListener::insertUnicodeString ( WPXString const &  str) [virtual]

adds a unicode string

Implements MWAWListener.

Referenced by insertField().

bool MWAWContentListener::isDocumentStarted ( ) const [virtual]

returns true if a document is opened

Implements MWAWListener.

Referenced by canWriteText().

returns true if the header/footer is open

returns true if a page is opened

bool MWAWContentListener::isParagraphOpened ( ) const [virtual]

returns true if a paragraph or a list is opened

Implements MWAWListener.

Referenced by MWAWHeaderFooter::insertPageNumberParagraph().

bool MWAWContentListener::isSectionOpened ( ) const [virtual]

returns true if a section is opened

Implements MWAWListener.

returns try if a subdocument is open

Implements MWAWListener.

bool MWAWContentListener::openFrame ( MWAWPosition const &  pos,
WPXPropertyList  extras = WPXPropertyList() 
) [protected]
bool MWAWContentListener::openSection ( MWAWSection const &  section) [virtual]

open a section if possible

Implements MWAWListener.

void MWAWContentListener::openTable ( MWAWTable const &  table,
WPXPropertyList  tableExtras = WPXPropertyList() 
)

open a table

open a cell

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 )

MWAWContentListener& MWAWContentListener::operator= ( const MWAWContentListener ) [private]
void MWAWContentListener::setDocumentLanguage ( std::string  locale)

sets the documents language

void MWAWContentListener::setFont ( MWAWFont const &  font) [virtual]
void MWAWContentListener::setParagraph ( MWAWParagraph const &  paragraph) [virtual]

sets the paragraph

Implements MWAWListener.

Referenced by MWAWHeaderFooter::insertPageNumberParagraph().

starts the document

Referenced by _openPageSpan().


Member Data Documentation

stack of local state

Referenced by _popParsingState(), and _pushParsingState().


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