[Libreoffice-commits] core.git: cui/Library_cui.mk cui/source cui/uiconfig extras/source

Maxim Monastirsky momonasmon at gmail.com
Tue May 9 09:23:42 UTC 2017


 cui/Library_cui.mk                             |    1 
 cui/source/customize/cfgutil.cxx               |  586 +++++++++----
 cui/source/customize/eventdlg.cxx              |    2 
 cui/source/customize/macropg.cxx               |    2 
 cui/source/customize/selector.cxx              | 1061 -------------------------
 cui/source/dialogs/scriptdlg.cxx               |    2 
 cui/source/factory/cuiexp.cxx                  |    2 
 cui/source/factory/dlgfact.cxx                 |    2 
 cui/source/inc/cfg.hxx                         |    2 
 cui/source/inc/cfgutil.hxx                     |   58 +
 cui/source/inc/selector.hxx                    |  222 -----
 cui/uiconfig/ui/macroselectordialog.ui         |    8 
 extras/source/glade/libreoffice-catalog.xml.in |    6 
 13 files changed, 461 insertions(+), 1493 deletions(-)

New commits:
commit e4d7511d7e49af14e3c8113bb1440e0eb04f40ad
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Tue May 9 09:30:54 2017 +0300

    tdf#106681 Styles category for the Add Commands dialog
    
    Change-Id: I7332967863697d3ad68a533b9fc603de2fdc87ef
    Reviewed-on: https://gerrit.libreoffice.org/37422
    Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>
    Tested-by: Maxim Monastirsky <momonasmon at gmail.com>

diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index 813bff0eba0c..7eb55fb05375 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -89,7 +89,6 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
     cui/source/customize/cfgutil \
     cui/source/customize/eventdlg \
     cui/source/customize/macropg \
-    cui/source/customize/selector \
     cui/source/dialogs/about \
     cui/source/dialogs/colorpicker \
     cui/source/dialogs/cuicharmap \
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 8ca7a614b315..c6e310e6505c 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -18,6 +18,7 @@
  */
 
 #include "cfgutil.hxx"
+#include "cfg.hxx"
 
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/container/XEnumerationAccess.hpp>
@@ -26,7 +27,6 @@
 #include <com/sun/star/frame/ModuleManager.hpp>
 #include <com/sun/star/frame/Desktop.hpp>
 #include <com/sun/star/frame/theUICommandDescription.hpp>
-#include <com/sun/star/frame/XDispatchInformationProvider.hpp>
 #include <com/sun/star/script/browse/XBrowseNode.hpp>
 #include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
 #include <com/sun/star/script/browse/theBrowseNodeFactory.hpp>
@@ -60,6 +60,11 @@
 #include "dialmgr.hxx"
 #include <svl/stritem.hxx>
 #include <vcl/builderfactory.hxx>
+#include <vcl/button.hxx>
+#include <vcl/commandinfoprovider.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/help.hxx>
+#include <vcl/vclmedit.hxx>
 #include <o3tl/make_unique.hxx>
 
 using namespace ::com::sun::star;
@@ -308,6 +313,27 @@ OUString SfxConfigFunctionListBox::GetSelectedScriptURI()
     return OUString();
 }
 
+OUString SfxConfigFunctionListBox::GetHelpText()
+{
+    SvTreeListEntry *pEntry = FirstSelected();
+    if ( pEntry )
+    {
+        SfxGroupInfo_Impl *pData = static_cast<SfxGroupInfo_Impl*>(pEntry->GetUserData());
+        if ( pData )
+        {
+            if ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
+            {
+                return Application::GetHelp()->GetHelpText( pData->sCommand, this );
+            }
+            else if ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
+            {
+                return pData->sHelpText;
+            }
+        }
+    }
+    return OUString();
+}
+
 OUString SfxConfigFunctionListBox::GetCurCommand()
 {
     SvTreeListEntry *pEntry = FirstSelected();
@@ -371,7 +397,10 @@ SvxConfigGroupBoxResource_Impl::SvxConfigGroupBoxResource_Impl() :
 
 SfxConfigGroupListBox::SfxConfigGroupListBox(vcl::Window* pParent, WinBits nStyle)
     : SvTreeListBox(pParent, nStyle)
-    , xImp(new SvxConfigGroupBoxResource_Impl()), pFunctionListBox(nullptr), pStylesInfo(nullptr)
+    , xImp(new SvxConfigGroupBoxResource_Impl())
+    , pFunctionListBox(nullptr)
+    , m_pImageProvider(nullptr)
+    , pStylesInfo(nullptr)
 {
     SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT );
     SetNodeBitmaps(xImp->m_collapsedImage, xImp->m_expandedImage);
@@ -426,6 +455,14 @@ void SfxConfigGroupListBox::InitModule()
         sal_Int32                       c1      = lGroups.getLength();
         sal_Int32                       i1      = 0;
 
+        if ( c1 )
+        {
+            // Add All Commands category
+            SvTreeListEntry* pEntry = InsertEntry( CUI_RES(RID_SVXSTR_ALLFUNCTIONS) );
+            aArr.push_back( o3tl::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_ALLFUNCTIONS, 0 ) );
+            pEntry->SetUserData(aArr.back().get());
+        }
+
         for (i1=0; i1<c1; ++i1)
         {
             sal_Int16&      rGroupID   = lGroups[i1];
@@ -442,8 +479,8 @@ void SfxConfigGroupListBox::InitModule()
                 { continue; }
 
             SvTreeListEntry*        pEntry = InsertEntry(sGroupName);
-            SfxGroupInfo_Impl* pInfo   = new SfxGroupInfo_Impl(SfxCfgKind::GROUP_FUNCTION, rGroupID);
-            pEntry->SetUserData(pInfo);
+            aArr.push_back( o3tl::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_FUNCTION, rGroupID ) );
+            pEntry->SetUserData(aArr.back().get());
         }
     }
     catch(const css::uno::RuntimeException&)
@@ -506,6 +543,131 @@ namespace
 }
 
 
+void SfxConfigGroupListBox::FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode >& xRootNode,
+                                           SvTreeListEntry* pParentEntry, bool bCheapChildrenOnDemand)
+{
+    try {
+        if ( xRootNode->hasChildNodes() )
+        {
+            Sequence< Reference< browse::XBrowseNode > > children =
+                xRootNode->getChildNodes();
+            bool bIsRootNode = false;
+
+            OUString user("user");
+            OUString share("share");
+            if ( xRootNode->getName() == "Root" )
+            {
+                bIsRootNode = true;
+            }
+
+            //To mimic current starbasic behaviour we
+            //need to make sure that only the current document
+            //is displayed in the config tree. Tests below
+            //set the bDisplay flag to FALSE if the current
+            //node is a first level child of the Root and is NOT
+            //either the current document, user or share
+            OUString currentDocTitle;
+            Reference< XModel > xDocument( lcl_getScriptableDocument_nothrow( m_xFrame ) );
+            if ( xDocument.is() )
+            {
+                currentDocTitle = ::comphelper::DocumentInfo::getDocumentTitle( xDocument );
+            }
+
+            for ( sal_Int32 n = 0; n < children.getLength(); ++n )
+            {
+                Reference< browse::XBrowseNode >& theChild = children[n];
+                bool bDisplay = true;
+                OUString uiName = theChild->getName();
+                if ( bIsRootNode )
+                {
+                    if (  ! ((theChild->getName().equals( user )  || theChild->getName().equals( share ) ||
+                        theChild->getName().equals( currentDocTitle ) ) ) )
+                    {
+                        bDisplay=false;
+                    }
+                    else
+                    {
+                        if ( uiName.equals( user ) )
+                        {
+                            uiName = xImp->m_sMyMacros;
+                        }
+                        else if ( uiName.equals( share ) )
+                        {
+                            uiName = xImp->m_sProdMacros;
+                        }
+                    }
+                }
+                if (children[n]->getType() != browse::BrowseNodeTypes::SCRIPT  && bDisplay )
+                {
+//                              We call acquire on the XBrowseNode so that it does not
+//                              get autodestructed and become invalid when accessed later.
+                    theChild->acquire();
+
+                    Image aImage = GetImage( theChild, m_xContext, bIsRootNode );
+                    SvTreeListEntry* pNewEntry =
+                        InsertEntry( uiName, pParentEntry );
+                    SetExpandedEntryBmp(  pNewEntry, aImage );
+                    SetCollapsedEntryBmp( pNewEntry, aImage );
+
+                    aArr.push_back( o3tl::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SCRIPTCONTAINER,
+                            0, static_cast<void *>( theChild.get())));
+
+                    pNewEntry->SetUserData( aArr.back().get() );
+
+                    if ( !bCheapChildrenOnDemand && children[n]->hasChildNodes() )
+                    {
+                        Sequence< Reference< browse::XBrowseNode > > grandchildren =
+                            children[n]->getChildNodes();
+
+                        for ( sal_Int32 m = 0; m < grandchildren.getLength(); ++m )
+                        {
+                            if ( grandchildren[m]->getType() == browse::BrowseNodeTypes::CONTAINER )
+                            {
+                                pNewEntry->EnableChildrenOnDemand();
+                                m = grandchildren.getLength();
+                            }
+                        }
+                    }
+                    else
+                    {
+                        /* i30923 - Would be nice if there was a better
+                        * way to determine if a basic lib had children
+                        * without having to ask for them (which forces
+                        * the library to be loaded */
+                        pNewEntry->EnableChildrenOnDemand();
+                    }
+                }
+            }
+        }
+    }
+    catch (RuntimeException&) {
+        // do nothing, the entry will not be displayed in the UI
+    }
+}
+
+void SfxConfigGroupListBox::FillFunctionsList(const css::uno::Sequence<DispatchInformation>& xCommands)
+{
+    for (const auto & rInfo : xCommands)
+    {
+        OUString sUIName = MapCommand2UIName(rInfo.Command);
+        Image aImage;
+        if ( m_pImageProvider )
+            aImage = m_pImageProvider->GetImage( rInfo.Command );
+
+        SvTreeListEntry* pFuncEntry = nullptr;
+        if ( !!aImage )
+            pFuncEntry = pFunctionListBox->InsertEntry( sUIName, aImage, aImage );
+        else
+            pFuncEntry = pFunctionListBox->InsertEntry(sUIName );
+
+        aArr.push_back( o3tl::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SLOT, 0 ) );
+        SfxGroupInfo_Impl* pGrpInfo = aArr.back().get();
+        pGrpInfo->sCommand = rInfo.Command;
+        pGrpInfo->sLabel   = sUIName;
+        pFuncEntry->SetUserData(pGrpInfo);
+    }
+}
+
 void SfxConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponentContext >& xContext,
     const css::uno::Reference< css::frame::XFrame >& xFrame,
     const OUString& sModuleLongName,
