svtools/source/control/ruler.cxx |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit ba627b04abfb65ac6d4aa25c192445ff282e2812
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sat Dec 6 20:15:59 2025 +0000
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Dec 11 09:31:50 2025 +0100

    cid#1659736 Division or modulo by float zero
    
    For char/line, the other cases gets set to non 0.
    
    In many of the other units we set lower levels equal
    to the level above so we don't have a smaller tick size
    to attempt to draw, so explicitly do this for char/line.
    
    probably in the code since:
    
    commit dda8877b989ebe330315e94523b983a6803e1372
    Date:   Mon Sep 2 23:25:33 2013 +0200
    
        Ruler: minimal unit 1/16 inch, 1/10 cm, dynamic tick draw, various
    
    Change-Id: Ifaa88144ec54922017fd66b0deeaa398b28b700d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195178
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>
    (cherry picked from commit bcd994e16a25cdba42a89725e75386342c6d85ae)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195297
    Tested-by: Xisco Fauli <[email protected]>
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 3b16fa111b66..e4da613bef16 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -427,7 +427,8 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& 
rRenderContext, tools::Long nMin,
     tools::Long DPIOffset = nScale - 1;
 
     double nTick4 = aImplRulerUnitTab[mnUnitIndex].nTick4;
-    double nTick2 = 0;
+    double nTick3 = aImplRulerUnitTab[mnUnitIndex].nTick3;
+    double nTick2 = aImplRulerUnitTab[mnUnitIndex].nTick2;
     double nTickCount = aImplRulerUnitTab[mnUnitIndex].nTick1 / nScale;
     double nTickUnit = 0;
     tools::Long nTickWidth;
@@ -440,6 +441,7 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& 
rRenderContext, tools::Long nMin,
         if (mnCharWidth == 0)
             mnCharWidth = 371;
         nTick4 = mnCharWidth * 2;
+        nTick3 = mnCharWidth;
         nTick2 = mnCharWidth;
         nTickCount = mnCharWidth;
         nTickUnit = mnCharWidth;
@@ -449,6 +451,7 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& 
rRenderContext, tools::Long nMin,
         if (mnLineHeight == 0)
             mnLineHeight = 551;
         nTick4 = mnLineHeight * 2;
+        nTick3 = mnLineHeight;
         nTick2 = mnLineHeight;
         nTickUnit = mnLineHeight;
         nTickCount = mnLineHeight;
@@ -531,13 +534,6 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& 
rRenderContext, tools::Long nMin,
 
     tools::Long n = 0;
     double nTick = 0.0;
-    double nTick3 = 0;
-
-    if ((mnUnitIndex != RULER_UNIT_CHAR) && (mnUnitIndex != RULER_UNIT_LINE))
-    {
-        nTick2 = aImplRulerUnitTab[mnUnitIndex].nTick2;
-        nTick3 = aImplRulerUnitTab[mnUnitIndex].nTick3;
-    }
 
     Size nTickGapSize;
 

Reply via email to