sc: only rewrite cell attrs on theme change when color actually differs
ThemeColorChanger::changeCellItems() / changeBorderLine() rebuilt the font / background / border items and reported the pattern as changed unconditionally whenever the item carried a valid theme type - even when the resolved theme color was already identical to the color stored on the item. The outer loop in changeSheets() then rewrote the pattern and called ApplySelectionPattern for every such "change", which made applying a theme on a document with many themed cell attributes effectively hang. Compare the resolved color to the current one in all three paths and only rewrite / signal bChanged when they actually differ. Iteration still traverses every pattern on the sheet, but no-op patterns no longer trigger a rewrite. Change-Id: I40c6a8ac98a0e49e34c7a557606c61f00bbdc5f9 Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/1106 Tested-by: Jenkins CPCI <releng@collaboraoffice.com> Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com> (cherry picked from commit 861d009764c45d5b4a053452d8df43367ca52b17) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206617 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
This commit is contained in:
committed by
Xisco Fauli
parent
59cf7e93fd
commit
fea2ef657d
@@ -60,6 +60,8 @@ bool changeBorderLine(editeng::SvxBorderLine* pBorderLine, model::ColorSet const
|
||||
if (rComplexColor.isValidThemeType())
|
||||
{
|
||||
Color aColor = rColorSet.resolveColor(rComplexColor);
|
||||
if (aColor == pBorderLine->GetColor())
|
||||
return false;
|
||||
pBorderLine->SetColor(aColor);
|
||||
return true;
|
||||
}
|
||||
@@ -77,11 +79,13 @@ bool changeCellItems(SfxItemSet& rItemSet, model::ColorSet const& rColorSet)
|
||||
if (rComplexColor.isValidThemeType())
|
||||
{
|
||||
Color aColor = rColorSet.resolveColor(rComplexColor);
|
||||
|
||||
SvxColorItem aColorItem(*pColorItem);
|
||||
aColorItem.setColor(aColor);
|
||||
rItemSet.Put(aColorItem);
|
||||
bChanged = true;
|
||||
if (aColor != pColorItem->getColor())
|
||||
{
|
||||
SvxColorItem aColorItem(*pColorItem);
|
||||
aColorItem.setColor(aColor);
|
||||
rItemSet.Put(aColorItem);
|
||||
bChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rItemSet.HasItem(ATTR_BACKGROUND, &pItem))
|
||||
@@ -91,11 +95,13 @@ bool changeCellItems(SfxItemSet& rItemSet, model::ColorSet const& rColorSet)
|
||||
if (rComplexColor.isValidThemeType())
|
||||
{
|
||||
Color aColor = rColorSet.resolveColor(rComplexColor);
|
||||
|
||||
SvxBrushItem aNewBrushItem(*pBrushItem);
|
||||
aNewBrushItem.SetColor(aColor);
|
||||
rItemSet.Put(aNewBrushItem);
|
||||
bChanged = true;
|
||||
if (aColor != pBrushItem->GetColor())
|
||||
{
|
||||
SvxBrushItem aNewBrushItem(*pBrushItem);
|
||||
aNewBrushItem.SetColor(aColor);
|
||||
rItemSet.Put(aNewBrushItem);
|
||||
bChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rItemSet.HasItem(ATTR_BORDER, &pItem))
|
||||
|
||||
Reference in New Issue
Block a user