From a80eefb7413245f81692c443b06f7d3a6a92f28c Mon Sep 17 00:00:00 2001 From: Jim Raykowski Date: Thu, 1 Oct 2020 22:29:35 -0800 Subject: [PATCH] tdf#84502 CuiConfigGroupListBox Macros,Styles like category for Sidebar Decks Change-Id: I4d41952547c98ba66c40c1aa1e9776cdf31304c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100455 Tested-by: Jenkins Reviewed-by: Jim Raykowski --- cui/inc/strings.hrc | 1 + cui/source/customize/cfgutil.cxx | 39 ++++++++++- cui/source/inc/cfgutil.hxx | 3 +- include/sfx2/sfxsids.hrc | 2 + include/sfx2/sidebar/Context.hxx | 4 +- include/sfx2/sidebar/ResourceManager.hxx | 4 +- .../data/org/openoffice/Office/Accelerators.xcu | 78 ++++++++++++++++++++-- .../data/org/openoffice/Office/UI/CalcCommands.xcu | 5 ++ .../openoffice/Office/UI/DrawImpressCommands.xcu | 20 ++++++ .../org/openoffice/Office/UI/GenericCommands.xcu | 23 +++++++ .../data/org/openoffice/Office/UI/Sidebar.xcu | 14 ++-- .../org/openoffice/Office/UI/WriterCommands.xcu | 10 +-- sfx2/sdi/frmslots.sdi | 4 ++ sfx2/sdi/sfx.sdi | 18 ++++- sfx2/source/view/viewfrm.cxx | 13 ++++ sw/inc/cmdid.h | 2 - sw/sdi/_viewsh.sdi | 4 -- sw/sdi/swriter.sdi | 15 ----- sw/source/uibase/uiview/view2.cxx | 8 --- 19 files changed, 214 insertions(+), 53 deletions(-) diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc index 1ba91c27c747..9ee8d66b2e89 100644 --- a/cui/inc/strings.hrc +++ b/cui/inc/strings.hrc @@ -114,6 +114,7 @@ #define RID_SVXSTR_HANJA NC_("RID_SVXSTR_HANJA", "Hanja") #define RID_SVXSTR_BASICMACROS NC_("RID_SVXSTR_BASICMACROS", "BASIC Macros") #define RID_SVXSTR_GROUP_STYLES NC_("RID_SVXSTR_GROUP_STYLES", "Styles") +#define RID_SVXSTR_GROUP_SIDEBARDECKS NC_("RID_SVXSTR_GROUP_SIDEBARDECKS", "Sidebar Decks") #define RID_SVXSTR_EVENT_STARTAPP NC_("RID_SVXSTR_EVENT_STARTAPP", "Start Application") #define RID_SVXSTR_EVENT_CLOSEAPP NC_("RID_SVXSTR_EVENT_CLOSEAPP", "Close Application") diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index 5ac0eda55edb..685af57c83b7 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -55,6 +55,9 @@ #include #include +#include +#include + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::script; @@ -346,6 +349,7 @@ struct SvxConfigGroupBoxResource_Impl OUString m_sMacros; OUString m_sDlgMacros; OUString m_aStrGroupStyles; + OUString m_aStrGroupSidebarDecks; SvxConfigGroupBoxResource_Impl(); }; @@ -355,7 +359,8 @@ SvxConfigGroupBoxResource_Impl::SvxConfigGroupBoxResource_Impl() : m_sProdMacros(CuiResId(RID_SVXSTR_PRODMACROS)), m_sMacros(CuiResId(RID_SVXSTR_BASICMACROS)), m_sDlgMacros(CuiResId(RID_SVXSTR_PRODMACROS)), - m_aStrGroupStyles(CuiResId(RID_SVXSTR_GROUP_STYLES)) + m_aStrGroupStyles(CuiResId(RID_SVXSTR_GROUP_STYLES)), + m_aStrGroupSidebarDecks(CuiResId(RID_SVXSTR_GROUP_SIDEBARDECKS)) { } @@ -676,13 +681,18 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent } } - // add styles + // add styles and sidebar decks if ( bEventMode ) { aArr.push_back( std::make_unique( SfxCfgKind::GROUP_STYLES, 0, nullptr ) ); // TODO last parameter should contain user data OUString sStyle(xImp->m_aStrGroupStyles); OUString sId(OUString::number(reinterpret_cast(aArr.back().get()))); m_xTreeView->insert(nullptr, -1, &sStyle, &sId, nullptr, nullptr, true, nullptr); + + aArr.push_back( std::make_unique(SfxCfgKind::GROUP_SIDEBARDECKS, 0)); + OUString sSidebarDecks(xImp->m_aStrGroupSidebarDecks); + sId = OUString::number(reinterpret_cast(aArr.back().get())); + m_xTreeView->insert(nullptr, -1, &sSidebarDecks, &sId, nullptr, nullptr, false, nullptr); } m_xTreeView->thaw(); @@ -933,6 +943,31 @@ void CuiConfigGroupListBox::GroupSelected() break; } + case SfxCfgKind::GROUP_SIDEBARDECKS: + { + sfx2::sidebar::ResourceManager aResourceManager; + sfx2::sidebar::Context aContext(m_sModuleLongName, OUString()); + sfx2::sidebar::ResourceManager::DeckContextDescriptorContainer aDecks; + aResourceManager.GetMatchingDecks(aDecks, aContext, false, m_xFrame->getController()); + + for (auto const& rDeck : aDecks) + { + const OUString sCommand = ".uno:SidebarDeck." + rDeck.msId; + m_pFunctionListBox->aArr.push_back(std::make_unique( + SfxCfgKind::GROUP_SIDEBARDECKS, 0, + nullptr)); + m_pFunctionListBox->aArr.back()->sCommand = sCommand; + m_pFunctionListBox->aArr.back()->sLabel = rDeck.msId; + m_pFunctionListBox->aArr.back()->sTooltip = + vcl::CommandInfoProvider::GetCommandShortcut(sCommand, m_xFrame); + m_pFunctionListBox->append(OUString::number(reinterpret_cast( + m_pFunctionListBox->aArr.back().get())), + rDeck.msId); + } + + break; + } + default: // Do nothing, the list box will stay empty SAL_INFO( "cui.customize", "Ignoring unexpected SfxCfgKind: " << static_cast(pInfo->nKind) ); diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx index 0b9e5a439d65..15d82db18e8d 100644 --- a/cui/source/inc/cfgutil.hxx +++ b/cui/source/inc/cfgutil.hxx @@ -82,7 +82,8 @@ enum class SfxCfgKind GROUP_SCRIPTCONTAINER = 3, FUNCTION_SCRIPT = 4, GROUP_STYLES = 5, - GROUP_ALLFUNCTIONS = 6 + GROUP_ALLFUNCTIONS = 6, + GROUP_SIDEBARDECKS = 7 }; struct SfxGroupInfo_Impl diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index 4bd6c194ff0e..d72bddf3100b 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -327,6 +327,8 @@ class SvxSearchItem; // Floating Window Template #define SID_STYLE_DESIGNER (SID_SFX_START + 539) +#define SID_SIDEBAR_DECK (SID_SFX_START + 850) + #define SID_TEMPLATE_ADDRESSBOOKSOURCE (SID_SFX_START + 1655) // Ruby dialog diff --git a/include/sfx2/sidebar/Context.hxx b/include/sfx2/sidebar/Context.hxx index a7d87fdbc11d..f4ca42d753d8 100644 --- a/include/sfx2/sidebar/Context.hxx +++ b/include/sfx2/sidebar/Context.hxx @@ -20,9 +20,11 @@ #include +#include + namespace sfx2::sidebar { -class Context +class SFX2_DLLPUBLIC Context { public: OUString msApplication; diff --git a/include/sfx2/sidebar/ResourceManager.hxx b/include/sfx2/sidebar/ResourceManager.hxx index 6f20c08caba3..9ac1130cc29b 100644 --- a/include/sfx2/sidebar/ResourceManager.hxx +++ b/include/sfx2/sidebar/ResourceManager.hxx @@ -23,6 +23,8 @@ #include #include +#include + namespace com::sun::star::frame { class XController; } namespace com::sun::star::frame { class XModel; } namespace sfx2::sidebar { class DeckDescriptor; } @@ -37,7 +39,7 @@ class ContextList; methods so that the sidebar can easily decide which content panels to display for a certain context. */ -class ResourceManager +class SFX2_DLLPUBLIC ResourceManager { public: diff --git a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu index d3d77d8c818c..5cbde0e93d8f 100644 --- a/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu @@ -313,6 +313,30 @@ Ctrl+Shift+e aka E_SHIFT_MOD1 under GTK/IBUS is for some emoji thing .uno:OptionsTreeDialog + + + I10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.PropertyDeck + + + + + I10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.StyleListDeck + + + + + I10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.GalleryDeck + + + + + I10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.NavigatorDeck + + @@ -550,6 +574,12 @@ Ctrl+Shift+e aka E_SHIFT_MOD1 under GTK/IBUS is for some emoji thing + + + I10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.ScFunctionsDeck + + I10N SHORTCUTS - NO TRANSLATE @@ -1548,6 +1578,12 @@ Ctrl+Shift+e aka E_SHIFT_MOD1 under GTK/IBUS is for some emoji thing + + + I10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.ShapesDeck + + I10N SHORTCUTS - NO TRANSLATE @@ -2795,6 +2831,30 @@ Ctrl+Shift+e aka E_SHIFT_MOD1 under GTK/IBUS is for some emoji thing + + + I10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.ShapesDeck + + + + + I10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.SdSlideTransitionDeck + + + + + I10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.SdCustomAnimationDeck + + + + + I10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.SdMasterPagesDeck + + I10N SHORTCUTS - NO TRANSLATE @@ -5858,6 +5918,18 @@ Ctrl+Shift+e aka E_SHIFT_MOD1 under GTK/IBUS is for some emoji thing .uno:Grow + + + I10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.WriterPageDeck + + + + + I10N SHORTCUTS - NO TRANSLATE + .uno:SidebarDeck.InspectorDeck + + I10N SHORTCUTS - NO TRANSLATE @@ -5914,12 +5986,6 @@ Ctrl+Shift+e aka E_SHIFT_MOD1 under GTK/IBUS is for some emoji thing vnd.sun.star.findbar:FocusToFindbar - - - I10N SHORTCUTS - NO TRANSLATE - .uno:InspectorDeck - - I10N SHORTCUTS - NO TRANSLATE diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu index 6c0e3d6d7562..38cc0f0569f0 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu @@ -2917,6 +2917,11 @@ 9 + + + ScFunctionsDeck + + diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu index deb4676df411..6f773011b5fa 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu @@ -2521,6 +2521,26 @@ 1 + + + ShapesDeck + + + + + SdSlideTransitionDeck + + + + + SdCustomAnimationDeck + + + + + SdMasterPagesDeck + + diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 95283860318e..c2088e58db7e 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -5426,6 +5426,9 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 Open Clip Art and Media Gallery + + .uno:Sidebar.GalleryDeck + 9 @@ -7351,6 +7354,26 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 1 + + + PropertyDeck + + + + + StyleListDeck + + + + + GalleryDeck + + + + + NavigatorDeck + + diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu index 66e66971ba60..daeecf5bbaed 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu @@ -57,7 +57,7 @@ - 450 + 600 @@ -77,7 +77,7 @@ - 100 + 500 @@ -97,7 +97,7 @@ - 200 + 500 @@ -138,7 +138,7 @@ - 160 + 700 @@ -158,7 +158,7 @@ - 140 + 600 @@ -178,7 +178,7 @@ - 120 + 500 @@ -285,7 +285,7 @@ - 700 + 600 true diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu index 572959ecbd97..fff26dd6a4fc 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu @@ -3827,12 +3827,14 @@ true - + - Inspector Deck + WriterPageDeck - - 0 + + + + InspectorDeck diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi index 09aafef95b7d..1e60d092d373 100644 --- a/sfx2/sdi/frmslots.sdi +++ b/sfx2/sdi/frmslots.sdi @@ -43,6 +43,10 @@ interface Window ExecMethod = ChildWindowExecute ; StateMethod = ChildWindowState ; ] + SID_SIDEBAR_DECK + [ + ExecMethod = ChildWindowExecute ; + ] SID_BROWSER // ole(no) api() [ ExecMethod = ChildWindowExecute ; diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 43dc58e317bf..eb588217d940 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -1011,8 +1011,6 @@ SfxVoidItem DesignerDialog SID_STYLE_DESIGNER GroupId = SfxGroupId::Format; ] - - SfxVoidItem DragHierarchy SID_STYLE_DRAGHIERARCHIE () [ @@ -4282,6 +4280,22 @@ SfxVoidItem StylePreview SID_STYLE_PREVIEW GroupId = ; ] +SfxVoidItem SidebarDeck SID_SIDEBAR_DECK +(SfxStringItem SidebarDeck SID_SIDEBAR_DECK) +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = ; +] SfxTemplateItem StyleApply SID_STYLE_APPLY (SfxStringItem Template SID_STYLE_APPLY,SfxUInt16Item Family SID_STYLE_FAMILY,SfxStringItem FamilyName SID_STYLE_FAMILYNAME,SfxStringItem Style SID_APPLY_STYLE) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 09c54757986d..7ffca943cb9b 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -133,6 +133,7 @@ using ::com::sun::star::container::XIndexContainer; #define ShellClass_SfxViewFrame #include +#include #define CHANGES_STR "private:resource/toolbar/changes" SFX_IMPL_SUPERCLASS_INTERFACE(SfxViewFrame,SfxShell) @@ -3145,6 +3146,18 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq ) // Evaluate Parameter sal_uInt16 nSID = rReq.GetSlot(); + if (nSID == SID_SIDEBAR_DECK) + { + const SfxStringItem* pDeckIdItem = rReq.GetArg(SID_SIDEBAR_DECK); + if (pDeckIdItem) + { + const OUString aDeckId(pDeckIdItem->GetValue()); + ::sfx2::sidebar::Sidebar::ToggleDeck(aDeckId, this); + } + rReq.Done(); + return; + } + const SfxBoolItem* pShowItem = rReq.GetArg(nSID); if ( nSID == SID_VIEW_DATA_SOURCE_BROWSER ) { diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 3b8194f52ec4..198aaded1608 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -868,8 +868,6 @@ #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 3e14394f03b5..7129c7cd99d4 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -79,10 +79,6 @@ 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 c560b85b6dc4..a3eff026d42c 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -431,21 +431,6 @@ 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 39752c694d31..49d04147f063 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -539,14 +539,6 @@ 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; -- 2.11.4.GIT