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>
This commit is contained in:
Jim Raykowski
2019-12-05 02:55:57 -09:00
committed by Heiko Tietze
parent f2f5d74067
commit fdb5ce011c
5 changed files with 21 additions and 0 deletions

View File

@@ -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: */

View File

@@ -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);
}
}

View File

@@ -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

View File

@@ -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;

View File

@@ -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>