diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-01-09 09:49:13 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-01-09 11:40:54 +0000 |
commit | 397722b55e06223377f812e29f3b51d997b837f5 (patch) | |
tree | f21d9f9a6e0c7776a5c4eeb6be6a16d9156cd113 /sw | |
parent | f5391df4548789acf71a45550742a2d3bbb3b7e4 (diff) |
workaround bizarre horizontal-scrollbar enable logic
when we really want no horizontal scrollbar, and
want to be in online layout mode for previews
Change-Id: I2d0e279a6f112ad7edbd6b523ea07b6dd2061ebc
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/utlui/unotools.cxx | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/sw/source/ui/utlui/unotools.cxx b/sw/source/ui/utlui/unotools.cxx index 8a18caf358de..7ee6d324281f 100644 --- a/sw/source/ui/utlui/unotools.cxx +++ b/sw/source/ui/utlui/unotools.cxx @@ -168,6 +168,31 @@ void SwOneExampleFrame::DisposeControl() _xController = 0; } +static void disableScrollBars(uno::Reference< beans::XPropertySet > xViewProps, + bool bEnableOnlineMode) +{ + //the scrollbar logic is kind of busted looking in writer, when the hori scrollbar + //property is changed then the hori scrollbar is enabled if the property is + //true or browse (online) mode is enabled. So... + //disable online mode + //turn off scrollbars + //turn back on online mode if that's what we want + //which subverts the (dodgy/buggy) scrollbar setting + // + //To reproduce this problem, in edit->autotext and click through + //the examples and see if the preview gets a horizontal scrollbar + uno::Any aFalseSet(uno::makeAny(sal_False)); + xViewProps->setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_SHOW_ONLINE_LAYOUT)), aFalseSet); + + xViewProps->setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_SHOW_HORI_SCROLL_BAR )), aFalseSet); + xViewProps->setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_SHOW_VERT_SCROLL_BAR )), aFalseSet); + + if (bEnableOnlineMode) + { + xViewProps->setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_SHOW_ONLINE_LAYOUT)), uno::makeAny(sal_True)); + } +} + IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer ) { if(!_xControl.is()) @@ -245,9 +270,9 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer ) aZoom <<= nZoomValue; xViewProps->setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_ZOOM_VALUE)), aZoom); } - // set onlinelayout property behind setting the zoom - xViewProps->setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_SHOW_ONLINE_LAYOUT)), - (nStyleFlags&EX_SHOW_ONLINE_LAYOUT) ? aTrueSet : aFalseSet ); + + // set onlinelayout property after setting the zoom + disableScrollBars(xViewProps, nStyleFlags&EX_SHOW_ONLINE_LAYOUT); bIsInitialized = sal_True; } @@ -255,7 +280,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer ) uno::Reference< text::XText > xText = xDoc->getText(); _xCursor = xText->createTextCursor(); - //From here, a cursor is defined, which goes trough the template, + //From here, a cursor is defined, which goes through the template, //and overwrites the template words where it is necessary. uno::Reference< lang::XUnoTunnel> xTunnel( _xCursor, uno::UNO_QUERY); @@ -345,8 +370,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer ) xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE ); // can only be done here - the SFX changes the ScrollBar values - xViewProps->setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_SHOW_HORI_SCROLL_BAR )), aFalseSet); - xViewProps->setPropertyValue(rtl::OUString::createFromAscii(SW_PROP_NAME_STR(UNO_NAME_SHOW_VERT_SCROLL_BAR )), aFalseSet); + disableScrollBars(xViewProps, nStyleFlags&EX_SHOW_ONLINE_LAYOUT); if (aInitializedLink.IsSet()) aInitializedLink.Call(this); |