diff options
author | Shivam Kumar Singh <shivamhere247@gmail.com> | 2020-08-17 10:46:27 +0530 |
---|---|---|
committer | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2020-08-25 11:29:49 +0200 |
commit | eef202b0659a8ef5f2c1d0b38f292039f0ceaa8d (patch) | |
tree | 93306d85b28dcb4777ac979eb1af7dbc03415503 | |
parent | ba9c11e0186844fffa02c594a5c49aad4a52242c (diff) |
tdf#135334 Add keyboard shortcut to launch SI
Change-Id: Id4e911e36527395eb0ed5f29a089a66e0908e882
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100835
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
-rw-r--r-- | include/sfx2/sidebar/Sidebar.hxx | 3 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/Accelerators.xcu | 6 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu | 8 | ||||
-rw-r--r-- | sfx2/source/sidebar/Sidebar.cxx | 34 | ||||
-rw-r--r-- | sw/inc/cmdid.h | 2 | ||||
-rw-r--r-- | sw/sdi/_viewsh.sdi | 4 | ||||
-rw-r--r-- | sw/sdi/swriter.sdi | 15 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 9 |
8 files changed, 81 insertions, 0 deletions
diff --git a/include/sfx2/sidebar/Sidebar.hxx b/include/sfx2/sidebar/Sidebar.hxx index 2ac3b0e6a425..9bb250029a28 100644 --- a/include/sfx2/sidebar/Sidebar.hxx +++ b/include/sfx2/sidebar/Sidebar.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SFX2_SIDEBAR_SIDEBAR_HXX #include <sfx2/dllapi.h> +#include <sfx2/viewfrm.hxx> #include <rtl/ustring.hxx> namespace com::sun::star::frame { class XFrame; } @@ -34,6 +35,8 @@ namespace sfx2::sidebar { class SFX2_DLLPUBLIC Sidebar { public: + static void ToggleDeck(const OUString& rsDeckId, SfxViewFrame *pViewFrame); + /** Switch to the deck that contains the specified panel and make sure that the panel is visible (expanded and scrolled into the visible area.) diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu index 8124fef24d53..b8a46cfc035a 100644 --- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu @@ -5870,6 +5870,12 @@ Ctrl+Shift+e aka E_SHIFT_MOD1 under GTK/IBUS is for some emoji thing <value xml:lang="es">vnd.sun.star.findbar:FocusToFindbar</value> </prop> </node> + <node oor:name="5_MOD1_MOD2" oor:op="replace"> + <prop oor:name="Command"> + <value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> + <value xml:lang="en-US">.uno:InspectorDeck</value> + </prop> + </node> <node oor:name="B_MOD1_MOD2" oor:op="replace"> <prop oor:name="Command"> <value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu index 0e4dd6fdc29d..f3e04aab39b6 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu @@ -3765,6 +3765,14 @@ <value>true</value> </prop> </node> + <node oor:name=".uno:InspectorDeck" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Inspector Deck</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>0</value> + </prop> + </node> </node> </node> </oor:component-data> diff --git a/sfx2/source/sidebar/Sidebar.cxx b/sfx2/source/sidebar/Sidebar.cxx index 6f205389e166..ccd2fbc589d2 100644 --- a/sfx2/source/sidebar/Sidebar.cxx +++ b/sfx2/source/sidebar/Sidebar.cxx @@ -21,11 +21,45 @@ #include <sfx2/sidebar/SidebarController.hxx> #include <sfx2/sidebar/ResourceManager.hxx> #include <sidebar/PanelDescriptor.hxx> +#include <sidebar/Tools.hxx> +#include <sfx2/sidebar/FocusManager.hxx> +#include <sfx2/childwin.hxx> +#include <sfx2/sfxsids.hrc> +#include <com/sun/star/frame/XDispatch.hpp> using namespace css; namespace sfx2::sidebar { +void Sidebar::ToggleDeck(const OUString& rsDeckId, SfxViewFrame* pViewFrame) +{ + if (!pViewFrame) + return; + + SfxChildWindow* pSidebarChildWindow = pViewFrame->GetChildWindow(SID_SIDEBAR); + bool bInitiallyVisible = pSidebarChildWindow && pSidebarChildWindow->IsVisible(); + if (!bInitiallyVisible) + pViewFrame->ShowChildWindow(SID_SIDEBAR); + + if (SidebarController* pController = + SidebarController::GetSidebarControllerForFrame(pViewFrame->GetFrame().GetFrameInterface())) + { + if (bInitiallyVisible && pController->IsDeckVisible(rsDeckId)) + { + // close the sidebar if it was already visible and showing this sidebar deck + const util::URL aURL(Tools::GetURL(".uno:Sidebar")); + css::uno::Reference<frame::XDispatch> xDispatch(Tools::GetDispatch(pViewFrame->GetFrame().GetFrameInterface(), aURL)); + if (xDispatch.is()) + xDispatch->dispatch(aURL, css::uno::Sequence<beans::PropertyValue>()); + } + else + { + pController->OpenThenSwitchToDeck(rsDeckId); + pController->GetFocusManager().GrabFocusPanel(); + } + } +} + void Sidebar::ShowPanel ( const OUString& rsPanelId, const css::uno::Reference<frame::XFrame>& rxFrame, bool bFocus) diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index fda0486edbe2..0728b983bc89 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -864,6 +864,8 @@ #define SID_ATTR_PAGE_FOOTER_LAYOUT (FN_SIDEBAR + 10) #define SID_ATTR_PAGE_MARGIN (FN_SIDEBAR + 11) +#define SID_INSPECTOR_DECK (FN_SIDEBAR + 13) + //Member IDs for Fill / SetVariable of items #define MID_STYLE 0xe0 #define MID_PWIDTH 0xe1 diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi index 3959e54b3cc2..e4c419c05a31 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -65,6 +65,10 @@ interface BaseTextEditView [ ExecMethod = Execute; ] + SID_INSPECTOR_DECK + [ + ExecMethod = Execute; + ] FN_PAGEDOWN // status(final|play) [ ExecMethod = Execute ; diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index ae5c0765ccd4..c815e1285670 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -431,6 +431,21 @@ SfxVoidItem SwBackspace FN_BACKSPACE GroupId = SfxGroupId::Edit; ] +SfxVoidItem InspectorDeck SID_INSPECTOR_DECK +[ + AutoUpdate = TRUE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + AccelConfig = TRUE, + MenuConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = ; +] + SfxVoidItem BorderDialog FN_FORMAT_BORDER_DLG () [ diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 780bfba16c33..bf235be5d1ec 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -125,6 +125,7 @@ #include <docstat.hxx> #include <wordcountdialog.hxx> #include <sfx2/sidebar/Sidebar.hxx> +#include <sfx2/sidebar/SidebarController.hxx> #include <vcl/GraphicNativeTransform.hxx> #include <vcl/GraphicNativeMetadata.hxx> @@ -534,6 +535,14 @@ void SwView::Execute(SfxRequest &rReq) bool bIgnore = false; switch( nSlot ) { + case SID_INSPECTOR_DECK: + { + OUString deckId; + if (nSlot == SID_INSPECTOR_DECK) + deckId = "InspectorDeck"; + ::sfx2::sidebar::Sidebar::ToggleDeck(deckId, GetViewFrame()); + } + break; case SID_CREATE_SW_DRAWVIEW: m_pWrtShell->getIDocumentDrawModelAccess().GetOrCreateDrawModel(); break; |