@@ -524,7 +686,8 @@ void SfxConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
         m_xModuleCategoryInfo.set(m_xGlobalCategoryInfo->getByName(m_sModuleLongName), css::uno::UNO_QUERY_THROW);
         m_xUICmdDescription   = css::frame::theUICommandDescription::get( m_xContext );
 
-        InitModule();
+        if ( bEventMode )
+            InitModule();
     }
 
     SAL_INFO("cui.customize", "** ** About to initialise SF Scripts");
@@ -563,100 +726,12 @@ void SfxConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
         {
              //We are only showing scripts not slot APIs so skip
              //Root node and show location nodes
-            try {
-                if ( rootNode->hasChildNodes() )
-                {
-                    Sequence< Reference< browse::XBrowseNode > > children =
-                        rootNode->getChildNodes();
-                    bool bIsRootNode = false;
-
-                    OUString user("user");
-                    OUString share("share");
-                    if ( rootNode->getName() == "Root" )
-                    {
-                        bIsRootNode = true;
-                    }
-
-                    //To mimic current starbasic behaviour we
-                    //need to make sure that only the current document
-                    //is displayed in the config tree. Tests below
-                    //set the bDisplay flag to FALSE if the current
-                    //node is a first level child of the Root and is NOT
-                    //either the current document, user or share
-                    OUString currentDocTitle;
-                    Reference< XModel > xDocument( lcl_getScriptableDocument_nothrow( m_xFrame ) );
-                    if ( xDocument.is() )
-                    {
-                        currentDocTitle = ::comphelper::DocumentInfo::getDocumentTitle( xDocument );
-                    }
-
-                    for ( sal_Int32 n = 0; n < children.getLength(); ++n )
-                    {
-                        Reference< browse::XBrowseNode >& theChild = children[n];
-                        bool bDisplay = true;
-                        OUString uiName = theChild->getName();
-                        if ( bIsRootNode )
-                        {
-                            if (  ! ((theChild->getName().equals( user )  || theChild->getName().equals( share ) ||
-                                theChild->getName().equals( currentDocTitle ) ) ) )
-                            {
-                                bDisplay=false;
-                            }
-                            else
-                            {
-                                if ( uiName.equals( user ) )
-                                {
-                                    uiName = xImp->m_sMyMacros;
-                                }
-                                else if ( uiName.equals( share ) )
-                                {
-                                    uiName = xImp->m_sProdMacros;
-                                }
-                            }
-                        }
-                        if (children[n]->getType() != browse::BrowseNodeTypes::SCRIPT  && bDisplay )
-                        {
-//                              We call acquire on the XBrowseNode so that it does not
-//                              get autodestructed and become invalid when accessed later.
-                            theChild->acquire();
-
-                            Image aImage = GetImage( theChild, xCtx, bIsRootNode );
-                            SvTreeListEntry* pNewEntry =
-                                InsertEntry( uiName );
-                            SetExpandedEntryBmp(  pNewEntry, aImage );
-                            SetCollapsedEntryBmp( pNewEntry, aImage );
-
-                            aArr.push_back( o3tl::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SCRIPTCONTAINER,
-                                    0, static_cast<void *>( theChild.get())));
-
-                            pNewEntry->SetUserData( aArr.back().get() );
-
-                            if ( children[n]->hasChildNodes() )
-                            {
-                                Sequence< Reference< browse::XBrowseNode > > grandchildren =
-                                    children[n]->getChildNodes();
-
-                                for ( sal_Int32 m = 0; m < grandchildren.getLength(); ++m )
-                                {
-                                    if ( grandchildren[m]->getType() == browse::BrowseNodeTypes::CONTAINER )
-                                    {
-                                        pNewEntry->EnableChildrenOnDemand();
-                                        m = grandchildren.getLength();
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-            catch (RuntimeException&) {
-                // do nothing, the entry will not be displayed in the UI
-            }
+            FillScriptList(rootNode, nullptr, false);
         }
     }
 
     // add styles
-    if ( m_xContext.is() )
+    if ( bEventMode && m_xContext.is() )
     {
         OUString sStyle(xImp->m_aStrGroupStyles);
         SvTreeListEntry *pEntry = InsertEntry( sStyle );
@@ -801,6 +876,7 @@ void SfxConfigGroupListBox::GroupSelected()
     pFunctionListBox->SetUpdateMode(false);
     pFunctionListBox->ClearAll();
     if ( pInfo->nKind != SfxCfgKind::GROUP_FUNCTION &&
+         pInfo->nKind != SfxCfgKind::GROUP_ALLFUNCTIONS &&
              pInfo->nKind != SfxCfgKind::GROUP_SCRIPTCONTAINER &&
              pInfo->nKind != SfxCfgKind::GROUP_STYLES )
     {
@@ -810,25 +886,36 @@ void SfxConfigGroupListBox::GroupSelected()
 
     switch ( pInfo->nKind )
     {
+        case SfxCfgKind::GROUP_ALLFUNCTIONS:
+        {
+            css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider( m_xFrame, UNO_QUERY );
+            SvTreeListEntry *pCurrEntry = First();
+            while( pCurrEntry )
+            {
+                SfxGroupInfo_Impl *pCurrentInfo = static_cast<SfxGroupInfo_Impl*>(pCurrEntry->GetUserData());
+                if (pCurrentInfo->nKind == SfxCfgKind::GROUP_FUNCTION)
+                {
+                    css::uno::Sequence< css::frame::DispatchInformation > lCommands;
+                    try
+                    {
+                        lCommands = xProvider->getConfigurableDispatchInformation( pCurrentInfo->nUniqueID );
+                        FillFunctionsList( lCommands );
+                    }
+                    catch ( container::NoSuchElementException& )
+                    {
+                    }
+                }
+                pCurrEntry = Next( pCurrEntry );
+            }
+            break;
+        }
+
         case SfxCfgKind::GROUP_FUNCTION :
         {
             sal_uInt16                                                          nGroup    = pInfo->nUniqueID;
             css::uno::Reference< css::frame::XDispatchInformationProvider > xProvider (m_xFrame, css::uno::UNO_QUERY_THROW);
             css::uno::Sequence< css::frame::DispatchInformation >           lCommands = xProvider->getConfigurableDispatchInformation(nGroup);
-            sal_Int32                                                       c         = lCommands.getLength();
-            sal_Int32                                                       i         = 0;
-
-            for (i=0; i<c; ++i)
-            {
-                const css::frame::DispatchInformation& rInfo      = lCommands[i];
-                OUString                        sUIName    = MapCommand2UIName(rInfo.Command);
-                SvTreeListEntry*                           pFuncEntry = pFunctionListBox->InsertEntry(sUIName);
-                SfxGroupInfo_Impl*                     pGrpInfo   = new SfxGroupInfo_Impl(SfxCfgKind::FUNCTION_SLOT, 0);
-                pGrpInfo->sCommand = rInfo.Command;
-                pGrpInfo->sLabel   = sUIName;
-                pFuncEntry->SetUserData(pGrpInfo);
-            }
-
+            FillFunctionsList( lCommands );
             break;
         }
 
@@ -849,7 +936,7 @@ void SfxConfigGroupListBox::GroupSelected()
                         {
                             if (children[n]->getType() == browse::BrowseNodeTypes::SCRIPT)
                             {
-                                OUString uri;
+                                OUString uri, description;
 
                                 Reference < beans::XPropertySet >xPropSet( children[n], UNO_QUERY );
                                 if (!xPropSet.is())
@@ -861,6 +948,15 @@ void SfxConfigGroupListBox::GroupSelected()
                                     xPropSet->getPropertyValue("URI");
                                 value >>= uri;
 
+                                try
+                                {
+                                    value = xPropSet->getPropertyValue("Description");
+                                    value >>= description;
+                                }
+                                catch (Exception &) {
+                                    // do nothing, the description will be empty
+                                }
+
                                 OUString* pScriptURI = new OUString( uri );
 
                                 Image aImage = GetImage( children[n], Reference< XComponentContext >(), false );
@@ -872,6 +968,7 @@ void SfxConfigGroupListBox::GroupSelected()
                                 pFunctionListBox->aArr.push_back( o3tl::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SCRIPT, 0, pScriptURI ));
                                 pFunctionListBox->aArr.back()->sCommand = uri;
                                 pFunctionListBox->aArr.back()->sLabel = children[n]->getName();
+                                pFunctionListBox->aArr.back()->sHelpText = description;
                                 pNewEntry->SetUserData( pFunctionListBox->aArr.back().get() );
                             }
                         }
@@ -962,87 +1059,7 @@ void SfxConfigGroupListBox::RequestingChildren( SvTreeListEntry *pEntry )
             {
                 Reference< browse::XBrowseNode > rootNode(
                     static_cast< browse::XBrowseNode* >( pInfo->pObject ) ) ;
-
-                try {
-                    if ( rootNode->hasChildNodes() )
-                    {
-                        Sequence< Reference< browse::XBrowseNode > > children =
-                            rootNode->getChildNodes();
-                        bool bIsRootNode = false;
-
-                        OUString user("user");
-                        OUString share("share" );
-                        if ( rootNode->getName() == "Root" )
-                        {
-                            bIsRootNode = true;
-                        }
-
-                        /* To mimic current starbasic behaviour we
-                        need to make sure that only the current document
-                        is displayed in the config tree. Tests below
-                        set the bDisplay flag to sal_False if the current
-                        node is a first level child of the Root and is NOT
-                        either the current document, user or share */
-                        OUString currentDocTitle;
-                        Reference< XModel > xDocument( lcl_getScriptableDocument_nothrow( m_xFrame ) );
-                        if ( xDocument.is() )
-                        {
-                            currentDocTitle = ::comphelper::DocumentInfo::getDocumentTitle( xDocument );
-                        }
-
-                        sal_Int32 nLen = children.getLength();
-                        for ( sal_Int32 n = 0; n < nLen; ++n )
-                        {
-                            Reference< browse::XBrowseNode >& theChild = children[n];
-                            OUString aName( theChild->getName() );
-                            bool bDisplay = true;
-                            if ( bIsRootNode )
-                            {
-                                if ( !( (aName.equals(user) || aName.equals(share) || aName.equals(currentDocTitle) ) ) )
-                                    bDisplay=false;
-                            }
-                            if ( children[n].is() && children[n]->getType() != browse::BrowseNodeTypes::SCRIPT && bDisplay )
-                            {
-
-                                /*
-                                    We call acquire on the XBrowseNode so that it does not
-                                    get autodestructed and become invalid when accessed later.
-                                */
-                                theChild->acquire();
-
-                                Image aImage = GetImage( theChild, Reference< XComponentContext >(), false );
-                                SvTreeListEntry* pNewEntry =
-                                    InsertEntry( theChild->getName(), pEntry );
-                                SetExpandedEntryBmp( pNewEntry, aImage );
-                                SetCollapsedEntryBmp(pNewEntry, aImage );
-
-                                aArr.push_back( o3tl::make_unique<SfxGroupInfo_Impl>(
-                                    SfxCfgKind::GROUP_SCRIPTCONTAINER,
-                                        0, static_cast<void *>( theChild.get())));
-
-                                pNewEntry->SetUserData( aArr.back().get() );
-
-                                if ( children[n]->hasChildNodes() )
-                                {
-                                    Sequence< Reference< browse::XBrowseNode > > grandchildren =
-                                        children[n]->getChildNodes();
-
-                                    for ( sal_Int32 m = 0; m < grandchildren.getLength(); ++m )
-                                    {
-                                        if ( grandchildren[m]->getType() == browse::BrowseNodeTypes::CONTAINER )
-                                        {
-                                            pNewEntry->EnableChildrenOnDemand();
-                                            m = grandchildren.getLength();
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-                catch (RuntimeException&) {
-                    // do nothing, the entry will not be displayed in the UI
-                }
+                FillScriptList(rootNode, pEntry, true /* i30923 */ );
             }
             break;
         }
@@ -1139,4 +1156,191 @@ void SfxConfigGroupListBox::SelectMacro( const OUString& rBasic,
     }
 }
 
+/*
+ * Implementation of SvxScriptSelectorDialog
+ *
+ * This dialog is used for selecting Slot API commands
+ * and Scripting Framework Scripts.
+ */
+
+SvxScriptSelectorDialog::SvxScriptSelectorDialog(
+    vcl::Window* pParent, bool bShowSlots, const css::uno::Reference< css::frame::XFrame >& xFrame)
+    : ModalDialog(pParent, "MacroSelectorDialog", "cui/ui/macroselectordialog.ui")
+    , m_bShowSlots(bShowSlots)
+{
+    get<FixedText>("libraryft")->Show(!m_bShowSlots);
+    get<FixedText>("categoryft")->Show(m_bShowSlots);
+    get<FixedText>("macronameft")->Show(!m_bShowSlots);
+    get<FixedText>("commandsft")->Show(m_bShowSlots);
+    get(m_pDescriptionText, "description");
+    get(m_pCommands, "commands");
+    if (m_bShowSlots)
+    {
+        // If we are showing Slot API commands update labels in the UI
+        SetText(CUI_RESSTR(RID_SVXSTR_SELECTOR_ADD_COMMANDS));
+        get(m_pCancelButton, "close");
+        get(m_pDialogDescription, "helptoolbar");
+        get(m_pOKButton, "add");
+    }
+    else
+    {
+        get(m_pCancelButton, "cancel");
+        get(m_pDialogDescription, "helpmacro");
+        get(m_pOKButton, "ok");
+    }
+    m_pCancelButton->Show();
+    m_pDialogDescription->Show();
+    m_pOKButton->Show();
+
+    get(m_pCategories, "categories");
+    m_pCategories->SetFunctionListBox(m_pCommands);
+    m_pCategories->Init(comphelper::getProcessComponentContext(), xFrame,
+                        vcl::CommandInfoProvider::GetModuleIdentifier(xFrame), bShowSlots);
+
+    m_pCategories->SetSelectHdl(
+            LINK( this, SvxScriptSelectorDialog, SelectHdl ) );
+    m_pCommands->SetSelectHdl( LINK( this, SvxScriptSelectorDialog, SelectHdl ) );
+    m_pCommands->SetDoubleClickHdl( LINK( this, SvxScriptSelectorDialog, FunctionDoubleClickHdl ) );
+
+    m_pOKButton->SetClickHdl( LINK( this, SvxScriptSelectorDialog, ClickHdl ) );
+    m_pCancelButton->SetClickHdl( LINK( this, SvxScriptSelectorDialog, ClickHdl ) );
+
+    m_sDefaultDesc = m_pDescriptionText->GetText();
+
+    // Support style commands
+    uno::Reference<frame::XController> xController;
+    uno::Reference<frame::XModel> xModel;
+    if (xFrame.is())
+        xController = xFrame->getController();
+    if (xController.is())
+        xModel = xController->getModel();
+
+    m_aStylesInfo.setModel(xModel);
+    m_pCommands->SetStylesInfo(&m_aStylesInfo);
+    m_pCategories->SetStylesInfo(&m_aStylesInfo);
+
+    UpdateUI();
+}
+
+SvxScriptSelectorDialog::~SvxScriptSelectorDialog()
+{
+    disposeOnce();
+}
+
+void SvxScriptSelectorDialog::dispose()
+{
+    m_pDialogDescription.clear();
+    m_pCategories.clear();
+    m_pCommands.clear();
+    m_pOKButton.clear();
+    m_pCancelButton.clear();
+    m_pDescriptionText.clear();
+    ModalDialog::dispose();
+}
+
+IMPL_LINK( SvxScriptSelectorDialog, SelectHdl, SvTreeListBox*, pCtrl, void )
+{
+    if (pCtrl == m_pCategories)
+    {
+        m_pCategories->GroupSelected();
+    }
+    UpdateUI();
+}
+
+IMPL_LINK_NOARG( SvxScriptSelectorDialog, FunctionDoubleClickHdl, SvTreeListBox*, bool )
+{
+    if (m_pOKButton->IsEnabled())
+        ClickHdl(m_pOKButton);
+    return false;
+}
+
+// Check if command is selected and enable the OK button accordingly
+// Grab the help text for this id if available and update the description field
+void
+SvxScriptSelectorDialog::UpdateUI()
+{
+    OUString url = GetScriptURL();
+    if ( !url.isEmpty() )
+    {
+        OUString sMessage = m_pCommands->GetHelpText();
+        m_pDescriptionText->SetText(sMessage.isEmpty() ? m_sDefaultDesc : sMessage);
+
+        m_pOKButton->Enable();
+    }
+    else
+    {
+        m_pDescriptionText->SetText(m_sDefaultDesc);
+        m_pOKButton->Enable( false );
+    }
+}
+
+IMPL_LINK( SvxScriptSelectorDialog, ClickHdl, Button *, pButton, void )
+{
+    if (pButton == m_pCancelButton)
+    {
+        EndDialog();
+    }
+    else if (pButton == m_pOKButton)
+    {
+        GetAddHdl().Call( *this );
+
+        // If we are displaying Slot API commands then this the dialog is being
+        // run from Tools/Configure and we should not close it
+        if ( !m_bShowSlots )
+        {
+            EndDialog( RET_OK );
+        }
+        else
+        {
+            // Select the next entry in the list if possible
+            SvTreeListEntry* current = m_pCommands->FirstSelected();
+            SvTreeListEntry* next = SvTreeListBox::NextSibling( current );
+
+            if ( next != nullptr )
+            {
+                m_pCommands->Select( next );
+            }
+        }
+    }
+}
+
+void
+SvxScriptSelectorDialog::SetRunLabel()
+{
+    m_pOKButton->SetText(CUI_RESSTR(RID_SVXSTR_SELECTOR_RUN));
+}
+
+void
+SvxScriptSelectorDialog::SetDialogDescription( const OUString& rDescription )
+{
+    m_pDialogDescription->SetText( rDescription );
+}
+
+OUString
+SvxScriptSelectorDialog::GetScriptURL() const
+{
+    OUString result;
+
+    SvTreeListEntry *pEntry = const_cast< SvxScriptSelectorDialog* >( this )->m_pCommands->FirstSelected();
+    if ( pEntry )
+    {
+        SfxGroupInfo_Impl *pData = static_cast<SfxGroupInfo_Impl*>(pEntry->GetUserData());
+        if  (   ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
+            ||  ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
+            ||  ( pData->nKind == SfxCfgKind::GROUP_STYLES )
+            )
+        {
+            result = pData->sCommand;
+        }
+    }
+
+    return result;
+}
+
+OUString
+SvxScriptSelectorDialog::GetSelectedDisplayName()
+{
+    return m_pCommands->GetEntryText( m_pCommands->FirstSelected() );
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/customize/eventdlg.cxx b/cui/source/customize/eventdlg.cxx
index 9e422eb9ba84..bfaac6c5d7e2 100644
--- a/cui/source/customize/eventdlg.cxx
+++ b/cui/source/customize/eventdlg.cxx
@@ -47,7 +47,7 @@
 #include <dialmgr.hxx>
 #include <cuires.hrc>
 #include "helpid.hrc"
-#include "selector.hxx"
+#include "cfgutil.hxx"
 #include "cfg.hxx"
 
 
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index 36b6b1327896..2d689be9a3ba 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -32,7 +32,7 @@
 #include <com/sun/star/container/NoSuchElementException.hpp>
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
 #include <dialmgr.hxx>
-#include "selector.hxx"
+#include "cfgutil.hxx"
 #include "cfg.hxx"
 #include "helpid.hrc"
 #include <cuires.hrc>
diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx
deleted file mode 100644
index aae8305378fb..000000000000
--- a/cui/source/customize/selector.cxx
+++ /dev/null
@@ -1,1061 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <memory>
-#include <vcl/help.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/metric.hxx>
-#include <vcl/vclmedit.hxx>
-#include <vcl/builderfactory.hxx>
-#include "selector.hxx"
-#include "cfg.hxx"
-#include <dialmgr.hxx>
-#include <svx/fmresids.hrc>
-#include <svx/dialmgr.hxx>
-#include <cuires.hrc>
-#include <bitmaps.hlst>
-#include <sfx2/app.hxx>
-#include <sfx2/msg.hxx>
-#include <sfx2/msgpool.hxx>
-#include <sfx2/minfitem.hxx>
-#include <sfx2/objsh.hxx>
-#include <sfx2/dispatch.hxx>
-
-#include <comphelper/documentinfo.hxx>
-#include <comphelper/processfactory.hxx>
-
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/container/XEnumeration.hpp>
-#include <com/sun/star/document/XEmbeddedScripts.hpp>
-#include <com/sun/star/document/XScriptInvocationContext.hpp>
-#include <com/sun/star/frame/ModuleManager.hpp>
-#include <com/sun/star/frame/Desktop.hpp>
-#include <com/sun/star/frame/XDispatchInformationProvider.hpp>
-#include <com/sun/star/frame/DispatchInformation.hpp>
-#include <com/sun/star/frame/theUICommandDescription.hpp>
-#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
-#include <com/sun/star/script/provider/XScriptProvider.hpp>
-#include <com/sun/star/script/browse/theBrowseNodeFactory.hpp>
-#include <com/sun/star/script/browse/XBrowseNode.hpp>
-#include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
-#include <com/sun/star/script/browse/XBrowseNodeFactory.hpp>
-#include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp>
-#include <com/sun/star/ui/theUICategoryDescription.hpp>
-
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::script;
-using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::document;
-using namespace ::com::sun::star::container;
-
-#include <svtools/imagemgr.hxx>
-#include "svtools/treelistentry.hxx"
-#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
-
-/*
- * The implementations of SvxConfigFunctionListBox and
- * SvxConfigGroupListBox are copied from sfx2/source/dialog/cfg.cxx
- */
-SvxConfigFunctionListBox::SvxConfigFunctionListBox(vcl::Window* pParent, WinBits nStyle)
-    : SvTreeListBox(pParent, nStyle | WB_CLIPCHILDREN | WB_HSCROLL | WB_SORT | WB_TABSTOP)
-    , pCurEntry(nullptr)
-    , m_pDraggingEntry(nullptr)
-{
-    GetModel()->SetSortMode( SortAscending );
-
-    // Timer for the BallonHelp
-    aTimer.SetTimeout( 200 );
-    aTimer.SetInvokeHandler(
-        LINK( this, SvxConfigFunctionListBox, TimerHdl ) );
-}
-
-VCL_BUILDER_FACTORY_CONSTRUCTOR(SvxConfigFunctionListBox, WB_TABSTOP)
-
-SvxConfigFunctionListBox::~SvxConfigFunctionListBox()
-{
-    disposeOnce();
-}
-
-void SvxConfigFunctionListBox::dispose()
-{
-    ClearAll();
-    SvTreeListBox::dispose();
-}
-
-SvTreeListEntry* SvxConfigFunctionListBox::GetLastSelectedEntry()
-{
-    if ( m_pDraggingEntry != nullptr )
-    {
-        return m_pDraggingEntry;
-    }
-    else
-    {
-        return FirstSelected();
-    }
-}
-
-void SvxConfigFunctionListBox::MouseMove( const MouseEvent& rMEvt )
-{
-    Point aMousePos = rMEvt.GetPosPixel();
-    pCurEntry = GetCurEntry();
-
-    if ( pCurEntry && GetEntry( aMousePos ) == pCurEntry )
-        aTimer.Start();
-    else
-    {
-        ::tools::Rectangle aRect(GetPosPixel(), GetSizePixel());
-        Help::ShowBalloon( this, aMousePos, aRect, OUString() );
-        aTimer.Stop();
-    }
-}
-
-
-IMPL_LINK_NOARG(SvxConfigFunctionListBox, TimerHdl, Timer *, void)
-{
-    aTimer.Stop();
-    Point aMousePos = GetPointerPosPixel();
-    SvTreeListEntry *pEntry = GetCurEntry();
-    if ( pEntry && GetEntry( aMousePos ) == pEntry && pCurEntry == pEntry )
-    {
-        ::tools::Rectangle aRect(GetPosPixel(), GetSizePixel());
-        Help::ShowBalloon( this, OutputToScreenPixel(aMousePos), aRect, GetHelpText( pEntry ) );
-    }
-}
-
-void SvxConfigFunctionListBox::ClearAll()
-{
-    aArr.clear();
-    Clear();
-}
-
-OUString SvxConfigFunctionListBox::GetHelpText( SvTreeListEntry *pEntry )
-{
-    SvxGroupInfo_Impl *pInfo =
-        pEntry ? static_cast<SvxGroupInfo_Impl*>(pEntry->GetUserData()): nullptr;
-
-    if ( pInfo )
-    {
-        if ( pInfo->nKind == SVX_CFGFUNCTION_SLOT )
-        {
-            OUString aCmdURL( pInfo->sURL );
-
-            OUString aHelpText = Application::GetHelp()->GetHelpText( aCmdURL, this );
-
-            return aHelpText;
-        }
-        else if ( pInfo->nKind == SVX_CFGFUNCTION_SCRIPT )
-        {
-            return pInfo->sHelpText;
-        }
-    }
-
-    return OUString();
-}
-
-void SvxConfigFunctionListBox::FunctionSelected()
-{
-    Help::ShowBalloon( this, Point(), ::tools::Rectangle(), OUString() );
-}
-
-// drag and drop support
-DragDropMode SvxConfigFunctionListBox::NotifyStartDrag(
-    TransferDataContainer& /*aTransferDataContainer*/, SvTreeListEntry* pEntry )
-{
-    m_pDraggingEntry = pEntry;
-    return GetDragDropMode();
-}
-
-void SvxConfigFunctionListBox::DragFinished( sal_Int8 /*nDropAction*/ )
-{
-    m_pDraggingEntry = nullptr;
-}
-
-sal_Int8
-SvxConfigFunctionListBox::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
-{
-    return DND_ACTION_NONE;
-}
-
-SvxConfigGroupListBox::SvxConfigGroupListBox(vcl::Window* pParent, WinBits nStyle)
-    : SvTreeListBox(pParent, nStyle |
-            WB_CLIPCHILDREN | WB_HSCROLL | WB_HASBUTTONS | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONSATROOT | WB_TABSTOP)
-    , m_bShowSlots(false)
-    , pFunctionListBox(nullptr)
-    , m_pImageProvider(nullptr)
-    , m_hdImage(BitmapEx(RID_CUIBMP_HARDDISK))
-    , m_libImage(BitmapEx(RID_CUIBMP_LIB))
-    , m_macImage(BitmapEx(RID_CUIBMP_MACRO))
-    , m_docImage(BitmapEx(RID_CUIBMP_DOC))
-    , m_sMyMacros(CUI_RESSTR(RID_SVXSTR_MYMACROS))
-    , m_sProdMacros(CUI_RESSTR(RID_SVXSTR_PRODMACROS))
-{
-    SetNodeBitmaps(
-        Image(BitmapEx(RID_SVXBMP_COLLAPSEDNODE)),
-        Image(BitmapEx(RID_SVXBMP_EXPANDEDNODE))
-    );
-}
-
-VCL_BUILDER_FACTORY_CONSTRUCTOR(SvxConfigGroupListBox, WB_TABSTOP)
-
-SvxConfigGroupListBox::~SvxConfigGroupListBox()
-{
-    disposeOnce();
-}
-
-void SvxConfigGroupListBox::dispose()
-{
-    ClearAll();
-    pFunctionListBox.clear();
-    SvTreeListBox::dispose();
-}
-
-void SvxConfigGroupListBox::ClearAll()
-{
-    aArr.clear();
-    Clear();
-}
-
-
-namespace
-{
-
-    /** examines a component whether it supports XEmbeddedScripts, or provides access to such a
-        component by implementing XScriptInvocationContext.
-        @return
-            the model which supports the embedded scripts, or <NULL/> if it cannot find such a
-            model
-    */
-    Reference< XModel > lcl_getDocumentWithScripts_throw( const Reference< XInterface >& _rxComponent )
-    {
-        Reference< XEmbeddedScripts > xScripts( _rxComponent, UNO_QUERY );
-        if ( !xScripts.is() )
-        {
-            Reference< XScriptInvocationContext > xContext( _rxComponent, UNO_QUERY );
-            if ( xContext.is() )
-                xScripts.set( xContext->getScriptContainer(), UNO_QUERY );
-        }
-
-        return Reference< XModel >( xScripts, UNO_QUERY );
-    }
-
-
-    Reference< XModel > lcl_getScriptableDocument_nothrow( const Reference< XFrame >& _rxFrame )
-    {
-        Reference< XModel > xDocument;
-
-        // examine our associated frame
-        try
-        {
-            OSL_ENSURE( _rxFrame.is(), "lcl_getScriptableDocument_nothrow: you need to pass a frame to this dialog/tab page!" );
-            if ( _rxFrame.is() )
-            {
-                // first try the model in the frame
-                Reference< XController > xController( _rxFrame->getController(), UNO_SET_THROW );
-                xDocument = lcl_getDocumentWithScripts_throw( xController->getModel() );
-
-                if ( !xDocument.is() )
-                {
-                    // if there is no suitable document in the frame, try the controller
-                    xDocument = lcl_getDocumentWithScripts_throw( _rxFrame->getController() );
-                }
-            }
-        }
-        catch( const Exception& )
-        {
-            DBG_UNHANDLED_EXCEPTION();
-        }
-
-        return xDocument;
-    }
-}
-
-void SvxConfigGroupListBox::fillScriptList( const Reference< browse::XBrowseNode >& _rxRootNode, SvTreeListEntry* _pParentEntry, bool _bCheapChildrenOnDemand )
-{
-    OSL_PRECOND( _rxRootNode.is(), "SvxConfigGroupListBox::fillScriptList: invalid root node!" );
-    if ( !_rxRootNode.is() )
-        return;
-
-    try
-    {
-        if ( _rxRootNode->hasChildNodes() )
-        {
-            Sequence< Reference< browse::XBrowseNode > > children =
-                _rxRootNode->getChildNodes();
-
-            bool bIsRootNode = _rxRootNode->getName() == "Root";
-
-            /* To mimic current starbasic behaviour we
-            need to make sure that only the current document
-            is displayed in the config tree. Tests below
-            set the bDisplay flag to sal_False if the current
-            node is a first level child of the Root and is NOT
-            either the current document, user or share */
-            OUString sCurrentDocTitle;
-            Reference< XModel > xWorkingDocument = lcl_getScriptableDocument_nothrow( m_xFrame );
-            if ( xWorkingDocument.is() )
-            {
-                sCurrentDocTitle = ::comphelper::DocumentInfo::getDocumentTitle( xWorkingDocument );
-            }
-
-            for ( long n = 0; n < children.getLength(); ++n )
-            {
-                Reference< browse::XBrowseNode >& theChild = children[n];
-                //#139111# some crash reports show that it might be unset
-                if ( !theChild.is() )
-                    continue;
-                OUString sUIName = theChild->getName();
-                bool bDisplay = true;
-
-                if  (   bIsRootNode
-                    ||  ( m_bShowSlots && _pParentEntry && ( GetModel()->GetDepth( _pParentEntry ) == 0 ) )
-                        // if we show slots (as in the customize dialog)
-                        // then the user & share are added at depth=1
-                    )
-                {
-                    if ( sUIName == "user" )
-                    {
-                        sUIName = m_sMyMacros;
-                        bIsRootNode = true;
-                    }
-                    else if ( sUIName == "share" )
-                    {
-                        sUIName = m_sProdMacros;
-                        bIsRootNode = true;
-                    }
-                    else if ( !sUIName.equals( sCurrentDocTitle ) )
-                    {
-                        bDisplay = false;
-                    }
-                }
-
-                if ( !bDisplay )
-                    continue;
-
-                if ( children[n]->getType() == browse::BrowseNodeTypes::SCRIPT )
-                    continue;
-
-                SvTreeListEntry* pNewEntry = InsertEntry( sUIName, _pParentEntry );
-
-                Image aImage = GetImage( theChild, comphelper::getProcessComponentContext(), bIsRootNode );
-                SetExpandedEntryBmp( pNewEntry, aImage );
-                SetCollapsedEntryBmp( pNewEntry, aImage );
-
-                SvxGroupInfo_Impl* pInfo =
-                    new SvxGroupInfo_Impl( SVX_CFGGROUP_SCRIPTCONTAINER, 0, theChild );
-                pNewEntry->SetUserData( pInfo );
-                aArr.push_back( std::unique_ptr<SvxGroupInfo_Impl>(pInfo) );
-
-                if ( _bCheapChildrenOnDemand )
-                {
-                    /* i30923 - Would be nice if there was a better
-                    * way to determine if a basic lib had children
-                    * without having to ask for them (which forces
-                    * the library to be loaded */
-                    pNewEntry->EnableChildrenOnDemand();
-                }
-                else
-                {
-                    // if there are granchildren we're interested in, display the '+' before
-                    // the entry, but do not yet expand
-                    Sequence< Reference< browse::XBrowseNode > > grandchildren =
-                        children[n]->getChildNodes();
-
-                    for ( sal_Int32 m = 0; m < grandchildren.getLength(); ++m )
-                    {
-                        if ( grandchildren[m]->getType() == browse::BrowseNodeTypes::CONTAINER )
-                        {
-                            pNewEntry->EnableChildrenOnDemand();
-                            break;
-                        }
-                    }
-                }
-            }
-        }
-    }
-    catch (const Exception&)
-    {
-        DBG_UNHANDLED_EXCEPTION();
-    }
-}
-
-void SvxConfigGroupListBox::Init(bool bShowSlots, const Reference< frame::XFrame >& xFrame)
-{
-    m_bShowSlots = bShowSlots;
-    m_xFrame.set(xFrame);
-
-    SetUpdateMode(false);
-    ClearAll();
-
-    Reference< XComponentContext > xContext(
-        comphelper::getProcessComponentContext() );
-
-    // are we showing builtin commands?
-    if ( m_bShowSlots && m_xFrame.is() )
-    {
-        Reference< frame::XDispatchInformationProvider > xDIP(
-            m_xFrame, UNO_QUERY );
-
-        Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xContext) );
-
-        OUString aModuleId;
-        try{
-            aModuleId = xModuleManager->identify( m_xFrame );
-        }catch(const uno::Exception&)
-            { aModuleId.clear(); }
-
-        Reference< container::XNameAccess > const xNameAccess(
-                frame::theUICommandDescription::get(xContext) );
-        xNameAccess->getByName( aModuleId ) >>= m_xModuleCommands;
-
-        Reference< container::XNameAccess > xAllCategories =
-            ui::theUICategoryDescription::get( xContext );
-
-        Reference< container::XNameAccess > xModuleCategories;
-        if ( !aModuleId.isEmpty() )
-        {
-            try
-            {
-                xModuleCategories.set( xAllCategories->getByName( aModuleId ), UNO_QUERY );
-            }
-            catch ( container::NoSuchElementException& )
-            {
-            }
-        }
-
-         if ( !xModuleCategories.is() )
-         {
-             xModuleCategories = xAllCategories;
-         }
-
-        if ( xModuleCategories.is() )
-        {
-            SvTreeListEntry *pEntry = InsertEntry( CUI_RES(RID_SVXSTR_ALLFUNCTIONS) );
-
-            SvxGroupInfo_Impl *pInfo =
-                new SvxGroupInfo_Impl( SVX_CFGGROUP_ALLFUNCTIONS, 0 );
-            aArr.push_back( std::unique_ptr<SvxGroupInfo_Impl>(pInfo) );
-
-            pEntry->SetUserData( pInfo );
-
-            Sequence< sal_Int16 > gids =
-                xDIP->getSupportedCommandGroups();
-
-            for ( sal_Int32 i = 0; i < gids.getLength(); ++i )
-            {
-                Sequence< frame::DispatchInformation > commands;
-                try
-                {
-                    commands =
-                        xDIP->getConfigurableDispatchInformation( gids[i] );
-                }
-                catch ( container::NoSuchElementException& )
-                {
-                    continue;
-                }
-
-                if ( commands.getLength() == 0 )
-                {
-                    continue;
-                }
-
-                sal_Int32 gid = gids[i];
-                OUString idx = OUString::number( gid );
-                OUString group = idx;
-                try
-                {
-                    xModuleCategories->getByName( idx ) >>= group;
-                }
-                catch ( container::NoSuchElementException& )
-                {
-                }
-
-                pEntry = InsertEntry( group );
-
-                pInfo = new SvxGroupInfo_Impl( SVX_CFGGROUP_FUNCTION, gids[i] );
-                aArr.push_back( std::unique_ptr<SvxGroupInfo_Impl>(pInfo) );
-
-                pEntry->SetUserData( pInfo );
-            }
-        }
-    }
-
-    // Add Scripting Framework entries
-    Reference< browse::XBrowseNode > rootNode;
-
-    try
-    {
-        Reference< browse::XBrowseNodeFactory > xFac = browse::theBrowseNodeFactory::get( xContext );
-        rootNode.set( xFac->createView( browse::BrowseNodeFactoryViewTypes::MACROSELECTOR ) );
-    }
-    catch( const Exception& )
-    {
-        DBG_UNHANDLED_EXCEPTION();
-    }
-
-    if ( rootNode.is() )
-    {
-        if ( m_bShowSlots )
-        {
-            SvxGroupInfo_Impl *pInfo =
-                new SvxGroupInfo_Impl( SVX_CFGGROUP_SCRIPTCONTAINER, 0, rootNode );
-
-            OUString aTitle = CUI_RESSTR(RID_SVXSTR_PRODMACROS);
-
-            SvTreeListEntry *pNewEntry = InsertEntry( aTitle );
-            pNewEntry->SetUserData( pInfo );
-            pNewEntry->EnableChildrenOnDemand();
-            aArr.push_back( std::unique_ptr<SvxGroupInfo_Impl>(pInfo) );
-        }
-        else
-        {
-            fillScriptList( rootNode, nullptr, false );
-        }
-    }
-    MakeVisible( GetEntry( nullptr,0 ) );
-    SetUpdateMode( true );
-}
-
-Image SvxConfigGroupListBox::GetImage(
-    const Reference< browse::XBrowseNode >& node,
-    Reference< XComponentContext > const & xCtx,
-    bool bIsRootNode
-)
-{
-    Image aImage;
-    if ( bIsRootNode )
-    {
-        if ( node->getName() == "user" || node->getName() == "share" )
-        {
-            aImage = m_hdImage;
-        }
-        else
-        {
-            OUString factoryURL;
-            OUString nodeName = node->getName();
-            Reference<XInterface> xDocumentModel = getDocumentModel(xCtx, nodeName );
-            if ( xDocumentModel.is() )
-            {
-                Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xCtx) );
-                // get the long name of the document:
-                OUString appModule( xModuleManager->identify(
-                                    xDocumentModel ) );
-                Sequence<beans::PropertyValue> moduleDescr;
-                Any aAny = xModuleManager->getByName(appModule);
-                if( !( aAny >>= moduleDescr ) )
-                {
-                    throw RuntimeException("SFTreeListBox::Init: failed to get PropertyValue");
-                }
-                beans::PropertyValue const * pmoduleDescr =
-                    moduleDescr.getConstArray();
-                for ( sal_Int32 pos = moduleDescr.getLength(); pos--; )
-                {
-                    if ( pmoduleDescr[ pos ].Name == "ooSetupFactoryEmptyDocumentURL" )
-                    {
-                        pmoduleDescr[ pos ].Value >>= factoryURL;
-                        break;
-                    }
-                }
-            }
-            if( !factoryURL.isEmpty() )
-            {
-                aImage = SvFileInformationManager::GetFileImage( INetURLObject(factoryURL) );
-            }
-            else
-            {
-                aImage = m_docImage;
-            }
-        }
-    }
-    else
-    {
-        if( node->getType() == browse::BrowseNodeTypes::SCRIPT )
-            aImage = m_macImage;
-        else
-            aImage = m_libImage;
-    }
-    return aImage;
-}
-
-Reference< XInterface  >
-SvxConfigGroupListBox::getDocumentModel(
-    Reference< XComponentContext > const & xCtx, OUString& docName )
-{
-    Reference< XInterface > xModel;
-    Reference< frame::XDesktop2 > desktop = Desktop::create(xCtx);
-
-    Reference< container::XEnumerationAccess > componentsAccess =
-        desktop->getComponents();
-    Reference< container::XEnumeration > components =
-        componentsAccess->createEnumeration();
-    while (components->hasMoreElements())
-    {
-        Reference< frame::XModel > model(
-            components->nextElement(), UNO_QUERY );
-        if ( model.is() )
-        {
-            OUString sTdocUrl = ::comphelper::DocumentInfo::getDocumentTitle( model );
-            if( sTdocUrl.equals( docName ) )
-            {
-                xModel = model;
-                break;
-            }
-        }
-    }
-    return xModel;
-}
-
-void SvxConfigGroupListBox::fillFunctionList(const Sequence< frame::DispatchInformation >& commands)
-{
-    for ( sal_Int32 i = 0; i < commands.getLength(); ++i )
-    {
-        if ( commands[i].Command.isEmpty() )
-        {
-            continue;
-        }
-
-        Image aImage;
-
-        OUString aCmdURL( commands[i].Command );
-
-        if ( m_pImageProvider )
-        {
-            aImage = m_pImageProvider->GetImage( aCmdURL );
-        }
-
-        OUString aLabel;
-        try
-        {
-            Any a = m_xModuleCommands->getByName( aCmdURL );
-            Sequence< beans::PropertyValue > aPropSeq;
-
-            if ( a >>= aPropSeq )
-            {
-                for ( sal_Int32 k = 0; k < aPropSeq.getLength(); ++k )
-                {
-                    if ( aPropSeq[k].Name == "Name" )
-                    {
-                        aPropSeq[k].Value >>= aLabel;
-                        break;
-                    }
-                }
-            }
-        }
-        catch ( container::NoSuchElementException& )
-        {
-        }
-
-        if ( aLabel.isEmpty() )
-        {
-            aLabel = commands[i].Command;
-        }
-
-        SvTreeListEntry* pFuncEntry = nullptr;
-        if ( !!aImage )
-        {
-            pFuncEntry = pFunctionListBox->InsertEntry(
-                aLabel, aImage, aImage );
-        }
-        else
-        {
-            pFuncEntry = pFunctionListBox->InsertEntry(
-                aLabel );
-        }
-
-        SvxGroupInfo_Impl *_pGroupInfo = new SvxGroupInfo_Impl(
-            SVX_CFGFUNCTION_SLOT, 123, aCmdURL, OUString() );
-
-        pFunctionListBox->aArr.push_back( std::unique_ptr<SvxGroupInfo_Impl>(_pGroupInfo) );
-
-        pFuncEntry->SetUserData( _pGroupInfo );
-    }
-}
-
-void SvxConfigGroupListBox::GroupSelected()
-{
-    SvTreeListEntry *pEntry = FirstSelected();
-    SvxGroupInfo_Impl *pInfo = static_cast<SvxGroupInfo_Impl*>(pEntry->GetUserData());
-    pFunctionListBox->SetUpdateMode(false);
-    pFunctionListBox->ClearAll();
-    if ( pInfo->nKind != SVX_CFGGROUP_FUNCTION &&
-             pInfo->nKind != SVX_CFGGROUP_SCRIPTCONTAINER &&
-             pInfo->nKind != SVX_CFGGROUP_ALLFUNCTIONS )
-    {
-        pFunctionListBox->SetUpdateMode(true);
-        return;
-    }
-
-    switch ( pInfo->nKind )
-    {
-        case SVX_CFGGROUP_FUNCTION:
-        {
-            Reference< frame::XDispatchInformationProvider > xDIP( m_xFrame, UNO_QUERY );
-            Sequence< frame::DispatchInformation > commands;
-            try
-            {
-                commands = xDIP->getConfigurableDispatchInformation( pInfo->nOrd );
-                fillFunctionList(commands);
-            }
-            catch ( container::NoSuchElementException& )
-            {
-            }
-
-            break;
-        }
-
-        case SVX_CFGGROUP_ALLFUNCTIONS:
-        {
-            Reference< frame::XDispatchInformationProvider > xDIP( m_xFrame, UNO_QUERY );
-            SvTreeListEntry *pCurrEntry = First();
-            while( pCurrEntry )
-            {
-                SvxGroupInfo_Impl *pCurrentInfo = static_cast<SvxGroupInfo_Impl*>(pCurrEntry->GetUserData());
-                if (pCurrentInfo->nKind == SVX_CFGGROUP_FUNCTION)
-                {
-
-
-                    Sequence< frame::DispatchInformation > commands;
-                    try
-                    {
-                        commands = xDIP->getConfigurableDispatchInformation( pCurrentInfo->nOrd );
-                        fillFunctionList(commands);
-                    }
-                    catch ( container::NoSuchElementException& )
-                    {
-                    }
-                }
-                pCurrEntry = Next( pCurrEntry );
-            };
-
-            break;
-        }
-
-        case SVX_CFGGROUP_SCRIPTCONTAINER:
-        {
-            Reference< browse::XBrowseNode > rootNode( pInfo->xBrowseNode );
-
-            try {
-                if ( rootNode->hasChildNodes() )
-                {
-                    Sequence< Reference< browse::XBrowseNode > > children =
-                        rootNode->getChildNodes();
-
-                    for ( sal_Int32 n = 0; n < children.getLength(); ++n )
-                    {
-                        if (!children[n].is())
-                            continue;
-                        if (children[n]->getType() == browse::BrowseNodeTypes::SCRIPT)
-                        {
-                            OUString uri;
-                            OUString description;
-
-                            Reference < beans::XPropertySet >xPropSet( children[n], UNO_QUERY );
-                            if (!xPropSet.is())
-                            {
-                                continue;
-                            }
-
-                            Any value = xPropSet->getPropertyValue("URI");
-                            value >>= uri;
-
-                            try
-                            {
-                                value = xPropSet->getPropertyValue("Description");
-                                value >>= description;
-                            }
-                            catch (Exception &) {
-                                // do nothing, the description will be empty
-                            }
-
-                            SvxGroupInfo_Impl* _pGroupInfo =
-                                new SvxGroupInfo_Impl(
-                                    SVX_CFGFUNCTION_SCRIPT, 123, uri, description );
-
-                            Image aImage = GetImage( children[n], Reference< XComponentContext >(), false );
-                            SvTreeListEntry* pNewEntry =
-                                pFunctionListBox->InsertEntry( children[n]->getName() );
-                            pFunctionListBox->SetExpandedEntryBmp( pNewEntry, aImage );
-                            pFunctionListBox->SetCollapsedEntryBmp(pNewEntry, aImage );
-
-                            pNewEntry->SetUserData( _pGroupInfo );
-
-                            pFunctionListBox->aArr.push_back( std::unique_ptr<SvxGroupInfo_Impl>(_pGroupInfo) );
-
-                        }
-                    }
-                }
-            }
-            catch (const Exception&)
-            {
-                DBG_UNHANDLED_EXCEPTION();
-            }
-            break;
-        }
-
-        default:
-        {
-            return;
-        }
-    }
-
-    if ( pFunctionListBox->GetEntryCount() )
-        pFunctionListBox->Select( pFunctionListBox->GetEntry( nullptr, 0 ) );
-
-    pFunctionListBox->SetUpdateMode(true);
-}
-
-bool SvxConfigGroupListBox::Expand( SvTreeListEntry* pParent )
-{
-    bool bRet = SvTreeListBox::Expand( pParent );
-    if ( bRet )
-    {
-        sal_uLong nEntries = GetOutputSizePixel().Height() / GetEntryHeight();
-
-        sal_uLong nChildCount = GetVisibleChildCount( pParent );
-
-        if ( nChildCount+1 > nEntries )
-        {
-            MakeVisible( pParent, true );
-        }
-        else
-        {
-            SvTreeListEntry *pEntry = GetFirstEntryInView();
-            sal_uLong nParentPos = 0;
-            while ( pEntry && pEntry != pParent )
-            {
-                ++nParentPos;
-                pEntry = GetNextEntryInView( pEntry );
-            }
-
-            if ( nParentPos + nChildCount + 1 > nEntries )
-                ScrollOutputArea( (short)( nEntries - ( nParentPos + nChildCount + 1 ) ) );
-        }
-    }
-
-    return bRet;
-}
-
-void SvxConfigGroupListBox::RequestingChildren( SvTreeListEntry *pEntry )
-{
-    SvxGroupInfo_Impl *pInfo = static_cast<SvxGroupInfo_Impl*>(pEntry->GetUserData());
-    pInfo->bWasOpened = true;
-    switch ( pInfo->nKind )
-    {
-        case SVX_CFGGROUP_SCRIPTCONTAINER:
-        {
-            if ( !GetChildCount( pEntry ) )
-            {
-                Reference< browse::XBrowseNode > rootNode( pInfo->xBrowseNode ) ;
-                fillScriptList( rootNode, pEntry, true /* i30923 */ );
-            }
-            break;
-        }
-
-        default:
-            OSL_FAIL( "Falscher Gruppentyp!" );
-            break;
-    }
-}
-
-/*
- * Implementation of SvxScriptSelectorDialog
- *
- * This dialog is used for selecting Slot API commands
- * and Scripting Framework Scripts.
- */
-
-SvxScriptSelectorDialog::SvxScriptSelectorDialog(
-    vcl::Window* pParent, bool bShowSlots, const Reference< frame::XFrame >& xFrame)
-    : ModalDialog(pParent, "MacroSelectorDialog", "cui/ui/macroselectordialog.ui")
-    , m_bShowSlots(bShowSlots)
-{
-    get<FixedText>("libraryft")->Show(!m_bShowSlots);
-    get<FixedText>("categoryft")->Show(m_bShowSlots);
-    get<FixedText>("macronameft")->Show(!m_bShowSlots);
-    get<FixedText>("commandsft")->Show(m_bShowSlots);
-    get(m_pDescriptionText, "description");
-    get(m_pCommands, "commands");
-    if (m_bShowSlots)
-    {
-        // If we are showing Slot API commands update labels in the UI, and
-        // enable drag'n'drop
-        SetText(CUI_RESSTR(RID_SVXSTR_SELECTOR_ADD_COMMANDS));
-        m_pCommands->SetDragDropMode( DragDropMode::APP_COPY );
-
-        get(m_pCancelButton, "close");
-        get(m_pDialogDescription, "helptoolbar");
-        get(m_pOKButton, "add");
-    }
-    else
-    {
-        get(m_pCancelButton, "cancel");
-        get(m_pDialogDescription, "helpmacro");
-        get(m_pOKButton, "ok");
-    }
-    m_pCancelButton->Show();
-    m_pDialogDescription->Show();
-    m_pOKButton->Show();
-
-    get(m_pCategories, "categories");
-    m_pCategories->SetFunctionListBox(m_pCommands);
-    m_pCategories->Init(bShowSlots, xFrame);
-
-    m_pCategories->SetSelectHdl(
-            LINK( this, SvxScriptSelectorDialog, SelectHdl ) );
-    m_pCommands->SetSelectHdl( LINK( this, SvxScriptSelectorDialog, SelectHdl ) );
-    m_pCommands->SetDoubleClickHdl( LINK( this, SvxScriptSelectorDialog, FunctionDoubleClickHdl ) );
-
-    m_pOKButton->SetClickHdl( LINK( this, SvxScriptSelectorDialog, ClickHdl ) );
-    m_pCancelButton->SetClickHdl( LINK( this, SvxScriptSelectorDialog, ClickHdl ) );
-
-    m_sDefaultDesc = m_pDescriptionText->GetText();
-
-    UpdateUI();
-}
-
-SvxScriptSelectorDialog::~SvxScriptSelectorDialog()
-{
-    disposeOnce();
-}
-
-void SvxScriptSelectorDialog::dispose()
-{
-    m_pDialogDescription.clear();
-    m_pCategories.clear();
-    m_pCommands.clear();
-    m_pOKButton.clear();
-    m_pCancelButton.clear();
-    m_pDescriptionText.clear();
-    ModalDialog::dispose();
-}
-
-IMPL_LINK( SvxScriptSelectorDialog, SelectHdl, SvTreeListBox*, pCtrl, void )
-{
-    if (pCtrl == m_pCategories)
-    {
-        m_pCategories->GroupSelected();
-    }
-    else if (pCtrl == m_pCommands)
-    {
-        m_pCommands->FunctionSelected();
-    }
-    UpdateUI();
-}
-
-IMPL_LINK_NOARG( SvxScriptSelectorDialog, FunctionDoubleClickHdl, SvTreeListBox*, bool )
-{
-    if (m_pOKButton->IsEnabled())
-        ClickHdl(m_pOKButton);
-    return false;
-}
-
-// Check if command is selected and enable the OK button accordingly
-// Grab the help text for this id if available and update the description field
-void
-SvxScriptSelectorDialog::UpdateUI()
-{
-    OUString url = GetScriptURL();
-    if ( !url.isEmpty() )
-    {
-        OUString sMessage =
-            m_pCommands->GetHelpText(m_pCommands->FirstSelected());
-        m_pDescriptionText->SetText(sMessage.isEmpty() ? m_sDefaultDesc : sMessage);
-
-        m_pOKButton->Enable();
-    }
-    else
-    {
-        m_pDescriptionText->SetText(m_sDefaultDesc);
-        m_pOKButton->Enable( false );
-    }
-}
-
-IMPL_LINK( SvxScriptSelectorDialog, ClickHdl, Button *, pButton, void )
-{
-    if (pButton == m_pCancelButton)
-    {
-        EndDialog();
-    }
-    else if (pButton == m_pOKButton)
-    {
-        GetAddHdl().Call( *this );
-
-        // If we are displaying Slot API commands then this the dialog is being
-        // run from Tools/Configure and we should not close it
-        if ( !m_bShowSlots )
-        {
-            EndDialog( RET_OK );
-        }
-        else
-        {
-            // Select the next entry in the list if possible
-            SvTreeListEntry* current = m_pCommands->FirstSelected();
-            SvTreeListEntry* next = SvTreeListBox::NextSibling( current );
-
-            if ( next != nullptr )
-            {
-                m_pCommands->Select( next );
-            }
-        }
-    }
-}
-
-void
-SvxScriptSelectorDialog::SetRunLabel()
-{
-    m_pOKButton->SetText(CUI_RESSTR(RID_SVXSTR_SELECTOR_RUN));
-}
-
-void
-SvxScriptSelectorDialog::SetDialogDescription( const OUString& rDescription )
-{
-    m_pDialogDescription->SetText( rDescription );
-}
-
-OUString
-SvxScriptSelectorDialog::GetScriptURL() const
-{
-    OUString result;
-
-    SvTreeListEntry *pEntry = const_cast< SvxScriptSelectorDialog* >( this )->m_pCommands->GetLastSelectedEntry();
-    if ( pEntry )
-    {
-        SvxGroupInfo_Impl *pData = static_cast<SvxGroupInfo_Impl*>(pEntry->GetUserData());
-        if  (   ( pData->nKind == SVX_CFGFUNCTION_SLOT )
-            ||  ( pData->nKind == SVX_CFGFUNCTION_SCRIPT )
-            )
-        {
-            result = pData->sURL;
-        }
-    }
-
-    return result;
-}
-
-OUString
-SvxScriptSelectorDialog::GetSelectedDisplayName()
-{
-    return m_pCommands->GetEntryText( m_pCommands->GetLastSelectedEntry() );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 438c87b50957..e4106a558944 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -31,7 +31,7 @@
 #include <bitmaps.hlst>
 #include "scriptdlg.hxx"
 #include <dialmgr.hxx>
-#include "selector.hxx"
+#include "cfgutil.hxx"
 
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/frame/XDesktop.hpp>
diff --git a/cui/source/factory/cuiexp.cxx b/cui/source/factory/cuiexp.cxx
index ac53518218e5..7f558b73c57a 100644
--- a/cui/source/factory/cuiexp.cxx
+++ b/cui/source/factory/cuiexp.cxx
@@ -39,7 +39,7 @@
 #include "passwdomdlg.hxx"
 #include "screenshotannotationdlg.hxx"
 #include "cuihyperdlg.hxx"
-#include "selector.hxx"
+#include "cfgutil.hxx"
 #include "SpellDialog.hxx"
 #include "zoom.hxx"
 #include "showcols.hxx"
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 19f48e5c224e..ef3775226053 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -74,7 +74,7 @@
 #include "postdlg.hxx"
 #include "grfpage.hxx"
 #include "scriptdlg.hxx"
-#include "selector.hxx"
+#include "cfgutil.hxx"
 #include "macropg.hxx"
 #include "sdrcelldlg.hxx"
 #include "newtabledlg.hxx"
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index c70c1ee7216d..40dc23710dc7 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -46,7 +46,7 @@
 #include <vector>
 #include <vcl/msgbox.hxx>
 
-#include "selector.hxx"
+#include "cfgutil.hxx"
 
 class SvxConfigEntry;
 class SvxConfigPage;
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index ef73b0bb429a..d053555bba86 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -27,12 +27,16 @@
 #include <com/sun/star/frame/XFrame.hpp>
 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/frame/XDispatchInformationProvider.hpp>
 #include <com/sun/star/script/browse/XBrowseNode.hpp>
 #include <vcl/timer.hxx>
 #include <svtools/svtabbx.hxx>
 #include <svtools/treelistbox.hxx>
+#include <vcl/dialog.hxx>
 #include <vcl/image.hxx>
 
+class Button;
+class SaveInData;
 class SfxMacroInfoItem;
 
 struct SfxStyleInfo_Impl
@@ -81,6 +85,7 @@ enum class SfxCfgKind
     GROUP_SCRIPTCONTAINER    = 3,
     FUNCTION_SCRIPT          = 4,
     GROUP_STYLES             = 5,
+    GROUP_ALLFUNCTIONS       = 6
 };
 
 struct SfxGroupInfo_Impl
@@ -91,6 +96,7 @@ struct SfxGroupInfo_Impl
     bool        bWasOpened;
     OUString    sCommand;
     OUString    sLabel;
+    OUString    sHelpText;
 
                 SfxGroupInfo_Impl( SfxCfgKind n, sal_uInt16 nr, void* pObj = nullptr ) :
                     nKind( n ), nUniqueID( nr ), pObject( pObj ), bWasOpened(false) {}
@@ -116,6 +122,7 @@ public:
     OUString      GetCurCommand();
     OUString      GetCurLabel();
     OUString      GetSelectedScriptURI();
+    OUString      GetHelpText();
     void          SetStylesInfo(SfxStylesInfo_Impl* pStyles);
 };
 
@@ -125,7 +132,7 @@ class SfxConfigGroupListBox : public SvTreeListBox
     std::unique_ptr<SvxConfigGroupBoxResource_Impl> xImp;
     VclPtr<SfxConfigFunctionListBox>  pFunctionListBox;
     SfxGroupInfoArr_Impl            aArr;
-
+    SaveInData* m_pImageProvider;
     OUString m_sModuleLongName;
     css::uno::Reference< css::uno::XComponentContext > m_xContext;
     css::uno::Reference< css::frame::XFrame > m_xFrame;
@@ -146,7 +153,9 @@ class SfxConfigGroupListBox : public SvTreeListBox
 
 
     void InitModule();
-
+    void FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode >& xRootNode,
+                         SvTreeListEntry* pParentEntry, bool bCheapChildrenOnDemand);
+    void FillFunctionsList(const css::uno::Sequence< css::frame::DispatchInformation >& xCommands);
     OUString MapCommand2UIName(const OUString& sCommand);
 
     SfxStylesInfo_Impl* pStylesInfo;
@@ -167,12 +176,57 @@ public:
                              bool bEventMode);
     void                SetFunctionListBox( SfxConfigFunctionListBox *pBox )
                         { pFunctionListBox = pBox; }
+    void                SetImageProvider( SaveInData* provider )
+                        { m_pImageProvider = provider; }
     void                GroupSelected();
     void                SelectMacro( const SfxMacroInfoItem* );
     void                SelectMacro( const OUString&, const OUString& );
     void                SetStylesInfo(SfxStylesInfo_Impl* pStyles);
 };
 
+class SvxScriptSelectorDialog : public ModalDialog
+{
+    VclPtr<FixedText>                      m_pDialogDescription;
+    VclPtr<SfxConfigGroupListBox>          m_pCategories;
+    VclPtr<SfxConfigFunctionListBox>       m_pCommands;
+    VclPtr<PushButton>                     m_pOKButton;
+    VclPtr<PushButton>                     m_pCancelButton;
+    VclPtr<VclMultiLineEdit>               m_pDescriptionText;
+    OUString                               m_sDefaultDesc;
+    SfxStylesInfo_Impl                     m_aStylesInfo;
+    bool                                   m_bShowSlots;
+    Link<SvxScriptSelectorDialog&,void>    m_aAddHdl;
+
+    DECL_LINK( ClickHdl, Button *, void );
+    DECL_LINK( SelectHdl, SvTreeListBox*, void );
+    DECL_LINK( FunctionDoubleClickHdl, SvTreeListBox*, bool );
+
+    void                            UpdateUI();
+
+public:
+
+    SvxScriptSelectorDialog (
+        vcl::Window* pParent = nullptr,
+        bool bShowSlots = false,
+        const css::uno::Reference< css::frame::XFrame >& xFrame = nullptr
+    );
+    virtual ~SvxScriptSelectorDialog() override;
+    virtual void dispose() override;
+
+    void        SetAddHdl( const Link<SvxScriptSelectorDialog&,void>& rLink ) { m_aAddHdl = rLink; }
+    const Link<SvxScriptSelectorDialog&,void>& GetAddHdl() const { return m_aAddHdl; }
+
+    void        SetImageProvider(SaveInData* provider)
+    {
+        m_pCategories->SetImageProvider(provider);
+    }
+
+    OUString    GetScriptURL() const;
+    OUString    GetSelectedDisplayName();
+    void        SetRunLabel();
+    void        SetDialogDescription(const OUString& rDescription);
+};
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/selector.hxx b/cui/source/inc/selector.hxx
deleted file mode 100644
index 826a4ccefe34..000000000000
--- a/cui/source/inc/selector.hxx
+++ /dev/null
@@ -1,222 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_CUI_SOURCE_INC_SELECTOR_HXX
-#define INCLUDED_CUI_SOURCE_INC_SELECTOR_HXX
-
-#include <vcl/lstbox.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/group.hxx>
-#include <vcl/menubtn.hxx>
-#include <svtools/treelistbox.hxx>
-
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/frame/DispatchInformation.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/script/browse/XBrowseNode.hpp>
-
-#include <memory>
-
-class SaveInData;
-
-#define SVX_CFGGROUP_FUNCTION 1
-#define SVX_CFGFUNCTION_SLOT  2
-#define SVX_CFGGROUP_SCRIPTCONTAINER  3
-#define SVX_CFGFUNCTION_SCRIPT 4
-#define SVX_CFGGROUP_ALLFUNCTIONS 5
-
-struct SvxGroupInfo_Impl
-{
-    sal_uInt16          nKind;
-    sal_uInt16          nOrd;
-    css::uno::Reference< css::script::browse::XBrowseNode >
-                        xBrowseNode;
-    OUString            sURL;
-    OUString            sHelpText;
-    bool                bWasOpened;
-
-    SvxGroupInfo_Impl( sal_uInt16 n, sal_uInt16 nr )
-        :nKind( n )
-        ,nOrd( nr )
-        ,xBrowseNode()
-        ,sURL()
-        ,sHelpText()
-        ,bWasOpened(false)
-    {
-    }
-
-    SvxGroupInfo_Impl( sal_uInt16 n, sal_uInt16 nr, const css::uno::Reference< css::script::browse::XBrowseNode >& _rxNode )
-        :nKind( n )
-        ,nOrd( nr )
-        ,xBrowseNode( _rxNode )
-        ,sURL()
-        ,sHelpText()
-        ,bWasOpened(false)
-    {
-    }
-
-    SvxGroupInfo_Impl( sal_uInt16 n, sal_uInt16 nr, const OUString& _rURL, const OUString& _rHelpText )
-        :nKind( n )
-        ,nOrd( nr )
-        ,xBrowseNode()
-        ,sURL( _rURL )
-        ,sHelpText( _rHelpText )
-        ,bWasOpened(false)
-    {
-    }
-};
-
-typedef std::vector<std::unique_ptr<SvxGroupInfo_Impl> > SvxGroupInfoArr_Impl;
-
-class SvxConfigFunctionListBox : public SvTreeListBox
-{
-friend class SvxConfigGroupListBox;
-    Timer                           aTimer;
-    SvTreeListEntry*                    pCurEntry;
-    SvxGroupInfoArr_Impl            aArr;
-    SvTreeListEntry*                    m_pDraggingEntry;
-
-    DECL_LINK(TimerHdl, Timer *, void);
-    virtual void                    MouseMove( const MouseEvent& rMEvt ) override;
-
-public:
-    SvxConfigFunctionListBox(vcl::Window* pParent, WinBits nStyle);
-    virtual ~SvxConfigFunctionListBox() override;
-    virtual void                    dispose() override;
-    void                            ClearAll();
-    OUString                        GetHelpText( SvTreeListEntry *pEntry );
-    using Window::GetHelpText;
-    SvTreeListEntry*                GetLastSelectedEntry();
-    void                            FunctionSelected();
-
-    // drag n drop methods
-    virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt ) override;
-
-    virtual DragDropMode    NotifyStartDrag(
-        TransferDataContainer&, SvTreeListEntry* ) override;
-
-    virtual void        DragFinished( sal_Int8 ) override;
-};
-
-class SvxConfigGroupListBox : public SvTreeListBox
-{
-    SvxGroupInfoArr_Impl            aArr;
-    bool                            m_bShowSlots;
-
-    VclPtr<SvxConfigFunctionListBox>  pFunctionListBox;
-    SaveInData*                     m_pImageProvider;
-
-    css::uno::Reference
-        < css::frame::XFrame > m_xFrame;
-
-    css::uno::Reference
-        < css::container::XNameAccess > m_xModuleCommands;
-
-    Image m_hdImage;
-    Image m_libImage;
-    Image m_macImage;
-    Image m_docImage;
-    OUString m_sMyMacros;
-    OUString m_sProdMacros;
-    Image GetImage(
-        const css::uno::Reference< css::script::browse::XBrowseNode >& node,
-        css::uno::Reference< css::uno::XComponentContext > const & xCtx,
-        bool bIsRootNode
-    );
-
-    static css::uno::Reference< css::uno::XInterface  > getDocumentModel(
-        css::uno::Reference< css::uno::XComponentContext > const & xCtx,
-        OUString& docName
-    );
-
-private:
-    void    fillScriptList(
-        const css::uno::Reference< css::script::browse::XBrowseNode >& _rxRootNode,
-        SvTreeListEntry* _pParentEntry,
-        bool _bCheapChildrenOnDemand
-    );
-    void    fillFunctionList( const com::sun::star::uno::Sequence< com::sun::star::frame::DispatchInformation >& commands );
-
-protected:
-    virtual void    RequestingChildren( SvTreeListEntry *pEntry) override;
-    virtual bool    Expand( SvTreeListEntry* pParent ) override;
-
-public:
-    SvxConfigGroupListBox(vcl::Window* pParent, WinBits nStyle);
-    virtual ~SvxConfigGroupListBox() override;
-    virtual void dispose() override;
-
-    void    Init(bool bShowSlots, const css::uno::Reference
-                    < css::frame::XFrame >& xFrame);
-
-    void    ClearAll();
-    void    GroupSelected();
-
-    void    SetFunctionListBox( SvxConfigFunctionListBox *pBox )
-        { pFunctionListBox = pBox; }
-
-    void    SetImageProvider( SaveInData* provider )
-        { m_pImageProvider = provider; }
-};
-
-class SvxScriptSelectorDialog : public ModalDialog
-{
-    VclPtr<FixedText>                      m_pDialogDescription;
-    VclPtr<SvxConfigGroupListBox>          m_pCategories;
-    VclPtr<SvxConfigFunctionListBox>       m_pCommands;
-    VclPtr<PushButton>                     m_pOKButton;
-    VclPtr<PushButton>                     m_pCancelButton;
-    VclPtr<VclMultiLineEdit>               m_pDescriptionText;
-    OUString                               m_sDefaultDesc;
-    bool                                   m_bShowSlots;
-    Link<SvxScriptSelectorDialog&,void>    m_aAddHdl;
-
-    DECL_LINK( ClickHdl, Button *, void );
-    DECL_LINK( SelectHdl, SvTreeListBox*, void );
-    DECL_LINK( FunctionDoubleClickHdl, SvTreeListBox*, bool );
-
-    void                            UpdateUI();
-
-public:
-
-    SvxScriptSelectorDialog (
-        vcl::Window* pParent = nullptr,
-        bool bShowSlots = false,
-        const css::uno::Reference< css::frame::XFrame >& xFrame = nullptr
-    );
-    virtual ~SvxScriptSelectorDialog() override;
-    virtual void dispose() override;
-
-    void        SetAddHdl( const Link<SvxScriptSelectorDialog&,void>& rLink ) { m_aAddHdl = rLink; }
-    const Link<SvxScriptSelectorDialog&,void>& GetAddHdl() const { return m_aAddHdl; }
-
-    void        SetImageProvider(SaveInData* provider)
-    {
-        m_pCategories->SetImageProvider(provider);
-    }
-
-    OUString    GetScriptURL() const;
-    OUString    GetSelectedDisplayName();
-    void        SetRunLabel();
-    void        SetDialogDescription(const OUString& rDescription);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/uiconfig/ui/macroselectordialog.ui b/cui/uiconfig/ui/macroselectordialog.ui
index 7036463d6aa1..476b526ffef4 100644
--- a/cui/uiconfig/ui/macroselectordialog.ui
+++ b/cui/uiconfig/ui/macroselectordialog.ui
@@ -159,7 +159,7 @@
                         <property name="top_padding">6</property>
                         <property name="left_padding">12</property>
                         <child>
-                          <object class="cuilo-SvxConfigGroupListBox" id="categories:border">
+                          <object class="cuilo-SfxConfigGroupListBox" id="categories:border">
                             <property name="width_request">280</property>
                             <property name="height_request">300</property>
                             <property name="visible">True</property>
@@ -167,7 +167,7 @@
                             <property name="hexpand">True</property>
                             <property name="vexpand">True</property>
                             <child internal-child="selection">
-                              <object class="GtkTreeSelection" id="SvxConfigGroupListBox-selection1"/>
+                              <object class="GtkTreeSelection" id="SfxConfigGroupListBox-selection1"/>
                             </child>
                           </object>
                         </child>
@@ -231,7 +231,7 @@
                         <property name="top_padding">6</property>
                         <property name="left_padding">12</property>
                         <child>
-                          <object class="cuilo-SvxConfigFunctionListBox" id="commands:border">
+                          <object class="cuilo-SfxConfigFunctionListBox" id="commands:border">
                             <property name="width_request">280</property>
                             <property name="height_request">300</property>
                             <property name="visible">True</property>
@@ -239,7 +239,7 @@
                             <property name="hexpand">True</property>
                             <property name="vexpand">True</property>
                             <child internal-child="selection">
-                              <object class="GtkTreeSelection" id="SvxConfigFunctionListBox-selection1"/>
+                              <object class="GtkTreeSelection" id="SfxConfigFunctionListBox-selection1"/>
                             </child>
                           </object>
                         </child>
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index be8a2738e855..2b723cac3e87 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -544,12 +544,6 @@
     <glade-widget-class title="SwIdxTreeListBox" name="swuilo-SwIdxTreeListBox"
                         generic-name="SwIdxTreeListBox" parent="svtlo-SvTreeListBox"
                         icon-name="widget-gtk-treeview"/>
-    <glade-widget-class title="SvxConfigGroupListBox" name="cuilo-SvxConfigGroupListBox"
-                        generic-name="SvxConfigGroupListBox" parent="svtlo-SvTreeListBox"
-                        icon-name="widget-gtk-treeview"/>
-    <glade-widget-class title="SvxConfigFunctionListBox`" name="cuilo-SvxConfigFunctionListBox"
-                        generic-name="SvxConfigFunctionListBox" parent="svtlo-SvTreeListBox"
-                        icon-name="widget-gtk-treeview"/>
     <glade-widget-class title="Tooltip Tree List" name="swuilo-SwFldRefTreeListBox"
                         generic-name="Tooltip Tree List" parent="svtlo-SvTreeListBox"
                         icon-name="widget-gtk-treeview"/>


More information about the Libreoffice-commits mailing list