summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2020-10-11 16:15:47 -0800
committerJim Raykowski <raykowj@gmail.com>2020-11-13 17:53:20 +0100
commit95b27dd2e5b5bdcb39962f72882dcdf406bcb393 (patch)
tree84c49a7daadf1ce908a9f5608d40494af164917d /sc
parentd40f2d02df26e216f367b5da3f9546b73f250469 (diff)
tdf#45705 rework zoom in and zoom out UI commands in Calc
Similar to commit 2cddaa6e199ed8bb6185b7825791199f9da4a670 done for Writer view shell, this patch makes zoom in and zoom out commands functional for Calc view shell in addition to the preview shell. Change-Id: Ibf1fd92e79c82cdea91d0d01491ac25577df54fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104196 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/sc.hrc2
-rw-r--r--sc/sdi/prevwsh.sdi4
-rw-r--r--sc/sdi/scalc.sdi36
-rw-r--r--sc/sdi/tabvwsh.sdi2
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx2
-rw-r--r--sc/source/ui/view/preview.cxx10
-rw-r--r--sc/source/ui/view/prevwsh.cxx10
-rw-r--r--sc/source/ui/view/tabview.cxx4
-rw-r--r--sc/source/ui/view/tabview3.cxx2
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx42
-rw-r--r--sc/source/ui/view/tabvwsha.cxx17
11 files changed, 83 insertions, 48 deletions
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index f13b1fb78ab4..b493545ec810 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -458,8 +458,6 @@
#define SID_PREVIEW_PREVIOUS (SID_PREVIEW_START+1)
#define SID_PREVIEW_FIRST (SID_PREVIEW_START+2)
#define SID_PREVIEW_LAST (SID_PREVIEW_START+3)
-#define SID_PREVIEW_ZOOMIN (SID_PREVIEW_START+5)
-#define SID_PREVIEW_ZOOMOUT (SID_PREVIEW_START+6)
#define SID_PREVIEW_CLOSE (SID_PREVIEW_START+7)
#define SID_PREVIEW_MARGIN (SID_PREVIEW_START+8)
#define SID_PREVIEW_SCALINGFACTOR (SID_PREVIEW_START+9)
diff --git a/sc/sdi/prevwsh.sdi b/sc/sdi/prevwsh.sdi
index 2dc6211ed86a..58cba8eaf47a 100644
--- a/sc/sdi/prevwsh.sdi
+++ b/sc/sdi/prevwsh.sdi
@@ -119,8 +119,8 @@ interface TablePrintPreview
StateMethod = GetState ;
GroupId = SfxGroupId::Intern ;
]
- SID_PREVIEW_ZOOMIN [ ExecMethod = Execute; StateMethod = GetState; ]
- SID_PREVIEW_ZOOMOUT [ ExecMethod = Execute; StateMethod = GetState; ]
+ SID_ZOOM_IN [ ExecMethod = Execute; StateMethod = GetState; ]
+ SID_ZOOM_OUT [ ExecMethod = Execute; StateMethod = GetState; ]
SID_REPAINT [ ExecMethod = Execute; StateMethod = GetState; ]
SID_UNDO [ ExecMethod = Execute; StateMethod = GetState; ]
SID_REDO [ ExecMethod = Execute; StateMethod = GetState; ]
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 86ae80497a77..077fa4adf9d9 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -5876,42 +5876,6 @@ SfxBoolItem WrapText SID_ATTR_ALIGN_LINEBREAK
]
-SfxVoidItem ZoomIn SID_PREVIEW_ZOOMIN
-()
-[
- AutoUpdate = FALSE,
- FastCall = FALSE,
- ReadOnlyDoc = TRUE,
- Toggle = FALSE,
- Container = FALSE,
- RecordAbsolute = FALSE,
- RecordPerSet;
-
- AccelConfig = TRUE,
- MenuConfig = FALSE,
- ToolBoxConfig = TRUE,
- GroupId = SfxGroupId::View;
-]
-
-
-SfxVoidItem ZoomOut SID_PREVIEW_ZOOMOUT
-()
-[
- AutoUpdate = FALSE,
- FastCall = FALSE,
- ReadOnlyDoc = TRUE,
- Toggle = FALSE,
- Container = FALSE,
- RecordAbsolute = FALSE,
- RecordPerSet;
-
- AccelConfig = TRUE,
- MenuConfig = FALSE,
- ToolBoxConfig = TRUE,
- GroupId = SfxGroupId::View;
-]
-
-
SfxVoidItem FocusInputLine SID_FOCUS_INPUTLINE
()
[
diff --git a/sc/sdi/tabvwsh.sdi b/sc/sdi/tabvwsh.sdi
index 1026c3e98105..50049bad7abc 100644
--- a/sc/sdi/tabvwsh.sdi
+++ b/sc/sdi/tabvwsh.sdi
@@ -161,6 +161,8 @@ interface TableEditView
SID_CREATE_SW_DRAWVIEW [ ExecMethod = Execute; ]
SID_ATTR_ZOOM [ ExecMethod = Execute; StateMethod = GetState; ]
SID_ATTR_ZOOMSLIDER [ ExecMethod = Execute; StateMethod = GetState; ]
+ SID_ZOOM_IN [ ExecMethod = Execute; StateMethod = GetState; ]
+ SID_ZOOM_OUT [ ExecMethod = Execute; StateMethod = GetState; ]
FID_INSERT_FILE [ ExecMethod = Execute; StateMethod = GetState; ]
FID_SCALE [ ExecMethod = Execute; StateMethod = GetState; ]
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index feea0f85f567..5390a7d0b903 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -1397,6 +1397,8 @@ void ScTabViewObj::SetZoom(sal_Int16 nZoom)
pViewSh->PaintLeft();
pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
+ pViewSh->GetViewFrame()->GetBindings().Invalidate(SID_ZOOM_IN);
+ pViewSh->GetViewFrame()->GetBindings().Invalidate(SID_ZOOM_OUT);
}
sal_Int16 ScTabViewObj::GetZoomType() const
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index 2ad68508b2e6..c95d45fd5dc0 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -65,6 +65,8 @@
#include <memory>
+#include <sfx2/sfxsids.hrc>
+
#define SC_PREVIEW_SHADOWSIZE 2
static tools::Long lcl_GetDisplayStart( SCTAB nTab, const ScDocument* pDoc, std::vector<tools::Long>& nPages )
@@ -654,9 +656,9 @@ void ScPreview::KeyInput( const KeyEvent& rKEvt )
sal_uInt16 nSlot = 0;
switch(nKey)
{
- case KEY_ADD: nSlot = SID_PREVIEW_ZOOMIN; break;
+ case KEY_ADD: nSlot = SID_ZOOM_IN; break;
case KEY_ESCAPE: nSlot = ScViewUtil::IsFullScreen( *pViewShell ) ? SID_CANCEL : SID_PREVIEW_CLOSE; break;
- case KEY_SUBTRACT: nSlot = SID_PREVIEW_ZOOMOUT; break;
+ case KEY_SUBTRACT: nSlot = SID_ZOOM_OUT; break;
}
if(nSlot)
{
@@ -909,8 +911,8 @@ void ScPreview::StaticInvalidate()
rBindings.Invalidate(SID_PREVIEW_FIRST);
rBindings.Invalidate(SID_PREVIEW_LAST);
rBindings.Invalidate(SID_ATTR_ZOOM);
- rBindings.Invalidate(SID_PREVIEW_ZOOMIN);
- rBindings.Invalidate(SID_PREVIEW_ZOOMOUT);
+ rBindings.Invalidate(SID_ZOOM_IN);
+ rBindings.Invalidate(SID_ZOOM_OUT);
rBindings.Invalidate(SID_PREVIEW_SCALINGFACTOR);
rBindings.Invalidate(SID_ATTR_ZOOMSLIDER);
}
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index c16159c709cc..c0304ef55493 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -68,6 +68,8 @@
#include <vcl/EnumContext.hxx>
#include <vcl/notebookbar.hxx>
+#include <sfx2/sfxsids.hrc>
+
// for mouse wheel
#define MINZOOM_SLIDER 10
#define MAXZOOM_SLIDER 400
@@ -676,7 +678,7 @@ void ScPreviewShell::Execute( SfxRequest& rReq )
}
}
break;
- case SID_PREVIEW_ZOOMIN:
+ case SID_ZOOM_IN:
{
sal_uInt16 nNew = pPreview->GetZoom() + 20 ;
nNew -= nNew % 20;
@@ -685,7 +687,7 @@ void ScPreviewShell::Execute( SfxRequest& rReq )
rReq.Done();
}
break;
- case SID_PREVIEW_ZOOMOUT:
+ case SID_ZOOM_OUT:
{
sal_uInt16 nNew = pPreview->GetZoom() - 1;
nNew -= nNew % 20;
@@ -807,11 +809,11 @@ void ScPreviewShell::GetState( SfxItemSet& rSet )
if (!nTotal || nPage==nTotal-1)
rSet.DisableItem(nWhich);
break;
- case SID_PREVIEW_ZOOMIN:
+ case SID_ZOOM_IN:
if (nZoom >= 400)
rSet.DisableItem(nWhich);
break;
- case SID_PREVIEW_ZOOMOUT:
+ case SID_ZOOM_OUT:
if (nZoom <= 20)
rSet.DisableItem(nWhich);
break;
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index d9eaab465ca4..70e781d5e30c 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -749,6 +749,8 @@ void ScTabView::UpdateVarZoom()
PaintLeft();
aViewData.GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
aViewData.GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
+ aViewData.GetBindings().Invalidate(SID_ZOOM_IN);
+ aViewData.GetBindings().Invalidate(SID_ZOOM_OUT);
}
bInZoomUpdate = false;
}
@@ -975,6 +977,8 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
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);
}
bDone = true;
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index f9334be17c2a..11290711ab60 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -3032,6 +3032,8 @@ void ScTabView::ZoomChanged()
SfxBindings& rBindings = aViewData.GetBindings();
rBindings.Invalidate( SID_ATTR_ZOOM );
rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
+ rBindings.Invalidate(SID_ZOOM_IN);
+ rBindings.Invalidate(SID_ZOOM_OUT);
HideNoteMarker();
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 5d86c0c41e4d..c2f496b3e2cd 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -57,6 +57,8 @@
#include <sfx2/lokhelper.hxx>
#include <scabstdlg.hxx>
+#include <basegfx/utils/zoomtools.hxx>
+
namespace
{
void collectUIInformation(const OUString& aZoom)
@@ -691,6 +693,44 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
}
break;
+ // handling for SID_ZOOM_IN and SID_ZOOM_OUT is ScTabView::ScrollCommand
+ // CommandWheelMode::ZOOM inspired
+ case SID_ZOOM_IN:
+ case SID_ZOOM_OUT:
+ {
+ HideNoteMarker();
+
+ if (!GetViewData().GetViewShell()->GetViewFrame()->GetFrame().IsInPlace())
+ {
+ // for ole inplace editing, the scale is defined by the visarea and client size
+ // and can't be changed directly
+
+ const Fraction& rOldY = GetViewData().GetZoomY();
+ long nOld = static_cast<long>(rOldY * 100);
+ long nNew;
+ if (SID_ZOOM_OUT == nSlot)
+ nNew = std::max(long(MINZOOM), basegfx::zoomtools::zoomOut(nOld));
+ else
+ nNew = std::min(long(MAXZOOM), basegfx::zoomtools::zoomIn(nOld));
+ if ( nNew != nOld)
+ {
+ bool bSyncZoom = SC_MOD()->GetAppOptions().GetSynchronizeZoom();
+ SetZoomType(SvxZoomType::PERCENT, bSyncZoom);
+ Fraction aFract(nNew, 100);
+ SetZoom(aFract, aFract, bSyncZoom);
+ PaintGrid();
+ PaintTop();
+ PaintLeft();
+ rBindings.Invalidate(SID_ATTR_ZOOM);
+ rBindings.Invalidate(SID_ATTR_ZOOMSLIDER);
+ rBindings.Invalidate(SID_ZOOM_IN);
+ rBindings.Invalidate(SID_ZOOM_OUT);
+ rReq.Done();
+ }
+ }
+ }
+ break;
+
case SID_ATTR_ZOOM: // status row
case FID_SCALE:
{
@@ -816,6 +856,8 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
PaintTop();
PaintLeft();
rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
+ rBindings.Invalidate( SID_ZOOM_IN );
+ rBindings.Invalidate( SID_ZOOM_OUT );
rReq.Done();
}
}
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 041560a67ff6..8b6674dca3c9 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -291,6 +291,23 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
}
break;
+ case SID_ZOOM_IN:
+ {
+ const Fraction& rZoomY = GetViewData().GetZoomY();
+ long nZoom = static_cast<long>(rZoomY * 100);
+ if (nZoom >= long(MAXZOOM))
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case SID_ZOOM_OUT:
+ {
+ const Fraction& rZoomY = GetViewData().GetZoomY();
+ long nZoom = static_cast<long>(rZoomY * 100);
+ if (nZoom <= long(MINZOOM))
+ rSet.DisableItem(nWhich);
+ }
+ break;
+
case FID_SCALE:
case SID_ATTR_ZOOM:
if ( bOle )