MWAWSpreadsheetListener Class Reference

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

#include <MWAWSpreadsheetListener.hxx>

Inheritance diagram for MWAWSpreadsheetListener:
MWAWListener

List of all members.

Public Member Functions

 MWAWSpreadsheetListener (MWAWParserState &parserState, std::vector< MWAWPageSpan > const &pageList, librevenge::RVNGSpreadsheetInterface *documentInterface)
 constructor
 MWAWSpreadsheetListener (MWAWParserState &parserState, MWAWBox2f const &box, librevenge::RVNGSpreadsheetInterface *documentInterface)
 simplified constructor (can be used for a embedded spreadsheet with one page).
virtual ~MWAWSpreadsheetListener ()
 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 a 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 openSheet (std::vector< float > const &colWidth, librevenge::RVNGUnit unit, std::string const &name="")
 open a sheet
void closeSheet ()
 closes this sheet
void openSheetRow (float h, librevenge::RVNGUnit unit)
 open a row with given height ( if h < 0.0, set min-row-height = -h )
void closeSheetRow ()
 closes this row
void openSheetCell (MWAWCell const &cell, MWAWCellContent const &content)
 open a cell
void closeSheetCell ()
 close a cell
void insertChart (MWAWPosition const &pos, MWAWChart &chart, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())
 adds a chart in given position
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 &paragraph)
 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 &note, 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 insertTable (MWAWPosition const &pos, MWAWTable &table, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())
 adds a table 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 &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 _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 _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 ()
shared_ptr
< MWAWSpreadsheetListenerInternal::State
_pushParsingState ()
 creates a new parsing state (copy of the actual state)
void _popParsingState ()
 resets the previous parsing state

Protected Attributes

shared_ptr
< MWAWSpreadsheetListenerInternal::DocumentState
m_ds
 the main parse state
shared_ptr
< MWAWSpreadsheetListenerInternal::State
m_ps
 the actual local parse state
std::vector< shared_ptr
< MWAWSpreadsheetListenerInternal::State > > 
m_psStack
 stack of local state
MWAWParserStatem_parserState
 the parser state
librevenge::RVNGSpreadsheetInterface * m_documentInterface
 the document interface

Private Member Functions

 MWAWSpreadsheetListener (const MWAWSpreadsheetListener &)
 copy constructor (unimplemented)
MWAWSpreadsheetListeneroperator= (const MWAWSpreadsheetListener &)
 operator= (unimplemented)

Detailed Description

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


Constructor & Destructor Documentation

MWAWSpreadsheetListener::MWAWSpreadsheetListener ( MWAWParserState parserState,
std::vector< MWAWPageSpan > const &  pageList,
librevenge::RVNGSpreadsheetInterface *  documentInterface 
)

constructor

MWAWSpreadsheetListener::MWAWSpreadsheetListener ( MWAWParserState parserState,
MWAWBox2f const &  box,
librevenge::RVNGSpreadsheetInterface *  documentInterface 
)

simplified constructor (can be used for a embedded spreadsheet with one page).

Note:
the box coordinates must be given in point.

copy constructor (unimplemented)


Member Function Documentation

update the list so that it corresponds to the actual level

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

close a list level

Referenced by _closeParagraph().

does close a page (low level)

Referenced by endDocument().

int MWAWSpreadsheetListener::_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 MWAWSpreadsheetListener::_handleFrameParameters ( librevenge::RVNGPropertyList &  propList,
MWAWPosition const &  pos 
) [protected]

Referenced by openFrame().

open a list level

Referenced by _openSpan().

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

does open a new page (low level)

Referenced by endDocument(), getPageSpan(), and openSheet().

resets the previous parsing state

Referenced by closeLink(), closeSheet(), closeTable(), and handleSubDocument().

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

Returns:
the old one

Referenced by handleSubDocument(), openLink(), openSheet(), and openTable().

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

Referenced by _openListElement(), and _openParagraph().

void MWAWSpreadsheetListener::addEmptyTableCell ( MWAWVec2i const &  pos,
MWAWVec2i  span = MWAWVec2i(1,1) 
) [virtual]

add empty cell

Implements MWAWListener.

bool MWAWSpreadsheetListener::canOpenSectionAddBreak ( ) const [inline, virtual]

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

Implements MWAWListener.

bool MWAWSpreadsheetListener::canWriteText ( ) const [virtual]

returns true if we can add text data

Implements MWAWListener.

Referenced by insertComment(), and insertNote().

tries to close a frame

Implements MWAWListener.

close a link

Implements MWAWListener.

close a section

Implements MWAWListener.

closes this table

Implements MWAWListener.

Referenced by _endSubDocument(), and endDocument().

close a cell

Implements MWAWListener.

Referenced by addEmptyTableCell(), and openTableCell().

closes this row

Implements MWAWListener.

void MWAWSpreadsheetListener::endDocument ( bool  sendDelayedSubDoc = true) [virtual]

ends the document

Implements MWAWListener.

Referenced by ClarisWksGraph::sendGroupChild().

