sc/source/ui/inc/prevwsh.hxx |5 +-
sc/source/ui/view/preview.cxx |5 +-
sc/source/ui/view/prevwsh.cxx | 104 +-
sw/source/ui/uiview/pview.cxx | 84 +
4 files changed, 143 insertions(+), 55 deletions(-)
New commits:
commit f194d18dfeceff104f9c5e500ea4dd94fa1b5b06
Author: Noel Power noel.po...@novell.com
Date: Tue Apr 3 17:07:54 2012 +0100
Hori/Vert scrollbars in calc preview should be shown only when necessary
diff --git a/sc/source/ui/inc/prevwsh.hxx b/sc/source/ui/inc/prevwsh.hxx
index 271a352..1ac668a 100644
--- a/sc/source/ui/inc/prevwsh.hxx
+++ b/sc/source/ui/inc/prevwsh.hxx
@@ -50,6 +50,7 @@ class CommandEvent;
class ScPreviewShell: public SfxViewShell
{
+friend class ScPreview; // allow access to AdjustPosSizePixel
ScDocShell* pDocShell;
ScPreview* pPreview; // Ausgabe-Fenster
@@ -63,7 +64,8 @@ class ScPreviewShell: public SfxViewShell
longnMaxVertPos;
SfxBroadcaster* pAccessibilityBroadcaster;
-
+boolGetPageSize( Size aPageSize );
+voidUpdateNeededScrollBars();
private:
voidConstruct( Window* pParent );
DECL_LINK(ScrollHandler, ScrollBar* );
@@ -72,7 +74,6 @@ private:
protected:
virtual voidActivate(sal_Bool bMDI);
virtual voidDeactivate(sal_Bool bMDI);
-
virtual voidAdjustPosSizePixel( const Point rPos, const Size rSize );
virtual voidInnerResizePixel( const Point rOfs, const Size rSize );
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index bbb7c72..e83224d 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -705,7 +705,10 @@ void ScPreview::SetZoom(sal_uInt16 nNewZoom)
SetMapMode( aMMMode );
bInSetZoom = true; // don't scroll during SetYOffset in
UpdateScrollBars
-pViewShell-UpdateScrollBars();
+if ( Window* pWin = pViewShell-GetWindow() )
+pViewShell-AdjustPosSizePixel( pWin-GetPosPixel(),
pWin-GetSizePixel() );
+else
+pViewShell-UpdateScrollBars();
bInSetZoom = false;
bStateValid = false;
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index dfc6268..8b65824 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -134,8 +134,8 @@ void ScPreviewShell::Construct( Window* pParent )
if (pDrawBC)
StartListening(*pDrawBC);
-pHorScroll-Show();
-pVerScroll-Show();
+pHorScroll-Show( false );
+pVerScroll-Show( false );
pCorner-Show();
SetHelpId( HID_SCSHELL_PREVWSH );
SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(Preview)));
@@ -244,24 +244,15 @@ Size ScPreviewShell::GetOptimalSizePixel() const
void ScPreviewShell::AdjustPosSizePixel( const Point rPos, const Size rSize )
{
-long nBarW =
GetViewFrame()-GetWindow().GetSettings().GetStyleSettings().GetScrollBarSize();
-long nBarH = nBarW;
-
-Size aOutSize( rSize.Width()-nBarW, rSize.Height()-nBarH );
+Size aOutSize( rSize );
pPreview-SetPosSizePixel( rPos, aOutSize );
-pHorScroll-SetPosSizePixel( Point( rPos.X(), rPos.Y() + aOutSize.Height()
),
- Size( aOutSize.Width(), nBarH ) );
-pVerScroll-SetPosSizePixel( Point( rPos.X() + aOutSize.Width(), rPos.Y()
),
- Size( nBarW, aOutSize.Height() ) );
-pCorner-SetPosSizePixel( Point( rPos.X() + aOutSize.Width(), rPos.Y() +
aOutSize.Height() ),
- Size( nBarW, nBarH ) );
if ( SVX_ZOOM_WHOLEPAGE == eZoom )
pPreview-SetZoom( pPreview-GetOptimalZoom(false) );
else if ( SVX_ZOOM_PAGEWIDTH == eZoom )
-pPreview-SetZoom( pPreview-GetOptimalZoom(sal_True) );
+pPreview-SetZoom( pPreview-GetOptimalZoom(true) );
-UpdateScrollBars();
+UpdateNeededScrollBars();
}
void ScPreviewShell::InnerResizePixel( const Point rOfs, const Size rSize )
@@ -274,7 +265,7 @@ void ScPreviewShell::OuterResizePixel( const Point rOfs,
const Size rSize )
AdjustPosSizePixel( rOfs,rSize );
}
-void ScPreviewShell::UpdateScrollBars()
+bool ScPreviewShell::GetPageSize( Size aPageSize )
{
ScDocument* pDoc = pDocShell-GetDocument();
SCTAB nTab = pPreview-GetTab();
@@ -282,13 +273,87 @@ void ScPreviewShell::UpdateScrollBars()
ScStyleSheetPool* pStylePool = pDoc-GetStyleSheetPool();
SfxStyleSheetBase* pStyleSheet = pStylePool-Find( pDoc-GetPageStyle(
nTab ),
SFX_STYLE_FAMILY_PAGE
);
-OSL_ENSURE(pStyleSheet,StyleSheet nicht gefunden);
-if (!pStyleSheet) return;
+OSL_ENSURE(pStyleSheet,No style sheet);
+if (!pStyleSheet) return false;
const SfxItemSet* pParamSet = pStyleSheet-GetItemSet();
-Size aPageSize = ((const SvxSizeItem)