Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

OXML_Document Class Reference

#include <OXML_Document.h>

Inheritance diagram for OXML_Document:
OXML_ObjectWithAttrProp

List of all members.

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_DocumentgetNewInstance ()
 Clears any previous document instance and provides a new blank one.
static OXML_DocumentgetInstance ()
 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_Documents_docInst = NULL

Constructor & Destructor Documentation

OXML_Document::OXML_Document (  )  [private]
OXML_Document::~OXML_Document (  )  [private, virtual]

Member Function Documentation

void OXML_Document::_assignHdrFtrIds (  )  [private]
UT_Error OXML_Document::addStyle ( const std::string &  id,
const std::string &  name,
const gchar **  attributes 
)
UT_Error OXML_Document::addStyle ( const OXML_SharedStyle obj  ) 
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.

Parameters:
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::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
std::string OXML_Document::getBookmarkName ( const std::string &  bookmarkId  )  const
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_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
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_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
std::string OXML_Document::getMappedNumberingId ( const std::string &  numId  )  const
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.

bool OXML_Document::isAllDefault ( const bool &  header  )  const
bool OXML_Document::setBookmarkName ( const std::string &  bookmarkId,
const std::string &  bookmarkName 
)
void OXML_Document::setColumns ( const std::string &  colNum,
const std::string &  colSep 
)
bool OXML_Document::setMappedNumberingId ( const std::string &  numId,
const std::string &  abstractNumId 
)
void OXML_Document::setPageHeight ( const std::string &  height  ) 
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  ) 
void OXML_Document::setPageWidth ( const std::string &  width  ) 

Member Data Documentation

std::map<std::string, std::string> OXML_Document::m_bookmarkMap [private]
std::string OXML_Document::m_colNum [private]

Referenced by serialize(), and setColumns().

std::string OXML_Document::m_colSep [private]

Referenced by serialize(), and setColumns().

std::map<std::string, std::string> OXML_Document::m_numberingMap [private]
std::string OXML_Document::m_pageHeight [private]
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_pageWidth [private]

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