summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorHeiko Tietze <tietze.heiko@gmail.com>2021-03-04 09:41:55 +0100
committerHeiko Tietze <heiko.tietze@documentfoundation.org>2021-03-18 10:13:26 +0100
commit951b243f10a7c184e635ce1d84f69683d8e7abde (patch)
tree31a5a80f04d93db3714f928effc7eb109e575e1d /sd
parentb3b1936ecdf5396892849d0e90d94324fad609ac (diff)
Resolves tdf#66470 - Scaling value in statusbar
Changes also the sort order at the options Change-Id: I61c231fb94d4b4c66358a17e7585609e31eb6a70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111947 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'sd')
-rw-r--r--sd/Library_sd.mk1
-rw-r--r--sd/inc/app.hrc1
-rw-r--r--sd/inc/strings.hrc1
-rw-r--r--sd/sdi/SlideSorterController.sdi5
-rw-r--r--sd/sdi/_drvwsh.sdi5
-rw-r--r--sd/sdi/outlnvsh.sdi5
-rw-r--r--sd/sdi/sdraw.sdi18
-rw-r--r--sd/source/ui/app/scalectrl.cxx108
-rw-r--r--sd/source/ui/app/sddll.cxx2
-rw-r--r--sd/source/ui/dlg/tpoption.cxx4
-rw-r--r--sd/source/ui/func/fuoltext.cxx1
-rw-r--r--sd/source/ui/inc/scalectrl.hxx39
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx1
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSlotManager.cxx5
-rw-r--r--sd/source/ui/view/drviewsa.cxx8
-rw-r--r--sd/uiconfig/sdraw/statusbar/statusbar.xml1
16 files changed, 203 insertions, 2 deletions
diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk
index fe2dfc3d7617..092dc70da1ef 100644
--- a/sd/Library_sd.mk
+++ b/sd/Library_sd.mk
@@ -199,6 +199,7 @@ $(eval $(call gb_Library_add_exception_objects,sd,\
sd/source/ui/app/sdpopup \
sd/source/ui/app/sdxfer \
sd/source/ui/app/tmplctrl \
+ sd/source/ui/app/scalectrl \
sd/source/ui/controller/slidelayoutcontroller \
sd/source/ui/controller/displaymodecontroller \
sd/source/ui/dlg/AnimationChildWindow \
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index 450bc35195fa..4a20807138b9 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -152,6 +152,7 @@
#define SID_DELETE_LAYER (SID_SD_START+81)
#define SID_DISMANTLE (SID_SD_START+82)
// FREE
+#define SID_SCALE (SID_SD_START+85)
#define SID_STATUS_PAGE (SID_SD_START+86)
#define SID_STATUS_LAYOUT (SID_SD_START+87)
#define SID_STATUS_SELMODE (SID_SD_START+88)
diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc
index 183324d2679a..751b576ec0ec 100644
--- a/sd/inc/strings.hrc
+++ b/sd/inc/strings.hrc
@@ -104,6 +104,7 @@
#define STR_DLG_INSERT_PAGES_FROM_FILE NC_("STR_DLG_INSERT_PAGES_FROM_FILE", "Insert File")
#define STR_READ_DATA_ERROR NC_("STR_READ_DATA_ERROR", "The file could not be loaded!")
#define STR_SCALE_OBJECTS NC_("STR_SCALE_OBJECTS", "The page size of the target document is different than the source document.\n\nDo you want to scale the copied objects to fit the new page size?")
+#define STR_SCALE_TOOLTIP NC_("STR_SCALE_TOOLTIP", "Scaling factor of the document; right-click to change.")
#define STR_CREATE_PAGES NC_("STR_CREATE_PAGES", "Create Slides")
#define STR_UNDO_CHANGE_PAGEFORMAT NC_("STR_UNDO_CHANGE_PAGEFORMAT", "Modify page format")
#define STR_UNDO_CHANGE_PAGEBORDER NC_("STR_UNDO_CHANGE_PAGEBORDER", "Modify page margins")
diff --git a/sd/sdi/SlideSorterController.sdi b/sd/sdi/SlideSorterController.sdi
index 8b4f08c63e1f..22bc64214868 100644
--- a/sd/sdi/SlideSorterController.sdi
+++ b/sd/sdi/SlideSorterController.sdi
@@ -186,6 +186,11 @@ interface SlideSorterView
ExecMethod = ExecStatusBar ;
StateMethod = GetStatusBarState ;
]
+ SID_SCALE // ole : no, status : ?
+ [
+ ExecMethod = ExecStatusBar ;
+ StateMethod = GetStatusBarState ;
+ ]
SID_RELOAD // ole : no, status : ?
[
GroupId = SfxGroupId::Document ;
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index 2307906426da..bbbfdaabc332 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -1682,6 +1682,11 @@ interface DrawView
ExecMethod = ExecStatusBar ;
StateMethod = GetStatusBarState ;
]
+ SID_SCALE // ole : no, status : ?
+ [
+ ExecMethod = ExecStatusBar ;
+ StateMethod = GetStatusBarState ;
+ ]
SID_LINEEND_POLYGON // ole : no, status : ?
[
ExecMethod = FuTemporary ;
diff --git a/sd/sdi/outlnvsh.sdi b/sd/sdi/outlnvsh.sdi
index 3b34d20f1c76..09957e8a0e39 100644
--- a/sd/sdi/outlnvsh.sdi
+++ b/sd/sdi/outlnvsh.sdi
@@ -261,6 +261,11 @@ interface OutlineView
ExecMethod = ExecStatusBar ;
StateMethod = GetStatusBarState ;
]
+ SID_SCALE // ole : no, status : ?
+ [
+ ExecMethod = ExecStatusBar ;
+ StateMethod = GetStatusBarState ;
+ ]
SID_THESAURUS // ole : no, status : ?
[
ExecMethod = FuTemporaryModify ;
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 436a89cc30b4..c45a8bea5e68 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -2401,6 +2401,24 @@ SfxStringItem LayoutStatus SID_STATUS_LAYOUT
GroupId = SfxGroupId::View;
]
+SfxStringItem Scale SID_SCALE
+
+[
+ AutoUpdate = FALSE,
+ FastCall = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = SfxGroupId::View;
+]
+
SfxBoolItem LeaveAllGroups SID_LEAVE_ALL_GROUPS
[
diff --git a/sd/source/ui/app/scalectrl.cxx b/sd/source/ui/app/scalectrl.cxx
new file mode 100644
index 000000000000..e1826957b03e
--- /dev/null
+++ b/sd/source/ui/app/scalectrl.cxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <scalectrl.hxx>
+
+#include <vcl/commandevent.hxx>
+#include <vcl/status.hxx>
+#include <vcl/weldutils.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/sfxsids.hrc>
+
+#include <ViewShellBase.hxx>
+#include <drawdoc.hxx>
+#include <app.hrc>
+#include <sdresid.hxx>
+#include <strings.hrc>
+
+SFX_IMPL_STATUSBAR_CONTROL(SdScaleControl, SfxStringItem);
+
+// class SdScaleControl ------------------------------------------
+SdScaleControl::SdScaleControl(sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& rStb)
+ : SfxStatusBarControl(_nSlotId, _nId, rStb)
+{
+ GetStatusBar().SetQuickHelpText(GetId(), SdResId(STR_SCALE_TOOLTIP));
+}
+
+SdScaleControl::~SdScaleControl() {}
+
+void SdScaleControl::StateChanged(sal_uInt16 /*nSID*/, SfxItemState eState,
+ const SfxPoolItem* pState)
+{
+ if (eState != SfxItemState::DEFAULT || pState->IsVoidItem())
+ return;
+ auto pStringItem = dynamic_cast<const SfxStringItem*>(pState);
+ GetStatusBar().SetItemText(GetId(), pStringItem->GetValue());
+}
+
+void SdScaleControl::Command(const CommandEvent& rCEvt)
+{
+ if (rCEvt.GetCommand() != CommandEventId::ContextMenu
+ || GetStatusBar().GetItemText(GetId()).isEmpty())
+ return;
+
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+
+ sd::ViewShellBase* pViewShellBase = sd::ViewShellBase::GetViewShellBase(pViewFrame);
+ if (!pViewShellBase)
+ return;
+
+ SdDrawDocument* pDoc = pViewShellBase->GetDocument();
+ if (!pDoc)
+ return;
+
+ std::unique_ptr<weld::Builder> xBuilder(
+ Application::CreateBuilder(nullptr, "modules/simpress/ui/masterpagemenu.ui"));
+ std::unique_ptr<weld::Menu> xPopup(xBuilder->weld_menu("menu"));
+
+ sal_uInt16 aTable[12] = { 1, 2, 4, 5, 8, 10, 16, 20, 30, 40, 50, 100 };
+
+ for (sal_uInt16 i = 11; i > 0; i--)
+ xPopup->append(OUString::number(12 - i), OUString::number(aTable[i]) + ":1");
+ for (sal_uInt16 i = 0; i < 12; i++)
+ xPopup->append(OUString::number(12 + i), "1:" + OUString::number(aTable[i]));
+
+ ::tools::Rectangle aRect(rCEvt.GetMousePosPixel(), Size(1, 1));
+ weld::Window* pParent = weld::GetPopupParent(GetStatusBar(), aRect);
+ OString sResult = xPopup->popup_at_rect(pParent, aRect);
+ if (!sResult.isEmpty())
+ {
+ sal_Int32 i = sResult.toUInt32();
+ sal_Int32 nX;
+ sal_Int32 nY;
+ if (i > 11)
+ nX = 1;
+ else
+ nX = aTable[12 - i % 12];
+ if (i > 11)
+ nY = aTable[i % 12];
+ else
+ nY = 1;
+ pDoc->SetUIScale(Fraction(nX, nY));
+
+ SfxBindings& pBindings = pViewFrame->GetBindings();
+ pBindings.Invalidate(SID_SCALE); //update statusbar
+ pBindings.Invalidate(SID_ATTR_METRIC); //update sidebar
+ pViewShellBase->UpdateBorder(true); // update ruler
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx
index cbcd201095d3..4e20d0997fb8 100644
--- a/sd/source/ui/app/sddll.cxx
+++ b/sd/source/ui/app/sddll.cxx
@@ -54,6 +54,7 @@
#include <SdShapeTypes.hxx>
#include <TextObjectBar.hxx>
#include <tmplctrl.hxx>
+#include <scalectrl.hxx>
#include <svx/svxids.hrc>
#include <svx/bmpmask.hxx>
@@ -198,6 +199,7 @@ void SdDLL::RegisterControllers(SdModule* pMod)
#endif
XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE, pMod );
SdTemplateControl::RegisterControl( SID_STATUS_LAYOUT, pMod );
+ SdScaleControl::RegisterControl( SID_SCALE, pMod );
SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod );
}
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index e2abc9565251..1da1974bedb7 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -253,9 +253,9 @@ SdTpOptionsMisc::SdTpOptionsMisc(weld::Container* pPage, weld::DialogController*
sal_uInt16 aTable[ TABLE_COUNT ] =
{ 1, 2, 4, 5, 8, 10, 16, 20, 30, 40, 50, 100 };
- for( sal_uInt16 i = 0; i < TABLE_COUNT; i++ )
+ for( sal_uInt16 i = TABLE_COUNT-1; i > 0 ; i-- )
m_xCbScale->append_text( GetScale( 1, aTable[i] ) );
- for( sal_uInt16 i = 1; i < TABLE_COUNT; i++ )
+ for( sal_uInt16 i = 0; i < TABLE_COUNT; i++ )
m_xCbScale->append_text( GetScale( aTable[i], 1 ) );
}
diff --git a/sd/source/ui/func/fuoltext.cxx b/sd/source/ui/func/fuoltext.cxx
index 2314e3b75d33..07c3625ffe46 100644
--- a/sd/source/ui/func/fuoltext.cxx
+++ b/sd/source/ui/func/fuoltext.cxx
@@ -77,6 +77,7 @@ const sal_uInt16 SidArray[] = {
SID_PARASPACE_DECREASE,
SID_STATUS_PAGE,
SID_STATUS_LAYOUT,
+ SID_SCALE,
SID_EXPAND_PAGE,
SID_SUMMARY_PAGE,
0 };
diff --git a/sd/source/ui/inc/scalectrl.hxx b/sd/source/ui/inc/scalectrl.hxx
new file mode 100644
index 000000000000..85c93017172f
--- /dev/null
+++ b/sd/source/ui/inc/scalectrl.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <sfx2/stbitem.hxx>
+
+class SdScaleControl : public SfxStatusBarControl
+{
+public:
+ SdScaleControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb);
+ virtual ~SdScaleControl() override;
+
+ virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
+ const SfxPoolItem* pState) override;
+
+ SFX_DECL_STATUSBAR_CONTROL();
+
+protected:
+ virtual void Command(const CommandEvent& rCEvt) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx
index 1bda593e16be..e1f75b21c5cf 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx
@@ -229,6 +229,7 @@ void SelectionManager::SelectionHasChanged ()
// StatusBar
pViewShell->Invalidate (SID_STATUS_PAGE);
pViewShell->Invalidate (SID_STATUS_LAYOUT);
+ pViewShell->Invalidate (SID_SCALE);
OSL_ASSERT(mrController.GetCurrentSlideManager());
SharedPageDescriptor pDescriptor(mrController.GetCurrentSlideManager()->GetCurrentSlide());
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index bc65ac5be70c..215d5ae1682a 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -860,6 +860,11 @@ void SlotManager::GetStatusBarState (SfxItemSet& rSet)
aLayoutStr = aLayoutStr.copy(0, nIndex);
rSet.Put( SfxStringItem( SID_STATUS_LAYOUT, aLayoutStr ) );
}
+ //Scale value
+ const Fraction& aUIScale = mrSlideSorter.GetModel().GetDocument()->GetUIScale();
+ OUString aString = OUString::number(aUIScale.GetNumerator()) +
+ ":" + OUString::number(aUIScale.GetDenominator());
+ rSet.Put( SfxStringItem( SID_SCALE, aString ) );
}
void SlotManager::RenameSlide(const SfxRequest& rRequest)
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index c489745af601..92174788cfc6 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -714,6 +714,14 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
aString = aString.copy(0, nPos);
rSet.Put( SfxStringItem( SID_STATUS_LAYOUT, aString ) );
}
+ // Scale
+ if( SfxItemState::DEFAULT == rSet.GetItemState( SID_SCALE ) )
+ {
+ const Fraction& aUIScale = GetDoc()->GetUIScale();
+ OUString aString = OUString::number(aUIScale.GetNumerator()) +
+ ":" + OUString::number(aUIScale.GetDenominator());
+ rSet.Put( SfxStringItem( SID_SCALE, aString ) );
+ }
}
void DrawViewShell::Notify (SfxBroadcaster&, const SfxHint& rHint)
diff --git a/sd/uiconfig/sdraw/statusbar/statusbar.xml b/sd/uiconfig/sdraw/statusbar/statusbar.xml
index 6a975cb477de..e89d1abc1f2e 100644
--- a/sd/uiconfig/sdraw/statusbar/statusbar.xml
+++ b/sd/uiconfig/sdraw/statusbar/statusbar.xml
@@ -22,6 +22,7 @@
<statusbar:statusbaritem xlink:href=".uno:Context" statusbar:align="left" statusbar:autosize="true" statusbar:mandatory="false" statusbar:width="184"/>
<statusbar:statusbaritem xlink:href=".uno:LayoutStatus" statusbar:align="left" statusbar:autosize="true" statusbar:mandatory="false" statusbar:width="54"/>
<statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="center" statusbar:ownerdraw="true" statusbar:autosize="true" statusbar:width="200"/>
+ <statusbar:statusbaritem xlink:href=".uno:Scale" statusbar:align="left" statusbar:autosize="false" statusbar:width="30"/>
<statusbar:statusbaritem xlink:href=".uno:ModifiedStatus" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="9"/>
<statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16"/>
<statusbar:statusbaritem xlink:href=".uno:ZoomPage" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="9"/>