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