diff options
author | Povilas Kanapickas <povilas@radix.lt> | 2022-12-07 03:13:28 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2022-12-14 13:46:49 +0000 |
commit | f87a0480af5b15d673490a5b1736133148ec7333 (patch) | |
tree | 40953c0ad10c9cb6f1b61c922b46b32af57db644 /sc | |
parent | cedf0458966b6e7e4398b45ee77f77053d43e79c (diff) |
sc: Extract ScTabView::SetZoomPercentFromCommand()
Change-Id: I06ece9a99886d94bf0b3396730951760cb199e97
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143755
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/inc/tabview.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/tabview.cxx | 31 |
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; |