[Libreoffice-commits] core.git: cui/source

Jim Raykowski raykowj at gmail.com
Mon Feb 5 23:20:18 UTC 2018


 cui/source/customize/CommandCategoryListBox.cxx |   29 ++++++++++++++++--------
 cui/source/customize/SvxMenuConfigPage.cxx      |    4 +--
 cui/source/customize/SvxToolbarConfigPage.cxx   |    4 +--
 cui/source/inc/CommandCategoryListBox.hxx       |    7 +++--
 4 files changed, 28 insertions(+), 16 deletions(-)

New commits:
commit d6630ddc992f65975f4ad4fc4677a799e634fca1
Author: Jim Raykowski <raykowj at gmail.com>
Date:   Wed Jan 24 23:05:16 2018 -0900

    tdf#112239: Add icons to customize dialog function tree
    
    Change-Id: I68e908664d24c52657b3a073aae1c8cc41c3ce3e
    Reviewed-on: https://gerrit.libreoffice.org/48556
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Muhammet Kara <muhammet.kara at pardus.org.tr>

diff --git a/cui/source/customize/CommandCategoryListBox.cxx b/cui/source/customize/CommandCategoryListBox.cxx
index bc0d3d6c80b4..4d83f1147215 100644
--- a/cui/source/customize/CommandCategoryListBox.cxx
+++ b/cui/source/customize/CommandCategoryListBox.cxx
@@ -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;
diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx
index b167e5259465..61277e9ac7ae 100644
--- a/cui/source/customize/SvxMenuConfigPage.cxx
+++ b/cui/source/customize/SvxMenuConfigPage.cxx
@@ -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 )
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx
index d63d2f9f39c5..478f1c44022c 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -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 )
diff --git a/cui/source/inc/CommandCategoryListBox.hxx b/cui/source/inc/CommandCategoryListBox.hxx
index 62423d0dac99..779189ed39f5 100644
--- a/cui/source/inc/CommandCategoryListBox.hxx
+++ b/cui/source/inc/CommandCategoryListBox.hxx
@@ -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


More information about the Libreoffice-commits mailing list