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 /svx | |
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 'svx')
-rw-r--r-- | svx/source/form/datanavi.cxx | 30 | ||||
-rw-r--r-- | svx/source/form/navigatortree.cxx | 52 | ||||
-rw-r--r-- | svx/source/form/tabwin.cxx | 6 | ||||
-rw-r--r-- | svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx | 6 |
4 files changed, 47 insertions, 47 deletions
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index ea553e28810e..e72b0e035c78 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -179,7 +179,7 @@ namespace svxform void XFormsPage::DeleteAndClearTree() { m_xItemList->all_foreach([this](weld::TreeIter& rEntry) { - delete reinterpret_cast<ItemNode*>(m_xItemList->get_id(rEntry).toInt64()); + delete weld::fromId<ItemNode*>(m_xItemList->get_id(rEntry)); return false; }); m_xItemList->clear(); @@ -272,7 +272,7 @@ namespace svxform if(!xDataTypes.is()) return; - ItemNode *pItemNode = reinterpret_cast<ItemNode*>(m_xItemList->get_id(*m_xScratchIter).toInt64()); + ItemNode *pItemNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*m_xScratchIter)); if (!pItemNode) { // the only known (and allowed?) case where this happens are sub-entries of a submission @@ -282,7 +282,7 @@ namespace svxform DBG_ASSERT(bSelected && !m_xItemList->get_iter_depth(*m_xScratchIter), "DataTreeListBox::StartDrag: what kind of entry *is* this?"); // on the submission page, we have only top-level entries (the submission themself) // plus direct children of those (facets of a submission) - pItemNode = bSelected ? reinterpret_cast<ItemNode*>(m_xItemList->get_id(*m_xScratchIter).toInt64()) : nullptr; + pItemNode = bSelected ? weld::fromId<ItemNode*>(m_xItemList->get_id(*m_xScratchIter)) : nullptr; if (!pItemNode) return; } @@ -339,7 +339,7 @@ namespace svxform if ( !sName.isEmpty() ) { ItemNode* pNode = new ItemNode( xChild ); - OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(pNode))); + OUString sId(weld::toId(pNode)); std::unique_ptr<weld::TreeIter> xEntry = m_xItemList->make_iterator(); m_xItemList->insert(_pParent, -1, &sName, &sId, nullptr, nullptr, false, xEntry.get()); m_xItemList->set_image(*xEntry, aExpImg); @@ -355,7 +355,7 @@ namespace svxform { Reference< css::xml::dom::XNode > xAttr = xMap->item(j); pNode = new ItemNode( xAttr ); - OUString sSubId(OUString::number(reinterpret_cast<sal_uInt64>(pNode))); + OUString sSubId(weld::toId(pNode)); OUString sAttrName = m_xUIHelper->getNodeDisplayName( xAttr, bShowDetails ); m_xItemList->insert(xEntry.get(), -1, &sAttrName, &sSubId, nullptr, nullptr, false, m_xScratchIter.get()); m_xItemList->set_image(*m_xScratchIter, aExpImg); @@ -427,7 +427,7 @@ namespace svxform } DBG_ASSERT( bEntry, "XFormsPage::DoToolBoxAction(): no entry" ); - ItemNode* pParentNode = reinterpret_cast<ItemNode*>(m_xItemList->get_id(*xEntry).toInt64()); + ItemNode* pParentNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xEntry)); DBG_ASSERT( pParentNode, "XFormsPage::DoToolBoxAction(): no parent node" ); xParentNode = pParentNode->m_xNode; Reference< css::xml::dom::XNode > xNewNode; @@ -573,7 +573,7 @@ namespace svxform { m_xItemList->iter_parent(*xEntry); } - ItemNode* pNode = reinterpret_cast<ItemNode*>(m_xItemList->get_id(*xEntry).toInt64()); + ItemNode* pNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xEntry)); if ( DGTInstance == m_eGroup || DGTBinding == m_eGroup ) { if ( DGTInstance == m_eGroup && !m_sInstanceURL.isEmpty() ) @@ -699,7 +699,7 @@ namespace svxform { DBG_UNHANDLED_EXCEPTION("svx"); } - OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(_pNewNode.release()))); + OUString sId(weld::toId(_pNewNode.release())); m_xItemList->insert(xParent.get(), -1, &sName, &sId, nullptr, nullptr, false, pRet); m_xItemList->set_image(*pRet, aImage); if (xParent && !m_xItemList->get_row_expanded(*xParent) && m_xItemList->iter_has_child(*xParent)) @@ -722,7 +722,7 @@ namespace svxform { // ID _rEntry->getPropertyValue( PN_SUBMISSION_ID ) >>= sTemp; - OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(pNode))); + OUString sId(weld::toId(pNode)); m_xItemList->insert(nullptr, -1, &sTemp, &sId, nullptr, nullptr, false, pRet); m_xItemList->set_image(*pRet, aImage); std::unique_ptr<weld::TreeIter> xRes(m_xItemList->make_iterator()); @@ -769,7 +769,7 @@ namespace svxform _rEntry->getPropertyValue( PN_BINDING_EXPR ) >>= sTemp; sName += sTemp; - OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(pNode))); + OUString sId(weld::toId(pNode)); m_xItemList->insert(nullptr, -1, &sName, &sId, nullptr, nullptr, false, pRet); m_xItemList->set_image(*pRet, aImage); } @@ -863,7 +863,7 @@ namespace svxform { Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY ); DBG_ASSERT( xModel.is(), "XFormsPage::RemoveEntry(): no model" ); - ItemNode* pNode = reinterpret_cast<ItemNode*>(m_xItemList->get_id(*xEntry).toInt64()); + ItemNode* pNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xEntry)); DBG_ASSERT( pNode, "XFormsPage::RemoveEntry(): no node" ); if ( DGTInstance == m_eGroup ) @@ -887,7 +887,7 @@ namespace svxform std::unique_ptr<weld::TreeIter> xParent(m_xItemList->make_iterator(xEntry.get())); bool bParent = m_xItemList->iter_parent(*xParent); (void)bParent; assert(bParent && "XFormsPage::RemoveEntry(): no parent entry"); - ItemNode* pParentNode = reinterpret_cast<ItemNode*>((m_xItemList->get_id(*xParent).toInt64())); + ItemNode* pParentNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xParent)); DBG_ASSERT( pParentNode && pParentNode->m_xNode.is(), "XFormsPage::RemoveEntry(): no parent XNode" ); Reference< css::xml::dom::XNode > xPNode; @@ -1084,7 +1084,7 @@ namespace svxform ItemNode* pNode = new ItemNode( xPropSet ); - OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(pNode))); + OUString sId(weld::toId(pNode)); m_xItemList->insert(nullptr, -1, &sEntry, &sId, nullptr, nullptr, false, xRes.get()); m_xItemList->set_image(*xRes, aImage); } @@ -1178,7 +1178,7 @@ namespace svxform m_xItemList->iter_parent(*xEntry); bSubmitChild = true; } - ItemNode* pNode = reinterpret_cast<ItemNode*>(m_xItemList->get_id(*xEntry).toInt64()); + ItemNode* pNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xEntry)); if ( pNode && ( pNode->m_xNode.is() || pNode->m_xPropSet.is() ) ) { bEnableEdit = true; @@ -1227,7 +1227,7 @@ namespace svxform TranslateId pResId2 = RID_STR_DATANAV_REMOVE_ELEMENT; if (bEntry) { - ItemNode* pNode = reinterpret_cast<ItemNode*>(m_xItemList->get_id(*xEntry).toInt64()); + ItemNode* pNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xEntry)); if ( pNode && pNode->m_xNode.is() ) { try diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index 84a3839af30f..22323f9feb0e 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -241,7 +241,7 @@ namespace svxform // I may add a format to pCtrlExch bool bHasNonHidden = std::any_of(m_arrCurrentSelection.begin(), m_arrCurrentSelection.end(), [this](const auto& rEntry) { - FmEntryData* pCurrent = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*rEntry).toInt64()); + FmEntryData* pCurrent = weld::fromId<FmEntryData*>(m_xTreeView->get_id(*rEntry)); return !IsHiddenControl( pCurrent ); }); @@ -277,7 +277,7 @@ namespace svxform Reference< XInterface >* pArray = seqIFaces.getArray(); for (const auto& rpEntry : m_arrCurrentSelection) { - *pArray = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*rpEntry).toInt64())->GetElement(); + *pArray = weld::fromId<FmEntryData*>(m_xTreeView->get_id(*rpEntry))->GetElement(); ++pArray; } // and the new format @@ -435,7 +435,7 @@ namespace svxform FmXFormShell::GetConversionMenu_Lock(*xConversionMenu); #if OSL_DEBUG_LEVEL > 0 const std::unique_ptr<weld::TreeIter>& rIter = *m_arrCurrentSelection.begin(); - FmControlData* pCurrent = reinterpret_cast<FmControlData*>(m_xTreeView->get_id(*rIter).toInt64()); + FmControlData* pCurrent = weld::fromId<FmControlData*>(m_xTreeView->get_id(*rIter)); OSL_ENSURE( pFormShell->GetImpl()->isSolelySelected_Lock( pCurrent->GetFormComponent() ), "NavigatorTree::Command: inconsistency between the navigator selection, and the selection as the shell knows it!" ); #endif @@ -490,7 +490,7 @@ namespace svxform const std::unique_ptr<weld::TreeIter>& rSelectedForm = *m_arrCurrentSelection.begin(); DBG_ASSERT( IsFormEntry(*rSelectedForm), "NavigatorTree::Command: This entry must be a FormEntry." ); - FmFormData* pFormData = reinterpret_cast<FmFormData*>(m_xTreeView->get_id(*rSelectedForm).toInt64()); + FmFormData* pFormData = weld::fromId<FmFormData*>(m_xTreeView->get_id(*rSelectedForm)); const Reference< XForm >& xForm( pFormData->GetFormIface()); Reference< XTabControllerModel > xTabController(xForm, UNO_QUERY); @@ -520,7 +520,7 @@ namespace svxform else if (FmXFormShell::isControlConversionSlot(sIdent)) { const std::unique_ptr<weld::TreeIter>& rIter = *m_arrCurrentSelection.begin(); - FmControlData* pCurrent = reinterpret_cast<FmControlData*>(m_xTreeView->get_id(*rIter).toInt64()); + FmControlData* pCurrent = weld::fromId<FmControlData*>(m_xTreeView->get_id(*rIter)); if (pFormShell->GetImpl()->executeControlConversionSlot_Lock(pCurrent->GetFormComponent(), sIdent)) ShowSelectionProperties(); } @@ -541,7 +541,7 @@ namespace svxform return xRet; m_xTreeView->all_foreach([this, pEntryData, &xRet](weld::TreeIter& rEntry){ - FmEntryData* pCurEntryData = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(rEntry).toInt64()); + FmEntryData* pCurEntryData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(rEntry)); if (pCurEntryData && pCurEntryData->IsEqualWithoutChildren(pEntryData)) { xRet = m_xTreeView->make_iterator(&rEntry); @@ -613,7 +613,7 @@ namespace svxform // insert current entry std::unique_ptr<weld::TreeIter> xParentEntry = FindEntry( pEntryData->GetParent() ); std::unique_ptr<weld::TreeIter> xNewEntry(m_xTreeView->make_iterator()); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntryData))); + OUString sId(weld::toId(pEntryData)); if(!xParentEntry) { @@ -682,13 +682,13 @@ namespace svxform bool NavigatorTree::IsFormEntry(const weld::TreeIter& rEntry) { - FmEntryData* pEntryData = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(rEntry).toInt64()); + FmEntryData* pEntryData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(rEntry)); return !pEntryData || dynamic_cast<const FmFormData*>( pEntryData) != nullptr; } bool NavigatorTree::IsFormComponentEntry(const weld::TreeIter& rEntry) { - FmEntryData* pEntryData = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(rEntry).toInt64()); + FmEntryData* pEntryData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(rEntry)); return dynamic_cast<const FmControlData*>( pEntryData) != nullptr; } @@ -967,7 +967,7 @@ namespace svxform // some data for the target bool bDropTargetIsForm = IsFormEntry(*_pTargetEntry); - FmFormData* pTargetData = bDropTargetIsForm ? reinterpret_cast<FmFormData*>(m_xTreeView->get_id(*_pTargetEntry).toInt64()) : nullptr; + FmFormData* pTargetData = bDropTargetIsForm ? weld::fromId<FmFormData*>(m_xTreeView->get_id(*_pTargetEntry)) : nullptr; DBG_ASSERT( DND_ACTION_COPY != _nAction, "NavigatorTree::implExecuteDataTransfer: somebody changed the logics!" ); @@ -1013,7 +1013,7 @@ namespace svxform DBG_ASSERT(m_xTreeView->get_iter_depth(*rCurrent) != 0, "NavigatorTree::implExecuteDataTransfer: invalid entry"); // don't drag root - FmEntryData* pCurrentUserData = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*rCurrent).toInt64()); + FmEntryData* pCurrentUserData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(*rCurrent)); Reference< XChild > xCurrentChild = pCurrentUserData->GetChildIFace(); Reference< XIndexContainer > xContainer(xCurrentChild->getParent(), UNO_QUERY); @@ -1270,7 +1270,7 @@ namespace svxform if (!IsFormEntry(rParentEntry)) return; - FmFormData* pParentFormData = reinterpret_cast<FmFormData*>(m_xTreeView->get_id(rParentEntry).toInt64()); + FmFormData* pParentFormData = weld::fromId<FmFormData*>(m_xTreeView->get_id(rParentEntry)); // create new form @@ -1332,7 +1332,7 @@ namespace svxform if (!IsFormEntry(rParentEntry)) return nullptr; - FmFormData* pParentFormData = reinterpret_cast<FmFormData*>(m_xTreeView->get_id(rParentEntry).toInt64()); + FmFormData* pParentFormData = weld::fromId<FmFormData*>(m_xTreeView->get_id(rParentEntry)); Reference<XForm> xParentForm(pParentFormData->GetFormIface()); // create new component @@ -1402,7 +1402,7 @@ namespace svxform const weld::TreeIter& rIter = rIterString.first; - FmEntryData* pEntryData = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(rIter).toInt64()); + FmEntryData* pEntryData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(rIter)); bool bRes = NavigatorTreeModel::Rename(pEntryData, rIterString.second); if (!bRes) { @@ -1490,12 +1490,12 @@ namespace svxform const std::unique_ptr<weld::TreeIter>& rIter = *m_arrCurrentSelection.begin(); if (m_nFormsSelected > 0) { // exactly one form is selected - FmFormData* pFormData = reinterpret_cast<FmFormData*>(m_xTreeView->get_id(*rIter).toInt64()); + FmFormData* pFormData = weld::fromId<FmFormData*>(m_xTreeView->get_id(*rIter)); aSelection.insert( Reference< XInterface >( pFormData->GetFormIface(), UNO_QUERY ) ); } else { // exactly one control is selected (whatever hidden or normal) - FmEntryData* pEntryData = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*rIter).toInt64()); + FmEntryData* pEntryData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(*rIter)); aSelection.insert( Reference< XInterface >( pEntryData->GetElement(), UNO_QUERY ) ); } @@ -1509,7 +1509,7 @@ namespace svxform for ( sal_Int32 i = 0; i < m_nFormsSelected; ++i ) { const std::unique_ptr<weld::TreeIter>& rIter = *it; - FmFormData* pFormData = reinterpret_cast<FmFormData*>(m_xTreeView->get_id(*rIter).toInt64()); + FmFormData* pFormData = weld::fromId<FmFormData*>(m_xTreeView->get_id(*rIter)); aSelection.insert( pFormData->GetPropertySet() ); ++it; } @@ -1522,7 +1522,7 @@ namespace svxform for ( sal_Int32 i = 0; i < m_nHiddenControls; ++i ) { const std::unique_ptr<weld::TreeIter>& rIter = *it; - FmEntryData* pEntryData = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*rIter).toInt64()); + FmEntryData* pEntryData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(*rIter)); aSelection.insert( pEntryData->GetPropertySet() ); ++it; } @@ -1599,7 +1599,7 @@ namespace svxform it != m_arrCurrentSelection.rend(); ) { const std::unique_ptr<weld::TreeIter>& rIter = *it; - FmEntryData* pCurrent = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*rIter).toInt64()); + FmEntryData* pCurrent = weld::fromId<FmEntryData*>(m_xTreeView->get_id(*rIter)); // a form ? auto pFormData = dynamic_cast<FmFormData*>(pCurrent); @@ -1668,7 +1668,7 @@ namespace svxform // remove remaining structure for (const auto& rpSelection : m_arrCurrentSelection) { - FmEntryData* pCurrent = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*rpSelection).toInt64()); + FmEntryData* pCurrent = weld::fromId<FmEntryData*>(m_xTreeView->get_id(*rpSelection)); // if the entry still has children, we skipped deletion of one of those children. // This may for instance be because the shape is in a hidden layer, where we're unable @@ -1711,7 +1711,7 @@ namespace svxform else { ++m_nControlsSelected; - if (IsHiddenControl(reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(rSelectionLoop).toInt64()))) + if (IsHiddenControl(weld::fromId<FmEntryData*>(m_xTreeView->get_id(rSelectionLoop)))) ++m_nHiddenControls; } } @@ -1774,7 +1774,7 @@ namespace svxform { // compare current selection with requested SelectList m_xTreeView->selected_foreach([this, &arredToSelect](weld::TreeIter& rSelection) { - FmEntryData* pCurrent = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(rSelection).toInt64()); + FmEntryData* pCurrent = weld::fromId<FmEntryData*>(m_xTreeView->get_id(rSelection)); if (pCurrent != nullptr) { FmEntryDataArray::iterator it = arredToSelect.find(pCurrent); @@ -1805,7 +1805,7 @@ namespace svxform // This may be a frequently used code ( at every change in mark of the view!), // so i use latter one m_xTreeView->all_foreach([this, &arredToSelect](weld::TreeIter& rLoop){ - FmEntryData* pCurEntryData = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(rLoop).toInt64()); + FmEntryData* pCurEntryData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(rLoop)); FmEntryDataArray::iterator it = arredToSelect.find(pCurEntryData); if (it != arredToSelect.end()) { @@ -1850,12 +1850,12 @@ namespace svxform { // When form selection, mark all controls of form if (IsFormEntry(*rSelectionLoop) && m_xTreeView->iter_compare(*rSelectionLoop, *m_xRootEntry) != 0) - MarkViewObj(reinterpret_cast<FmFormData*>(m_xTreeView->get_id(*rSelectionLoop).toInt64()), false/*deep*/); + MarkViewObj(weld::fromId<FmFormData*>(m_xTreeView->get_id(*rSelectionLoop)), false/*deep*/); // When control selection, mark Control-SdrObjects else if (IsFormComponentEntry(*rSelectionLoop)) { - FmControlData* pControlData = reinterpret_cast<FmControlData*>(m_xTreeView->get_id(*rSelectionLoop).toInt64()); + FmControlData* pControlData = weld::fromId<FmControlData*>(m_xTreeView->get_id(*rSelectionLoop)); if (pControlData) { @@ -1891,7 +1891,7 @@ namespace svxform std::unique_ptr<weld::TreeIter> xSelected(m_xTreeView->make_iterator()); if (!m_xTreeView->get_selected(xSelected.get())) xSelected.reset(); - FmFormData* pSingleSelectionData = xSelected ? dynamic_cast<FmFormData*>(reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*xSelected).toInt64())) + FmFormData* pSingleSelectionData = xSelected ? dynamic_cast<FmFormData*>(weld::fromId<FmEntryData*>(m_xTreeView->get_id(*xSelected))) : nullptr; DBG_ASSERT( pSingleSelectionData, "NavigatorTree::SynchronizeMarkList: invalid selected form!" ); if ( pSingleSelectionData ) diff --git a/svx/source/form/tabwin.cxx b/svx/source/form/tabwin.cxx index 19fb11131751..536a21227d81 100644 --- a/svx/source/form/tabwin.cxx +++ b/svx/source/form/tabwin.cxx @@ -77,7 +77,7 @@ void FmFieldWin::addToList(const uno::Reference< container::XNameAccess>& i_xCol if ( xColumn->getPropertySetInfo()->hasPropertyByName(FM_PROP_LABEL) ) xColumn->getPropertyValue(FM_PROP_LABEL) >>= sLabel; m_aListBoxData.emplace_back(new ColumnInfo(rEntry)); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_aListBoxData.back().get()))); + OUString sId(weld::toId(m_aListBoxData.back().get())); if ( !sLabel.isEmpty() ) m_xListBox->append(sId, sLabel); else @@ -89,7 +89,7 @@ IMPL_LINK(FmFieldWin, DragBeginHdl, bool&, rUnsetDragIcon, bool) { rUnsetDragIcon = false; - ColumnInfo* pSelected = reinterpret_cast<ColumnInfo*>(m_xListBox->get_selected_id().toInt64()); + ColumnInfo* pSelected = weld::fromId<ColumnInfo*>(m_xListBox->get_selected_id()); if (!pSelected) { // no drag without a field @@ -147,7 +147,7 @@ IMPL_LINK_NOARG(FmFieldWin, RowActivatedHdl, weld::TreeView&, bool) bool FmFieldWin::createSelectionControls() { - ColumnInfo* pSelected = reinterpret_cast<ColumnInfo*>(m_xListBox->get_selected_id().toInt64()); + ColumnInfo* pSelected = weld::fromId<ColumnInfo*>(m_xListBox->get_selected_id()); if (pSelected) { // build a descriptor for the currently selected field diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx index 345a0ce803e8..ed81ba92f53e 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx @@ -147,7 +147,7 @@ void DictionaryList::refillFromDictionary( sal_Int32 nTextConversionOptions ) m_xControl->set_text(*m_xIter, pEntry->m_aTerm, 0); m_xControl->set_text(*m_xIter, pEntry->m_aMapping, 1); m_xControl->set_text(*m_xIter, getPropertyTypeName(pEntry->m_nConversionPropertyType), 2); - m_xControl->set_id(*m_xIter, OUString::number(reinterpret_cast<sal_Int64>(pEntry))); + m_xControl->set_id(*m_xIter, weld::toId(pEntry)); } } @@ -163,7 +163,7 @@ DictionaryEntry* DictionaryList::getFirstSelectedEntry() const DictionaryEntry* DictionaryList::getEntryOnPos(sal_Int32 nPos) const { OUString sLBEntry = m_xControl->get_id(nPos); - return reinterpret_cast<DictionaryEntry*>(sLBEntry.toInt64()); + return weld::fromId<DictionaryEntry*>(sLBEntry); } DictionaryEntry* DictionaryList::getTermEntry( std::u16string_view rTerm ) const @@ -194,7 +194,7 @@ void DictionaryList::addEntry(const OUString& rTerm, const OUString& rMapping, m_xControl->set_text(*m_xIter, pEntry->m_aTerm, 0); m_xControl->set_text(*m_xIter, pEntry->m_aMapping, 1); m_xControl->set_text(*m_xIter, getPropertyTypeName(pEntry->m_nConversionPropertyType), 2); - m_xControl->set_id(*m_xIter, OUString::number(reinterpret_cast<sal_Int64>(pEntry))); + m_xControl->set_id(*m_xIter, weld::toId(pEntry)); m_xControl->select(*m_xIter); } |