diff options
author | Thorsten Behrens <tbehrens@novell.com> | 2010-10-26 15:49:05 +0200 |
---|---|---|
committer | Thorsten Behrens <tbehrens@novell.com> | 2010-10-26 15:49:05 +0200 |
commit | 8eddddda1d8e0a9401ae16e5c1fe422b2105f42a (patch) | |
tree | bb2709379bc15d46152a040b668b19c461eff92c /sd/source/ui/view/sdwindow.cxx | |
parent | c2784bad7dd834481ac2643f64b6f472fce4b43e (diff) |
Fix broken Impress document zoom behaviour
As outlined in bugs n#380013 and i#88939, in certain cases Impress
loads documents nastily offset to the top or left, instead of
keeping it nicely centered.
Diffstat (limited to 'sd/source/ui/view/sdwindow.cxx')
-rwxr-xr-x[-rw-r--r--] | sd/source/ui/view/sdwindow.cxx | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index 15e5b29ec48b..9a80ee38dd60 100644..100755 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -73,6 +73,7 @@ Window::Window(::Window* pParent) maWinPos(0, 0), // vorsichtshalber; die Werte sollten aber maViewOrigin(0, 0), // vom Besitzer des Fensters neu gesetzt maViewSize(1000, 1000), // werden + maPrevSize(-1,-1), mnMinZoom(MIN_ZOOM), mnMaxZoom(MAX_ZOOM), mbMinZoomAutoCalc(false), @@ -472,6 +473,9 @@ long Window::SetZoomFactor(long nZoom) aMap.SetScaleY(Fraction(nZoom, 100)); SetMapMode(aMap); + // invalidate previous size - it was relative to the old scaling + maPrevSize = Size(-1,-1); + // Update the map mode's origin (to what effect?). UpdateMapOrigin(); @@ -668,11 +672,20 @@ void Window::SetMinZoomAutoCalc (bool bAuto) void Window::UpdateMapOrigin(BOOL bInvalidate) { - BOOL bChanged = FALSE; - Size aWinSize = PixelToLogic(GetOutputSizePixel()); + BOOL bChanged = FALSE; + const Size aWinSize = PixelToLogic(GetOutputSizePixel()); if ( mbCenterAllowed ) { + if( maPrevSize != Size(-1,-1) ) + { + // keep view centered around current pos, when window + // resizes + maWinPos.X() -= (aWinSize.Width() - maPrevSize.Width()) / 2; + maWinPos.Y() -= (aWinSize.Height() - maPrevSize.Height()) / 2; + bChanged = TRUE; + } + if ( maWinPos.X() > maViewSize.Width() - aWinSize.Width() ) { maWinPos.X() = maViewSize.Width() - aWinSize.Width(); @@ -697,6 +710,8 @@ void Window::UpdateMapOrigin(BOOL bInvalidate) UpdateMapMode (); + maPrevSize = aWinSize; + if (bChanged && bInvalidate) Invalidate(); } |