Kaydet (Commit) d6630ddc authored tarafından Jim Raykowski's avatar Jim Raykowski Kaydeden (comit) Muhammet Kara

tdf#112239: Add icons to customize dialog function tree

Change-Id: I68e908664d24c52657b3a073aae1c8cc41c3ce3e
Reviewed-on: https://gerrit.libreoffice.org/48556Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMuhammet Kara <muhammet.kara@pardus.org.tr>
üst 951dd781
...@@ -43,6 +43,8 @@ ...@@ -43,6 +43,8 @@
#include <o3tl/make_unique.hxx> #include <o3tl/make_unique.hxx>
#include <i18nutil/searchopt.hxx> #include <i18nutil/searchopt.hxx>
#include <cfg.hxx> //for SaveInData
CommandCategoryListBox::CommandCategoryListBox(vcl::Window* pParent) CommandCategoryListBox::CommandCategoryListBox(vcl::Window* pParent)
: ListBox( pParent, WB_BORDER | WB_DROPDOWN) : ListBox( pParent, WB_BORDER | WB_DROPDOWN)
, pStylesInfo( nullptr ) , pStylesInfo( nullptr )
...@@ -198,7 +200,8 @@ void CommandCategoryListBox::Init( ...@@ -198,7 +200,8 @@ void CommandCategoryListBox::Init(
void CommandCategoryListBox::FillFunctionsList( void CommandCategoryListBox::FillFunctionsList(
const css::uno::Sequence<css::frame::DispatchInformation>& xCommands, const css::uno::Sequence<css::frame::DispatchInformation>& xCommands,
const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox, const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox,
const OUString& filterTerm ) const OUString& filterTerm,
SaveInData *pCurrentSaveInData )
{ {
// Setup search filter parameters // Setup search filter parameters
m_searchOptions.searchString = filterTerm; m_searchOptions.searchString = filterTerm;
...@@ -217,7 +220,11 @@ void CommandCategoryListBox::FillFunctionsList( ...@@ -217,7 +220,11 @@ void CommandCategoryListBox::FillFunctionsList(
continue; continue;
} }
SvTreeListEntry* pFuncEntry = pFunctionListBox->InsertEntry(sUIName ); Image aImage;
if (pCurrentSaveInData)
aImage = pCurrentSaveInData->GetImage(rInfo.Command);
SvTreeListEntry* pFuncEntry = pFunctionListBox->InsertEntry(sUIName, aImage, aImage );
m_aGroupInfo.push_back( o3tl::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SLOT, 0 ) ); m_aGroupInfo.push_back( o3tl::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SLOT, 0 ) );
SfxGroupInfo_Impl* pGrpInfo = m_aGroupInfo.back().get(); SfxGroupInfo_Impl* pGrpInfo = m_aGroupInfo.back().get();
...@@ -255,7 +262,7 @@ OUString CommandCategoryListBox::MapCommand2UIName(const OUString& sCommand) ...@@ -255,7 +262,7 @@ OUString CommandCategoryListBox::MapCommand2UIName(const OUString& sCommand)
} }
void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox, void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox,
const OUString& filterTerm ) const OUString& filterTerm , SaveInData *pCurrentSaveInData)
{ {
SfxGroupInfo_Impl *pInfo = static_cast<SfxGroupInfo_Impl*>(GetSelectedEntryData()); SfxGroupInfo_Impl *pInfo = static_cast<SfxGroupInfo_Impl*>(GetSelectedEntryData());
pFunctionListBox->SetUpdateMode(false); pFunctionListBox->SetUpdateMode(false);
...@@ -281,7 +288,7 @@ void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionLi ...@@ -281,7 +288,7 @@ void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionLi
{ {
lCommands = xProvider->getConfigurableDispatchInformation( lCommands = xProvider->getConfigurableDispatchInformation(
pCurrentInfo->nUniqueID ); pCurrentInfo->nUniqueID );
FillFunctionsList( lCommands, pFunctionListBox, filterTerm ); FillFunctionsList( lCommands, pFunctionListBox, filterTerm, pCurrentSaveInData );
} }
catch( css::container::NoSuchElementException& ) catch( css::container::NoSuchElementException& )
{ {
...@@ -298,7 +305,7 @@ void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionLi ...@@ -298,7 +305,7 @@ void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionLi
xProvider (m_xFrame, css::uno::UNO_QUERY_THROW); xProvider (m_xFrame, css::uno::UNO_QUERY_THROW);
css::uno::Sequence< css::frame::DispatchInformation > lCommands = css::uno::Sequence< css::frame::DispatchInformation > lCommands =
xProvider->getConfigurableDispatchInformation(nGroup); xProvider->getConfigurableDispatchInformation(nGroup);
FillFunctionsList( lCommands, pFunctionListBox, filterTerm ); FillFunctionsList( lCommands, pFunctionListBox, filterTerm, pCurrentSaveInData );
break; break;
} }
case SfxCfgKind::GROUP_SCRIPTCONTAINER: //Macros case SfxCfgKind::GROUP_SCRIPTCONTAINER: //Macros
...@@ -363,7 +370,7 @@ void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionLi ...@@ -363,7 +370,7 @@ void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionLi
pMacroGroup->EnableChildrenOnDemand(); pMacroGroup->EnableChildrenOnDemand();
//Add the children and the grand children //Add the children and the grand children
addChildren( pMacroGroup, childGroup, pFunctionListBox, filterTerm ); addChildren( pMacroGroup, childGroup, pFunctionListBox, filterTerm, pCurrentSaveInData );
// Remove the main group if empty // Remove the main group if empty
if (!pMacroGroup->HasChildren()) if (!pMacroGroup->HasChildren())
...@@ -464,7 +471,7 @@ void CommandCategoryListBox::SetStylesInfo(SfxStylesInfo_Impl* pStyles) ...@@ -464,7 +471,7 @@ void CommandCategoryListBox::SetStylesInfo(SfxStylesInfo_Impl* pStyles)
void CommandCategoryListBox::addChildren( void CommandCategoryListBox::addChildren(
SvTreeListEntry* parentEntry, const css::uno::Reference< css::script::browse::XBrowseNode > &parentNode, SvTreeListEntry* parentEntry, const css::uno::Reference< css::script::browse::XBrowseNode > &parentNode,
const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox, const OUString& filterTerm ) const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox, const OUString& filterTerm , SaveInData *pCurrentSaveInData)
{ {
// Setup search filter parameters // Setup search filter parameters
m_searchOptions.searchString = filterTerm; m_searchOptions.searchString = filterTerm;
...@@ -486,7 +493,7 @@ void CommandCategoryListBox::addChildren( ...@@ -486,7 +493,7 @@ void CommandCategoryListBox::addChildren(
pNewEntry->SetUserData( m_aGroupInfo.back().get() ); pNewEntry->SetUserData( m_aGroupInfo.back().get() );
pNewEntry->EnableChildrenOnDemand(); pNewEntry->EnableChildrenOnDemand();
addChildren(pNewEntry, child, pFunctionListBox, filterTerm); addChildren(pNewEntry, child, pFunctionListBox, filterTerm, pCurrentSaveInData);
// Remove the group if empty // Remove the group if empty
if (!pNewEntry->HasChildren()) if (!pNewEntry->HasChildren())
...@@ -537,7 +544,11 @@ void CommandCategoryListBox::addChildren( ...@@ -537,7 +544,11 @@ void CommandCategoryListBox::addChildren(
OUString* pScriptURI = new OUString( uri ); OUString* pScriptURI = new OUString( uri );
SvTreeListEntry* pNewEntry = pFunctionListBox->InsertEntry( sUIName, parentEntry ); Image aImage;
if (pCurrentSaveInData)
aImage = pCurrentSaveInData->GetImage(uri);
SvTreeListEntry* pNewEntry = pFunctionListBox->InsertEntry( sUIName, aImage, aImage, parentEntry );
m_aGroupInfo.push_back( o3tl::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SCRIPT, 0, pScriptURI )); m_aGroupInfo.push_back( o3tl::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SCRIPT, 0, pScriptURI ));
m_aGroupInfo.back()->sCommand = uri; m_aGroupInfo.back()->sCommand = uri;
......
...@@ -190,7 +190,7 @@ void SvxMenuConfigPage::Init() ...@@ -190,7 +190,7 @@ void SvxMenuConfigPage::Init()
comphelper::getProcessComponentContext(), comphelper::getProcessComponentContext(),
m_xFrame, m_xFrame,
vcl::CommandInfoProvider::GetModuleIdentifier(m_xFrame)); vcl::CommandInfoProvider::GetModuleIdentifier(m_xFrame));
m_pCommandCategoryListBox->categorySelected( m_pFunctions ); m_pCommandCategoryListBox->categorySelected( m_pFunctions, OUString(), GetSaveInData() );
} }
void SvxMenuConfigPage::dispose() void SvxMenuConfigPage::dispose()
...@@ -337,7 +337,7 @@ IMPL_LINK_NOARG( SvxMenuConfigPage, SelectCategory, ListBox&, void ) ...@@ -337,7 +337,7 @@ IMPL_LINK_NOARG( SvxMenuConfigPage, SelectCategory, ListBox&, void )
{ {
OUString aSearchTerm( m_pSearchEdit->GetText() ); OUString aSearchTerm( m_pSearchEdit->GetText() );
m_pCommandCategoryListBox->categorySelected( m_pFunctions, aSearchTerm ); m_pCommandCategoryListBox->categorySelected( m_pFunctions, aSearchTerm, GetSaveInData() );
} }
IMPL_LINK_NOARG( SvxMenuConfigPage, AddCommandHdl, Button *, void ) IMPL_LINK_NOARG( SvxMenuConfigPage, AddCommandHdl, Button *, void )
......
...@@ -318,7 +318,7 @@ void SvxToolbarConfigPage::Init() ...@@ -318,7 +318,7 @@ void SvxToolbarConfigPage::Init()
comphelper::getProcessComponentContext(), comphelper::getProcessComponentContext(),
m_xFrame, m_xFrame,
vcl::CommandInfoProvider::GetModuleIdentifier(m_xFrame)); vcl::CommandInfoProvider::GetModuleIdentifier(m_xFrame));
m_pCommandCategoryListBox->categorySelected( m_pFunctions ); m_pCommandCategoryListBox->categorySelected( m_pFunctions, OUString(), GetSaveInData() );
} }
SaveInData* SvxToolbarConfigPage::CreateSaveInData( SaveInData* SvxToolbarConfigPage::CreateSaveInData(
...@@ -413,7 +413,7 @@ IMPL_LINK_NOARG( SvxToolbarConfigPage, SelectCategory, ListBox&, void ) ...@@ -413,7 +413,7 @@ IMPL_LINK_NOARG( SvxToolbarConfigPage, SelectCategory, ListBox&, void )
{ {
OUString aSearchTerm( m_pSearchEdit->GetText() ); OUString aSearchTerm( m_pSearchEdit->GetText() );
m_pCommandCategoryListBox->categorySelected( m_pFunctions, aSearchTerm ); m_pCommandCategoryListBox->categorySelected( m_pFunctions, aSearchTerm, GetSaveInData() );
} }
IMPL_LINK_NOARG( SvxToolbarConfigPage, AddCommandHdl, Button *, void ) IMPL_LINK_NOARG( SvxToolbarConfigPage, AddCommandHdl, Button *, void )
......
...@@ -52,7 +52,8 @@ public: ...@@ -52,7 +52,8 @@ public:
void FillFunctionsList( void FillFunctionsList(
const css::uno::Sequence< css::frame::DispatchInformation >& xCommands, const css::uno::Sequence< css::frame::DispatchInformation >& xCommands,
const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox, const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox,
const OUString& filterTerm ); const OUString& filterTerm,
SaveInData *pCurrentSaveInData = nullptr );
OUString MapCommand2UIName(const OUString& sCommand); OUString MapCommand2UIName(const OUString& sCommand);
/** /**
...@@ -61,14 +62,14 @@ public: ...@@ -61,14 +62,14 @@ public:
the commands in the selected category. the commands in the selected category.
*/ */
void categorySelected( const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox, void categorySelected( const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox,
const OUString& filterTerm = OUString() ); const OUString& filterTerm = OUString(), SaveInData* pCurrentSaveInData = nullptr );
void SetStylesInfo(SfxStylesInfo_Impl* pStyles); void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
// Adds children of the given macro group to the functions list // Adds children of the given macro group to the functions list
void addChildren( void addChildren(
SvTreeListEntry* parentEntry, const css::uno::Reference<com::sun::star::script::browse::XBrowseNode> &parentNode, SvTreeListEntry* parentEntry, const css::uno::Reference<com::sun::star::script::browse::XBrowseNode> &parentNode,
const VclPtr<SfxConfigFunctionListBox> &pFunctionListBox, const OUString &filterTerm); const VclPtr<SfxConfigFunctionListBox> &pFunctionListBox, const OUString &filterTerm , SaveInData *pCurrentSaveInData = nullptr );
}; };
#endif // INCLUDED_CUI_SOURCE_INC_COMMANDCATEGORYLISTBOX_HXX #endif // INCLUDED_CUI_SOURCE_INC_COMMANDCATEGORYLISTBOX_HXX
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment