svtools/source/control/ruler.cxx |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

New commits:
commit f838f886aab79ef5c09c3f9b4c701cefec9c8576
Author:     Sahil Gautam <sahil.gautam.ext...@allotropia.de>
AuthorDate: Wed Feb 19 10:28:34 2025 +0530
Commit:     Sahil Gautam <sahil.gautam.ext...@allotropia.de>
CommitDate: Wed Feb 19 14:40:54 2025 +0100

    tdf#165160 active and non-active parts of ruler should be distinctable
    
    Change-Id: I52d280b5253fec3c090a4e1d0c49b028142ae1ac
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181879
    Reviewed-by: Sahil Gautam <sahil.gautam.ext...@allotropia.de>
    Tested-by: Jenkins
    Reviewed-by: Vernon, Stuart Foote <vsfo...@libreoffice.org>

diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index d178ca1f4897..3d69a3f81a96 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -20,6 +20,7 @@
 #include <tools/debug.hxx>
 #include <tools/poly.hxx>
 #include <vcl/event.hxx>
+#include <vcl/themecolors.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/vcllayout.hxx>
 #include <vcl/virdev.hxx>
@@ -1188,16 +1189,29 @@ void Ruler::ImplFormat(vcl::RenderContext const & 
rRenderContext)
     nVirTop++;
     nVirBottom--;
 
+    Color aRulerColor;
+    Color aMarginRulerColor;
+    if (ThemeColors::IsThemeEnabled())
+    {
+        aRulerColor = ThemeColors::GetThemeColors().GetBaseColor();
+        aMarginRulerColor = ThemeColors::GetThemeColors().GetWindowColor();
+    }
+    else
+    {
+        aRulerColor = rStyleSettings.GetWindowColor();
+        aMarginRulerColor = rStyleSettings.GetDialogColor();
+    }
+
     // draw margin1, margin2 and in-between
     maVirDev->SetLineColor();
-    maVirDev->SetFillColor(rStyleSettings.GetDialogColor());
+    maVirDev->SetFillColor(aMarginRulerColor);
     if (nM1 > nVirLeft)
         ImplVDrawRect(*maVirDev, nP1, nVirTop + 1, nM1, nVirBottom); //left 
gray rectangle
     if (nM2 < nP2)
         ImplVDrawRect(*maVirDev, nM2, nVirTop + 1, nP2, nVirBottom); //right 
gray rectangle
     if (nM2 - nM1 > 0)
     {
-        maVirDev->SetFillColor(rStyleSettings.GetWindowColor());
+        maVirDev->SetFillColor(aRulerColor);
         ImplVDrawRect(*maVirDev, nM1 + 1, nVirTop, nM2 - 1, nVirBottom); 
//center rectangle
     }
     maVirDev->SetLineColor(rStyleSettings.GetShadowColor());

Reply via email to