diff options
author | Jim Raykowski <raykowj@gmail.com> | 2020-10-01 22:29:35 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2021-05-11 06:53:36 +0200 |
commit | a80eefb7413245f81692c443b06f7d3a6a92f28c (patch) | |
tree | fd77d628574c3752117cd4995f4243118976a46c /cui/source | |
parent | b137ff671f25a605334083c0f87ada84eaa0fcf2 (diff) |
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 <raykowj@gmail.com>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/customize/cfgutil.cxx | 39 | ||||
-rw-r--r-- | cui/source/inc/cfgutil.hxx | 3 |
2 files changed, 39 insertions, 3 deletions
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 <vcl/help.hxx> #include <vcl/svapp.hxx> +#include <sfx2/sidebar/ResourceManager.hxx> +#include <sfx2/sidebar/Context.hxx> + 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<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, nullptr ) ); // TODO last parameter should contain user data OUString sStyle(xImp->m_aStrGroupStyles); OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get()))); m_xTreeView->insert(nullptr, -1, &sStyle, &sId, nullptr, nullptr, true, nullptr); + + aArr.push_back( std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SIDEBARDECKS, 0)); + OUString sSidebarDecks(xImp->m_aStrGroupSidebarDecks); + sId = OUString::number(reinterpret_cast<sal_Int64>(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<SfxGroupInfo_Impl>( + 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<sal_Int64>( + 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<int>(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 |