#include <WPSContentListener.h>
Public Types | |
enum | FieldType { None, PageNumber, Date, Time, Title, Link, Database } |
Defines some basic type for field. More... | |
enum | NoteType { FOOTNOTE, ENDNOTE } |
defines the footnote type More... | |
Public Member Functions | |
WPSContentListener (std::vector< WPSPageSpan > const &pageList, WPXDocumentInterface *documentInterface) | |
virtual | ~WPSContentListener () |
void | setDocumentLanguage (int lcid) |
void | startDocument () |
void | endDocument () |
void | handleSubDocument (WPSSubDocumentPtr &subDocument, libwps::SubDocumentType subDocumentType) |
bool | isHeaderFooterOpened () const |
void | insertCharacter (uint8_t character) |
adds a basic character, .. More... | |
void | insertUnicode (uint32_t character) |
adds an unicode character More... | |
void | insertUnicodeString (WPXString const &str) |
adds a unicode string More... | |
void | insertTab () |
void | insertEOL (bool softBreak=false) |
void | insertBreak (const uint8_t breakType) |
void | setTextFont (const WPXString &fontName) |
void | setFontSize (const uint16_t fontSize) |
void | setFontAttributes (const uint32_t fontAttributes) |
void | setTextLanguage (int lcid) |
void | setTextColor (const uint32_t rgb) |
void | setFont (const WPSFont &font) |
bool | isParagraphOpened () const |
returns true if a paragraph or a list is opened More... | |
void | setParagraphLineSpacing (const double lineSpacing, WPXUnit unit=WPX_PERCENT) |
void | setParagraphJustification (libwps::Justification justification, bool force=false) |
Define the paragraph justification. More... | |
void | setParagraphTextIndent (double margin) |
sets the first paragraph text indent. More... | |
void | setParagraphMargin (double margin, int pos) |
sets the paragraph margin. More... | |
void | setTabs (const std::vector< WPSTabStop > &tabStops) |
sets the tabulations. More... | |
void | setParagraphBackgroundColor (uint32_t color=0xFFFFFF) |
sets the paragraph background color More... | |
void | setParagraphBorders (int which, WPSBorder style=WPSBorder()) |
indicates that the paragraph has a basic borders (ie. More... | |
void | setCurrentList (shared_ptr< WPSList > list) |
function to set the actual list More... | |
shared_ptr< WPSList > | getCurrentList () const |
returns the current list More... | |
void | setCurrentListLevel (int level) |
function to set the level of the current list More... | |
void | insertField (FieldType type) |
adds a field type More... | |
void | insertDateTimeField (char const *format) |
insert a date/time field with given format (see strftime) More... | |
void | insertNote (const NoteType noteType, WPSSubDocumentPtr &subDocument) |
adds note More... | |
void | insertLabelNote (const NoteType noteType, WPXString const &label, WPSSubDocumentPtr &subDocument) |
adds a label note More... | |
void | insertComment (WPSSubDocumentPtr &subDocument) |
adds comment More... | |
void | insertPicture (WPSPosition const &pos, const WPXBinaryData &binaryData, std::string type="image/pict", WPXPropertyList frameExtras=WPXPropertyList()) |
adds a picture in given position More... | |
void | insertTextBox (WPSPosition const &pos, WPSSubDocumentPtr subDocument, WPXPropertyList frameExtras=WPXPropertyList()) |
adds a textbox in given position More... | |
void | openTable (std::vector< float > const &colWidth, WPXUnit unit) |
open a table More... | |
void | closeTable () |
closes this table More... | |
void | openTableRow (float h, WPXUnit unit, bool headerRow=false) |
open a row with given height. More... | |
void | closeTableRow () |
closes this row More... | |
void | openTableCell (WPSCell const &cell, WPXPropertyList const &extras) |
low level function to define a cell. More... | |
void | closeTableCell () |
close a cell More... | |
void | addEmptyTableCell (Vec2i const &pos, Vec2i span=Vec2i(1, 1)) |
add empty cell More... | |
bool | isSectionOpened () const |
returns true if a section is opened More... | |
int | getSectionNumColumns () const |
returns the actual number of columns ( or 1 if no section is opened ) More... | |
bool | openSection (std::vector< int > colsWidth=std::vector< int >(), WPXUnit unit=WPX_INCH) |
open a section if possible More... | |
bool | closeSection () |
close a section More... | |
Static Public Member Functions | |
static void | appendUnicode (uint32_t val, WPXString &buffer) |
adds an unicode character to a string ( with correct encoding ). More... | |
Protected Member Functions | |
void | _openSection () |
void | _closeSection () |
void | _openPageSpan () |
void | _closePageSpan () |
void | _updatePageSpanDependent (bool set) |
void | _recomputeParagraphPositions () |
void | _startSubDocument () |
void | _endSubDocument () |
void | _handleFrameParameters (WPXPropertyList &propList, WPSPosition const &pos) |
bool | _openFrame (WPSPosition const &pos, WPXPropertyList extras=WPXPropertyList()) |
void | _closeFrame () |
void | _openParagraph () |
void | _closeParagraph () |
void | _appendParagraphProperties (WPXPropertyList &propList, const bool isListElement=false) |
void | _getTabStops (WPXPropertyListVector &tabStops) |
void | _appendJustification (WPXPropertyList &propList, libwps::Justification justification) |
void | _resetParagraphState (const bool isListElement=false) |
void | _openListElement () |
void | _closeListElement () |
void | _changeList () |
void | _openSpan () |
void | _closeSpan () |
void | _flushText () |
void | _flushDeferredTabs () |
void | _insertBreakIfNecessary (WPXPropertyList &propList) |
shared_ptr < WPSContentParsingState > | _pushParsingState () |
creates a new parsing state (copy of the actual state) More... | |
void | _popParsingState () |
resets the previous parsing state More... | |
Static Protected Member Functions | |
static void | _addLanguage (int lcid, WPXPropertyList &propList) |
Protected Attributes | |
shared_ptr < WPSDocumentParsingState > | m_ds |
shared_ptr < WPSContentParsingState > | m_ps |
std::vector< shared_ptr < WPSContentParsingState > > | m_psStack |
WPXDocumentInterface * | m_documentInterface |
Private Member Functions | |
WPSContentListener (const WPSContentListener &) | |
WPSContentListener & | operator= (const WPSContentListener &) |
WPSContentListener::WPSContentListener | ( | std::vector< WPSPageSpan > const & | pageList, |
WPXDocumentInterface * | documentInterface | ||
) |
|
virtual |
|
private |
|
staticprotected |
Referenced by _openSpan().
|
protected |
Referenced by _appendParagraphProperties().
|
protected |
Referenced by _openListElement(), and _openParagraph().
|
protected |
Referenced by _closeSection(), _endSubDocument(), _openSpan(), closeTableCell(), endDocument(), and insertLabelNote().
|
protected |
|
protected |
Referenced by _closeParagraph().
|
protected |
Referenced by _closeListElement(), _closeParagraph(), endDocument(), and insertBreak().
|
protected |
|
protected |
Referenced by _closePageSpan(), _openListElement(), _openParagraph(), closeSection(), endDocument(), and handleSubDocument().
|
protected |
|
protected |
Referenced by closeTable(), and handleSubDocument().
|
protected |
Referenced by insertCharacter(), insertEOL(), insertTab(), insertUnicode(), and insertUnicodeString().
|
protected |
Referenced by _closeSpan(), _openFrame(), insertComment(), insertEOL(), insertField(), insertLabelNote(), and insertTab().
|
protected |
Referenced by _openListElement(), and _openParagraph().
|
protected |
Referenced by _openFrame().
|
protected |
Referenced by _appendParagraphProperties().
|
protected |
|
protected |
Referenced by _openSpan().
|
protected |
Referenced by _openSection().
|
protected |
Referenced by _openFrame(), _openSpan(), insertComment(), and insertLabelNote().
|
protected |
Referenced by _changeList(), _openListElement(), _openParagraph(), and openSection().
|
protected |
|
protected |
resets the previous parsing state
Referenced by closeTable(), and handleSubDocument().
|
protected |
creates a new parsing state (copy of the actual state)
Referenced by handleSubDocument(), and openTable().
|
protected |
Referenced by _openPageSpan(), _resetParagraphState(), setParagraphMargin(), setParagraphTextIndent(), and WPSContentListener().
|
protected |
Referenced by _openListElement(), and _openParagraph().
|
protected |
Referenced by handleSubDocument(), and openTable().
|
protected |
Referenced by _openPageSpan(), and WPSContentListener().
add empty cell
|
static |
adds an unicode character to a string ( with correct encoding ).
Referenced by WPS4Text::footNotesDataParser(), insertUnicode(), WPS8TextStyle::readParagraph(), WPS4Text::readParagraph(), and WPS8Text::readString().
bool WPSContentListener::closeSection | ( | ) |
close a section
void WPSContentListener::closeTable | ( | ) |
closes this table
Referenced by _endSubDocument(), and endDocument().
void WPSContentListener::closeTableCell | ( | ) |
close a cell
Referenced by addEmptyTableCell(), and openTableCell().
void WPSContentListener::closeTableRow | ( | ) |
closes this row
void WPSContentListener::endDocument | ( | ) |
shared_ptr< WPSList > WPSContentListener::getCurrentList | ( | ) | const |
returns the current list
int WPSContentListener::getSectionNumColumns | ( | ) | const |
returns the actual number of columns ( or 1 if no section is opened )
void WPSContentListener::handleSubDocument | ( | WPSSubDocumentPtr & | subDocument, |
libwps::SubDocumentType | subDocumentType | ||
) |
Referenced by insertComment(), insertLabelNote(), and WPSPageSpan::sendHeaderFooters().
void WPSContentListener::insertBreak | ( | const uint8_t | breakType | ) |
void WPSContentListener::insertCharacter | ( | uint8_t | character | ) |
adds a basic character, ..
void WPSContentListener::insertComment | ( | WPSSubDocumentPtr & | subDocument | ) |
adds comment
void WPSContentListener::insertDateTimeField | ( | char const * | format | ) |
insert a date/time field with given format (see strftime)
Referenced by insertField().
void WPSContentListener::insertEOL | ( | bool | softBreak = false | ) |
void WPSContentListener::insertField | ( | WPSContentListener::FieldType | type | ) |
adds a field type
void WPSContentListener::insertLabelNote | ( | const NoteType | noteType, |
WPXString const & | label, | ||
WPSSubDocumentPtr & | subDocument | ||
) |
adds a label 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.
Referenced by insertNote().
void WPSContentListener::insertNote | ( | const NoteType | noteType, |
WPSSubDocumentPtr & | subDocument | ||
) |
adds note
void WPSContentListener::insertPicture | ( | WPSPosition const & | pos, |
const WPXBinaryData & | binaryData, | ||
std::string | type = "image/pict" , |
||
WPXPropertyList | frameExtras = WPXPropertyList() |
||
) |
adds a picture in given position
void WPSContentListener::insertTab | ( | ) |
void WPSContentListener::insertTextBox | ( | WPSPosition const & | pos, |
WPSSubDocumentPtr | subDocument, | ||
WPXPropertyList | frameExtras = WPXPropertyList() |
||
) |
adds a textbox in given position
void WPSContentListener::insertUnicode | ( | uint32_t | character | ) |
adds an unicode character
by convention if character=0xfffd(undef), no character is added
Referenced by insertCharacter().
void WPSContentListener::insertUnicodeString | ( | WPXString const & | str | ) |
adds a unicode string
Referenced by insertDateTimeField(), and insertField().
bool WPSContentListener::isHeaderFooterOpened | ( | ) | const |
bool WPSContentListener::isParagraphOpened | ( | ) | const |
returns true if a paragraph or a list is opened
bool WPSContentListener::isSectionOpened | ( | ) | const |
returns true if a section is opened
bool WPSContentListener::openSection | ( | std::vector< int > | colsWidth = std::vector<int>() , |
WPXUnit | unit = WPX_INCH |
||
) |
open a section if possible
void WPSContentListener::openTable | ( | std::vector< float > const & | colWidth, |
WPXUnit | unit | ||
) |
open a table
void WPSContentListener::openTableCell | ( | WPSCell const & | cell, |
WPXPropertyList const & | extras | ||
) |
low level function to define a cell.
cell | the cell position, alignement, ... |
extras | to be used to pass extra data, for instance spreadsheet data |
void WPSContentListener::openTableRow | ( | float | h, |
WPXUnit | unit, | ||
bool | headerRow = false |
||
) |
open a row with given height.
If h<0, use min-row-heigth
|
private |
void WPSContentListener::setCurrentList | ( | shared_ptr< WPSList > | list | ) |
function to set the actual list
void WPSContentListener::setCurrentListLevel | ( | int | level | ) |
function to set the level of the current list
void WPSContentListener::setDocumentLanguage | ( | int | lcid | ) |
void WPSContentListener::setFont | ( | const WPSFont & | font | ) |
void WPSContentListener::setFontAttributes | ( | const uint32_t | fontAttributes | ) |
Referenced by _flushDeferredTabs(), and setFont().
void WPSContentListener::setFontSize | ( | const uint16_t | fontSize | ) |
Referenced by setFont().
void WPSContentListener::setParagraphBackgroundColor | ( | uint32_t | color = 0xFFFFFF | ) |
sets the paragraph background color
indicates that the paragraph has a basic borders (ie.
a black line)
which | = libwps::LeftBorderBit | ... |
style | indicates the style |
void WPSContentListener::setParagraphJustification | ( | libwps::Justification | justification, |
bool | force = false |
||
) |
Define the paragraph justification.
You can set force=true to force a break if there is a justification change
void WPSContentListener::setParagraphLineSpacing | ( | const double | lineSpacing, |
WPXUnit | unit = WPX_PERCENT |
||
) |
void WPSContentListener::setParagraphMargin | ( | double | margin, |
int | pos | ||
) |
sets the paragraph margin.
margin | is given in inches |
pos | in WPS_LEFT, WPS_RIGHT, WPS_TOP, WPS_BOTTOM |
void WPSContentListener::setParagraphTextIndent | ( | double | margin | ) |
sets the first paragraph text indent.
void WPSContentListener::setTabs | ( | const std::vector< WPSTabStop > & | tabStops | ) |
sets the tabulations.
tabStops | the tabulations |
void WPSContentListener::setTextColor | ( | const uint32_t | rgb | ) |
Referenced by setFont().
void WPSContentListener::setTextFont | ( | const WPXString & | fontName | ) |
Referenced by setFont().
void WPSContentListener::setTextLanguage | ( | int | lcid | ) |
Referenced by setFont().
void WPSContentListener::startDocument | ( | ) |
Referenced by _openPageSpan().
|
protected |
Referenced by _changeList(), _closeFrame(), _closeListElement(), _closePageSpan(), _closeParagraph(), _closeSection(), _closeSpan(), _flushDeferredTabs(), _flushText(), _openFrame(), _openListElement(), _openPageSpan(), _openParagraph(), _openSection(), _openSpan(), addEmptyTableCell(), closeTable(), closeTableCell(), closeTableRow(), endDocument(), insertComment(), insertEOL(), insertField(), insertLabelNote(), openTable(), openTableCell(), openTableRow(), and startDocument().
|
protected |
|
protected |
Referenced by _appendParagraphProperties(), _changeList(), _closeFrame(), _closeListElement(), _closePageSpan(), _closeParagraph(), _closeSection(), _closeSpan(), _endSubDocument(), _flushDeferredTabs(), _flushText(), _getTabStops(), _insertBreakIfNecessary(), _openFrame(), _openListElement(), _openPageSpan(), _openParagraph(), _openSection(), _openSpan(), _popParsingState(), _pushParsingState(), _recomputeParagraphPositions(), _resetParagraphState(), _startSubDocument(), _updatePageSpanDependent(), addEmptyTableCell(), closeSection(), closeTable(), closeTableCell(), closeTableRow(), endDocument(), getCurrentList(), getSectionNumColumns(), handleSubDocument(), insertBreak(), insertCharacter(), insertComment(), insertEOL(), insertLabelNote(), insertNote(), insertTab(), insertUnicode(), insertUnicodeString(), isParagraphOpened(), isSectionOpened(), openSection(), openTable(), openTableCell(), openTableRow(), setCurrentList(), setCurrentListLevel(), setFontAttributes(), setFontSize(), setParagraphBackgroundColor(), setParagraphBorders(), setParagraphJustification(), setParagraphLineSpacing(), setParagraphMargin(), setParagraphTextIndent(), setTabs(), setTextColor(), setTextFont(), and setTextLanguage().
|
protected |
Referenced by _popParsingState(), and _pushParsingState().