Used by ODi_Office_Styles to handle a family of "style:style" styles. More...
#include <ODi_Style_Style_Family.h>
Public Member Functions | |
ODi_Style_Style_Family () | |
virtual | ~ODi_Style_Style_Family () |
Destructor. | |
ODi_Style_Style * | addStyle (const gchar **ppAtts, ODi_ElementStack &rElementStack, ODi_Abi_Data &rAbiData, std::string *pReplacementName=NULL, std::string *pReplacementDisplayName=NULL) |
ODi_Style_Style * | addDefaultStyle (ODi_ElementStack &rElementStack, ODi_Abi_Data &rAbiData) |
void | fixStyles () |
Fix any problems encountered on the added styles. | |
void | linkStyles () |
It links, if applicable, each style with its parent and its next style. | |
const ODi_Style_Style * | getStyle (const gchar *pStyleName, bool bOnContentStream) const |
const ODi_Style_Style * | getDefaultStyle () const |
void | removeStyleStyle (ODi_Style_Style *pRemovedStyle, bool bOnContentStream) |
void | defineAbiStyles (PD_Document *pDocument) const |
void | buildAbiPropsAttrString (ODi_FontFaceDecls &rFontFaceDecls) |
Private Types | |
typedef std::map< std::string, ODi_Style_Style * > | StyleMap |
Private Member Functions | |
void | _buildAbiPropsAttrString (ODi_FontFaceDecls &rFontFaceDecls, const StyleMap &map) |
void | _findSuitableReplacement (std::string &rReplacementName, const ODi_Style_Style *pRemovedStyle, bool bOnContentStream) |
Finds a suitable replacement for the style that will be removed. | |
void | _reparentStyles (const StyleMap &map, const std::string &removedName, const std::string &replacementName) |
void | _linkStyles (const StyleMap &map, bool onContentStream) |
Helper function for linkStyles(). | |
void | _removeEmptyStyles (const StyleMap &map, bool bOnContentStream) |
Remove any style that doesn't have properties. | |
Private Attributes | |
StyleMap | m_styles |
StyleMap | m_styles_contentStream |
ODi_Style_Style * | m_pDefaultStyle |
std::map< std::string, std::string > | m_removedStyleStyles |
std::map< std::string, std::string > | m_removedStyleStyles_contentStream |
Used by ODi_Office_Styles to handle a family of "style:style" styles.
Some family names: "text", "paragraph", "section", "graphic", "table", etc.
typedef std::map<std::string, ODi_Style_Style*> ODi_Style_Style_Family::StyleMap [private] |
ODi_Style_Style_Family::ODi_Style_Style_Family | ( | ) | [inline] |
ODi_Style_Style_Family::~ODi_Style_Style_Family | ( | ) | [virtual] |
Destructor.
References DELETEP, m_pDefaultStyle, m_styles, m_styles_contentStream, and UT_map_delete_all_second().
void ODi_Style_Style_Family::_buildAbiPropsAttrString | ( | ODi_FontFaceDecls & | rFontFaceDecls, | |
const StyleMap & | map | |||
) | [private] |
Referenced by buildAbiPropsAttrString().
void ODi_Style_Style_Family::_findSuitableReplacement | ( | std::string & | rReplacementName, | |
const ODi_Style_Style * | pRemovedStyle, | |||
bool | bOnContentStream | |||
) | [private] |
Finds a suitable replacement for the style that will be removed.
A suitable replacement is a parent style that has properties or, if none is found, the default paragraph style.
rReplacementName | Will receive the name of the replacement style. | |
pRemovedStyle | The style that will be removed. |
References ODi_Style_Style::getFamily(), ODi_Style_Style::getName(), ODi_Style_Style::getParentName(), ODi_Style_Style::hasProperties(), m_pDefaultStyle, m_removedStyleStyles, m_removedStyleStyles_contentStream, m_styles, and m_styles_contentStream.
Referenced by removeStyleStyle().
void ODi_Style_Style_Family::_linkStyles | ( | const StyleMap & | map, | |
bool | onContentStream | |||
) | [private] |
Helper function for linkStyles().
References ODi_Style_Style::getNextStyleName(), ODi_Style_Style::getParentName(), getStyle(), ODi_Style_Style::setNextStyleName(), ODi_Style_Style::setNextStylePointer(), ODi_Style_Style::setParentName(), ODi_Style_Style::setParentStylePointer(), and UT_ASSERT_HARMLESS.
Referenced by linkStyles().
void ODi_Style_Style_Family::_removeEmptyStyles | ( | const StyleMap & | map, | |
bool | bOnContentStream | |||
) | [private] |
Remove any style that doesn't have properties.
References DELETEP, and removeStyleStyle().
Referenced by fixStyles().
void ODi_Style_Style_Family::_reparentStyles | ( | const StyleMap & | map, | |
const std::string & | removedName, | |||
const std::string & | replacementName | |||
) | [private] |
References ODi_Style_Style::getNextStyleName(), ODi_Style_Style::getParentName(), ODi_Style_Style::setNextStyleName(), and ODi_Style_Style::setParentName().
Referenced by removeStyleStyle().
ODi_Style_Style* ODi_Style_Style_Family::addDefaultStyle | ( | ODi_ElementStack & | rElementStack, | |
ODi_Abi_Data & | rAbiData | |||
) | [inline] |
References m_pDefaultStyle.
Referenced by ODi_Office_Styles::addDefaultStyle().
ODi_Style_Style * ODi_Style_Style_Family::addStyle | ( | const gchar ** | ppAtts, | |
ODi_ElementStack & | rElementStack, | |||
ODi_Abi_Data & | rAbiData, | |||
std::string * | pReplacementName = NULL , |
|||
std::string * | pReplacementDisplayName = NULL | |||
) |
pReplacementName | Name to replace the actual name of the style that is being added. NULL if the name shouldn't be replaced. |
References gchar, ODi_ElementStack::hasElement(), m_removedStyleStyles, m_removedStyleStyles_contentStream, m_styles, m_styles_contentStream, ODi_Style_Style::setDisplayName(), ODi_Style_Style::setName(), UT_ASSERT, and UT_getAttribute().
Referenced by ODi_Office_Styles::addStyle().
void ODi_Style_Style_Family::buildAbiPropsAttrString | ( | ODi_FontFaceDecls & | rFontFaceDecls | ) |
References _buildAbiPropsAttrString(), ODi_Style_Style::buildAbiPropsAttrString(), m_pDefaultStyle, m_styles, and m_styles_contentStream.
Referenced by ODi_Office_Styles::_buildAbiPropsAttrString().
void ODi_Style_Style_Family::defineAbiStyles | ( | PD_Document * | pDocument | ) | const |
References ODi_Style_Style::defineAbiStyle(), m_pDefaultStyle, and m_styles.
Referenced by ODi_Office_Styles::_defineAbiStyles().
void ODi_Style_Style_Family::fixStyles | ( | ) |
Fix any problems encountered on the added styles.
References _removeEmptyStyles(), m_styles, and m_styles_contentStream.
Referenced by ODi_Office_Styles::_fixStyles().
const ODi_Style_Style* ODi_Style_Style_Family::getDefaultStyle | ( | ) | const [inline] |
References m_pDefaultStyle.
Referenced by ODi_Office_Styles::getDefaultParagraphStyle().
const ODi_Style_Style * ODi_Style_Style_Family::getStyle | ( | const gchar * | pStyleName, | |
bool | bOnContentStream | |||
) | const |
References ODi_Style_Style::getName(), m_pDefaultStyle, m_removedStyleStyles, m_removedStyleStyles_contentStream, m_styles, m_styles_contentStream, and UT_return_val_if_fail.
Referenced by _linkStyles(), ODi_Office_Styles::addStyle(), ODi_Office_Styles::getGraphicStyle(), ODi_Office_Styles::getParagraphStyle(), ODi_Office_Styles::getSectionStyle(), ODi_Office_Styles::getTableCellStyle(), ODi_Office_Styles::getTableColumnStyle(), ODi_Office_Styles::getTableRowStyle(), ODi_Office_Styles::getTableStyle(), and ODi_Office_Styles::getTextStyle().
void ODi_Style_Style_Family::linkStyles | ( | ) |
It links, if applicable, each style with its parent and its next style.
By "linking" I mean that a given style will have a pointer to its parent and its next style.
References _linkStyles(), m_styles, and m_styles_contentStream.
Referenced by ODi_Office_Styles::_linkStyles().
void ODi_Style_Style_Family::removeStyleStyle | ( | ODi_Style_Style * | pRemovedStyle, | |
bool | bOnContentStream | |||
) |
std::map<std::string, std::string> ODi_Style_Style_Family::m_removedStyleStyles [private] |
Referenced by _findSuitableReplacement(), addStyle(), getStyle(), and removeStyleStyle().
std::map<std::string, std::string> ODi_Style_Style_Family::m_removedStyleStyles_contentStream [private] |
Referenced by _findSuitableReplacement(), addStyle(), getStyle(), and removeStyleStyle().
StyleMap ODi_Style_Style_Family::m_styles [private] |