merge the formfield patch from ooo-build
[ooovba.git] / applied_patches / 0518-sd-view-zoom-fix.diff
blob989118f890281342727174a52e0961356caa1cf2
1 --- sd/source/ui/inc/Window.hxx 2008-04-10 22:56:52.000000000 +0200
2 +++ sd/source/ui/inc/Window.hxx 2008-05-01 03:51:10.000000000 +0200
3 @@ -171,7 +171,8 @@
4 ::sd::Window* mpShareWin;
5 Point maWinPos;
6 Point maViewOrigin;
7 - Size maViewSize;
8 + Size maViewSize;
9 + Size maPrevSize; // contains previous window size in logical coords
10 USHORT mnMinZoom;
11 USHORT mnMaxZoom;
12 /** This flag tells whether to re-calculate the minimal zoom factor
13 --- sd/source/ui/view/sdwindow.cxx 2008-04-11 01:19:01.000000000 +0200
14 +++ sd/source/ui/view/sdwindow.cxx 2008-05-01 03:50:12.000000000 +0200
15 @@ -77,6 +77,7 @@
16 maWinPos(0, 0), // vorsichtshalber; die Werte sollten aber
17 maViewOrigin(0, 0), // vom Besitzer des Fensters neu gesetzt
18 maViewSize(1000, 1000), // werden
19 + maPrevSize(-1,-1),
20 mnMinZoom(MIN_ZOOM),
21 mnMaxZoom(MAX_ZOOM),
22 mbMinZoomAutoCalc(false),
23 @@ -490,6 +491,9 @@
24 aMap.SetScaleY(Fraction(nZoom, 100));
25 SetMapMode(aMap);
27 + // invalidate previous size - it was relative to the old scaling
28 + maPrevSize = Size(-1,-1);
30 // Update the map mode's origin (to what effect?).
31 UpdateMapOrigin();
33 @@ -634,11 +639,20 @@
35 void Window::UpdateMapOrigin(BOOL bInvalidate)
37 - BOOL bChanged = FALSE;
38 - Size aWinSize = PixelToLogic(GetOutputSizePixel());
39 + BOOL bChanged = FALSE;
40 + const Size aWinSize = PixelToLogic(GetOutputSizePixel());
42 if ( mbCenterAllowed )
44 + if( maPrevSize != Size(-1,-1) )
45 + {
46 + // keep view centered around current pos, when window
47 + // resizes
48 + maWinPos.X() -= (aWinSize.Width() - maPrevSize.Width()) / 2;
49 + maWinPos.Y() -= (aWinSize.Height() - maPrevSize.Height()) / 2;
50 + bChanged = TRUE;
51 + }
53 if ( maWinPos.X() > maViewSize.Width() - aWinSize.Width() )
55 maWinPos.X() = maViewSize.Width() - aWinSize.Width();
56 @@ -663,6 +677,8 @@
58 UpdateMapMode ();
60 + maPrevSize = aWinSize;
62 if (bChanged && bInvalidate)
63 Invalidate();