#include <OXML_Document.h>
Public Member Functions | |
OXML_SharedStyle | getStyleById (const std::string &id) const |
Returns a reference to the FIRST style with corresponding ID OR empty SharedStyle if none found. | |
OXML_SharedStyle | getStyleByName (const std::string &name) const |
Returns a reference to the FIRST style with corresponding name OR empty SharedStyle if none found. | |
UT_Error | addStyle (const std::string &id, const std::string &name, const gchar **attributes) |
UT_Error | addStyle (const OXML_SharedStyle &obj) |
UT_Error | clearStyles () |
UT_Error | addList (const OXML_SharedList &obj) |
UT_Error | addImage (const OXML_SharedImage &obj) |
OXML_SharedList | getListById (UT_uint32 id) const |
OXML_SharedImage | getImageById (const std::string &id) const |
OXML_SharedSection | getFootnote (const std::string &id) const |
Returns a reference to the FIRST footnote with corresponding ID OR empty SharedSection if none found. | |
UT_Error | addFootnote (const OXML_SharedSection &obj) |
UT_Error | clearFootnotes () |
OXML_SharedSection | getEndnote (const std::string &id) const |
UT_Error | addEndnote (const OXML_SharedSection &obj) |
UT_Error | clearEndnotes () |
OXML_SharedSection | getHeader (const std::string &id) const |
Returns a reference to the FIRST header with corresponding ID OR empty SharedSection if none found. | |
UT_Error | addHeader (const OXML_SharedSection &obj) |
UT_Error | clearHeaders () |
bool | isAllDefault (const bool &header) const |
OXML_SharedSection | getHdrFtrById (const bool &header, const std::string &id) const |
OXML_SharedSection | getFooter (const std::string &id) const |
Returns a reference to the FIRST footer with corresponding ID OR NULL if none found. | |
UT_Error | addFooter (const OXML_SharedSection &obj) |
UT_Error | clearFooters () |
OXML_SharedSection | getLastSection () const |
Retrieves the last appended section of the document OR empty SharedSection if no sections have been appended. | |
OXML_SharedSection | getSection (const std::string &id) const |
Returns a reference to the FIRST section with corresponding ID OR empty SharedSection if none found. | |
UT_Error | appendSection (const OXML_SharedSection &obj) |
Appends a new section at the end of the list. | |
UT_Error | clearSections () |
OXML_SharedTheme | getTheme () |
OXML_SharedFontManager | getFontManager () |
UT_Error | serialize (IE_Exp_OpenXML *exporter) |
Writes the OpenXML document and all its content to a file on disk. | |
UT_Error | addToPT (PD_Document *pDocument) |
Builds the Abiword Piecetable representation of the OpenXML document and all its content. | |
std::string | getMappedNumberingId (const std::string &numId) const |
bool | setMappedNumberingId (const std::string &numId, const std::string &abstractNumId) |
std::string | getBookmarkName (const std::string &bookmarkId) const |
std::string | getBookmarkId (const std::string &bookmarkName) const |
bool | setBookmarkName (const std::string &bookmarkId, const std::string &bookmarkName) |
void | setPageWidth (const std::string &width) |
void | setPageHeight (const std::string &height) |
void | setPageOrientation (const std::string &orientation) |
void | setPageMargins (const std::string &top, const std::string &left, const std::string &right, const std::string &bottom) |
void | setColumns (const std::string &colNum, const std::string &colSep) |
Static Public Member Functions | |
static OXML_Document * | getNewInstance () |
Clears any previous document instance and provides a new blank one. | |
static OXML_Document * | getInstance () |
Provides a reference to the current OpenXML document. | |
static void | destroyInstance () |
Frees the current document and all its content from memory. | |
static OXML_SharedSection | getCurrentSection () |
Provides a pointer to the last section that was appended (or empty SharedSection if none found). | |
Private Member Functions | |
OXML_Document () | |
virtual | ~OXML_Document () |
void | _assignHdrFtrIds () |
UT_Error | applyPageProps (PD_Document *pDocument) |
Private Attributes | |
OXML_SectionVector | m_sections |
OXML_SectionMap | m_headers |
OXML_SectionMap | m_footers |
OXML_SectionMap | m_footnotes |
OXML_SectionMap | m_endnotes |
OXML_StyleMap | m_styles_by_id |
OXML_StyleMap | m_styles_by_name |
OXML_SharedTheme | m_theme |
OXML_SharedFontManager | m_fontManager |
OXML_ListMap | m_lists_by_id |
OXML_ImageMap | m_images_by_id |
std::map< std::string, std::string > | m_numberingMap |
std::map< std::string, std::string > | m_bookmarkMap |
std::string | m_pageWidth |
std::string | m_pageHeight |
std::string | m_pageOrientation |
std::string | m_pageMarginTop |
std::string | m_pageMarginLeft |
std::string | m_pageMarginRight |
std::string | m_pageMarginBottom |
std::string | m_colNum |
std::string | m_colSep |
Static Private Attributes | |
static OXML_Document * | s_docInst = NULL |
OXML_Document::OXML_Document | ( | ) | [private] |
References clearEndnotes(), clearFooters(), clearFootnotes(), clearHeaders(), clearSections(), and clearStyles().
Referenced by getInstance().
OXML_Document::~OXML_Document | ( | ) | [private, virtual] |
References clearEndnotes(), clearFooters(), clearFootnotes(), clearHeaders(), clearSections(), and clearStyles().
void OXML_Document::_assignHdrFtrIds | ( | ) | [private] |
References m_footers, m_headers, and UT_convertToDimensionlessString().
Referenced by addToPT().
UT_Error OXML_Document::addEndnote | ( | const OXML_SharedSection & | obj | ) |
References m_endnotes, UT_ERROR, and UT_return_val_if_fail.
Referenced by OXMLi_ListenerState_Endnote::endElement(), and IE_Exp_OpenXML_Listener::populateStrux().
UT_Error OXML_Document::addFooter | ( | const OXML_SharedSection & | obj | ) |
References m_footers, UT_ERROR, and UT_return_val_if_fail.
Referenced by OXMLi_ListenerState_HdrFtr::endElement(), and IE_Exp_OpenXML_Listener::populateStrux().
UT_Error OXML_Document::addFootnote | ( | const OXML_SharedSection & | obj | ) |
References m_footnotes, UT_ERROR, and UT_return_val_if_fail.
Referenced by OXMLi_ListenerState_Footnote::endElement(), and IE_Exp_OpenXML_Listener::populateStrux().
UT_Error OXML_Document::addHeader | ( | const OXML_SharedSection & | obj | ) |
References m_headers, UT_ERROR, and UT_return_val_if_fail.
Referenced by OXMLi_ListenerState_HdrFtr::endElement(), and IE_Exp_OpenXML_Listener::populateStrux().
UT_Error OXML_Document::addImage | ( | const OXML_SharedImage & | obj | ) |
References m_images_by_id, UT_ERROR, and UT_return_val_if_fail.
Referenced by OXMLi_ListenerState_Image::addImage(), and IE_Exp_OpenXML_Listener::addImages().
UT_Error OXML_Document::addList | ( | const OXML_SharedList & | obj | ) |
References m_lists_by_id, UT_ERROR, and UT_return_val_if_fail.
Referenced by IE_Exp_OpenXML_Listener::addLists(), and OXMLi_ListenerState_Numbering::endElement().
UT_Error OXML_Document::addStyle | ( | const std::string & | id, | |
const std::string & | name, | |||
const gchar ** | attributes | |||
) |
References PP_std_copyProps(), and UT_DEBUGMSG.
Referenced by IE_Exp_OpenXML_Listener::addDocumentStyles(), and OXMLi_ListenerState_Styles::endElement().
UT_Error OXML_Document::addStyle | ( | const OXML_SharedStyle & | obj | ) |
References m_styles_by_id, m_styles_by_name, UT_ERROR, and UT_return_val_if_fail.
UT_Error OXML_Document::addToPT | ( | PD_Document * | pDocument | ) |
Builds the Abiword Piecetable representation of the OpenXML document and all its content.
This method is used during the import process.
pDocument | A valid reference to the PD_Document object. |
References _assignHdrFtrIds(), applyPageProps(), m_footers, m_headers, m_images_by_id, m_lists_by_id, m_pageMarginBottom, m_pageMarginLeft, m_pageMarginRight, m_pageMarginTop, m_sections, m_styles_by_id, and UT_OK.
Referenced by IE_Imp_OpenXML::_loadFile().
UT_Error OXML_Document::appendSection | ( | const OXML_SharedSection & | obj | ) |
Appends a new section at the end of the list.
References m_sections, UT_DEBUGMSG, UT_ERROR, and UT_return_val_if_fail.
Referenced by OXMLi_ListenerState_MainDocument::endElement(), and IE_Exp_OpenXML_Listener::populateStrux().
UT_Error OXML_Document::applyPageProps | ( | PD_Document * | pDocument | ) | [private] |
References DIM_IN, fp_PageSize::getPredefinedName(), m_pageHeight, m_pageOrientation, m_pageWidth, PD_Document::setPageSizeFromFile(), UT_convertDimensionless(), and UT_OK.
Referenced by addToPT().
UT_Error OXML_Document::clearEndnotes | ( | ) |
References m_endnotes, and UT_OK.
Referenced by OXML_Document(), and ~OXML_Document().
UT_Error OXML_Document::clearFooters | ( | ) |
References m_footers, and UT_OK.
Referenced by OXML_Document(), and ~OXML_Document().
UT_Error OXML_Document::clearFootnotes | ( | ) |
References m_footnotes, and UT_OK.
Referenced by OXML_Document(), and ~OXML_Document().
UT_Error OXML_Document::clearHeaders | ( | ) |
References m_headers, and UT_OK.
Referenced by OXML_Document(), and ~OXML_Document().
UT_Error OXML_Document::clearSections | ( | ) |
References m_sections, and UT_OK.
Referenced by OXML_Document(), and ~OXML_Document().
UT_Error OXML_Document::clearStyles | ( | ) |
References m_styles_by_id, m_styles_by_name, and UT_OK.
Referenced by OXML_Document(), and ~OXML_Document().
void OXML_Document::destroyInstance | ( | ) | [static] |
Frees the current document and all its content from memory.
References DELETEP, and s_docInst.
Referenced by IE_Imp_OpenXML::_cleanup(), getNewInstance(), and IE_Exp_OpenXML_Listener::~IE_Exp_OpenXML_Listener().
std::string OXML_Document::getBookmarkId | ( | const std::string & | bookmarkName | ) | const |
References m_bookmarkMap.
Referenced by IE_Exp_OpenXML_Listener::populate().
std::string OXML_Document::getBookmarkName | ( | const std::string & | bookmarkId | ) | const |
References m_bookmarkMap, and UT_DEBUGMSG.
Referenced by OXMLi_ListenerState_Common::startElement().
OXML_SharedSection OXML_Document::getCurrentSection | ( | ) | [static] |
Provides a pointer to the last section that was appended (or empty SharedSection if none found).
References getLastSection(), s_docInst, and UT_return_val_if_fail.
OXML_SharedSection OXML_Document::getEndnote | ( | const std::string & | id | ) | const |
References m_endnotes.
Referenced by OXML_Element_Field::addToPT().
OXML_SharedFontManager OXML_Document::getFontManager | ( | ) |
References m_fontManager, and UT_DEBUGMSG.
Referenced by OXMLi_ListenerState_DocSettings::startElement(), and OXMLi_ListenerState_Common::startElement().
OXML_SharedSection OXML_Document::getFooter | ( | const std::string & | id | ) | const |
Returns a reference to the FIRST footer with corresponding ID OR NULL if none found.
References m_footers.
Referenced by OXML_Section::_setReferenceIds(), and OXMLi_ListenerState_Common::startElement().
OXML_SharedSection OXML_Document::getFootnote | ( | const std::string & | id | ) | const |
Returns a reference to the FIRST footnote with corresponding ID OR empty SharedSection if none found.
References m_footnotes.
Referenced by OXML_Element_Field::addToPT().
OXML_SharedSection OXML_Document::getHdrFtrById | ( | const bool & | header, | |
const std::string & | id | |||
) | const |
References gchar, m_footers, and m_headers.
Referenced by OXML_Section::serializeProperties().
OXML_SharedSection OXML_Document::getHeader | ( | const std::string & | id | ) | const |
Returns a reference to the FIRST header with corresponding ID OR empty SharedSection if none found.
References m_headers.
Referenced by OXML_Section::_setReferenceIds(), and OXMLi_ListenerState_Common::startElement().
OXML_SharedImage OXML_Document::getImageById | ( | const std::string & | id | ) | const |
References m_images_by_id.
Referenced by OXML_Element_Image::addToPT().
OXML_Document * OXML_Document::getInstance | ( | ) | [static] |
Provides a reference to the current OpenXML document.
References OXML_Document(), and s_docInst.
Referenced by OXMLi_ListenerState_Theme::_initializeTheme(), IE_Imp_OpenXML::_loadFile(), OXML_Section::_setReferenceIds(), OXMLi_ListenerState_Image::addImage(), OXML_Style::addToPT(), OXML_Element_Paragraph::addToPT(), OXML_Element_Image::addToPT(), OXML_Element_Field::addToPT(), OXML_Section::applyDocumentProperties(), OXMLi_ListenerState_Styles::endElement(), OXMLi_ListenerState_Numbering::endElement(), OXMLi_ListenerState_MainDocument::endElement(), OXMLi_ListenerState_HdrFtr::endElement(), OXMLi_ListenerState_Footnote::endElement(), OXMLi_ListenerState_Endnote::endElement(), OXMLi_ListenerState_Common::endElement(), getNewInstance(), OXML_FontManager::getValidFont(), OXML_Section::serialize(), OXML_Section::serializeProperties(), OXMLi_ListenerState_Table::startElement(), OXMLi_ListenerState_Numbering::startElement(), OXMLi_ListenerState_MainDocument::startElement(), OXMLi_ListenerState_DocSettings::startElement(), and OXMLi_ListenerState_Common::startElement().
OXML_SharedSection OXML_Document::getLastSection | ( | ) | const |
Retrieves the last appended section of the document OR empty SharedSection if no sections have been appended.
References m_sections, and UT_return_val_if_fail.
Referenced by getCurrentSection(), and OXML_Section::serialize().
OXML_SharedList OXML_Document::getListById | ( | UT_uint32 | id | ) | const |
References m_lists_by_id.
Referenced by OXML_Element_Paragraph::addToPT().
std::string OXML_Document::getMappedNumberingId | ( | const std::string & | numId | ) | const |
References m_numberingMap.
Referenced by OXMLi_ListenerState_Common::startElement().
OXML_Document * OXML_Document::getNewInstance | ( | ) | [static] |
Clears any previous document instance and provides a new blank one.
References destroyInstance(), and getInstance().
Referenced by OXMLi_ListenerState_Numbering::endElement(), and IE_Exp_OpenXML_Listener::IE_Exp_OpenXML_Listener().
OXML_SharedSection OXML_Document::getSection | ( | const std::string & | id | ) | const |
Returns a reference to the FIRST section with corresponding ID OR empty SharedSection if none found.
References m_sections.
OXML_SharedStyle OXML_Document::getStyleById | ( | const std::string & | id | ) | const |
Returns a reference to the FIRST style with corresponding ID OR empty SharedStyle if none found.
References m_styles_by_id.
Referenced by OXML_Style::addToPT(), OXMLi_ListenerState_Table::startElement(), and OXMLi_ListenerState_Common::startElement().
OXML_SharedStyle OXML_Document::getStyleByName | ( | const std::string & | name | ) | const |
Returns a reference to the FIRST style with corresponding name OR empty SharedStyle if none found.
References m_styles_by_name.
OXML_SharedTheme OXML_Document::getTheme | ( | ) |
References m_theme, and UT_DEBUGMSG.
Referenced by OXMLi_ListenerState_Theme::_initializeTheme(), OXML_FontManager::getValidFont(), and OXMLi_ListenerState_Common::startElement().
bool OXML_Document::isAllDefault | ( | const bool & | header | ) | const |
References gchar, m_footers, m_headers, and type.
Referenced by OXML_Section::serializeProperties().
UT_Error OXML_Document::serialize | ( | IE_Exp_OpenXML * | exporter | ) |
Writes the OpenXML document and all its content to a file on disk.
This method is used during the export process.
exporter | the actual exporter which handles writing the files. |
References IE_Exp_OpenXML::finishDocument(), IE_Exp_OpenXML::finishSectionProperties(), m_colNum, m_colSep, m_endnotes, m_footers, m_footnotes, m_headers, m_images_by_id, m_lists_by_id, m_pageHeight, m_pageMarginBottom, m_pageMarginLeft, m_pageMarginRight, m_pageMarginTop, m_pageOrientation, m_pageWidth, m_sections, m_styles_by_id, IE_Exp_OpenXML::setColumns(), IE_Exp_OpenXML::setContinuousSection(), IE_Exp_OpenXML::setEvenAndOddHeaders(), IE_Exp_OpenXML::setPageMargins(), IE_Exp_OpenXML::setPageSize(), IE_Exp_OpenXML::setTitlePage(), IE_Exp_OpenXML::startDocument(), IE_Exp_OpenXML::startSectionProperties(), TARGET_DOCUMENT, and UT_OK.
Referenced by IE_Exp_OpenXML::_writeDocument().
bool OXML_Document::setBookmarkName | ( | const std::string & | bookmarkId, | |
const std::string & | bookmarkName | |||
) |
References m_bookmarkMap.
Referenced by IE_Exp_OpenXML_Listener::populate(), and OXMLi_ListenerState_Common::startElement().
void OXML_Document::setColumns | ( | const std::string & | colNum, | |
const std::string & | colSep | |||
) |
References m_colNum, and m_colSep.
Referenced by OXML_Section::applyDocumentProperties().
bool OXML_Document::setMappedNumberingId | ( | const std::string & | numId, | |
const std::string & | abstractNumId | |||
) |
References m_numberingMap.
Referenced by OXMLi_ListenerState_Numbering::startElement().
void OXML_Document::setPageHeight | ( | const std::string & | height | ) |
References m_pageHeight.
Referenced by IE_Exp_OpenXML_Listener::setPageSize(), and OXMLi_ListenerState_MainDocument::startElement().
void OXML_Document::setPageMargins | ( | const std::string & | top, | |
const std::string & | left, | |||
const std::string & | right, | |||
const std::string & | bottom | |||
) |
void OXML_Document::setPageOrientation | ( | const std::string & | orientation | ) |
References m_pageOrientation.
Referenced by IE_Exp_OpenXML_Listener::setPageSize(), and OXMLi_ListenerState_MainDocument::startElement().
void OXML_Document::setPageWidth | ( | const std::string & | width | ) |
References m_pageWidth.
Referenced by IE_Exp_OpenXML_Listener::setPageSize(), and OXMLi_ListenerState_MainDocument::startElement().
std::map<std::string, std::string> OXML_Document::m_bookmarkMap [private] |
Referenced by getBookmarkId(), getBookmarkName(), and setBookmarkName().
std::string OXML_Document::m_colNum [private] |
Referenced by serialize(), and setColumns().
std::string OXML_Document::m_colSep [private] |
Referenced by serialize(), and setColumns().
OXML_SectionMap OXML_Document::m_endnotes [private] |
Referenced by addEndnote(), clearEndnotes(), getEndnote(), and serialize().
Referenced by getFontManager().
OXML_SectionMap OXML_Document::m_footers [private] |
Referenced by _assignHdrFtrIds(), addFooter(), addToPT(), clearFooters(), getFooter(), getHdrFtrById(), isAllDefault(), and serialize().
OXML_SectionMap OXML_Document::m_footnotes [private] |
Referenced by addFootnote(), clearFootnotes(), getFootnote(), and serialize().
OXML_SectionMap OXML_Document::m_headers [private] |
Referenced by _assignHdrFtrIds(), addHeader(), addToPT(), clearHeaders(), getHdrFtrById(), getHeader(), isAllDefault(), and serialize().
OXML_ImageMap OXML_Document::m_images_by_id [private] |
Referenced by addImage(), addToPT(), getImageById(), and serialize().
OXML_ListMap OXML_Document::m_lists_by_id [private] |
Referenced by addList(), addToPT(), getListById(), and serialize().
std::map<std::string, std::string> OXML_Document::m_numberingMap [private] |
Referenced by getMappedNumberingId(), and setMappedNumberingId().
std::string OXML_Document::m_pageHeight [private] |
Referenced by applyPageProps(), serialize(), and setPageHeight().
std::string OXML_Document::m_pageMarginBottom [private] |
Referenced by addToPT(), serialize(), and setPageMargins().
std::string OXML_Document::m_pageMarginLeft [private] |
Referenced by addToPT(), serialize(), and setPageMargins().
std::string OXML_Document::m_pageMarginRight [private] |
Referenced by addToPT(), serialize(), and setPageMargins().
std::string OXML_Document::m_pageMarginTop [private] |
Referenced by addToPT(), serialize(), and setPageMargins().
std::string OXML_Document::m_pageOrientation [private] |
Referenced by applyPageProps(), serialize(), and setPageOrientation().
std::string OXML_Document::m_pageWidth [private] |
Referenced by applyPageProps(), serialize(), and setPageWidth().
OXML_SectionVector OXML_Document::m_sections [private] |
Referenced by addToPT(), appendSection(), clearSections(), getLastSection(), getSection(), and serialize().
OXML_StyleMap OXML_Document::m_styles_by_id [private] |
Referenced by addStyle(), addToPT(), clearStyles(), getStyleById(), and serialize().
OXML_StyleMap OXML_Document::m_styles_by_name [private] |
Referenced by addStyle(), clearStyles(), and getStyleByName().
OXML_SharedTheme OXML_Document::m_theme [private] |
Referenced by getTheme().
OXML_Document * OXML_Document::s_docInst = NULL [static, private] |
Referenced by destroyInstance(), getCurrentSection(), and getInstance().