[Libreoffice-commits] core.git: sw/sdi sw/source
Jim Raykowski (via logerrit)
logerrit at kemper.freedesktop.org
Sun Sep 27 04:35:31 UTC 2020
sw/sdi/_viewsh.sdi | 10 ++++++++++
sw/source/uibase/uiview/view2.cxx | 13 +++++++++++++
sw/source/uibase/uiview/viewmdi.cxx | 3 +++
sw/source/uibase/uiview/viewstat.cxx | 11 +++++++++++
4 files changed, 37 insertions(+)
New commits:
commit 2cddaa6e199ed8bb6185b7825791199f9da4a670
Author: Jim Raykowski <raykowj at gmail.com>
AuthorDate: Tue Sep 15 21:41:25 2020 -0800
Commit: Jim Raykowski <raykowj at gmail.com>
CommitDate: Sun Sep 27 06:34:51 2020 +0200
tdf#45705 Integrate zoom UI commands into Writer text edit view
Change-Id: I71481e018175086a1a1711db22cea03b13eda490
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102830
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj at gmail.com>
diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index e087a07a6126..8231265d4e21 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -18,6 +18,16 @@
interface BaseTextEditView
{
+ SID_ZOOM_IN
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+ SID_ZOOM_OUT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
FN_TOGGLE_OUTLINE_CONTENT_VISIBILITY
[
ExecMethod = Execute ;
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index b4ae522a2cf9..6866c8b4788a 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -141,6 +141,8 @@
#include <memory>
#include <string_view>
+#include <basegfx/utils/zoomtools.hxx>
+
const char sStatusDelim[] = " : ";
using namespace sfx2;
@@ -581,6 +583,17 @@ void SwView::Execute(SfxRequest &rReq)
rTmpWin.SetUseInputLanguage( false );
}
break;
+ case SID_ZOOM_IN:
+ case SID_ZOOM_OUT:
+ {
+ long nFact = m_pWrtShell->GetViewOptions()->GetZoom();
+ if (SID_ZOOM_OUT == nSlot)
+ nFact = basegfx::zoomtools::zoomIn(nFact);
+ else
+ nFact = basegfx::zoomtools::zoomOut(nFact);
+ SetZoom(SvxZoomType::PERCENT, nFact);
+ }
+ break;
case FN_TO_PREV_PAGE:
case FN_TO_NEXT_PAGE:
{
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index 12606618f8e2..3b18942f150d 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -77,6 +77,9 @@ void SwView::SetZoom( SvxZoomType eZoomType, short nFactor, bool bViewOnly )
if (bCursorIsVisible)
m_pWrtShell->ShowCursor();
+ Invalidate(SID_ZOOM_IN);
+ Invalidate(SID_ZOOM_OUT);
+
collectUIInformation(OUString::number(nFactor));
}
diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx
index c9ace0d854a0..8c267d180350 100644
--- a/sw/source/uibase/uiview/viewstat.cxx
+++ b/sw/source/uibase/uiview/viewstat.cxx
@@ -69,6 +69,17 @@ void SwView::GetState(SfxItemSet &rSet)
{
switch(nWhich)
{
+ case SID_ZOOM_IN:
+ case SID_ZOOM_OUT:
+ {
+ long nFact = m_pWrtShell->GetViewOptions()->GetZoom();
+ if ((SID_ZOOM_OUT == nWhich && nFact >= long(600)) ||
+ (SID_ZOOM_IN == nWhich && nFact <= long(20)))
+ {
+ rSet.DisableItem(nWhich);
+ }
+ }
+ break;
case FN_TOGGLE_OUTLINE_CONTENT_VISIBILITY:
{
bool bDisable(true);
More information about the Libreoffice-commits
mailing list