summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/inc/tabview.hxx2
-rw-r--r--sc/source/ui/view/tabview.cxx31
2 files changed, 20 insertions, 13 deletions
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index ebb7337d78b7..f62b2c4f9cba 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -254,6 +254,8 @@ private:
void PaintRangeFinderEntry (const ScRangeFindData* pData, SCTAB nTab);
+ void SetZoomPercentFromCommand(sal_uInt16 nZoomPercent);
+
protected:
void UpdateHeaderWidth( const ScVSplitPos* pWhich = nullptr,
const SCROW* pPosY = nullptr );
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 94a9aa144ad6..f12327b04a5d 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -935,6 +935,23 @@ Point ScTabView::GetGridOffset() const
// --- Scroll-Bars --------------------------------------------------------
+void ScTabView::SetZoomPercentFromCommand(sal_uInt16 nZoomPercent)
+{
+ // scroll wheel doesn't set the AppOptions default
+
+ bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
+ SetZoomType(SvxZoomType::PERCENT, bSyncZoom);
+ Fraction aFract(nZoomPercent, 100);
+ SetZoom(aFract, aFract, bSyncZoom);
+ PaintGrid();
+ PaintTop();
+ PaintLeft();
+ aViewData.GetBindings().Invalidate( SID_ATTR_ZOOM);
+ aViewData.GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER);
+ aViewData.GetBindings().Invalidate( SID_ZOOM_IN);
+ aViewData.GetBindings().Invalidate( SID_ZOOM_OUT);
+}
+
bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
{
HideNoteMarker();
@@ -957,19 +974,7 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
nNew = std::min( MAXZOOM, basegfx::zoomtools::zoomIn( nOld ));
if ( nNew != nOld )
{
- // scroll wheel doesn't set the AppOptions default
-
- bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
- SetZoomType( SvxZoomType::PERCENT, bSyncZoom );
- Fraction aFract( nNew, 100 );
- SetZoom( aFract, aFract, bSyncZoom );
- PaintGrid();
- PaintTop();
- PaintLeft();
- aViewData.GetBindings().Invalidate( SID_ATTR_ZOOM );
- aViewData.GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
- aViewData.GetBindings().Invalidate( SID_ZOOM_IN);
- aViewData.GetBindings().Invalidate( SID_ZOOM_OUT);
+ SetZoomPercentFromCommand(nNew);
}
bDone = true;