summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Hardeck <thardeck@suse.com>2012-01-13 18:22:46 +0100
committerJan Holesovsky <kendy@suse.cz>2012-01-13 23:04:12 +0100
commit022ce7d362f146ed69f54aae20cf2b8c582e9f8d (patch)
tree2119b7ead9c05302a72ad77fd199333e255df2ca
parent12eb7da661635a64272e32204f246d0a5c299ccd (diff)
fdo#44173: use a geometric progression for zooming
Zooming does now base on a geometric progression instead of an arithmetic one. Since the zoom factor is not only used in Draw but for all other applications 1.2 seems like a good choice.
-rw-r--r--sc/source/ui/view/prevwsh.cxx7
-rw-r--r--sc/source/ui/view/tabview.cxx9
-rw-r--r--sd/source/ui/view/viewshel.cxx8
-rw-r--r--svx/inc/svx/zoom_def.hxx3
-rw-r--r--svx/source/stbctrls/zoomsliderctrl.cxx6
-rw-r--r--sw/source/ui/uiview/viewport.cxx6
6 files changed, 22 insertions, 17 deletions
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index d76622a23ffb..b25a46486347 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -79,8 +79,7 @@
#include "sc.hrc"
#include "scabstdlg.hxx"
-// fuer Rad-Maus
-#define SC_DELTA_ZOOM 10
+// for mouse wheel
#define MINZOOM_SLIDER 10
#define MAXZOOM_SLIDER 400
@@ -449,9 +448,9 @@ sal_Bool ScPreviewShell::ScrollCommand( const CommandEvent& rCEvt )
long nOld = pPreview->GetZoom();
long nNew = nOld;
if ( pData->GetDelta() < 0 )
- nNew = Max( (long) MINZOOM, (long)( nOld - SC_DELTA_ZOOM ) );
+ nNew = Max( (long) MINZOOM, (long)round( nOld / ZOOM_FACTOR ));
else
- nNew = Min( (long) MAXZOOM, (long)( nOld + SC_DELTA_ZOOM ) );
+ nNew = Min( (long) MAXZOOM, (long)round( nOld * ZOOM_FACTOR ));
if ( nNew != nOld )
{
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index a5fdf313f11a..738aeec692f6 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -149,15 +149,14 @@
#include <string>
#include <algorithm>
+#include <svx/zoom_def.hxx>
+
#define SPLIT_MARGIN 30
#define SC_ICONSIZE 36
#define SC_SCROLLBAR_MIN 30
#define SC_TABBAR_MIN 6
-// fuer Rad-Maus
-#define SC_DELTA_ZOOM 10
-
using namespace ::com::sun::star;
// STATIC DATA -----------------------------------------------------------
@@ -1060,9 +1059,9 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
long nOld = (long)(( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator());
long nNew = nOld;
if ( pData->GetDelta() < 0 )
- nNew = Max( (long) MINZOOM, (long)( nOld - SC_DELTA_ZOOM ) );
+ nNew = Max( (long) MINZOOM, (long)round( nOld / ZOOM_FACTOR ));
else
- nNew = Min( (long) MAXZOOM, (long)( nOld + SC_DELTA_ZOOM ) );
+ nNew = Min( (long) MAXZOOM, (long)round( nOld * ZOOM_FACTOR ));
if ( nNew != nOld )
{
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 68ebe722f4e1..6c79ec29863f 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -82,6 +82,8 @@
#include <sfx2/request.hxx>
#include "SpellDialogChildWindow.hxx"
+#include <svx/zoom_def.hxx>
+
#include "Window.hxx"
#include "fupoor.hxx"
@@ -125,8 +127,6 @@ private:
namespace sd {
-static const int DELTA_ZOOM = 10;
-
sal_Bool ViewShell::IsPageFlipMode(void) const
{
return this->ISA(DrawViewShell) && mpContentWindow.get() != NULL &&
@@ -718,9 +718,9 @@ bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWi
long nNewZoom;
if( pData->GetDelta() < 0L )
- nNewZoom = Max( (long) pWin->GetMinZoom(), (long)(nOldZoom - DELTA_ZOOM) );
+ nNewZoom = Max( (long) pWin->GetMinZoom(), (long)round( nOldZoom / ZOOM_FACTOR ));
else
- nNewZoom = Min( (long) pWin->GetMaxZoom(), (long)(nOldZoom + DELTA_ZOOM) );
+ nNewZoom = Min( (long) pWin->GetMaxZoom(), (long)round( nOldZoom * ZOOM_FACTOR ));
SetZoom( nNewZoom );
Invalidate( SID_ATTR_ZOOM );
diff --git a/svx/inc/svx/zoom_def.hxx b/svx/inc/svx/zoom_def.hxx
index 0a244763ed98..e1944931e01d 100644
--- a/svx/inc/svx/zoom_def.hxx
+++ b/svx/inc/svx/zoom_def.hxx
@@ -8,4 +8,7 @@
#endif
+// zoom factor for Calc, Writer, Draw and Impress
+#define ZOOM_FACTOR 1.2
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx
index aa8ae8a58972..b27048025d8d 100644
--- a/svx/source/stbctrls/zoomsliderctrl.cxx
+++ b/svx/source/stbctrls/zoomsliderctrl.cxx
@@ -36,6 +36,8 @@
#include <svx/dialmgr.hxx>
#include <svx/dialogs.hrc>
+#include <svx/zoom_def.hxx>
+
#include <set>
// -----------------------------------------------------------------------
@@ -357,11 +359,11 @@ sal_Bool SvxZoomSliderControl::MouseButtonDown( const MouseEvent & rEvt )
// click to - button
if ( nXDiff >= nButtonLeftOffset && nXDiff <= nButtonRightOffset )
- mpImpl->mnCurrentZoom = mpImpl->mnCurrentZoom - 5;
+ mpImpl->mnCurrentZoom = round( mpImpl->mnCurrentZoom / ZOOM_FACTOR );
// click to + button
else if ( nXDiff >= aControlRect.GetWidth() - nSliderXOffset + nButtonLeftOffset &&
nXDiff <= aControlRect.GetWidth() - nSliderXOffset + nButtonRightOffset )
- mpImpl->mnCurrentZoom = mpImpl->mnCurrentZoom + 5;
+ mpImpl->mnCurrentZoom = round( mpImpl->mnCurrentZoom * ZOOM_FACTOR );
// click to slider
else if( nXDiff >= nSliderXOffset && nXDiff <= aControlRect.GetWidth() - nSliderXOffset )
mpImpl->mnCurrentZoom = Offset2Zoom( nXDiff );
diff --git a/sw/source/ui/uiview/viewport.cxx b/sw/source/ui/uiview/viewport.cxx
index e4fc725c87b1..6bbb5d6e0c87 100644
--- a/sw/source/ui/uiview/viewport.cxx
+++ b/sw/source/ui/uiview/viewport.cxx
@@ -52,6 +52,8 @@
#include <IDocumentSettingAccess.hxx>
+#include <svx/zoom_def.hxx>
+
//Das SetVisArea der DocShell darf nicht vom InnerResizePixel gerufen werden.
//Unsere Einstellungen muessen aber stattfinden.
#ifndef WB_RIGHT_ALIGNED
@@ -1309,9 +1311,9 @@ sal_Bool SwView::HandleWheelCommands( const CommandEvent& rCEvt )
{
sal_uInt16 nFact = pWrtShell->GetViewOptions()->GetZoom();
if( 0L > pWData->GetDelta() )
- nFact = static_cast< sal_uInt16 >(Max( 20, nFact - 10 ));
+ nFact = static_cast< sal_uInt16 >(Max( 20, (int)round( nFact / ZOOM_FACTOR )));
else
- nFact = static_cast< sal_uInt16 >(Min( 600, nFact + 10 ));
+ nFact = static_cast< sal_uInt16 >(Min( 600, (int)round( nFact * ZOOM_FACTOR )));
SetZoom( SVX_ZOOM_PERCENT, nFact );
bOk = sal_True;