This class stores info about the parent elements of the current element being parsed. More...
#include <ODi_ElementStack.h>
Public Member Functions | |
ODi_ElementStack () | |
Constructor. | |
~ODi_ElementStack () | |
Destructor. | |
const ODi_StartTag * | getStartTag (UT_sint32 level) |
bool | hasElement (const gchar *pName) const |
UT_sint32 | getElementLevel (const gchar *pName) const |
Returns the level of the closest element with the given name. | |
const ODi_StartTag * | getClosestElement (const gchar *pName, UT_sint32 fromLevel=0) const |
Returns the closest parent with the given name. | |
void | startElement (const gchar *pName, const gchar **ppAtts) |
Must be the last command called by the starElement method of the listener class. | |
void | endElement (const gchar *pName) |
Must be the last command called by the endElement method of the listener class. | |
bool | isEmpty () const |
void | clear () |
UT_sint32 | getStackSize () const |
Private Attributes | |
UT_GenericVector< ODi_StartTag * > * | m_pStartTags |
UT_sint32 | m_stackSize |
This class stores info about the parent elements of the current element being parsed.
Example:
If you are parsing the <style:footnote-sep/> element, this class will hold info about its parents. On this case: <style:page-layout-properties>, <style:page-layout> and <office:automatic-styles>.
<office:automatic-styles> <style:page-layout> <style:page-layout-properties> <style:footnote-sep/> </style:page-layout-properties> </style:page-layout> </office:automatic-styles>
When parsing a start element tag, level 0 is the parent element.
When parsing a start element tag, level 0 is its own element, with level 1 being the parent and so on.
ODi_ElementStack::ODi_ElementStack | ( | ) |
Constructor.
ODi_ElementStack::~ODi_ElementStack | ( | ) |
Destructor.
References DELETEP, m_pStartTags, and UT_VECTOR_PURGEALL.
void ODi_ElementStack::clear | ( | void | ) | [inline] |
References m_stackSize.
void ODi_ElementStack::endElement | ( | const gchar * | pName | ) |
Must be the last command called by the endElement method of the listener class.
References m_pStartTags, m_stackSize, UT_ASSERT, and UT_return_if_fail.
Referenced by ODi_StreamListener::_endElement().
const ODi_StartTag * ODi_ElementStack::getClosestElement | ( | const gchar * | pName, | |
UT_sint32 | fromLevel = 0 | |||
) | const |
Returns the closest parent with the given name.
It returns NULL if there is no parent with the given name.
pName | Element name. | |
fromLevel | The level from which the search begins. |
References ODi_StartTag::getName(), m_pStartTags, and m_stackSize.
Referenced by ODi_TextContent_ListenerState::_insureInSection(), and ODi_TextContent_ListenerState::_startParagraphElement().
UT_sint32 ODi_ElementStack::getElementLevel | ( | const gchar * | pName | ) | const |
Returns the level of the closest element with the given name.
References ODi_StartTag::getName(), m_pStartTags, m_stackSize, UT_ASSERT_HARMLESS, and UT_SHOULD_NOT_HAPPEN.
UT_sint32 ODi_ElementStack::getStackSize | ( | ) | const [inline] |
References m_stackSize.
Referenced by ODi_StreamListener::_endElement(), ODi_StreamListener::_handleStateAction(), and ODi_Style_Style::startElement().
const ODi_StartTag * ODi_ElementStack::getStartTag | ( | UT_sint32 | level | ) |
level | 0 is the immediate parent, 1 is the parent of the parent and so on. |
On the startElement method, level 0 is the parent start tag. On the endElement method, level 0 is the corresponding start tag.
References m_pStartTags, and m_stackSize.
Referenced by ODi_Frame_ListenerState::_drawImage(), ODi_Frame_ListenerState::_drawInlineImage(), ODi_Frame_ListenerState::_drawObject(), ODi_Frame_ListenerState::_drawTextBox(), ODi_TextContent_ListenerState::_endParagraphElement(), ODi_Frame_ListenerState::_getFrameProperties(), ODi_TextContent_ListenerState::_startParagraphElement(), ODi_TextContent_ListenerState::endElement(), ODi_MetaStream_ListenerState::endElement(), ODi_TextContent_ListenerState::startElement(), ODi_StylesStream_ListenerState::startElement(), and ODi_Style_Style::startElement().
bool ODi_ElementStack::hasElement | ( | const gchar * | pName | ) | const |
References ODi_StartTag::getName(), and m_stackSize.
Referenced by ODi_Frame_ListenerState::_drawImage(), ODi_Frame_ListenerState::_drawObject(), ODi_TextContent_ListenerState::_endParagraphElement(), ODi_Style_PageLayout::_parseHeaderFooterProperties(), ODi_TextContent_ListenerState::_startParagraphElement(), ODi_Style_Style_Family::addStyle(), ODi_Frame_ListenerState::ODi_Frame_ListenerState(), ODi_Style_Style::ODi_Style_Style(), ODi_Table_ListenerState::ODi_Table_ListenerState(), and ODi_Frame_ListenerState::startElement().
bool ODi_ElementStack::isEmpty | ( | ) | const [inline] |
References m_stackSize.
void ODi_ElementStack::startElement | ( | const gchar * | pName, | |
const gchar ** | ppAtts | |||
) |
Must be the last command called by the starElement method of the listener class.
References UT_GenericVector< T >::getItemCount(), m_pStartTags, m_stackSize, UT_GenericVector< T >::push_back(), ODi_StartTag::set(), UT_ASSERT_HARMLESS, and UT_SHOULD_NOT_HAPPEN.
Referenced by ODi_StreamListener::_startElement().
UT_GenericVector<ODi_StartTag*>* ODi_ElementStack::m_pStartTags [private] |
Referenced by endElement(), getClosestElement(), getElementLevel(), getStartTag(), startElement(), and ~ODi_ElementStack().
UT_sint32 ODi_ElementStack::m_stackSize [private] |
Referenced by clear(), endElement(), getClosestElement(), getElementLevel(), getStackSize(), getStartTag(), hasElement(), isEmpty(), and startElement().