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

New commits:
commit c4945c3ff5b698991abacd60cbf252857c582549
Author:     Sahil Gautam <sahil.gautam.ext...@allotropia.de>
AuthorDate: Wed Feb 19 10:28:34 2025 +0530
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Feb 19 22:17:35 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>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181901

diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index d4f75c69bfce..b3d5b9e1c7bb 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>
@@ -35,6 +36,8 @@
 #include <memory>
 #include <vector>
 
+#include <officecfg/Office/Common.hxx>
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::accessibility;
@@ -1189,16 +1192,29 @@ void Ruler::ImplFormat(vcl::RenderContext const & 
rRenderContext)
     nVirTop++;
     nVirBottom--;
 
+    Color aRulerColor;
+    Color aMarginRulerColor;
+    if (officecfg::Office::Common::Appearance::LibreOfficeTheme::get())
+    {
+        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