[ooo-build-commit] .: 2 commits - svtools/source

Thorsten Behrens thorsten at kemper.freedesktop.org
Thu Sep 30 14:26:21 PDT 2010


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

New commits:
commit 3e349f44f2b580e83a995144d69ebf9d83bf77df
Merge: c6f1b65... ef6a354...
Author: Thorsten Behrens <thb at openoffice.org>
Date:   Thu Sep 30 23:20:33 2010 +0200

    Merge branch 'master' of ssh://git.freedesktop.org/git/libreoffice/libs-gui

commit c6f1b65cca41fb527d2568bea82c08d1e8d26cf7
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date:   Thu Sep 30 23:16:05 2010 +0200

    Fix for display error in ruler
    
    Depending on zoom factor, ruler display generates artifacts. This
    was fixed as http://www.openoffice.org/issues/show_bug.cgi?id=84723
    
    Fixes i#84723

diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index ba56da2..052e675 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -516,18 +516,19 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
     long nMaxWidth = maVirDev.PixelToLogic( Size( mpData->nPageWidth, 0 ), maMapMode ).Width();
     if ( nMaxWidth < 0 )
         nMaxWidth *= -1;
-// Amelia
+    // Amelia
     if (( mnUnitIndex == RULER_UNIT_CHAR ) || ( mnUnitIndex == RULER_UNIT_LINE ))
         nMaxWidth /= nTickUnit;
     else
         nMaxWidth /= aImplRulerUnitTab[mnUnitIndex].nTickUnit;
     UniString aNumStr( UniString::CreateFromInt32( nMaxWidth ) );
     long nTxtWidth = GetTextWidth( aNumStr );
-    if ( (nTxtWidth*2) > nTickWidth )
+    const long nTextOff   = 4;
+    if ( nTickWidth < nTxtWidth+nTextOff )
     {
+        // Calculate the scale of the ruler
         long nMulti     = 1;
         long nOrgTick3  = nTick3;
-        long nTextOff   = 2;
         while ( nTickWidth < nTxtWidth+nTextOff )
         {
             long nOldMulti = nMulti;
@@ -549,8 +550,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
                 bNoTicks = TRUE;
                 break;
             }
-            if ( nMulti >= 100 )
-                nTextOff = 4;
+
             nTick3 = nOrgTick3 * nMulti;
             aPixSize = maVirDev.LogicToPixel( Size( nTick3, nTick3 ), maMapMode );
             if ( mnWinStyle & WB_HORZ )
@@ -574,7 +574,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
             {
                 if ( nStart > nMin )
                 {
-                    // Nur 0 malen, wenn Margin1 nicht gleich dem NullPunkt ist
+                    // 0 is only painted when Margin1 is not equal to zero
                     if ( (mpData->nMargin1Style & RULER_STYLE_INVISIBLE) || (mpData->nMargin1 != 0) )
                     {
                         aNumStr = (sal_Unicode)'0';
@@ -597,7 +597,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
                 else
                     n = aPixSize.Height();
 
-                // Tick3 - Ausgabe (Text)
+                // Tick3 - Output (Text)
                 if ( !(nTick % nTick3) )
                 {
                     //aNumStr = UniString::CreateFromInt32( nTick / aImplRulerUnitTab[mnUnitIndex].nTickUnit );
@@ -610,7 +610,9 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
                     nX = nStart+n;
                     //different orientation needs a different starting position
                     nY = bVertRight ? nCenter+nTxtHeight2 : nCenter-nTxtHeight2;
-                    if ( nX < nMax )
+
+                    // Check if we can display full number
+                    if ( nX < (nMax-nTxtWidth2) )
                     {
                         if ( mnWinStyle & WB_HORZ )
                             nX -= nTxtWidth2;
@@ -619,7 +621,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
                         ImplVDrawText( nX, nY, aNumStr );
                     }
                     nX = nStart-n;
-                    if ( nX > nMin )
+                    if ( nX > (nMin+nTxtWidth2) )
                     {
                         if ( mnWinStyle & WB_HORZ )
                             nX -= nTxtWidth2;
@@ -628,7 +630,7 @@ void Ruler::ImplDrawTicks( long nMin, long nMax, long nStart, long nCenter )
                         ImplVDrawText( nX, nY, aNumStr );
                     }
                 }
-                // Tick/Tick2 - Ausgabe (Striche)
+                // Tick/Tick2 - Output (Strokes)
                 else
                 {
         /// Amelia
@@ -1298,7 +1300,7 @@ void Ruler::ImplFormat()
     Size    aVirDevSize;
     BOOL    b3DLook = !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO);
 
-    // VirtualDevice initialisieren
+    // initialize VirtualDevice 
     if ( mnWinStyle & WB_HORZ )
     {
         aVirDevSize.Width() = mnVirWidth;
@@ -1427,15 +1429,15 @@ void Ruler::ImplFormat()
         if ( nP2 < nVirRight )
             nMax--;
 
-        // Beschriftung ausgeben
+        // Draw captions
         ImplDrawTicks( nMin, nMax, nStart, nCenter );
     }
 
-    // Spalten ausgeben
+    // Draw borders
     if ( mpData->pBorders )
         ImplDrawBorders( nVirLeft, nP2, nVirTop, nVirBottom );
 
-    // Einzuege ausgeben
+    // Draw indents
     if ( mpData->pIndents )
         ImplDrawIndents( nVirLeft, nP2, nVirTop-1, nVirBottom+1 );
 
@@ -2934,7 +2936,7 @@ void Ruler::SetMargin2( long nPos, USHORT nMarginStyle )
 
 void Ruler::SetLines( USHORT n, const RulerLine* pLineAry )
 {
-    // Testen, ob sich was geaendert hat
+    // To determine if what has changed
     if ( mpData->nLines == n )
     {
         USHORT           i = n;
@@ -2953,18 +2955,18 @@ void Ruler::SetLines( USHORT n, const RulerLine* pLineAry )
             return;
     }
 
-    // Neue Werte setzen und neu ausgeben
+    // New values and new share issue
     BOOL bMustUpdate;
     if ( IsReallyVisible() && IsUpdateMode() )
         bMustUpdate = TRUE;
     else
         bMustUpdate = FALSE;
 
-    // Alte Linien loeschen
+    // Delete old lines
     if ( bMustUpdate )
         ImplInvertLines();
 
-    // Neue Daten setzen
+    // New data set
     if ( !n || !pLineAry )
     {
         if ( !mpData->pLines )


More information about the ooo-build-commit mailing list