summaryrefslogtreecommitdiffstats
path: root/formula/source/ui/dlg/funcpage.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'formula/source/ui/dlg/funcpage.cxx')
-rw-r--r--formula/source/ui/dlg/funcpage.cxx30
1 files changed, 20 insertions, 10 deletions
diff --git a/formula/source/ui/dlg/funcpage.cxx b/formula/source/ui/dlg/funcpage.cxx
index f591c73a21e6..dbdb49464ae7 100644
--- a/formula/source/ui/dlg/funcpage.cxx
+++ b/formula/source/ui/dlg/funcpage.cxx
@@ -37,6 +37,9 @@ IMPL_LINK(FuncPage, KeyInputHdl, const KeyEvent&, rKEvt, bool)
return false;
}
+// tdf#104487 - remember last used function category - set default to All category
+sal_Int32 FuncPage::m_nRememberedFunctionCategory = 1;
+
FuncPage::FuncPage(weld::Container* pParent, const IFunctionManager* _pFunctionManager)
: m_xBuilder(Application::CreateBuilder(pParent, "formula/ui/functionpage.ui"))
, m_xContainer(m_xBuilder->weld_container("FunctionPage"))
@@ -54,11 +57,12 @@ FuncPage::FuncPage(weld::Container* pParent, const IFunctionManager* _pFunctionM
for (sal_uInt32 j = 0; j < nCategoryCount; ++j)
{
const IFunctionCategory* pCategory = m_pFunctionManager->getCategory(j);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pCategory)));
+ OUString sId(weld::toId(pCategory));
m_xLbCategory->append(sId, pCategory->getName());
}
- m_xLbCategory->set_active(1);
+ // tdf#104487 - remember last used function category
+ m_xLbCategory->set_active(m_nRememberedFunctionCategory);
OUString searchStr = m_xLbFunctionSearchString->get_text();
UpdateFunctionList(searchStr);
// lock to its initial size
@@ -83,7 +87,7 @@ void FuncPage::impl_addFunctions(const IFunctionCategory* _pCategory)
TFunctionDesc pDesc(_pCategory->getFunction(i));
if (!pDesc->isHidden())
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pDesc)));
+ OUString sId(weld::toId(pDesc));
m_xLbFunction->append(sId, pDesc->getFunctionName());
}
}
@@ -96,11 +100,13 @@ void FuncPage::UpdateFunctionList(const OUString& aStr)
m_xLbFunction->freeze();
const sal_Int32 nSelPos = m_xLbCategory->get_active();
+ // tdf#104487 - remember last used function category
+ m_nRememberedFunctionCategory = nSelPos;
if (aStr.isEmpty() || nSelPos == 0)
{
const IFunctionCategory* pCategory
- = reinterpret_cast<const IFunctionCategory*>(m_xLbCategory->get_id(nSelPos).toInt64());
+ = weld::fromId<const IFunctionCategory*>(m_xLbCategory->get_id(nSelPos));
if (nSelPos > 0)
{
@@ -123,7 +129,7 @@ void FuncPage::UpdateFunctionList(const OUString& aStr)
{
if (elem) // may be null if a function is no longer available
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(elem)));
+ OUString sId(weld::toId(elem));
m_xLbFunction->append(sId, elem->getFunctionName());
}
}
@@ -159,11 +165,13 @@ void FuncPage::UpdateFunctionList(const OUString& aStr)
for (sal_uInt32 j = 0; j < nFunctionCount; ++j)
{
TFunctionDesc pDesc(pCategory->getFunction(j));
- if (rCharClass.uppercase(pDesc->getFunctionName()).indexOf(aSearchStr) >= 0)
+ // tdf#146781 - search for the desired function also in the description
+ if (rCharClass.uppercase(pDesc->getFunctionName()).indexOf(aSearchStr) >= 0
+ || rCharClass.uppercase(pDesc->getDescription()).indexOf(aSearchStr) >= 0)
{
if (!pDesc->isHidden())
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pDesc)));
+ OUString sId(weld::toId(pDesc));
m_xLbFunction->append(sId, pDesc->getFunctionName());
}
}
@@ -192,7 +200,7 @@ IMPL_LINK_NOARG(FuncPage, SelTreeViewHdl, weld::TreeView&, void)
const IFunctionDescription* pDesc = GetFuncDesc(GetFunction());
if (pDesc)
{
- const OString sHelpId = pDesc->getHelpId();
+ const OUString sHelpId = pDesc->getHelpId();
if (!sHelpId.isEmpty())
m_xLbFunction->set_help_id(sHelpId);
}
@@ -215,13 +223,15 @@ IMPL_LINK_NOARG(FuncPage, ModifyHdl, weld::Entry&, void)
void FuncPage::SetCategory(sal_Int32 nCat)
{
+ // tdf#104487 - remember last used function category
+ m_nRememberedFunctionCategory = nCat;
m_xLbCategory->set_active(nCat);
UpdateFunctionList(OUString());
}
sal_Int32 FuncPage::GetFuncPos(const IFunctionDescription* _pDesc)
{
- return m_xLbFunction->find_id(OUString::number(reinterpret_cast<sal_Int64>(_pDesc)));
+ return m_xLbFunction->find_id(weld::toId(_pDesc));
}
void FuncPage::SetFunction(sal_Int32 nFunc)
@@ -249,7 +259,7 @@ const IFunctionDescription* FuncPage::GetFuncDesc(sal_Int32 nPos) const
if (nPos == -1)
return nullptr;
// not pretty, but hopefully rare
- return reinterpret_cast<const IFunctionDescription*>(m_xLbFunction->get_id(nPos).toInt64());
+ return weld::fromId<const IFunctionDescription*>(m_xLbFunction->get_id(nPos));
}
} // formula