summaryrefslogtreecommitdiff
path: root/formula
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-02-04 09:13:52 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-02-04 15:02:03 +0100
commite00032ba6a2ddd4c08ae6f03b1982d3c099d288e (patch)
tree33f52e795971fd330922e21857b12c6097727ca8 /formula
parent8d3f658aa58ddee8c7bc32ddea070c1bb3bf19b8 (diff)
add toId/fromId to tidy up some ugly casting
Change-Id: I70f34ac5e9b5d2f2d6c0375e823908eaa2e540b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129487 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'formula')
-rw-r--r--formula/source/ui/dlg/funcpage.cxx14
-rw-r--r--formula/source/ui/dlg/structpg.cxx6
2 files changed, 10 insertions, 10 deletions
diff --git a/formula/source/ui/dlg/funcpage.cxx b/formula/source/ui/dlg/funcpage.cxx
index f591c73a21e6..553517ce778a 100644
--- a/formula/source/ui/dlg/funcpage.cxx
+++ b/formula/source/ui/dlg/funcpage.cxx
@@ -54,7 +54,7 @@ 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());
}
@@ -83,7 +83,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());
}
}
@@ -100,7 +100,7 @@ void FuncPage::UpdateFunctionList(const OUString& aStr)
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 +123,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());
}
}
@@ -163,7 +163,7 @@ void FuncPage::UpdateFunctionList(const OUString& aStr)
{
if (!pDesc->isHidden())
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pDesc)));
+ OUString sId(weld::toId(pDesc));
m_xLbFunction->append(sId, pDesc->getFunctionName());
}
}
@@ -221,7 +221,7 @@ void FuncPage::SetCategory(sal_Int32 nCat)
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 +249,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
diff --git a/formula/source/ui/dlg/structpg.cxx b/formula/source/ui/dlg/structpg.cxx
index 69a912206384..6cfc34a96ca1 100644
--- a/formula/source/ui/dlg/structpg.cxx
+++ b/formula/source/ui/dlg/structpg.cxx
@@ -64,7 +64,7 @@ bool StructPage::InsertEntry(const OUString& rText, const weld::TreeIter* pParen
{
SetActiveFlag(false);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pIFormulaToken)));
+ OUString sId(weld::toId(pIFormulaToken));
bool bEntry = false;
switch (nFlag)
@@ -107,7 +107,7 @@ const FormulaToken* StructPage::GetFunctionEntry(const weld::TreeIter* pEntry)
if (!pEntry)
return nullptr;
- const FormulaToken * pToken = reinterpret_cast<const FormulaToken *>(m_xTlbStruct->get_id(*pEntry).toInt64());
+ const FormulaToken * pToken = weld::fromId<const FormulaToken*>(m_xTlbStruct->get_id(*pEntry));
if (pToken)
{
if ( !(pToken->IsFunction() || pToken->GetParamCount() > 1 ) )
@@ -135,7 +135,7 @@ IMPL_LINK(StructPage, SelectHdl, weld::TreeView&, rTlb, void)
std::unique_ptr<weld::TreeIter> xCurEntry(m_xTlbStruct->make_iterator());
if (m_xTlbStruct->get_cursor(xCurEntry.get()))
{
- pSelectedToken = reinterpret_cast<const FormulaToken *>(m_xTlbStruct->get_id(*xCurEntry).toInt64());
+ pSelectedToken = weld::fromId<const FormulaToken*>(m_xTlbStruct->get_id(*xCurEntry));
if (pSelectedToken)
{
if ( !(pSelectedToken->IsFunction() || pSelectedToken->GetParamCount() > 1) )