This class contains the minimal code needed to write a Graphic sub document. More...
#include <MWAWGraphicListener.hxx>
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 ¶graph) |
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 §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 | _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 | |
MWAWParserState & | m_parserState |
the parser state | |
Private Member Functions | |
MWAWGraphicListener (const MWAWGraphicListener &) | |
MWAWGraphicListener & | operator= (const MWAWGraphicListener &) |
This class contains the minimal code needed to write a Graphic sub document.
MWAWGraphicListener::MWAWGraphicListener | ( | MWAWParserState & | parserState | ) |
constructor
MWAWGraphicListener::~MWAWGraphicListener | ( | ) | [virtual] |
destructor
MWAWGraphicListener::MWAWGraphicListener | ( | const MWAWGraphicListener & | ) | [private] |
void MWAWGraphicListener::_changeList | ( | ) | [protected] |
update the list so that it corresponds to the actual level
Referenced by _endSubDocument(), _openSpan(), and endGraphic().
void MWAWGraphicListener::_closeListElement | ( | ) | [protected] |
close a list level
Referenced by _closeParagraph().
void MWAWGraphicListener::_closeParagraph | ( | ) | [protected] |
Referenced by _changeList(), _endSubDocument(), endGraphic(), and insertEOL().
void MWAWGraphicListener::_closeSpan | ( | ) | [protected] |
Referenced by _closeListElement(), _closeParagraph(), and setFont().
void MWAWGraphicListener::_endSubDocument | ( | ) | [protected] |
Referenced by handleSubDocument().
void MWAWGraphicListener::_flushText | ( | ) | [protected] |
Referenced by _closeSpan(), insertEOL(), insertField(), and insertTab().
int MWAWGraphicListener::_getListId | ( | ) | const [protected] |
low level: find a list id which corresponds to actual list and a change of level.
Referenced by _changeList().
void MWAWGraphicListener::_handleFrameParameters | ( | WPXPropertyList & | propList, |
Box2f const & | pos, | ||
MWAWGraphicStyle const & | style | ||
) | [protected] |
void MWAWGraphicListener::_openListElement | ( | ) | [protected] |
open a list level
Referenced by _openSpan().
void MWAWGraphicListener::_openParagraph | ( | ) | [protected] |
Referenced by _openSpan().
void MWAWGraphicListener::_openSpan | ( | ) | [protected] |
Referenced by insertChar(), insertEOL(), insertField(), insertTab(), insertUnicode(), and insertUnicodeString().
void MWAWGraphicListener::_popParsingState | ( | ) | [protected] |
resets the previous parsing state
Referenced by handleSubDocument().
shared_ptr< MWAWGraphicListenerInternal::State > MWAWGraphicListener::_pushParsingState | ( | ) | [protected] |
creates a new parsing state (copy of the actual state)
Referenced by handleSubDocument().
void MWAWGraphicListener::_resetParagraphState | ( | const bool | isListElement = false | ) | [protected] |
Referenced by _openListElement(), and _openParagraph().
void MWAWGraphicListener::_startSubDocument | ( | ) | [protected] |
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.
Box2f const & MWAWGraphicListener::getGraphicBdBox | ( | ) |
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] |
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.
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] |
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.
bool MWAWGraphicListener::isSubDocumentOpened | ( | libmwaw::SubDocumentType & | subdocType | ) | const [virtual] |
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
shared_ptr<MWAWGraphicListenerInternal::GraphicState> MWAWGraphicListener::m_gs [protected] |
the actual global state
Referenced by _changeList(), _closeListElement(), _closeParagraph(), _closeSpan(), _flushText(), _handleFrameParameters(), _openListElement(), _openParagraph(), _openSpan(), endGraphic(), getGraphicBdBox(), handleSubDocument(), insertEOL(), insertField(), insertTab(), and startGraphic().
MWAWParserState& MWAWGraphicListener::m_parserState [protected] |
the parser state
Referenced by _changeList(), _getListId(), _openSpan(), and insertCharacter().
shared_ptr<MWAWGraphicListenerInternal::State> MWAWGraphicListener::m_ps [protected] |
the actual local parse state
Referenced by _changeList(), _closeListElement(), _closeParagraph(), _closeSpan(), _endSubDocument(), _flushText(), _getListId(), _handleFrameParameters(), _openListElement(), _openParagraph(), _openSpan(), _popParsingState(), _pushParsingState(), _resetParagraphState(), _startSubDocument(), canWriteText(), closeFrame(), endGraphic(), getFont(), getParagraph(), handleSubDocument(), insertChar(), insertCharacter(), insertEOL(), insertField(), insertGroup(), insertTab(), insertUnicode(), insertUnicodeString(), isDocumentStarted(), isParagraphOpened(), isSubDocumentOpened(), openFrame(), setFont(), setParagraph(), and startGraphic().
std::vector<shared_ptr<MWAWGraphicListenerInternal::State> > MWAWGraphicListener::m_psStack [protected] |
stack of local state
Referenced by _popParsingState(), and _pushParsingState().