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 @@
#include <o3tl/make_unique.hxx>
#include <i18nutil/searchopt.hxx>
#include <cfg.hxx> //for SaveInData
CommandCategoryListBox::CommandCategoryListBox(vcl::Window* pParent)
: ListBox( pParent, WB_BORDER | WB_DROPDOWN)
, pStylesInfo( nullptr )
......@@ -198,7 +200,8 @@ void CommandCategoryListBox::Init(
void CommandCategoryListBox::FillFunctionsList(
const css::uno::Sequence<css::frame::DispatchInformation>& xCommands,
const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox,
const OUString& filterTerm )
const OUString& filterTerm,
SaveInData *pCurrentSaveInData )
{
// Setup search filter parameters
m_searchOptions.searchString = filterTerm;
......@@ -217,7 +220,11 @@ void CommandCategoryListBox::FillFunctionsList(
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 ) );
SfxGroupInfo_Impl* pGrpInfo = m_aGroupInfo.back().get();
......@@ -255,7 +262,7 @@ OUString CommandCategoryListBox::MapCommand2UIName(const OUString& sCommand)
}
void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox,
const OUString& filterTerm )
const OUString& filterTerm , SaveInData *pCurrentSaveInData)
{
SfxGroupInfo_Impl *pInfo = static_cast<SfxGroupInfo_Impl*>(GetSelectedEntryData());
pFunctionListBox->SetUpdateMode(false);
......@@ -281,7 +288,7 @@ void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionLi
{
lCommands = xProvider->getConfigurableDispatchInformation(
pCurrentInfo->nUniqueID );
FillFunctionsList( lCommands, pFunctionListBox, filterTerm );
FillFunctionsList( lCommands, pFunctionListBox, filterTerm, pCurrentSaveInData );
}
catch( css::container::NoSuchElementException& )
{
......@@ -298,7 +305,7 @@ void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionLi
xProvider (m_xFrame, css::uno::UNO_QUERY_THROW);
css::uno::Sequence< css::frame::DispatchInformation > lCommands =
xProvider->getConfigurableDispatchInformation(nGroup);
FillFunctionsList( lCommands, pFunctionListBox, filterTerm );
FillFunctionsList( lCommands, pFunctionListBox, filterTerm, pCurrentSaveInData );
break;
}
case SfxCfgKind::GROUP_SCRIPTCONTAINER: //Macros
......@@ -363,7 +370,7 @@ void CommandCategoryListBox::categorySelected( const VclPtr<SfxConfigFunctionLi
pMacroGroup->EnableChildrenOnDemand();
//Add the children and the grand children
addChildren( pMacroGroup, childGroup, pFunctionListBox, filterTerm );
addChildren( pMacroGroup, childGroup, pFunctionListBox, filterTerm, pCurrentSaveInData );
// Remove the main group if empty
if (!pMacroGroup->HasChildren())
......@@ -464,7 +471,7 @@ void CommandCategoryListBox::SetStylesInfo(SfxStylesInfo_Impl* pStyles)
void CommandCategoryListBox::addChildren(
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
m_searchOptions.searchString = filterTerm;
......@@ -486,7 +493,7 @@ void CommandCategoryListBox::addChildren(
pNewEntry->SetUserData( m_aGroupInfo.back().get() );
pNewEntry->EnableChildrenOnDemand();
addChildren(pNewEntry, child, pFunctionListBox, filterTerm);
addChildren(pNewEntry, child, pFunctionListBox, filterTerm, pCurrentSaveInData);
// Remove the group if empty
if (!pNewEntry->HasChildren())
......@@ -537,7 +544,11 @@ void CommandCategoryListBox::addChildren(
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.back()->sCommand = uri;
......
......@@ -190,7 +190,7 @@ void SvxMenuConfigPage::Init()
comphelper::getProcessComponentContext(),
m_xFrame,
vcl::CommandInfoProvider::GetModuleIdentifier(m_xFrame));
m_pCommandCategoryListBox->categorySelected( m_pFunctions );
m_pCommandCategoryListBox->categorySelected( m_pFunctions, OUString(), GetSaveInData() );
}
void SvxMenuConfigPage::dispose()
......@@ -337,7 +337,7 @@ IMPL_LINK_NOARG( SvxMenuConfigPage, SelectCategory, ListBox&, void )
{
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 )
......
......@@ -318,7 +318,7 @@ void SvxToolbarConfigPage::Init()
comphelper::getProcessComponentContext(),
m_xFrame,
vcl::CommandInfoProvider::GetModuleIdentifier(m_xFrame));
m_pCommandCategoryListBox->categorySelected( m_pFunctions );
m_pCommandCategoryListBox->categorySelected( m_pFunctions, OUString(), GetSaveInData() );
}
SaveInData* SvxToolbarConfigPage::CreateSaveInData(
......@@ -413,7 +413,7 @@ IMPL_LINK_NOARG( SvxToolbarConfigPage, SelectCategory, ListBox&, void )
{
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 )
......
......@@ -52,7 +52,8 @@ public:
void FillFunctionsList(
const css::uno::Sequence< css::frame::DispatchInformation >& xCommands,
const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox,
const OUString& filterTerm );
const OUString& filterTerm,
SaveInData *pCurrentSaveInData = nullptr );
OUString MapCommand2UIName(const OUString& sCommand);
/**
......@@ -61,14 +62,14 @@ public:
the commands in the selected category.
*/
void categorySelected( const VclPtr<SfxConfigFunctionListBox>& pFunctionListBox,
const OUString& filterTerm = OUString() );
const OUString& filterTerm = OUString(), SaveInData* pCurrentSaveInData = nullptr );
void SetStylesInfo(SfxStylesInfo_Impl* pStyles);
// Adds children of the given macro group to the functions list
void addChildren(
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
......
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