diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-02-04 09:13:52 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-02-04 15:02:03 +0100 |
commit | e00032ba6a2ddd4c08ae6f03b1982d3c099d288e (patch) | |
tree | 33f52e795971fd330922e21857b12c6097727ca8 /sc/source/ui | |
parent | 8d3f658aa58ddee8c7bc32ddea070c1bb3bf19b8 (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 'sc/source/ui')
-rw-r--r-- | sc/source/ui/cctrl/checklistmenu.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/dbgui/PivotLayoutTreeList.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/dbgui/PivotLayoutTreeListData.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/formdlg/dwfunctr.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/acredlin.cxx | 46 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/conflictsdlg.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/mvtabdlg.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/solveroptions.cxx | 8 |
10 files changed, 54 insertions, 55 deletions
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 290a6468d1d2..a941076cfef7 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -1612,7 +1612,7 @@ void ScListSubMenuControl::addItem(ScCheckListMenuControl::Action* pAction) void ScListSubMenuControl::addMenuItem(const OUString& rText, ScCheckListMenuControl::Action* pAction) { addItem(pAction); - mxMenu->append(OUString::number(reinterpret_cast<sal_Int64>(pAction)), rText); + mxMenu->append(weld::toId(pAction), rText); } void ScListSubMenuControl::addMenuColorItem(const OUString& rText, bool bActive, VirtualDevice& rImage, @@ -1623,7 +1623,7 @@ void ScListSubMenuControl::addMenuColorItem(const OUString& rText, bool bActive, weld::TreeView& rColorMenu = nMenu == 0 ? *mxBackColorMenu : *mxTextColorMenu; rColorMenu.show(); - OUString sId = OUString::number(reinterpret_cast<sal_Int64>(pAction)); + OUString sId = weld::toId(pAction); rColorMenu.insert(nullptr, -1, &rText, &sId, nullptr, nullptr, false, mxScratchIter.get()); rColorMenu.set_toggle(*mxScratchIter, bActive ? TRISTATE_TRUE : TRISTATE_FALSE); rColorMenu.set_image(*mxScratchIter, rImage); @@ -1731,7 +1731,7 @@ IMPL_LINK(ScListSubMenuControl, ColorSelChangedHdl, weld::TreeView&, rMenu, void IMPL_LINK(ScListSubMenuControl, RowActivatedHdl, weld::TreeView&, rMenu, bool) { - executeMenuItem(reinterpret_cast<ScCheckListMenuControl::Action*>(rMenu.get_selected_id().toInt64())); + executeMenuItem(weld::fromId<ScCheckListMenuControl::Action*>(rMenu.get_selected_id())); return true; } diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx index 083dd509438d..c173d7ca7d8f 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx @@ -44,8 +44,7 @@ IMPL_LINK_NOARG(ScPivotLayoutTreeList, DoubleClickHdl, weld::TreeView&, bool) if (nEntry == -1) return true; - ScItemValue* pCurrentItemValue - = reinterpret_cast<ScItemValue*>(mxControl->get_id(nEntry).toInt64()); + ScItemValue* pCurrentItemValue = weld::fromId<ScItemValue*>(mxControl->get_id(nEntry)); ScPivotFuncData& rCurrentFunctionData = pCurrentItemValue->maFunctionData; SCCOL nCurrentColumn = rCurrentFunctionData.mnCol; @@ -86,14 +85,14 @@ void ScPivotLayoutTreeList::FillFields(ScPivotFieldVector& rFieldVector) OUString aLabel = mpParent->GetItem(rField.nCol)->maName; ScItemValue* pItemValue = new ScItemValue(aLabel, rField.nCol, rField.nFuncMask); maItemValues.push_back(std::unique_ptr<ScItemValue>(pItemValue)); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue))); + OUString sId(weld::toId(pItemValue)); mxControl->append(sId, pItemValue->maName); } } void ScPivotLayoutTreeList::InsertEntryForSourceTarget(weld::TreeView& rSource, int nTarget) { - ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(rSource.get_selected_id().toInt64()); + ScItemValue* pItemValue = weld::fromId<ScItemValue*>(rSource.get_selected_id()); ScItemValue* pOriginalItemValue = pItemValue->mpOriginalItemValue; // Don't allow to add "Data" element to page fields @@ -110,7 +109,7 @@ void ScPivotLayoutTreeList::InsertEntryForItem(const ScItemValue* pItemValue, in ScItemValue* pListItemValue = new ScItemValue(pItemValue); maItemValues.push_back(std::unique_ptr<ScItemValue>(pListItemValue)); OUString sName = pListItemValue->maName; - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pListItemValue))); + OUString sId(weld::toId(pListItemValue)); mxControl->insert(nullptr, nPosition, &sName, &sId, nullptr, nullptr, false, nullptr); } diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx index 6cc8efc6d5be..45af29a4f1a4 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx @@ -69,7 +69,7 @@ void ScPivotLayoutTreeListBase::PushEntriesToPivotFieldVector(ScPivotFieldVector return; do { - ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(*xEachEntry).toInt64()); + ScItemValue* pItemValue = weld::fromId<ScItemValue*>(mxControl->get_id(*xEachEntry)); ScPivotFuncData& rFunctionData = pItemValue->maFunctionData; ScPivotField aField; @@ -88,7 +88,7 @@ void ScPivotLayoutTreeListBase::InsertEntryForSourceTarget(weld::TreeView& /*pSo void ScPivotLayoutTreeListBase::RemoveEntryForItem(const ScItemValue* pItemValue) { - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue))); + OUString sId(weld::toId(pItemValue)); int nPos = mxControl->find_id(sId); if (nPos == -1) return; diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx index a894a03d14c4..19992fc31831 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx @@ -84,7 +84,7 @@ IMPL_LINK_NOARG(ScPivotLayoutTreeListData, DoubleClickHdl, weld::TreeView&, bool if (nEntry == -1) return true; - ScItemValue* pCurrentItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(nEntry).toInt64()); + ScItemValue* pCurrentItemValue = weld::fromId<ScItemValue*>(mxControl->get_id(nEntry)); ScPivotFuncData& rCurrentFunctionData = pCurrentItemValue->maFunctionData; SCCOL nCurrentColumn = rCurrentFunctionData.mnCol; @@ -151,7 +151,7 @@ void ScPivotLayoutTreeListData::FillDataField(ScPivotFieldVector& rDataFields) pItemValue->maFunctionData.mnDupCount); maDataItemValues.push_back(std::unique_ptr<ScItemValue>(pItemValue)); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue))); + OUString sId(weld::toId(pItemValue)); mxControl->append(sId, sDataItemName); } } @@ -164,7 +164,7 @@ void ScPivotLayoutTreeListData::PushDataFieldNames(std::vector<ScDPName>& rDataF do { - ScItemValue* pEachItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(*xLoopEntry).toInt64()); + ScItemValue* pEachItemValue = weld::fromId<ScItemValue*>(mxControl->get_id(*xLoopEntry)); SCCOL nColumn = pEachItemValue->maFunctionData.mnCol; ScDPLabelData& rLabelData = mpParent->GetLabelData(nColumn); @@ -190,7 +190,7 @@ void ScPivotLayoutTreeListData::InsertEntryForSourceTarget(weld::TreeView& rSour if (rSource.count_selected_rows() <=0) return; - ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(rSource.get_selected_id().toInt64()); + ScItemValue* pItemValue = weld::fromId<ScItemValue*>(rSource.get_selected_id()); if (mpParent->IsDataElement(pItemValue->maFunctionData.mnCol)) return; @@ -198,7 +198,7 @@ void ScPivotLayoutTreeListData::InsertEntryForSourceTarget(weld::TreeView& rSour if (&rSource == mxControl.get()) { OUString sText = mxControl->get_selected_text(); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue))); + OUString sId(weld::toId(pItemValue)); mxControl->remove_id(sId); mxControl->insert(nullptr, nTarget, &sText, &sId, nullptr, nullptr, false, nullptr); } @@ -229,7 +229,7 @@ void ScPivotLayoutTreeListData::InsertEntryForItem(ScItemValue* pItemValue, int pDataItemValue->maName, rFunctionData.mnDupCount); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pDataItemValue))); + OUString sId(weld::toId(pDataItemValue)); mxControl->insert(nullptr, nPosition, &sDataName, &sId, nullptr, nullptr, false, nullptr); } @@ -247,7 +247,7 @@ void ScPivotLayoutTreeListData::AdjustDuplicateCount(ScItemValue* pInputItemValu return; do { - ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(*xEachEntry).toInt64()); + ScItemValue* pItemValue = weld::fromId<ScItemValue*>(mxControl->get_id(*xEachEntry)); if (pItemValue == pInputItemValue) continue; diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx index 053d766deb76..e4a2276dacee 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx @@ -42,7 +42,7 @@ void ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector& rLabelVect if (pLabelData->mnOriginalDim < 0 && !pLabelData->mbDataLayout) { - mxControl->append(OUString::number(reinterpret_cast<sal_Int64>(pValue)), pLabelData->maName); + mxControl->append(weld::toId(pValue), pLabelData->maName); } } } diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index d42e99371fb3..424c0ee99ca8 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -164,7 +164,7 @@ void ScFunctionWin::SetDescription() { xFiFuncDesc->set_label(OUString()); const ScFuncDesc* pDesc = - reinterpret_cast<const ScFuncDesc*>(xFuncList->get_selected_id().toInt64()); + weld::fromId<const ScFuncDesc*>(xFuncList->get_selected_id()); if (pDesc) { pDesc->initArgumentInfo(); // full argument info is needed @@ -209,7 +209,7 @@ void ScFunctionWin::UpdateFunctionList() const ScFuncDesc* pDesc = pFuncMgr->First( nCategory ); while ( pDesc ) { - xFuncList->append(OUString::number(reinterpret_cast<sal_Int64>(pDesc)), *(pDesc->mxFuncName)); + xFuncList->append(weld::toId(pDesc), *(pDesc->mxFuncName)); pDesc = pFuncMgr->Next(); } } @@ -219,7 +219,7 @@ void ScFunctionWin::UpdateFunctionList() { if (pDesc) { - xFuncList->append(OUString::number(reinterpret_cast<sal_Int64>(pDesc)), pDesc->getFunctionName()); + xFuncList->append(weld::toId(pDesc), pDesc->getFunctionName()); } } } @@ -277,7 +277,7 @@ void ScFunctionWin::DoEnter() pHdl->ClearText(); } const ScFuncDesc* pDesc = - reinterpret_cast<const ScFuncDesc*>(xFuncList->get_selected_id().toInt64()); + weld::fromId<const ScFuncDesc*>(xFuncList->get_selected_id()); if (pDesc) { pFuncDesc=pDesc; diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index cec8465ae93e..c3c0179c28d7 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -279,7 +279,7 @@ void ScAcceptChgDlg::ClearView() rTreeView.all_foreach( [&rTreeView](weld::TreeIter& rEntry) { - ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64()); + ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry)); delete pEntryData; return false; }); @@ -480,7 +480,7 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendChangeAction( weld::TreeView& rTreeView = pTheView->GetWidget(); std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator()); OUString sString(aBuf.makeStringAndClear()); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewData.release()))); + OUString sId(weld::toId(pNewData.release())); rTreeView.insert(pParent, -1, &sString, &sId, nullptr, nullptr, bCreateOnDemand, xEntry.get()); if (!bFlag && bUseColor && !pParent) { @@ -598,7 +598,7 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendFilteredAction( { weld::TreeView& rTreeView = pTheView->GetWidget(); xEntry = rTreeView.make_iterator(); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewData.release()))); + OUString sId(weld::toId(pNewData.release())); rTreeView.insert(pParent, -1, &aActionString, &sId, nullptr, nullptr, bCreateOnDemand, xEntry.get()); OUString aRefStr = pScChangeAction->GetRefString(*pDoc, true); @@ -724,7 +724,7 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::InsertChangeActionContent(const weld::TreeView& rTreeView = pTheView->GetWidget(); std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator()); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewData.release()))); + OUString sId(weld::toId(pNewData.release())); rTreeView.insert(&rParent, -1, &aString, &sId, nullptr, nullptr, false, xEntry.get()); if (pTheView->IsValidComment(aComment) && bFlag) bHasFilterEntry=true; @@ -883,7 +883,7 @@ IMPL_LINK( ScAcceptChgDlg, RejectHandle, SvxTPView*, pRef, void ) { weld::TreeView& rTreeView = pTheView->GetWidget(); rTreeView.selected_foreach([this, pChanges, &rTreeView](weld::TreeIter& rEntry){ - ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64()); + ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry)); if (pEntryData) { ScChangeAction* pScChangeAction= static_cast<ScChangeAction*>(pEntryData->pData); @@ -916,7 +916,7 @@ IMPL_LINK( ScAcceptChgDlg, AcceptHandle, SvxTPView*, pRef, void ) { weld::TreeView& rTreeView = pTheView->GetWidget(); rTreeView.selected_foreach([pChanges, &rTreeView](weld::TreeIter& rEntry) { - ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64()); + ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry)); if (pEntryData) { ScChangeAction* pScChangeAction= @@ -1053,7 +1053,7 @@ void ScAcceptChgDlg::GetDependents(const ScChangeAction* pScChangeAction, std::unique_ptr<weld::TreeIter> xParent(rTreeView.make_iterator(&rEntry)); if (rTreeView.iter_parent(*xParent)) { - ScRedlinData *pParentData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xParent).toInt64()); + ScRedlinData *pParentData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xParent)); ScChangeAction* pParentAction=static_cast<ScChangeAction*>(pParentData->pData); if(pParentAction!=pScChangeAction) @@ -1072,7 +1072,7 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap, const { bool bTheTestFlag = true; weld::TreeView& rTreeView = pTheView->GetWidget(); - ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rParent).toInt64()); + ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rParent)); const ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData); bool bParentInserted = false; // If the parent is a MatrixOrigin then place it in the right order before @@ -1101,7 +1101,7 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap, const if (xOriginal) { bTheTestFlag=false; - ScRedlinData *pParentData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xOriginal).toInt64()); + ScRedlinData *pParentData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xOriginal)); pParentData->pData=const_cast<ScChangeAction *>(pScChangeAction); pParentData->nActionNo=pScChangeAction->GetActionNumber(); pParentData->bIsAcceptable=pScChangeAction->IsRejectable(); // select old value @@ -1131,7 +1131,7 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap, const if (xEntry) { bTheTestFlag=false; - ScRedlinData *pParentData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64()); + ScRedlinData *pParentData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry)); pParentData->pData=const_cast<ScChangeAction *>(pScChangeAction); pParentData->nActionNo=pScChangeAction->GetActionNumber(); pParentData->bIsAcceptable=pScChangeAction->IsClickable(); @@ -1186,7 +1186,7 @@ bool ScAcceptChgDlg::InsertChildren(ScChangeActionMap* pActionMap, const weld::T bTheTestFlag=false; weld::TreeView& rTreeView = pTheView->GetWidget(); - ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64()); + ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry)); pEntryData->bIsRejectable=false; pEntryData->bIsAcceptable=false; pEntryData->bDisabled=true; @@ -1216,7 +1216,7 @@ bool ScAcceptChgDlg::InsertDeletedChildren(const ScChangeAction* pScChangeAction if (xEntry) { weld::TreeView& rTreeView = pTheView->GetWidget(); - ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64()); + ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry)); pEntryData->bIsRejectable=false; pEntryData->bIsAcceptable=false; pEntryData->bDisabled=true; @@ -1277,7 +1277,7 @@ IMPL_LINK(ScAcceptChgDlg, ExpandingHandle, const weld::TreeIter&, rEntry, bool) m_xDialog->set_busy_cursor(true); ScChangeActionMap aActionMap; weld::TreeView& rTreeView = pTheView->GetWidget(); - ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64()); + ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry)); if (!rTreeView.iter_has_child(rEntry)) { bool bTheTestFlag = true; @@ -1407,7 +1407,7 @@ void ScAcceptChgDlg::RemoveEntries(sal_uLong nStartAction,sal_uLong nEndAction) ScRedlinData *pEntryData=nullptr; std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator()); if (rTreeView.get_cursor(xEntry.get())) - pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64()); + pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry)); if (!rTreeView.get_iter_first(*xEntry)) return; @@ -1424,7 +1424,7 @@ void ScAcceptChgDlg::RemoveEntries(sal_uLong nStartAction,sal_uLong nEndAction) do { OUString sId(rTreeView.get_id(*xEntry)); - pEntryData = reinterpret_cast<ScRedlinData *>(sId.toInt64()); + pEntryData = weld::fromId<ScRedlinData*>(sId); if (pEntryData) { nAction = pEntryData->nActionNo; @@ -1461,7 +1461,7 @@ void ScAcceptChgDlg::UpdateEntries(const ScChangeTrack* pChgTrack, sal_uLong nSt while (bEntry) { bool bRemove = false; - ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64()); + ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry)); if (pEntryData) { ScChangeAction* pScChangeAction= @@ -1565,7 +1565,7 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, UpdateSelectionHdl, Timer *, void) weld::TreeView& rTreeView = pTheView->GetWidget(); std::vector<const ScChangeAction*> aActions; rTreeView.selected_foreach([&rTreeView, &bAcceptFlag, &bRejectFlag, &aActions](weld::TreeIter& rEntry){ - ScRedlinData* pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64()); + ScRedlinData* pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry)); if (pEntryData) { bRejectFlag &= pEntryData->bIsRejectable; @@ -1623,7 +1623,7 @@ IMPL_LINK(ScAcceptChgDlg, CommandHdl, const CommandEvent&, rCEvt, bool) if (pDoc->IsDocEditable() && bEntry) { - ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64()); + ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry)); if (pEntryData) { ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData); @@ -1640,7 +1640,7 @@ IMPL_LINK(ScAcceptChgDlg, CommandHdl, const CommandEvent&, rCEvt, bool) { if (bEntry) { - ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64()); + ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry)); if (pEntryData) { ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData); @@ -1764,8 +1764,8 @@ int ScAcceptChgDlg::ColCompareHdl(const weld::TreeIter& rLeft, const weld::TreeI if (CALC_DATE == nSortCol) { - RedlinData *pLeftData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rLeft).toInt64()); - RedlinData *pRightData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rRight).toInt64()); + RedlinData *pLeftData = weld::fromId<RedlinData*>(rTreeView.get_id(rLeft)); + RedlinData *pRightData = weld::fromId<RedlinData*>(rTreeView.get_id(rRight)); if (pLeftData && pRightData) { if(pLeftData->aDateTime < pRightData->aDateTime) @@ -1777,8 +1777,8 @@ int ScAcceptChgDlg::ColCompareHdl(const weld::TreeIter& rLeft, const weld::TreeI } else if (CALC_POS == nSortCol) { - ScRedlinData *pLeftData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rLeft).toInt64()); - ScRedlinData *pRightData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rRight).toInt64()); + ScRedlinData *pLeftData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rLeft)); + ScRedlinData *pRightData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rRight)); if (pLeftData && pRightData) { nCompare = 1; diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx index 6e97d262c82b..1559f5419899 100644 --- a/sc/source/ui/miscdlgs/conflictsdlg.cxx +++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx @@ -481,7 +481,7 @@ IMPL_LINK_NOARG(ScConflictsDlg, UpdateSelectionHdl, Timer *, void) rTreeView.selected_foreach([&rTreeView, &aActions](weld::TreeIter& rEntry){ if (rTreeView.get_iter_depth(rEntry)) { - RedlinData* pUserData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rEntry).toInt64()); + RedlinData* pUserData = weld::fromId<RedlinData*>(rTreeView.get_id(rEntry)); if (pUserData) { ScChangeAction* pAction = static_cast< ScChangeAction* >( pUserData->pData ); @@ -511,7 +511,7 @@ IMPL_LINK_NOARG(ScConflictsDlg, UpdateSelectionHdl, Timer *, void) void ScConflictsDlg::SetConflictAction(const weld::TreeIter& rRootEntry, ScConflictAction eConflictAction) { weld::TreeView& rTreeView = m_xLbConflicts->GetWidget(); - RedlinData* pUserData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rRootEntry).toInt64()); + RedlinData* pUserData = weld::fromId<RedlinData*>(rTreeView.get_id(rRootEntry)); ScConflictsListEntry* pConflictEntry = static_cast< ScConflictsListEntry* >( pUserData ? pUserData->pData : nullptr ); if ( pConflictEntry ) { @@ -595,7 +595,7 @@ void ScConflictsDlg::UpdateView() std::unique_ptr<RedlinData> pRootUserData(new RedlinData()); pRootUserData->pData = static_cast<void*>(&rConflictEntry); OUString sString(GetConflictString(rConflictEntry)); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pRootUserData.release()))); + OUString sId(weld::toId(pRootUserData.release())); std::unique_ptr<weld::TreeIter> xRootEntry(rTreeView.make_iterator()); std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator()); rTreeView.insert(nullptr, -1, &sString, &sId, nullptr, nullptr, false, xRootEntry.get()); @@ -637,7 +637,7 @@ void ScConflictsDlg::UpdateView() std::unique_ptr<RedlinData> pUserData(new RedlinData()); pUserData->pData = static_cast< void* >( pAction ); - OUString aId(OUString::number(reinterpret_cast<sal_Int64>(pUserData.release()))); + OUString aId(weld::toId(pUserData.release())); rTreeView.insert(xRootEntry.get(), -1, nullptr, &aId, nullptr, nullptr, false, xEntry.get()); SetActionString(pAction, mpOwnDoc, *xEntry); } diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx index b753b678b631..6ec7712f87ea 100644 --- a/sc/source/ui/miscdlgs/mvtabdlg.cxx +++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx @@ -177,7 +177,7 @@ void ScMoveTableDlg::CheckNewTabName() ScDocument* ScMoveTableDlg::GetSelectedDoc() { - return reinterpret_cast<ScDocument*>(m_xLbDoc->get_active_id().toUInt64()); + return weld::fromId<ScDocument*>(m_xLbDoc->get_active_id()); } void ScMoveTableDlg::Init() @@ -223,7 +223,7 @@ void ScMoveTableDlg::InitDocListBox() aEntryName += " " + msCurrentDoc; } - OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(&pScSh->GetDocument()))); + OUString sId(weld::toId(&pScSh->GetDocument())); m_xLbDoc->insert(i, aEntryName, &sId, nullptr, nullptr); i++; diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index 35d5f956797e..41603b6d517e 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -129,7 +129,7 @@ const uno::Sequence<beans::PropertyValue>& ScSolverOptionsDialog::GetProperties( for (sal_Int32 nEntryPos=0; nEntryPos<nEntryCount; ++nEntryPos) { uno::Any& rValue = maPropertiesRange[nEntryPos].Value; - if (ScSolverOptionsString* pStringItem = reinterpret_cast<ScSolverOptionsString*>(m_xLbSettings->get_id(nEntryPos).toInt64())) + if (ScSolverOptionsString* pStringItem = weld::fromId<ScSolverOptionsString*>(m_xLbSettings->get_id(nEntryPos))) { if (pStringItem->IsDouble()) rValue <<= pStringItem->GetDoubleValue(); @@ -224,7 +224,7 @@ void ScSolverOptionsDialog::FillListBox() m_xLbSettings->set_text(nPos, sTxt, 0); } - m_xLbSettings->set_id(nPos, OUString::number(reinterpret_cast<sal_Int64>(m_aOptions.back().get()))); + m_xLbSettings->set_id(nPos, weld::toId(m_aOptions.back().get())); } } @@ -241,7 +241,7 @@ void ScSolverOptionsDialog::EditOption() int nEntry = m_xLbSettings->get_selected_index(); if (nEntry == -1) return; - ScSolverOptionsString* pStringItem = reinterpret_cast<ScSolverOptionsString*>(m_xLbSettings->get_id(nEntry).toInt64()); + ScSolverOptionsString* pStringItem = weld::fromId<ScSolverOptionsString*>(m_xLbSettings->get_id(nEntry)); if (!pStringItem) return; @@ -331,7 +331,7 @@ IMPL_LINK_NOARG(ScSolverOptionsDialog, SettingsSelHdl, weld::TreeView&, void) int nEntry = m_xLbSettings->get_selected_index(); if (nEntry != -1) { - ScSolverOptionsString* pStringItem = reinterpret_cast<ScSolverOptionsString*>(m_xLbSettings->get_id(nEntry).toInt64()); + ScSolverOptionsString* pStringItem = weld::fromId<ScSolverOptionsString*>(m_xLbSettings->get_id(nEntry)); if (!pStringItem) bCheckbox = true; } |