tdf#108458 Show tooltips in CuiConfigFunctionListBox

Change-Id: I6644e939c644c827e2b3ad019b975a3845585063
Reviewed-on: https://gerrit.libreoffice.org/84555
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc
index 1ade0c0..3169862 100644
--- a/cui/inc/strings.hrc
+++ b/cui/inc/strings.hrc
@@ -396,6 +396,10 @@

#define RID_SVXSTR_EDIT_PATHS                       NC_("optpathspage|editpaths", "Edit Paths: %1")

#define RID_SVXSTR_COMMANDLABEL                     NC_("RID_SVXSTR_COMMANDLABEL", "Label")
#define RID_SVXSTR_COMMANDNAME                      NC_("RID_SVXSTR_COMMANDLABEL", "Command")
#define RID_SVXSTR_COMMANDTIP                       NC_("RID_SVXSTR_COMMANDLABEL", "Tooltip")

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/customize/CommandCategoryListBox.cxx b/cui/source/customize/CommandCategoryListBox.cxx
index 7576d07..d9e3f57 100644
--- a/cui/source/customize/CommandCategoryListBox.cxx
+++ b/cui/source/customize/CommandCategoryListBox.cxx
@@ -243,6 +243,7 @@ void CommandCategoryListBox::FillFunctionsList(
        SfxGroupInfo_Impl* pGrpInfo = m_aGroupInfo.back().get();
        pGrpInfo->sCommand = rInfo.Command;
        pGrpInfo->sLabel   = sUIName;
        pGrpInfo->sTooltip = sTooltipLabel;
        pFunctionListBox->append(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), sUIName, xImage);
    }
}
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index b464ff5..e52ed44 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -278,6 +278,7 @@ CuiConfigFunctionListBox::CuiConfigFunctionListBox(std::unique_ptr<weld::TreeVie
{
    m_xTreeView->make_sorted();
    m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 35, m_xTreeView->get_height_rows(9));
    m_xTreeView->connect_query_tooltip(LINK(this, CuiConfigFunctionListBox, QueryTooltip));
}

CuiConfigFunctionListBox::~CuiConfigFunctionListBox()
@@ -285,6 +286,17 @@ CuiConfigFunctionListBox::~CuiConfigFunctionListBox()
    ClearAll();
}

IMPL_LINK(CuiConfigFunctionListBox, QueryTooltip, const weld::TreeIter&, rIter, OUString)
{
    SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(rIter).toInt64());
    if (!pData)
        return OUString();
    OUString aLabel = CuiResId(RID_SVXSTR_COMMANDLABEL) + ": ";
    OUString aName = CuiResId(RID_SVXSTR_COMMANDNAME) + ": ";
    OUString aTip = CuiResId(RID_SVXSTR_COMMANDTIP) + ": ";
    return  aLabel + pData->sLabel + "\n" + aName + pData->sCommand+ "\n" + aTip + pData->sTooltip;
}

void CuiConfigFunctionListBox::ClearAll()
/*  Description
    Deletes all entries in the FunctionListBox, all UserData and all
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index e930c24..bfce0d6 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -92,6 +92,7 @@ struct SfxGroupInfo_Impl
    OUString    sCommand;
    OUString    sLabel;
    OUString    sHelpText;
    OUString    sTooltip;

                SfxGroupInfo_Impl( SfxCfgKind n, sal_uInt16 nr, void* pObj = nullptr ) :
                    nKind( n ), nUniqueID( nr ), pObject( pObj ) {}
@@ -175,6 +176,8 @@ public:
    OUString      GetHelpText( bool bConsiderParent = true );
    OUString      GetCurCommand() const;
    OUString      GetCurLabel() const;

    DECL_LINK(QueryTooltip, const weld::TreeIter& rIter, OUString);
};

struct SvxConfigGroupBoxResource_Impl;
diff --git a/cui/uiconfig/ui/menuassignpage.ui b/cui/uiconfig/ui/menuassignpage.ui
index 7f37aad..44d0693 100644
--- a/cui/uiconfig/ui/menuassignpage.ui
+++ b/cui/uiconfig/ui/menuassignpage.ui
@@ -322,6 +322,7 @@
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <property name="has_tooltip">True</property>
                <property name="hexpand">True</property>
                <property name="vexpand">True</property>
                <property name="model">liststore1</property>