MWAWFont const & MWAWSpreadsheetListener::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.

Implements MWAWListener.

returns the actual paragraph

Implements MWAWListener.

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

returns the actual section

Implements MWAWListener.

Type MWAWSpreadsheetListener::getType ( ) const [inline, virtual]

returns the listener type

Implements MWAWListener.

void MWAWSpreadsheetListener::handleSubDocument ( MWAWSubDocumentPtr  subDocument,
libmwaw::SubDocumentType  subDocumentType 
) [virtual]

function called to add a subdocument

Implements MWAWListener.

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

inserts a break type: ColumBreak, PageBreak, ..

Implements MWAWListener.

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

adds a basic character, ..

Implements MWAWListener.

Referenced by insertCharacter().

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

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

Implements MWAWListener.

Referenced by ClarisWksDatabase::sendDatabase(), and ClarisWksSpreadsheet::sendSpreadsheet().

int MWAWSpreadsheetListener::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 a chart in given position

adds comment

Implements MWAWListener.

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

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

Implements MWAWListener.

Referenced by ClarisWksDatabase::sendDatabase(), and ClarisWksSpreadsheet::sendSpreadsheet().

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

adds a field type

Implements MWAWListener.

bool MWAWSpreadsheetListener::insertFooter ( MWAWSubDocumentPtr  subDocument,
librevenge::RVNGPropertyList const &  extras 
) [virtual]

insert a footer

Implements MWAWListener.

bool MWAWSpreadsheetListener::insertHeader ( MWAWSubDocumentPtr  subDocument,
librevenge::RVNGPropertyList const &  extras 
) [virtual]

insert a header

Implements MWAWListener.

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

adds a shape picture in given position

Implements MWAWListener.

adds a tab

Implements MWAWListener.

Referenced by ClarisWksDatabase::sendDatabase().

adds a table in given position

void MWAWSpreadsheetListener::insertTextBox ( MWAWPosition const &  pos,
MWAWSubDocumentPtr  subDocument,
MWAWGraphicStyle const &  frameStyle = MWAWGraphicStyle::emptyStyle() 
) [virtual]

adds a textbox in given position

Implements MWAWListener.

void MWAWSpreadsheetListener::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 MWAWSpreadsheetListener::insertUnicodeString ( librevenge::RVNGString const &  str) [virtual]

adds a unicode string

Implements MWAWListener.

Referenced by insertField().

returns true if a document is opened

Implements MWAWListener.

returns true if the header/footer is open

Implements MWAWListener.

returns true if a page is opened

Implements MWAWListener.

returns true if a paragraph or a list is opened

Implements MWAWListener.

bool MWAWSpreadsheetListener::isSectionOpened ( ) const [inline, virtual]

returns true if a section is opened

Implements MWAWListener.

returns try if a subdocument is open

Implements MWAWListener.

bool MWAWSpreadsheetListener::openFrame ( MWAWPosition const &  pos,
MWAWGraphicStyle const &  style = MWAWGraphicStyle::emptyStyle() 
) [virtual]

tries to open a frame

Implements MWAWListener.

void MWAWSpreadsheetListener::openLink ( MWAWLink const &  link) [virtual]

open a link

Implements MWAWListener.

bool MWAWSpreadsheetListener::openSection ( MWAWSection const &  section) [virtual]

open a section if possible

Implements MWAWListener.

void MWAWSpreadsheetListener::openSheet ( std::vector< float > const &  colWidth,
librevenge::RVNGUnit  unit,
std::string const &  name = "" 
)
void MWAWSpreadsheetListener::openSheetRow ( float  h,
librevenge::RVNGUnit  unit 
)

open a row with given height ( if h < 0.0, set min-row-height = -h )

Referenced by ClarisWksDatabase::sendDatabase(), and ClarisWksSpreadsheet::sendSpreadsheet().

void MWAWSpreadsheetListener::openTable ( MWAWTable const &  table) [virtual]

open a table

Implements MWAWListener.

void MWAWSpreadsheetListener::openTableCell ( MWAWCell const &  cell) [virtual]

open a cell

Implements MWAWListener.

void MWAWSpreadsheetListener::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.

MWAWSpreadsheetListener& MWAWSpreadsheetListener::operator= ( const MWAWSpreadsheetListener ) [private]

operator= (unimplemented)

void MWAWSpreadsheetListener::setDocumentLanguage ( std::string  locale) [virtual]

sets the documents language

Implements MWAWListener.

void MWAWSpreadsheetListener::setFont ( MWAWFont const &  font) [virtual]

sets the font

Implements MWAWListener.

Referenced by _flushDeferredTabs(), and ClarisWksSpreadsheet::sendSpreadsheet().

void MWAWSpreadsheetListener::setParagraph ( MWAWParagraph const &  paragraph) [virtual]

sets the paragraph

Implements MWAWListener.

starts the document

Implements MWAWListener.

Referenced by _openPageSpan(), and ClarisWksGraph::sendGroupChild().


Member Data Documentation

stack of local state

Referenced by _popParsingState(), and _pushParsingState().


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