Kaydet (Commit) 108d4a63 authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Justin Luth

writerfilter: create StyleSheetEntry::GetMergedInheritedProperties

This is a useful function. Make it more widely available.

Change-Id: I729c908eaf26e17c16198d14dcb89069ec6ca70c
Reviewed-on: https://gerrit.libreoffice.org/58261
Tested-by: Jenkins
Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
üst 7e65a079
......@@ -78,36 +78,6 @@ void DomainMapperTableHandler::startTable(const TablePropertyMapPtr& pProps)
#endif
}
PropertyMapPtr lcl_SearchParentStyleSheetAndMergeProperties(const StyleSheetEntryPtr& rStyleSheet, const StyleSheetTablePtr& pStyleSheetTable)
{
PropertyMapPtr pRet;
if (!rStyleSheet)
return pRet;
if(!rStyleSheet->sBaseStyleIdentifier.isEmpty())
{
const StyleSheetEntryPtr pParentStyleSheet = pStyleSheetTable->FindStyleSheetByISTD(rStyleSheet->sBaseStyleIdentifier);
//a loop in the style hierarchy, bail out
if (pParentStyleSheet == rStyleSheet)
return pRet;
pRet = lcl_SearchParentStyleSheetAndMergeProperties( pParentStyleSheet, pStyleSheetTable );
}
else
{
pRet = new PropertyMap;
}
if (pRet)
{
pRet->InsertProps(rStyleSheet->pProperties);
}
return pRet;
}
void lcl_mergeBorder( PropertyIds nId, const PropertyMapPtr& pOrig, const PropertyMapPtr& pDest )
{
boost::optional<PropertyMap::Property> pOrigVal = pOrig->getProperty(nId);
......@@ -388,7 +358,7 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
m_aTableProperties = pEmptyProps;
PropertyMapPtr pMergedProperties = lcl_SearchParentStyleSheetAndMergeProperties(pStyleSheet, pStyleSheetTable);
PropertyMapPtr pMergedProperties = pStyleSheet->GetMergedInheritedProperties(pStyleSheetTable);
table::BorderLine2 aBorderLine;
TableInfo rStyleInfo;
......
......@@ -161,6 +161,24 @@ void StyleSheetEntry::AppendInteropGrabBag(const beans::PropertyValue& rValue)
m_aInteropGrabBag.push_back(rValue);
}
PropertyMapPtr StyleSheetEntry::GetMergedInheritedProperties(const StyleSheetTablePtr& pStyleSheetTable)
{
PropertyMapPtr pRet;
if ( pStyleSheetTable && !sBaseStyleIdentifier.isEmpty() && sBaseStyleIdentifier != sStyleIdentifierD )
{
const StyleSheetEntryPtr pParentStyleSheet = pStyleSheetTable->FindStyleSheetByISTD(sBaseStyleIdentifier);
if ( pParentStyleSheet )
pRet = pParentStyleSheet->GetMergedInheritedProperties(pStyleSheetTable);
}
if ( !pRet )
pRet = new PropertyMap;
pRet->InsertProps(pProperties);
return pRet;
}
void lcl_mergeProps( const PropertyMapPtr& pToFill, const PropertyMapPtr& pToAdd, TblStyleType nStyleId )
{
static const PropertyIds pPropsToCheck[] =
......
......@@ -47,6 +47,8 @@ enum StyleType
STYLE_TYPE_TABLE,
STYLE_TYPE_LIST
};
class StyleSheetTable;
typedef tools::SvRef<StyleSheetTable> StyleSheetTablePtr;
struct StyleSheetTable_Impl;
class StyleSheetEntry : public virtual SvRefBase
......@@ -71,6 +73,9 @@ public:
css::beans::PropertyValue GetInteropGrabBag(); ///< Used for table styles, has a name.
css::beans::PropertyValues GetInteropGrabBagSeq(); ///< Used for existing styles, just a list of properties.
// Get all properties, merged with the all of the parent's properties
PropertyMapPtr GetMergedInheritedProperties(const StyleSheetTablePtr& pStyleSheetTable);
StyleSheetEntry();
virtual ~StyleSheetEntry() override;
};
......@@ -113,7 +118,6 @@ private:
void applyDefaults(bool bParaProperties);
};
typedef tools::SvRef< StyleSheetTable > StyleSheetTablePtr;
class TableStyleSheetEntry :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment