MWAWGraphicListener Class Reference

This class contains the minimal code needed to write a Graphic sub document. More...

#include <MWAWGraphicListener.hxx>

Inheritance diagram for MWAWGraphicListener:
MWAWListener

List of all members.

Public Member Functions

 MWAWGraphicListener (MWAWParserState &parserState)
 constructor
virtual ~MWAWGraphicListener ()
 destructor
void startGraphic (Box2f const &bdbox)
 starts a new graphic
bool endGraphic (WPXBinaryData &data, std::string &mimeType)
 ends the actual graphic and fill the final WPXBinaryData, ...
bool isDocumentStarted () const
 returns true if a document is opened
void handleSubDocument (Vec2f const &orig, 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 a text zone is opened
Box2f const & getGraphicBdBox ()
 returns the graphic bdbox.
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 insertPicture (Box2f const &bdbox, MWAWGraphicStyle const &style, const WPXBinaryData &binaryData, std::string type="image/pict")
 adds a picture in given position
void insertPicture (Box2f const &bdbox, MWAWGraphicShape const &shape, MWAWGraphicStyle const &style)
 adds a shape picture in given position
void insertTextBox (Box2f const &bdbox, MWAWSubDocumentPtr subDocument, MWAWGraphicStyle const &style)
 adds a textbox in given position
void insertGroup (Box2f const &bdbox, MWAWSubDocumentPtr subDocument)
 adds a group: ie.
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 _startSubDocument ()
void _endSubDocument ()
void _handleFrameParameters (WPXPropertyList &propList, Box2f const &pos, MWAWGraphicStyle const &style)
bool openFrame ()
void closeFrame ()
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 ()
shared_ptr
< MWAWGraphicListenerInternal::State
_pushParsingState ()
 creates a new parsing state (copy of the actual state)
void _popParsingState ()
 resets the previous parsing state

Protected Attributes

shared_ptr
< MWAWGraphicListenerInternal::GraphicState
m_gs
 the actual global state
shared_ptr
< MWAWGraphicListenerInternal::State
m_ps
 the actual local parse state
std::vector< shared_ptr
< MWAWGraphicListenerInternal::State > > 
m_psStack
 stack of local state
MWAWParserStatem_parserState
 the parser state

Private Member Functions

 MWAWGraphicListener (const MWAWGraphicListener &)
MWAWGraphicListeneroperator= (const MWAWGraphicListener &)

Detailed Description

This class contains the minimal code needed to write a Graphic sub document.

Note:
it will be probably be enhanced in some near/far futur... All units are specicified in WPX_POINT

Constructor & Destructor Documentation


Member Function Documentation

void MWAWGraphicListener::_changeList ( ) [protected]

update the list so that it corresponds to the actual level

Referenced by _endSubDocument(), _openSpan(), and endGraphic().

close a list level

Referenced by _closeParagraph().

Referenced by handleSubDocument().

int MWAWGraphicListener::_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 MWAWGraphicListener::_handleFrameParameters ( WPXPropertyList &  propList,
Box2f const &  pos,
MWAWGraphicStyle const &  style 
) [protected]

open a list level

Referenced by _openSpan().

Referenced by _openSpan().

resets the previous parsing state

Referenced by handleSubDocument().

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

Returns:
the old one

Referenced by handleSubDocument().

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

Referenced by _openListElement(), and _openParagraph().

Referenced by handleSubDocument().

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

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

Implements MWAWListener.

bool MWAWGraphicListener::canWriteText ( ) const [virtual]

returns true if a text zone is opened

Implements MWAWListener.

void MWAWGraphicListener::closeFrame ( ) [protected]
bool MWAWGraphicListener::closeSection ( ) [inline, virtual]

close a section

Implements MWAWListener.

bool MWAWGraphicListener::endGraphic ( WPXBinaryData &  data,
std::string &  mimeType 
)

ends the actual graphic and fill the final WPXBinaryData, ...

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

returns the actual font

Implements MWAWListener.

returns the graphic bdbox.

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

returns the actual paragraph

Implements MWAWListener.

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

returns the actual section

Implements MWAWListener.

void MWAWGraphicListener::handleSubDocument ( Vec2f const &  orig,
MWAWSubDocumentPtr  subDocument,
libmwaw::SubDocumentType  subDocumentType 
)

function called to add a subdocument

Referenced by insertGroup().

void MWAWGraphicListener::insertBreak ( BreakType  breakType) [virtual]

inserts a break type: ColumBreak, PageBreak, ..

Implements MWAWListener.

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

adds a basic character, ..

Implements MWAWListener.

Referenced by insertCharacter().

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

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

Implements MWAWListener.

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

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

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

Implements MWAWListener.

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

adds a field type

Implements MWAWListener.

void MWAWGraphicListener::insertGroup ( Box2f const &  bdbox,
MWAWSubDocumentPtr  subDocument 
)

adds a group: ie.

next insertion will be done relative to this bdbox[0] position

Referenced by CWGraph::sendGroup().

void MWAWGraphicListener::insertPicture ( Box2f const &  bdbox,
MWAWGraphicStyle const &  style,
const WPXBinaryData &  binaryData,
std::string  type = "image/pict" 
)

adds a picture in given position

Referenced by CWGraph::sendGroup().

void MWAWGraphicListener::insertPicture ( Box2f const &  bdbox,
MWAWGraphicShape const &  shape,
MWAWGraphicStyle const &  style 
)

adds a shape picture in given position

void MWAWGraphicListener::insertTab ( ) [virtual]

adds a tab

Implements MWAWListener.

void MWAWGraphicListener::insertTextBox ( Box2f const &  bdbox,
MWAWSubDocumentPtr  subDocument,
MWAWGraphicStyle const &  style 
)

adds a textbox in given position

Referenced by CWGraph::sendGroup().

void MWAWGraphicListener::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 MWAWGraphicListener::insertUnicodeString ( WPXString const &  str) [virtual]

adds a unicode string

Implements MWAWListener.

Referenced by insertField().

bool MWAWGraphicListener::isDocumentStarted ( ) const [virtual]

returns true if a document is opened

Implements MWAWListener.

bool MWAWGraphicListener::isParagraphOpened ( ) const [virtual]

returns true if a paragraph or a list is opened

Implements MWAWListener.

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

returns true if a section is opened

Implements MWAWListener.

returns try if a subdocument is open

Implements MWAWListener.

bool MWAWGraphicListener::openFrame ( ) [protected]
bool MWAWGraphicListener::openSection ( MWAWSection const &  section) [virtual]

open a section if possible

Implements MWAWListener.

MWAWGraphicListener& MWAWGraphicListener::operator= ( const MWAWGraphicListener ) [private]
void MWAWGraphicListener::setFont ( MWAWFont const &  font) [virtual]

sets the font

Implements MWAWListener.

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

sets the paragraph

Implements MWAWListener.

void MWAWGraphicListener::startGraphic ( Box2f const &  bdbox)

starts a new graphic


Member Data Documentation

stack of local state

Referenced by _popParsingState(), and _pushParsingState().


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