summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Timofeev <timofeev.i.s@gmail.com>2012-08-08 16:46:19 +0400
committerPetr Mladek <pmladek@suse.cz>2012-08-13 12:13:43 +0200
commit6f86c8e38a5263e609ec189b2a01d4fad7cd0e4e (patch)
treee8a63926f80a3078142db38c60ba3692d6a2778a
parent8609e601b7351fd9480475e12e9e2c1aa7811c78 (diff)
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@suse.cz>
-rw-r--r--svtools/source/control/ruler.cxx16
1 files changed, 15 insertions, 1 deletions
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index a50e4650c5b3..a8e8e8f6b894 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -1206,6 +1206,8 @@ void Ruler::ImplFormat()
void Ruler::ImplInitExtraField( sal_Bool bUpdate )
{
+ Size aWinSize = GetOutputSizePixel();
+
// Extra-Field beruecksichtigen
if ( mnWinStyle & WB_EXTRAFIELD )
{
@@ -1215,7 +1217,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
@@ -1232,6 +1233,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;