[Libreoffice-commits] .: Branch 'libreoffice-3-5' - svtools/source

Petr Mladek pmladek at kemper.freedesktop.org
Mon Aug 13 03:25:51 PDT 2012


 svtools/source/control/ruler.cxx |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 1500bc8970dc61f96697a186d6bb0d1aacc2ce67
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Wed Aug 8 16:46:19 2012 +0400

    fdo#50654: update virtual device width on modifying WB_EXTRAFIELD flag
    
    Writer sets this flag dynamically via Ruler::SetStyle depending on
    the text direction, the flag is set by default and gets unset for the
    vertical ruler, because the initial text direction is horizontal,
    see SwView::StateTabWin.
    
    Ruler::SetStyle calls Ruler::ImplInitExtraField, which modifies mnVirOff,
    however mnVirWidth depends on mnVirOff, but gets updated only in Resize.
    
    This patch copies the code from Resize to ImplInitExtraField, we cannot
    just call Resize from ImplInitExtraField due to possible infinite recursion.
    
    Change-Id: Ic7bb897059295aebe86c11977c37419017b55787
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 00fc759..de371f7 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -1359,6 +1359,8 @@ void Ruler::ImplFormat()
 
 void Ruler::ImplInitExtraField( sal_Bool bUpdate )
 {
+    Size aWinSize = GetOutputSizePixel();
+
     // Extra-Field beruecksichtigen
     if ( mnWinStyle & WB_EXTRAFIELD )
     {
@@ -1368,7 +1370,6 @@ void Ruler::ImplInitExtraField( sal_Bool bUpdate )
         maExtraRect.Bottom() = RULER_OFF+mnVirHeight-1;
         if(mpData->bTextRTL)
         {
-            Size aWinSize = GetOutputSizePixel();
             if(mnWinStyle & WB_HORZ)
                 maExtraRect.Move(aWinSize.Width() - maExtraRect.GetWidth() - maExtraRect.Left(), 0);
             else
@@ -1385,6 +1386,19 @@ void Ruler::ImplInitExtraField( sal_Bool bUpdate )
         mnVirOff = 0;
     }
 
+    // mnVirWidth depends on mnVirOff
+    if ( (mnVirWidth > RULER_MIN_SIZE) ||
+     ((aWinSize.Width() > RULER_MIN_SIZE) && (aWinSize.Height() > RULER_MIN_SIZE)) )
+    {
+        if ( mnWinStyle & WB_HORZ )
+            mnVirWidth = aWinSize.Width()-mnVirOff;
+        else
+            mnVirWidth = aWinSize.Height()-mnVirOff;
+
+        if ( mnVirWidth < RULER_MIN_SIZE )
+            mnVirWidth = 0;
+    }
+
     if ( bUpdate )
     {
         mbCalc      = sal_True;


More information about the Libreoffice-commits mailing list