tdf#148836: Alphabetize customize keyboard dialog

"All Commands" is kept at the top, and LibreOffice Macros, Styles and Sidebar Decks are kept at the bottom,
while others are sorted alphabetally.

Change-Id: I0c8287d4ffed9f9ee901d306a16670933541ba93
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index aa77952..fa11a4d 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -469,7 +469,7 @@ void CuiConfigGroupListBox::ClearAll()
    m_xTreeView->clear();
}

void CuiConfigGroupListBox::InitModule()
sal_Int32 CuiConfigGroupListBox::InitModule()
{
    try
    {
@@ -478,13 +478,6 @@ void CuiConfigGroupListBox::InitModule()
        sal_Int32                       c1      = lGroups.getLength();
        sal_Int32                       i1      = 0;

        if ( c1 )
        {
            // Add All Commands category
            aArr.push_back(std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_ALLFUNCTIONS, 0));
            m_xTreeView->append(weld::toId(aArr.back().get()), CuiResId(RID_CUISTR_ALLFUNCTIONS));
        }

        for (i1=0; i1<c1; ++i1)
        {
            sal_Int16      nGroupID   = lGroups[i1];
@@ -503,11 +496,13 @@ void CuiConfigGroupListBox::InitModule()
            aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_FUNCTION, nGroupID ) );
            m_xTreeView->append(weld::toId(aArr.back().get()), sGroupName);
        }
        return c1;
    }
    catch(const css::uno::RuntimeException&)
        { throw; }
    catch(const css::uno::Exception&)
        {}
    return 0;
}

void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode >& xRootNode,
@@ -634,6 +629,7 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent

    m_xContext = xContext;
    m_xFrame = xFrame;
    sal_Int32 c1 = 0;
    if( bEventMode )
    {
        m_sModuleLongName = sModuleLongName;
@@ -641,7 +637,7 @@ void CuiConfigGroupListBox::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();
        c1 = InitModule();
    }

    SAL_INFO("cui.customize", "** ** About to initialise SF Scripts");
@@ -658,7 +654,21 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
        // TODO exception handling
    }

    m_xTreeView->thaw();
    m_xTreeView->make_sorted();
    m_xTreeView->make_unsorted();
    m_xTreeView->freeze();

    // add All Commands to the top
    if ( bEventMode && c1 )
    {
        aArr.insert(aArr.begin(), std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_ALLFUNCTIONS, 0));
        OUString sId(weld::toId(aArr.front().get()));
        OUString s(CuiResId(RID_CUISTR_ALLFUNCTIONS));
        m_xTreeView->insert(nullptr, 0, &s, &sId, nullptr, nullptr, false, nullptr);
    }

    // add application macros to the end
    if ( rootNode.is() )
    {
        if ( bEventMode )
@@ -681,7 +691,7 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
        }
    }

    // add styles and sidebar decks
    // add styles and sidebar decks to the end
    if ( bEventMode )
    {
        aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, nullptr ) ); // TODO last parameter should contain user data
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index 44f532b..b1f22e4 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -204,7 +204,7 @@ class CuiConfigGroupListBox
        css::uno::Reference< css::uno::XComponentContext > const & xCtx,
        std::u16string_view docName);

    void InitModule();
    sal_Int32 InitModule();
    void FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode >& xRootNode,
                        const weld::TreeIter* pParentEntry);
    void FillFunctionsList(const css::uno::Sequence< css::frame::DispatchInformation >& xCommands);