dont use GetItemSurrogates for gathering SvxBrushItem
which is very expensive these days Change-Id: I6ef85e3f635d11263d87cfd57c5153a450da46e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173868 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
250f35740d
commit
3d00583063
4 changed files with 48 additions and 11 deletions
|
@ -1474,6 +1474,9 @@ public:
|
|||
/// Iterate over all RES_SHADOW SvxShadowItem, if the function returns false, iteration is stopped
|
||||
SW_DLLPUBLIC void ForEachShadowItem(const std::function<bool(const SvxShadowItem&)>& ) const;
|
||||
|
||||
/// Iterate over all RES_BACKGROUND SvxBrushItem, if the function returns false, iteration is stopped
|
||||
SW_DLLPUBLIC void ForEachBackgroundBrushItem(const std::function<bool(const SvxBrushItem&)>& ) const;
|
||||
|
||||
// Call into intransparent Basic; expect possible Return String.
|
||||
void ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs );
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ ItemInfoPackage& getItemInfoPackageSwAttributes()
|
|||
{ RES_VERT_ORIENT, new SwFormatVertOrient, FN_VERT_ORIENT, SFX_ITEMINFOFLAG_NONE },
|
||||
{ RES_HORI_ORIENT, new SwFormatHoriOrient, FN_HORI_ORIENT, SFX_ITEMINFOFLAG_NONE },
|
||||
{ RES_ANCHOR, new SwFormatAnchor, 0, SFX_ITEMINFOFLAG_NONE },
|
||||
{ RES_BACKGROUND, new SvxBrushItem( RES_BACKGROUND ), SID_ATTR_BRUSH, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE },
|
||||
{ RES_BACKGROUND, new SvxBrushItem( RES_BACKGROUND ), SID_ATTR_BRUSH, SFX_ITEMINFOFLAG_NONE },
|
||||
{ RES_BOX, new SvxBoxItem( RES_BOX ), SID_ATTR_BORDER_OUTER, SFX_ITEMINFOFLAG_NONE },
|
||||
{ RES_SHADOW, new SvxShadowItem( RES_SHADOW ), SID_ATTR_BORDER_SHADOW, SFX_ITEMINFOFLAG_NONE },
|
||||
{ RES_FRMMACRO, new SvxMacroItem( RES_FRMMACRO ), SID_ATTR_MACROITEM, SFX_ITEMINFOFLAG_NONE },
|
||||
|
|
|
@ -1634,6 +1634,45 @@ void SwDoc::ForEachShadowItem(const std::function<bool(const SvxShadowItem&)>& r
|
|||
}
|
||||
}
|
||||
|
||||
/// Iterate over all RES_BACKGROUND SvxBrushItem, if the function returns false, iteration is stopped
|
||||
void SwDoc::ForEachBackgroundBrushItem(const std::function<bool(const SvxBrushItem&)>& rFunc ) const
|
||||
{
|
||||
SwNodeOffset nCount = GetNodes().Count();
|
||||
for (SwNodeOffset i(0); i < nCount; ++i)
|
||||
{
|
||||
const SwNode* pNode = GetNodes()[i];
|
||||
if (!pNode->IsTableNode())
|
||||
continue;
|
||||
const SwTableNode* pTableNode = pNode->GetTableNode();
|
||||
const SwTable& rTable = pTableNode->GetTable();
|
||||
if (const SwTableFormat* pFormat = rTable.GetFrameFormat())
|
||||
{
|
||||
const SwAttrSet& rAttrSet = pFormat->GetAttrSet();
|
||||
if (const SvxBrushItem* pItem = rAttrSet.GetItemIfSet(RES_BACKGROUND))
|
||||
if (!rFunc(*pItem))
|
||||
return;
|
||||
}
|
||||
for (const SwTableLine* pTableLine : rTable.GetTabLines())
|
||||
{
|
||||
if (const SwTableLineFormat* pFormat = pTableLine->GetFrameFormat())
|
||||
{
|
||||
const SwAttrSet& rAttrSet = pFormat->GetAttrSet();
|
||||
if (const SvxBrushItem* pItem = rAttrSet.GetItemIfSet(RES_BACKGROUND))
|
||||
if (!rFunc(*pItem))
|
||||
return;
|
||||
}
|
||||
for (const SwTableBox* pTableBox : pTableLine->GetTabBoxes())
|
||||
if (SwTableBoxFormat* pFormat = pTableBox->GetFrameFormat())
|
||||
{
|
||||
const SwAttrSet& rAttrSet = pFormat->GetAttrSet();
|
||||
if (const SvxBrushItem* pItem = rAttrSet.GetItemIfSet(RES_BACKGROUND))
|
||||
if (!rFunc(*pItem))
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SwDoc::Summary(SwDoc& rExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress)
|
||||
{
|
||||
const SwOutlineNodes& rOutNds = GetNodes().GetOutLineNds();
|
||||
|
|
|
@ -1316,7 +1316,6 @@ void RtfExport::OutColorTable()
|
|||
InsColor(COL_BROWN);
|
||||
InsColor(COL_GRAY);
|
||||
InsColor(COL_LIGHTGRAY);
|
||||
ItemSurrogates aSurrogates;
|
||||
|
||||
// char color
|
||||
{
|
||||
|
@ -1355,15 +1354,10 @@ void RtfExport::OutColorTable()
|
|||
{
|
||||
InsColor(pBackground->GetColor());
|
||||
}
|
||||
rPool.GetItemSurrogates(aSurrogates, RES_BACKGROUND);
|
||||
for (const SfxPoolItem* pItem : aSurrogates)
|
||||
{
|
||||
pBackground = static_cast<const SvxBrushItem*>(pItem);
|
||||
if (pBackground)
|
||||
{
|
||||
InsColor(pBackground->GetColor());
|
||||
}
|
||||
}
|
||||
m_rDoc.ForEachBackgroundBrushItem([this](const SvxBrushItem& rBrush) -> bool {
|
||||
InsColor(rBrush.GetColor());
|
||||
return true;
|
||||
});
|
||||
}
|
||||
{
|
||||
const SvxBrushItem* pBackground = GetDfltAttr(RES_CHRATR_BACKGROUND);
|
||||
|
@ -1416,6 +1410,7 @@ void RtfExport::OutColorTable()
|
|||
}
|
||||
|
||||
// TextFrame or paragraph background solid fill.
|
||||
ItemSurrogates aSurrogates;
|
||||
rPool.GetItemSurrogatesForItem(aSurrogates, SfxItemType::XFillColorItemType);
|
||||
for (const SfxPoolItem* pItem : aSurrogates)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue