sc/source/ui/view/output3.cxx |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 2949681e7dfe2050f69a86ac0f315557ff313a88
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Aug 26 15:51:12 2024 +0100
Commit:     Pranam Lashkari <lpra...@collabora.com>
CommitDate: Mon Aug 26 21:31:41 2024 +0200

    text drawing boxes don't redraw with a new text autocolor choice
    
    when light/dark mode themes are toggled on off in calc. This works fine
    in writer though, so follow the same pattern as SwViewShellImp::PaintLayer
    and set a default background color on the when we draw.
    
    So SdrTextPrimitive2D::get2DDecomposition will see that the outliner
    should have a new background, and drops its cache, even if
    setSuitableOutlinerBg has no reason to set anything explicit.
    
    Change-Id: I19ca407853238e6533085c6aa617206ee122d3a9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172427
    Reviewed-by: Pranam Lashkari <lpra...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sc/source/ui/view/output3.cxx b/sc/source/ui/view/output3.cxx
index 760a62a12d1d..9dfe421d1e24 100644
--- a/sc/source/ui/view/output3.cxx
+++ b/sc/source/ui/view/output3.cxx
@@ -182,6 +182,18 @@ void ScOutputData::DrawSelectiveObjects(SdrLayerID nLayer)
     rOutl.EnableAutoColor( mbUseStyleColor );
     rOutl.SetDefaultHorizontalTextDirection(
                 mpDoc->GetEditTextDirection( nTab ) );
+    Color aOldOutlinerBackgroundColor = rOutl.GetBackgroundColor();
+    const ScTabViewShell* pTabViewShellBg = mbUseStyleColor ? 
ScTabViewShell::GetActiveViewShell() : nullptr;
+    if (pTabViewShellBg)
+    {
+        // Similar to writer's SwViewShellImp::PaintLayer set the default
+        // background of the Outliner for the AutoColor cases where there is no
+        // explicit background known.  But like elsewhere in calc, take
+        // mbUseStyleColor of false as ScAutoFontColorMode::Print for print
+        // output, so don't set a default outliner background then.
+        const ScViewRenderingOptions& rViewRenderingOptions = 
pTabViewShellBg->GetViewRenderingData();
+        rOutl.SetBackgroundColor(rViewRenderingOptions.GetDocColor());
+    }
 
     //  #i69767# The hyphenator must be set (used to be before drawing a text 
shape with hyphenation).
     //  LinguMgr::GetHyphenator (EditEngine) uses a wrapper now that creates 
the real hyphenator on demand,
@@ -267,6 +279,9 @@ void ScOutputData::DrawSelectiveObjects(SdrLayerID nLayer)
         }
     }
 
+    if (pTabViewShellBg)
+        rOutl.SetBackgroundColor(aOldOutlinerBackgroundColor);
+
     mpDev->SetDrawMode(nOldDrawMode);
 }
 

Reply via email to