basctl/source/basicide/IDEComboBox.cxx                                |   14 
 basctl/source/basicide/baside2b.cxx                                   |   24 -
 basctl/source/basicide/bastype2.cxx                                   |    8 
 basctl/source/basicide/moduldl2.cxx                                   |    6 
 basctl/source/dlged/managelang.cxx                                    |    8 
 chart2/source/controller/dialogs/tp_DataSource.cxx                    |   30 -
 cui/source/customize/CommandCategoryListBox.cxx                       |   43 -
 cui/source/customize/SvxMenuConfigPage.cxx                            |   19 
 cui/source/customize/SvxToolbarConfigPage.cxx                         |   57 +-
 cui/source/customize/acccfg.cxx                                       |   30 -
 cui/source/customize/cfg.cxx                                          |   38 -
 cui/source/customize/cfgutil.cxx                                      |   43 -
 cui/source/dialogs/cuicharmap.cxx                                     |    4 
 cui/source/dialogs/hldocntp.cxx                                       |   10 
 cui/source/dialogs/hlmarkwn.cxx                                       |   10 
 cui/source/dialogs/linkdlg.cxx                                        |   20 
 cui/source/dialogs/scriptdlg.cxx                                      |   18 
 cui/source/options/dbregister.cxx                                     |   12 
 cui/source/options/optaboutconfig.cxx                                 |   12 
 cui/source/options/optgdlg.cxx                                        |    6 
 cui/source/options/optlingu.cxx                                       |   34 -
 cui/source/options/optpath.cxx                                        |   14 
 cui/source/options/optsave.cxx                                        |    2 
 cui/source/options/treeopt.cxx                                        |   34 -
 cui/source/tabpages/autocdlg.cxx                                      |   36 -
 cui/source/tabpages/swpossizetabpage.cxx                              |   20 
 dbaccess/source/ui/app/AppDetailView.cxx                              |    8 
 dbaccess/source/ui/browser/unodatbr.cxx                               |   76 
+--
 dbaccess/source/ui/misc/WColumnSelect.cxx                             |   14 
 dbaccess/source/ui/misc/WNameMatch.cxx                                |    8 
 dbaccess/source/ui/misc/WTypeSelect.cxx                               |   16 
 dbaccess/source/ui/querydesign/TableWindow.cxx                        |    6 
 desktop/source/deployment/gui/dp_gui_updatedialog.cxx                 |   13 
 extensions/source/propctrlr/selectlabeldialog.cxx                     |    2 
 extensions/source/propctrlr/taborder.cxx                              |    4 
 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx                  |   14 
 formula/source/ui/dlg/funcpage.cxx                                    |   14 
 formula/source/ui/dlg/structpg.cxx                                    |    6 
 fpicker/source/office/fileview.cxx                                    |   28 -
 fpicker/source/office/iodlgimp.cxx                                    |    2 
 include/vcl/weld.hxx                                                  |   10 
 reportdesign/source/ui/dlg/AddField.cxx                               |    8 
 reportdesign/source/ui/dlg/Navigator.cxx                              |   14 
 sc/source/filter/orcus/xmlcontext.cxx                                 |    2 
 sc/source/ui/cctrl/checklistmenu.cxx                                  |    6 
 sc/source/ui/dbgui/PivotLayoutTreeList.cxx                            |    9 
 sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx                        |    4 
 sc/source/ui/dbgui/PivotLayoutTreeListData.cxx                        |   14 
 sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx                       |    2 
 sc/source/ui/formdlg/dwfunctr.cxx                                     |    8 
 sc/source/ui/miscdlgs/acredlin.cxx                                    |   46 -
 sc/source/ui/miscdlgs/conflictsdlg.cxx                                |    8 
 sc/source/ui/miscdlgs/mvtabdlg.cxx                                    |    4 
 sc/source/ui/miscdlgs/solveroptions.cxx                               |    8 
 sd/source/ui/animations/CustomAnimationList.cxx                       |   34 -
 sd/source/ui/animations/CustomAnimationPane.cxx                       |   16 
 sd/source/ui/dlg/custsdlg.cxx                                         |    8 
 sd/source/ui/dlg/sdtreelb.cxx                                         |   10 
 sfx2/source/appl/newhelp.cxx                                          |   36 -
 sfx2/source/devtools/DocumentModelTreeHandler.cxx                     |   16 
 sfx2/source/devtools/ObjectInspectorTreeHandler.cxx                   |   12 
 sfx2/source/dialog/versdlg.cxx                                        |   10 
 sfx2/source/doc/autoredactdialog.cxx                                  |   13 
 starmath/source/dialog.cxx                                            |    4 
 svx/source/form/datanavi.cxx                                          |   30 -
 svx/source/form/navigatortree.cxx                                     |   52 +-
 svx/source/form/tabwin.cxx                                            |    6 
 svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx |    6 
 sw/source/ui/config/optload.cxx                                       |   12 
 sw/source/ui/config/optpage.cxx                                       |   12 
 sw/source/ui/dbui/addresslistdialog.cxx                               |   24 -
 sw/source/ui/dialog/uiregionsw.cxx                                    |   46 -
 sw/source/ui/frmdlg/frmpage.cxx                                       |   22 
 sw/source/ui/misc/bookmark.cxx                                        |   18 
 sw/source/ui/misc/glosbib.cxx                                         |   20 
 sw/source/ui/misc/glossary.cxx                                        |    2 
 sw/source/uibase/misc/redlndlg.cxx                                    |   14 
 sw/source/uibase/utlui/content.cxx                                    |  232 
+++++-----
 sw/source/uibase/utlui/glbltree.cxx                                   |   28 -
 vcl/unx/generic/print/prtsetup.cxx                                    |   18 
 xmlsecurity/source/dialogs/certificatechooser.cxx                     |   10 
 xmlsecurity/source/dialogs/certificateviewer.cxx                      |   10 
 82 files changed, 800 insertions(+), 827 deletions(-)

New commits:
commit e00032ba6a2ddd4c08ae6f03b1982d3c099d288e
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Feb 4 09:13:52 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Feb 4 15:02:03 2022 +0100

    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 <caol...@redhat.com>

diff --git a/basctl/source/basicide/IDEComboBox.cxx 
b/basctl/source/basicide/IDEComboBox.cxx
index e295e44ff1ed..423e5c5d1cda 100644
--- a/basctl/source/basicide/IDEComboBox.cxx
+++ b/basctl/source/basicide/IDEComboBox.cxx
@@ -222,7 +222,7 @@ void LibBox::FillBox()
     // create list box entries
     LibEntry* pEntry = new 
LibEntry(ScriptDocument::getApplicationScriptDocument(),
                                     LIBRARY_LOCATION_UNKNOWN, OUString());
-    OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+    OUString sId(weld::toId(pEntry));
     m_xWidget->append(sId, IDEResId(RID_STR_ALL));
 
     InsertEntries(ScriptDocument::getApplicationScriptDocument(), 
LIBRARY_LOCATION_USER);
@@ -261,7 +261,7 @@ void LibBox::InsertEntries(const ScriptDocument& rDocument, 
LibraryLocation eLoc
             OUString aName(rDocument.getTitle(eLocation));
             OUString aEntryText(CreateMgrAndLibStr(aName, aLibName));
             LibEntry* pEntry = new LibEntry(rDocument, eLocation, aLibName);
-            
m_xWidget->append(OUString::number(reinterpret_cast<sal_Int64>(pEntry)), 
aEntryText);
+            m_xWidget->append(weld::toId(pEntry), aEntryText);
         }
     }
 }
@@ -320,7 +320,7 @@ void LibBox::Select()
 
 void LibBox::NotifyIDE()
 {
-    LibEntry* pEntry = 
reinterpret_cast<LibEntry*>(m_xWidget->get_active_id().toInt64());
+    LibEntry* pEntry = weld::fromId<LibEntry*>(m_xWidget->get_active_id());
     if (pEntry)
     {
         const ScriptDocument& aDocument(pEntry->GetDocument());
@@ -340,7 +340,7 @@ void LibBox::ClearBox()
     sal_Int32 nCount = m_xWidget->get_count();
     for (sal_Int32 i = 0; i < nCount; ++i)
     {
-        LibEntry* pEntry = 
reinterpret_cast<LibEntry*>(m_xWidget->get_id(i).toInt64());
+        LibEntry* pEntry = weld::fromId<LibEntry*>(m_xWidget->get_id(i));
         delete pEntry;
     }
     m_xWidget->clear();
@@ -440,7 +440,7 @@ void LanguageBox::FillBox()
                 sLanguage += " " + msDefaultLanguageStr;
             }
             LanguageEntry* pEntry = new LanguageEntry(pLocale[i], bIsDefault);
-            OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+            OUString sId(weld::toId(pEntry));
             m_xWidget->append(sId, sLanguage);
 
             if (bIsCurrent)
@@ -467,7 +467,7 @@ void LanguageBox::ClearBox()
     sal_Int32 nCount = m_xWidget->get_count();
     for (sal_Int32 i = 0; i < nCount; ++i)
     {
-        LanguageEntry* pEntry = 
reinterpret_cast<LanguageEntry*>(m_xWidget->get_id(i).toInt64());
+        LanguageEntry* pEntry = 
weld::fromId<LanguageEntry*>(m_xWidget->get_id(i));
         delete pEntry;
     }
     m_xWidget->clear();
@@ -475,7 +475,7 @@ void LanguageBox::ClearBox()
 
 void LanguageBox::SetLanguage()
 {
-    LanguageEntry* pEntry = 
reinterpret_cast<LanguageEntry*>(m_xWidget->get_active_id().toInt64());
+    LanguageEntry* pEntry = 
weld::fromId<LanguageEntry*>(m_xWidget->get_active_id());
     if (pEntry)
         
GetShell()->GetCurLocalizationMgr()->handleSetCurrentLocale(pEntry->m_aLocale);
 }
diff --git a/basctl/source/basicide/baside2b.cxx 
b/basctl/source/basicide/baside2b.cxx
index 9671d149ca2b..eb038f69d86f 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1668,7 +1668,7 @@ void WatchWindow::dispose()
 
     // Destroy user data
     m_xTreeListBox->all_foreach([this](weld::TreeIter& rEntry){
-        WatchItem* pItem = 
reinterpret_cast<WatchItem*>(m_xTreeListBox->get_id(rEntry).toInt64());
+        WatchItem* pItem = 
weld::fromId<WatchItem*>(m_xTreeListBox->get_id(rEntry));
         delete pItem;
         return false;
     });
@@ -1729,7 +1729,7 @@ void WatchWindow::AddWatch( const OUString& rVName )
     lcl_SeparateNameAndIndex( rVName, aVar, aIndex );
     WatchItem* pWatchItem = new WatchItem(aVar);
 
-    OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pWatchItem)));
+    OUString sId(weld::toId(pWatchItem));
     std::unique_ptr<weld::TreeIter> xRet = m_xTreeListBox->make_iterator();
     m_xTreeListBox->insert(nullptr, -1, &aVar, &sId, nullptr, nullptr, false, 
xRet.get());
     m_xTreeListBox->set_text(*xRet, "", 1);
@@ -1752,7 +1752,7 @@ void WatchWindow::RemoveSelectedWatch()
         m_xTreeListBox->remove(*xEntry);
         bEntry = m_xTreeListBox->get_cursor(xEntry.get());
         if (bEntry)
-            
m_xEdit->set_text(reinterpret_cast<WatchItem*>(m_xTreeListBox->get_id(*xEntry).toInt64())->maName);
+            
m_xEdit->set_text(weld::fromId<WatchItem*>(m_xTreeListBox->get_id(*xEntry))->maName);
         else
             m_xEdit->set_text(OUString());
         if ( !m_xTreeListBox->n_children() )
@@ -1772,7 +1772,7 @@ IMPL_LINK_NOARG(WatchWindow, TreeListHdl, 
weld::TreeView&, void)
     bool bCurEntry = m_xTreeListBox->get_cursor(xCurEntry.get());
     if (!bCurEntry)
         return;
-    WatchItem* pItem = 
reinterpret_cast<WatchItem*>(m_xTreeListBox->get_id(*xCurEntry).toInt64());
+    WatchItem* pItem = 
weld::fromId<WatchItem*>(m_xTreeListBox->get_id(*xCurEntry));
     if (!pItem)
         return;
     m_xEdit->set_text(pItem->maName);
@@ -2069,7 +2069,7 @@ IMPL_LINK(WatchWindow, RequestingChildrenHdl, const 
weld::TreeIter&, rParent, bo
     if (m_xTreeListBox->iter_has_child(rParent))
         return true;
 
-    WatchItem* pItem = 
reinterpret_cast<WatchItem*>(m_xTreeListBox->get_id(rParent).toInt64());
+    WatchItem* pItem = 
weld::fromId<WatchItem*>(m_xTreeListBox->get_id(rParent));
     std::unique_ptr<weld::TreeIter> xRet = m_xTreeListBox->make_iterator();
 
     SbxDimArray* pArray = pItem->mpArray.get();
@@ -2097,7 +2097,7 @@ IMPL_LINK(WatchWindow, RequestingChildrenHdl, const 
weld::TreeIter&, rParent, bo
             OUString const& rName = pItem->maMemberList.back();
 
             WatchItem* pWatchItem = new WatchItem(rName);
-            OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(pWatchItem)));
+            OUString sId(weld::toId(pWatchItem));
 
             m_xTreeListBox->insert(&rParent, -1, &rName, &sId, nullptr, 
nullptr, false, xRet.get());
             m_xTreeListBox->set_text(*xRet, "", 1);
@@ -2148,7 +2148,7 @@ IMPL_LINK(WatchWindow, RequestingChildrenHdl, const 
weld::TreeIter&, rParent, bo
                 aDisplayName += aIndexStr;
                 pChildItem->maDisplayName = aDisplayName;
 
-                OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(pChildItem)));
+                OUString sId(weld::toId(pChildItem));
 
                 m_xTreeListBox->insert(&rParent, -1, &aDisplayName, &sId, 
nullptr, nullptr, false,
                                        xRet.get());
@@ -2178,12 +2178,12 @@ SbxBase* WatchWindow::ImplGetSBXForEntry(const 
weld::TreeIter& rEntry, bool& rbA
     SbxBase* pSBX = nullptr;
     rbArrayElement = false;
 
-    WatchItem* pItem = 
reinterpret_cast<WatchItem*>(m_xTreeListBox->get_id(rEntry).toInt64());
+    WatchItem* pItem = 
weld::fromId<WatchItem*>(m_xTreeListBox->get_id(rEntry));
     OUString aVName( pItem->maName );
 
     std::unique_ptr<weld::TreeIter> xParentEntry = 
m_xTreeListBox->make_iterator(&rEntry);
     bool bParentEntry = m_xTreeListBox->iter_parent(*xParentEntry);
-    WatchItem* pParentItem = bParentEntry ? 
reinterpret_cast<WatchItem*>(m_xTreeListBox->get_id(*xParentEntry).toInt64()) : 
nullptr;
+    WatchItem* pParentItem = bParentEntry ? 
weld::fromId<WatchItem*>(m_xTreeListBox->get_id(*xParentEntry)) : nullptr;
     if( pParentItem )
     {
         SbxObject* pObj = pParentItem->mpObject.get();
@@ -2216,7 +2216,7 @@ SbxBase* WatchWindow::ImplGetSBXForEntry(const 
weld::TreeIter& rEntry, bool& rbA
 
 IMPL_LINK(WatchWindow, EditingEntryHdl, const weld::TreeIter&, rIter, bool)
 {
-    WatchItem* pItem = 
reinterpret_cast<WatchItem*>(m_xTreeListBox->get_id(rIter).toInt64());
+    WatchItem* pItem = weld::fromId<WatchItem*>(m_xTreeListBox->get_id(rIter));
 
     bool bEdit = false;
     if (StarBASIC::IsRunning() && StarBASIC::GetActiveMethod() && 
!SbxBase::IsError())
@@ -2293,7 +2293,7 @@ void implCollapseModifiedObjectEntry(const 
weld::TreeIter& rParent, weld::TreeVi
     {
         implCollapseModifiedObjectEntry(*xDeleteEntry, rTree);
 
-        WatchItem* pItem = 
reinterpret_cast<WatchItem*>(rTree.get_id(*xDeleteEntry).toInt64());
+        WatchItem* pItem = 
weld::fromId<WatchItem*>(rTree.get_id(*xDeleteEntry));
         delete pItem;
         rTree.remove(*xDeleteEntry);
         rTree.copy_iterator(rParent, *xDeleteEntry);
@@ -2352,7 +2352,7 @@ void WatchWindow::UpdateWatches(bool bBasicStopped)
     setBasicWatchMode( true );
 
     m_xTreeListBox->all_foreach([this, pCurMethod, 
bBasicStopped](weld::TreeIter& rEntry){
-        WatchItem* pItem = 
reinterpret_cast<WatchItem*>(m_xTreeListBox->get_id(rEntry).toInt64());
+        WatchItem* pItem = 
weld::fromId<WatchItem*>(m_xTreeListBox->get_id(rEntry));
         DBG_ASSERT( !pItem->maName.isEmpty(), "Var? - Must not be empty!" );
         OUString aWatchStr;
         OUString aTypeStr;
diff --git a/basctl/source/basicide/bastype2.cxx 
b/basctl/source/basicide/bastype2.cxx
index afff27b75dfd..d027c7dc6d2b 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -176,7 +176,7 @@ SbTreeListBox::~SbTreeListBox()
     bool bValidIter = m_xControl->get_iter_first(*m_xScratchIter);
     while (bValidIter)
     {
-        Entry* pBasicEntry = 
reinterpret_cast<Entry*>(m_xControl->get_id(*m_xScratchIter).toInt64());
+        Entry* pBasicEntry = 
weld::fromId<Entry*>(m_xControl->get_id(*m_xScratchIter));
         delete pBasicEntry;
         bValidIter = m_xControl->iter_next(*m_xScratchIter);
     }
@@ -577,7 +577,7 @@ void SbTreeListBox::RemoveEntry(const weld::TreeIter& rIter)
     }
 
     // removing the associated user data
-    Entry* pBasicEntry = 
reinterpret_cast<Entry*>(m_xControl->get_id(rIter).toInt64());
+    Entry* pBasicEntry = weld::fromId<Entry*>(m_xControl->get_id(rIter));
     delete pBasicEntry;
     // removing the entry
     m_xControl->remove(rIter);
@@ -604,7 +604,7 @@ bool SbTreeListBox::FindEntry(std::u16string_view rText, 
EntryType eType, weld::
     bool bValidIter = m_xControl->iter_children(rIter);
     while (bValidIter)
     {
-        Entry* pBasicEntry = 
reinterpret_cast<Entry*>(m_xControl->get_id(rIter).toInt64());
+        Entry* pBasicEntry = weld::fromId<Entry*>(m_xControl->get_id(rIter));
         assert(pBasicEntry && "FindEntry: no Entry ?!");
         if (pBasicEntry->GetType() == eType && rText == 
m_xControl->get_text(rIter))
             return true;
@@ -654,7 +654,7 @@ void SbTreeListBox::AddEntry(
     std::unique_ptr<weld::TreeIter> xScratch = pRet ? nullptr : 
m_xControl->make_iterator();
     if (!pRet)
         pRet = xScratch.get();
-    OUString 
sId(OUString::number(reinterpret_cast<sal_uInt64>(rUserData.release())));
+    OUString sId(weld::toId(rUserData.release()));
     m_xControl->insert(pParent, -1, &rText, &sId, nullptr, nullptr, 
bChildrenOnDemand, pRet);
     m_xControl->set_image(*pRet, rImage);
 }
diff --git a/basctl/source/basicide/moduldl2.cxx 
b/basctl/source/basicide/moduldl2.cxx
index 2515cace9800..265a5d55b746 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -345,7 +345,7 @@ LibPage::~LibPage()
         const sal_Int32 nCount = m_xBasicsBox->get_count();
         for (sal_Int32 i = 0; i < nCount; ++i)
         {
-            DocumentEntry* pEntry = 
reinterpret_cast<DocumentEntry*>(m_xBasicsBox->get_id(i).toInt64());
+            DocumentEntry* pEntry = 
weld::fromId<DocumentEntry*>(m_xBasicsBox->get_id(i));
             delete pEntry;
         }
     }
@@ -1184,13 +1184,13 @@ void LibPage::FillListBox()
 void LibPage::InsertListBoxEntry( const ScriptDocument& rDocument, 
LibraryLocation eLocation )
 {
     OUString aEntryText(rDocument.getTitle(eLocation));
-    OUString sId(OUString::number(reinterpret_cast<sal_Int64>(new 
DocumentEntry(rDocument, eLocation))));
+    OUString sId(weld::toId(new DocumentEntry(rDocument, eLocation)));
     m_xBasicsBox->append(sId,  aEntryText);
 }
 
 void LibPage::SetCurLib()
 {
-    DocumentEntry* pEntry = 
reinterpret_cast<DocumentEntry*>(m_xBasicsBox->get_active_id().toInt64());
+    DocumentEntry* pEntry = 
weld::fromId<DocumentEntry*>(m_xBasicsBox->get_active_id());
     if (!pEntry)
         return;
 
diff --git a/basctl/source/dlged/managelang.cxx 
b/basctl/source/dlged/managelang.cxx
index c7cd423cccee..0853f4ac86d3 100644
--- a/basctl/source/dlged/managelang.cxx
+++ b/basctl/source/dlged/managelang.cxx
@@ -113,7 +113,7 @@ void ManageLanguageDialog::FillLanguageBox()
                 sLanguage += " " + m_sDefLangStr;
             }
             LanguageEntry* pEntry = new LanguageEntry(pLocale[i], bIsDefault);
-            
m_xLanguageLB->append(OUString::number(reinterpret_cast<sal_Int64>(pEntry)), 
sLanguage);
+            m_xLanguageLB->append(weld::toId(pEntry), sLanguage);
         }
     }
     else
@@ -125,7 +125,7 @@ void ManageLanguageDialog::ClearLanguageBox()
     const sal_Int32 nCount = m_xLanguageLB->n_children();
     for (sal_Int32 i = 0; i < nCount; ++i)
     {
-        LanguageEntry* pEntry = 
reinterpret_cast<LanguageEntry*>(m_xLanguageLB->get_id(i).toInt64());
+        LanguageEntry* pEntry = 
weld::fromId<LanguageEntry*>(m_xLanguageLB->get_id(i));
         delete pEntry;
     }
     m_xLanguageLB->clear();
@@ -166,7 +166,7 @@ IMPL_LINK_NOARG(ManageLanguageDialog, DeleteHdl, 
weld::Button&, void)
     for (int i = 0; i < nCount; ++i)
     {
         const sal_Int32 nSelPos = aSelection[i];
-        LanguageEntry* pEntry = 
reinterpret_cast<LanguageEntry*>(m_xLanguageLB->get_id(nSelPos).toInt64());
+        LanguageEntry* pEntry = 
weld::fromId<LanguageEntry*>(m_xLanguageLB->get_id(nSelPos));
         if ( pEntry )
             aLocaleSeqRange[i] = pEntry->m_aLocale;
     }
@@ -185,7 +185,7 @@ IMPL_LINK_NOARG(ManageLanguageDialog, DeleteHdl, 
weld::Button&, void)
 IMPL_LINK_NOARG(ManageLanguageDialog, MakeDefHdl, weld::Button&, void)
 {
     const sal_Int32 nPos = m_xLanguageLB->get_selected_index();
-    LanguageEntry* pSelectEntry = 
reinterpret_cast<LanguageEntry*>(m_xLanguageLB->get_id(nPos).toInt64());
+    LanguageEntry* pSelectEntry = 
weld::fromId<LanguageEntry*>(m_xLanguageLB->get_id(nPos));
     if (pSelectEntry && !pSelectEntry->m_bIsDefault)
     {
         // set new default entry
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx 
b/chart2/source/controller/dialogs/tp_DataSource.cxx
index e208db89a6ff..63d7aee7bbeb 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -62,7 +62,7 @@ void lcl_UpdateCurrentRange(weld::TreeView& rOutListBox, 
const OUString & rRole,
     {
         rOutListBox.set_text(nEntry, 
::chart::DialogModel::ConvertRoleFromInternalToUI(rRole), 0);
         rOutListBox.set_text(nEntry, rRange, 1);
-        ::chart::SeriesEntry* pEntry = 
reinterpret_cast<::chart::SeriesEntry*>(rOutListBox.get_id(nEntry).toInt64());
+        ::chart::SeriesEntry* pEntry = 
weld::fromId<::chart::SeriesEntry*>(rOutListBox.get_id(nEntry));
         pEntry->m_sRole = rRole;
     }
 }
@@ -74,7 +74,7 @@ bool lcl_UpdateCurrentSeriesName(weld::TreeView& rOutListBox)
         return false;
 
     bool bResult = false;
-    ::chart::SeriesEntry * pEntry = 
reinterpret_cast<::chart::SeriesEntry*>(rOutListBox.get_id(nEntry).toInt64());
+    ::chart::SeriesEntry * pEntry = 
weld::fromId<::chart::SeriesEntry*>(rOutListBox.get_id(nEntry));
     if (pEntry->m_xDataSeries.is() && pEntry->m_xChartType.is())
     {
         OUString aLabel(::chart::DataSeriesHelper::getDataSeriesLabel(
@@ -96,7 +96,7 @@ OUString lcl_GetSelectedRole(const weld::TreeView& 
rRoleListBox, bool bUITransla
     {
         if (bUITranslated)
             return rRoleListBox.get_text(nEntry);
-        ::chart::SeriesEntry* pEntry = 
reinterpret_cast<::chart::SeriesEntry*>(rRoleListBox.get_id(nEntry).toInt64());
+        ::chart::SeriesEntry* pEntry = 
weld::fromId<::chart::SeriesEntry*>(rRoleListBox.get_id(nEntry));
         return pEntry->m_sRole;
     }
     return OUString();
@@ -236,7 +236,7 @@ void DataSourceTabPage::InsertRoleLBEntry(const OUString& 
rRole, const OUString&
     m_aEntries.emplace_back(new SeriesEntry);
     SeriesEntry* pEntry = m_aEntries.back().get();
     pEntry->m_sRole = rRole;
-    m_xLB_ROLE->append(OUString::number(reinterpret_cast<sal_Int64>(pEntry)),
+    m_xLB_ROLE->append(weld::toId(pEntry),
                        
::chart::DialogModel::ConvertRoleFromInternalToUI(rRole));
     m_xLB_ROLE->set_text(m_xLB_ROLE->n_children() - 1, rRange, 1);
 }
@@ -335,7 +335,7 @@ void DataSourceTabPage::fillSeriesListBox()
     int nEntry = m_xLB_SERIES->get_selected_index();
     if (nEntry != -1)
     {
-        pEntry = 
reinterpret_cast<SeriesEntry*>(m_xLB_SERIES->get_id(nEntry).toInt64());
+        pEntry = weld::fromId<SeriesEntry*>(m_xLB_SERIES->get_id(nEntry));
         xSelected.set(pEntry->m_xDataSeries);
     }
 
@@ -377,7 +377,7 @@ void DataSourceTabPage::fillSeriesListBox()
         pEntry = m_aEntries.back().get();
         pEntry->m_xDataSeries.set(series.second.first);
         pEntry->m_xChartType = series.second.second;
-        
m_xLB_SERIES->append(OUString::number(reinterpret_cast<sal_Int64>(pEntry)), 
aLabel);
+        m_xLB_SERIES->append(weld::toId(pEntry), aLabel);
         if (bHasSelectedEntry && series.second.first == xSelected)
             nSelectedEntry = nEntry;
         ++nEntry;
@@ -394,7 +394,7 @@ void DataSourceTabPage::fillRoleListBox()
     int nSeriesEntry = m_xLB_SERIES->get_selected_index();
     SeriesEntry* pSeriesEntry = nullptr;
     if (nSeriesEntry != -1)
-        pSeriesEntry = 
reinterpret_cast<SeriesEntry*>(m_xLB_SERIES->get_id(nSeriesEntry).toInt64());
+        pSeriesEntry = 
weld::fromId<SeriesEntry*>(m_xLB_SERIES->get_id(nSeriesEntry));
     bool bHasSelectedEntry = (pSeriesEntry != nullptr);
 
     int nRoleIndex = m_xLB_ROLE->get_selected_index();
@@ -569,7 +569,7 @@ IMPL_LINK_NOARG(DataSourceTabPage, AddButtonClickedHdl, 
weld::Button&, void)
 
     if (nEntry != -1)
     {
-        ::chart::SeriesEntry* pEntry = 
reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry).toInt64());
+        ::chart::SeriesEntry* pEntry = 
weld::fromId<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry));
         xSeriesToInsertAfter.set(pEntry->m_xDataSeries);
         xChartTypeForNewSeries = pEntry->m_xChartType;
     }
@@ -605,13 +605,13 @@ IMPL_LINK_NOARG(DataSourceTabPage, 
RemoveButtonClickedHdl, weld::Button&, void)
     if (nEntry == -1)
         return;
 
-    SeriesEntry* pEntry = 
reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry).toInt64());
+    SeriesEntry* pEntry = 
weld::fromId<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry));
     Reference< XDataSeries > xNewSelSeries;
     SeriesEntry * pNewSelEntry = nullptr;
     if (nEntry + 1 < m_xLB_SERIES->n_children())
-        pNewSelEntry = 
reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry + 
1).toInt64());
+        pNewSelEntry = 
weld::fromId<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry + 1));
     else if (nEntry > 0)
-        pNewSelEntry = 
reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry - 
1).toInt64());
+        pNewSelEntry = 
weld::fromId<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(nEntry - 1));
     if (pNewSelEntry)
         xNewSelSeries.set(pNewSelEntry->m_xDataSeries);
 
@@ -626,7 +626,7 @@ IMPL_LINK_NOARG(DataSourceTabPage, RemoveButtonClickedHdl, 
weld::Button&, void)
     {
         for (int i = 0; i < m_xLB_SERIES->n_children(); ++i)
         {
-            pEntry = 
reinterpret_cast<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(i).toInt64());
+            pEntry = 
weld::fromId<::chart::SeriesEntry*>(m_xLB_SERIES->get_id(i));
             if (pEntry->m_xDataSeries == xNewSelSeries)
             {
                 m_xLB_SERIES->select(i);
@@ -644,7 +644,7 @@ IMPL_LINK_NOARG(DataSourceTabPage, UpButtonClickedHdl, 
weld::Button&, void)
     int nEntry = m_xLB_SERIES->get_selected_index();
     SeriesEntry* pEntry = nullptr;
     if (nEntry != -1)
-        pEntry = 
reinterpret_cast<SeriesEntry*>(m_xLB_SERIES->get_id(nEntry).toInt64());
+        pEntry = weld::fromId<SeriesEntry*>(m_xLB_SERIES->get_id(nEntry));
 
     bool bHasSelectedEntry = (pEntry != nullptr);
 
@@ -664,7 +664,7 @@ IMPL_LINK_NOARG(DataSourceTabPage, DownButtonClickedHdl, 
weld::Button&, void)
     int nEntry = m_xLB_SERIES->get_selected_index();
     SeriesEntry* pEntry = nullptr;
     if (nEntry != -1)
-        pEntry = 
reinterpret_cast<SeriesEntry*>(m_xLB_SERIES->get_id(nEntry).toInt64());
+        pEntry = weld::fromId<SeriesEntry*>(m_xLB_SERIES->get_id(nEntry));
 
     bool bHasSelectedEntry = (pEntry != nullptr);
 
@@ -787,7 +787,7 @@ bool DataSourceTabPage::updateModelFromControl(const 
weld::Entry* pField)
     int nSeriesEntry = m_xLB_SERIES->get_selected_index();
     SeriesEntry* pSeriesEntry = nullptr;
     if (nSeriesEntry != -1)
-        pSeriesEntry = 
reinterpret_cast<SeriesEntry*>(m_xLB_SERIES->get_id(nSeriesEntry).toInt64());
+        pSeriesEntry = 
weld::fromId<SeriesEntry*>(m_xLB_SERIES->get_id(nSeriesEntry));
     bool bHasSelectedEntry = (pSeriesEntry != nullptr);
 
     if( bHasSelectedEntry )
diff --git a/cui/source/customize/CommandCategoryListBox.cxx 
b/cui/source/customize/CommandCategoryListBox.cxx
index c5bc7da17ca3..f6b34076fa02 100644
--- a/cui/source/customize/CommandCategoryListBox.cxx
+++ b/cui/source/customize/CommandCategoryListBox.cxx
@@ -134,9 +134,8 @@ void CommandCategoryListBox::Init(const 
css::uno::Reference<css::uno::XComponent
             // Add the category of "All commands"
             m_aGroupInfo.push_back(
                 
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_ALLFUNCTIONS, 0));
-            m_xControl->append(
-                
OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())),
-                CuiResId(RID_CUISTR_ALLFUNCTIONS));
+            m_xControl->append(weld::toId(m_aGroupInfo.back().get()),
+                               CuiResId(RID_CUISTR_ALLFUNCTIONS));
         }
 
         // Separate the "All commands"category from the actual categories
@@ -181,9 +180,7 @@ void CommandCategoryListBox::Init(const 
css::uno::Reference<css::uno::XComponent
             sal_Int16 nGroupID = a.second;
             m_aGroupInfo.push_back(
                 
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_FUNCTION, nGroupID));
-            m_xControl->append(
-                
OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())),
-                rGroupName);
+            m_xControl->append(weld::toId(m_aGroupInfo.back().get()), 
rGroupName);
         }
 
         // Separate regular commands from styles and macros
@@ -192,14 +189,13 @@ void CommandCategoryListBox::Init(const 
css::uno::Reference<css::uno::XComponent
         // Add macros category
         m_aGroupInfo.push_back(
             
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SCRIPTCONTAINER, 0, 
nullptr));
-        
m_xControl->append(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())),
-                           CuiResId(RID_CUISTR_MACROS));
+        m_xControl->append(weld::toId(m_aGroupInfo.back().get()), 
CuiResId(RID_CUISTR_MACROS));
 
         // Add styles category
         //TODO: last param should contain user data?
         m_aGroupInfo.push_back(
             std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_STYLES, 0, 
nullptr));
-        
m_xControl->append(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())),
+        m_xControl->append(weld::toId(m_aGroupInfo.back().get()),
                            CuiResId(RID_CUISTR_GROUP_STYLES));
     }
     catch (const css::uno::RuntimeException&)
@@ -260,9 +256,7 @@ void CommandCategoryListBox::FillFunctionsList(
         pGrpInfo->sCommand = rInfo.Command;
         pGrpInfo->sLabel = sUIName;
         pGrpInfo->sTooltip = sTooltipLabel;
-        pFunctionListBox->append(
-            
OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), 
sUIName,
-            xImage);
+        pFunctionListBox->append(weld::toId(m_aGroupInfo.back().get()), 
sUIName, xImage);
     }
 }
 
@@ -301,8 +295,7 @@ void 
CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
                                               const OUString& filterTerm,
                                               SaveInData* pCurrentSaveInData)
 {
-    SfxGroupInfo_Impl* pInfo
-        = 
reinterpret_cast<SfxGroupInfo_Impl*>(m_xControl->get_active_id().toInt64());
+    SfxGroupInfo_Impl* pInfo = 
weld::fromId<SfxGroupInfo_Impl*>(m_xControl->get_active_id());
     std::vector<std::unique_ptr<weld::TreeIter>> aNodesToExpand;
     pFunctionListBox->freeze();
     pFunctionListBox->ClearAll();
@@ -318,7 +311,7 @@ void 
CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
             for (sal_Int32 nCurPos = 0; nCurPos < nEntryCount; ++nCurPos)
             {
                 SfxGroupInfo_Impl* pCurrentInfo
-                    = 
reinterpret_cast<SfxGroupInfo_Impl*>(m_xControl->get_id(nCurPos).toInt64());
+                    = 
weld::fromId<SfxGroupInfo_Impl*>(m_xControl->get_id(nCurPos));
 
                 if (!pCurrentInfo) //separator
                     continue;
@@ -411,9 +404,7 @@ void 
CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
                         
m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
                             SfxCfgKind::GROUP_SCRIPTCONTAINER, 0));
                         std::unique_ptr<weld::TreeIter> 
xMacroGroup(pFunctionListBox->tree_append(
-                            OUString::number(
-                                
reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())),
-                            sUIName));
+                            weld::toId(m_aGroupInfo.back().get()), sUIName));
 
                         {
                             // tdf#128010: Do not nag user asking to enable 
JRE: if it's disabled,
@@ -455,8 +446,7 @@ void 
CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
                     
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_STYLES, 0));
                 // pIt.sLabel is Name of the style family
                 std::unique_ptr<weld::TreeIter> 
xFuncEntry(pFunctionListBox->tree_append(
-                    
OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())),
-                    pIt.sLabel));
+                    weld::toId(m_aGroupInfo.back().get()), pIt.sLabel));
 
                 const std::vector<SfxStyleInfo_Impl> lStyles = 
pStylesInfo->getStyles(pIt.sFamily);
 
@@ -486,9 +476,8 @@ void 
CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
                     m_aGroupInfo.back()->sCommand = pStyle->sCommand;
                     m_aGroupInfo.back()->sLabel = pStyle->sLabel;
 
-                    pFunctionListBox->append(
-                        
OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())),
-                        sUIName, xFuncEntry.get());
+                    
pFunctionListBox->append(weld::toId(m_aGroupInfo.back().get()), sUIName,
+                                             xFuncEntry.get());
                 }
 
                 // Remove the style group from the list if no children
@@ -547,8 +536,7 @@ void CommandCategoryListBox::addChildren(
             m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
                 SfxCfgKind::GROUP_SCRIPTCONTAINER, 0, 
static_cast<void*>(child.get())));
             std::unique_ptr<weld::TreeIter> 
xNewEntry(pFunctionListBox->tree_append(
-                
OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), 
sUIName,
-                parentEntry));
+                weld::toId(m_aGroupInfo.back().get()), sUIName, parentEntry));
 
             addChildren(xNewEntry.get(), child, pFunctionListBox, filterTerm, 
pCurrentSaveInData,
                         rNodesToExpand);
@@ -610,9 +598,8 @@ void CommandCategoryListBox::addChildren(
             m_aGroupInfo.back()->sCommand = uri;
             m_aGroupInfo.back()->sLabel = sUIName;
             m_aGroupInfo.back()->sHelpText = description;
-            pFunctionListBox->append(
-                
OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), 
sUIName,
-                xImage, parentEntry);
+            pFunctionListBox->append(weld::toId(m_aGroupInfo.back().get()), 
sUIName, xImage,
+                                     parentEntry);
         }
     }
 }
diff --git a/cui/source/customize/SvxMenuConfigPage.cxx 
b/cui/source/customize/SvxMenuConfigPage.cxx
index 73d01792798a..db0d95904a77 100644
--- a/cui/source/customize/SvxMenuConfigPage.cxx
+++ b/cui/source/customize/SvxMenuConfigPage.cxx
@@ -100,8 +100,7 @@ void SvxMenuConfigPage::ListModified()
     pEntries->clear();
 
     for (int i = 0; i < m_xContentsListBox->n_children(); ++i)
-        pEntries->push_back(
-            
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(i).toInt64()));
+        
pEntries->push_back(weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(i)));
 
     GetSaveInData()->SetModified();
     GetTopLevelSelection()->SetModified();
@@ -123,7 +122,7 @@ IMPL_LINK(SvxMenuConfigPage, MenuEntriesSizeAllocHdl, const 
Size&, rSize, void)
 SvxMenuConfigPage::~SvxMenuConfigPage()
 {
     for (int i = 0, nCount = m_xSaveInListBox->get_count(); i < nCount; ++i)
-        delete 
reinterpret_cast<SaveInData*>(m_xSaveInListBox->get_id(i).toInt64());
+        delete weld::fromId<SaveInData*>(m_xSaveInListBox->get_id(i));
     m_xSaveInListBox->clear();
 }
 
@@ -154,8 +153,7 @@ void SvxMenuConfigPage::UpdateButtonStates()
 
     bool bIsSeparator
         = selection != -1
-          && 
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(selection).toInt64())
-                 ->IsSeparator();
+          && 
weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(selection))->IsSeparator();
     bool bIsValidSelection = (m_xContentsListBox->n_children() != 0 && 
selection != -1);
 
     m_xMoveUpButton->set_sensitive(bIsValidSelection && selection != 0);
@@ -217,7 +215,7 @@ void SvxMenuConfigPage::DeleteSelectedContent()
 
     // get currently selected menu entry
     SvxConfigEntry* pMenuEntry
-        = 
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+        = weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
 
     // get currently selected menu
     SvxConfigEntry* pMenu = GetTopLevelSelection();
@@ -268,7 +266,7 @@ void SvxMenuConfigPage::SelectElement()
         rTreeView.bulk_insert_for_each(
             pEntries->size(), [this, &rTreeView, pEntries](weld::TreeIter& 
rIter, int nIdx) {
                 auto const& entry = (*pEntries)[nIdx];
-                OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(entry)));
+                OUString sId(weld::toId(entry));
                 rTreeView.set_id(rIter, sId);
                 InsertEntryIntoUI(entry, rTreeView, rIter, true);
             });
@@ -360,7 +358,7 @@ IMPL_LINK_NOARG(SvxMenuConfigPage, AddCommandHdl, 
weld::Button&, void)
     if (nPos == -1)
         return;
     weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
-    SvxConfigEntry* pEntry = 
reinterpret_cast<SvxConfigEntry*>(rTreeView.get_id(nPos).toInt64());
+    SvxConfigEntry* pEntry = 
weld::fromId<SvxConfigEntry*>(rTreeView.get_id(nPos));
     InsertEntryIntoUI(pEntry, rTreeView, nPos, true);
 }
 
@@ -431,7 +429,7 @@ IMPL_LINK(SvxMenuConfigPage, ModifyItemHdl, const OString&, 
rIdent, void)
     {
         int nActEntry = m_xContentsListBox->get_selected_index();
         SvxConfigEntry* pEntry
-            = 
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+            = 
weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
 
         OUString aNewName(SvxConfigPageHelper::stripHotKey(pEntry->GetName()));
         OUString aDesc = CuiResId(RID_CUISTR_LABEL_NEW_NAME);
@@ -531,8 +529,7 @@ IMPL_LINK(SvxMenuConfigPage, ContentContextMenuHdl, const 
CommandEvent&, rCEvt,
 
     bool bIsSeparator
         = nSelectIndex != -1
-          && 
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nSelectIndex).toInt64())
-                 ->IsSeparator();
+          && 
weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nSelectIndex))->IsSeparator();
     bool bIsValidSelection = (m_xContentsListBox->n_children() != 0 && 
nSelectIndex != -1);
 
     std::unique_ptr<weld::Builder> xBuilder(
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx 
b/cui/source/customize/SvxToolbarConfigPage.cxx
index 9b24588cfa64..bcf7da3c8c72 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -125,8 +125,7 @@ void SvxToolbarConfigPage::ListModified()
     pEntries->clear();
 
     for (int i = 0; i < m_xContentsListBox->n_children(); ++i)
-        pEntries->push_back(
-            
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(i).toInt64()));
+        
pEntries->push_back(weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(i)));
 
     GetSaveInData()->SetModified();
     GetTopLevelSelection()->SetModified();
@@ -140,8 +139,7 @@ SvxToolbarConfigPage::~SvxToolbarConfigPage()
 {
     for (int i = 0, nCount = m_xSaveInListBox->get_count(); i < nCount; ++i)
     {
-        ToolbarSaveInData* pData
-            = 
reinterpret_cast<ToolbarSaveInData*>(m_xSaveInListBox->get_id(i).toInt64());
+        ToolbarSaveInData* pData = 
weld::fromId<ToolbarSaveInData*>(m_xSaveInListBox->get_id(i));
         delete pData;
     }
     m_xSaveInListBox->clear();
@@ -186,8 +184,7 @@ void SvxToolbarConfigPage::DeleteSelectedContent()
         return;
 
     // get currently selected entry
-    SvxConfigEntry* pEntry
-        = 
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+    SvxConfigEntry* pEntry = 
weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
 
     SvxConfigEntry* pToolbar = GetTopLevelSelection();
 
@@ -251,8 +248,7 @@ void SvxToolbarConfigPage::Init()
     {
         for (sal_Int32 i = 0, nCount = m_xTopLevelListBox->get_count(); i < 
nCount; ++i)
         {
-            SvxConfigEntry* pData
-                = 
reinterpret_cast<SvxConfigEntry*>(m_xTopLevelListBox->get_id(i).toInt64());
+            SvxConfigEntry* pData = 
weld::fromId<SvxConfigEntry*>(m_xTopLevelListBox->get_id(i));
 
             if (pData->GetCommand().equals(m_aURLToSelect))
             {
@@ -317,8 +313,8 @@ IMPL_LINK(SvxToolbarConfigPage, GearHdl, const OString&, 
rIdent, void)
             // Where to save the new toolbar? (i.e. Modulewise or documentwise)
             int nInsertPos = aNameDialog.m_xSaveInListBox->get_active();
 
-            ToolbarSaveInData* pData = reinterpret_cast<ToolbarSaveInData*>(
-                m_xSaveInListBox->get_id(nInsertPos).toInt64());
+            ToolbarSaveInData* pData
+                = 
weld::fromId<ToolbarSaveInData*>(m_xSaveInListBox->get_id(nInsertPos));
 
             if (GetSaveInData() != pData)
             {
@@ -333,7 +329,7 @@ IMPL_LINK(SvxToolbarConfigPage, GearHdl, const OString&, 
rIdent, void)
 
             pData->CreateToolbar(pToolbar);
 
-            OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(pToolbar)));
+            OUString sId(weld::toId(pToolbar));
             m_xTopLevelListBox->append(sId, pToolbar->GetName());
             m_xTopLevelListBox->set_active_id(sId);
             SelectElement();
@@ -352,8 +348,8 @@ IMPL_LINK(SvxToolbarConfigPage, GearHdl, const OString&, 
rIdent, void)
     else if (rIdent == "toolbar_gear_rename")
     {
         sal_Int32 nSelectionPos = m_xTopLevelListBox->get_active();
-        SvxConfigEntry* pToolbar = reinterpret_cast<SvxConfigEntry*>(
-            m_xTopLevelListBox->get_id(nSelectionPos).toInt64());
+        SvxConfigEntry* pToolbar
+            = 
weld::fromId<SvxConfigEntry*>(m_xTopLevelListBox->get_id(nSelectionPos));
         ToolbarSaveInData* pSaveInData = 
static_cast<ToolbarSaveInData*>(GetSaveInData());
 
         //Rename the toolbar
@@ -376,7 +372,7 @@ IMPL_LINK(SvxToolbarConfigPage, GearHdl, const OString&, 
rIdent, void)
 
             // have to use remove and insert to change the name
             m_xTopLevelListBox->remove(nSelectionPos);
-            OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(pToolbar)));
+            OUString sId(weld::toId(pToolbar));
             m_xTopLevelListBox->insert(nSelectionPos, sNewName, &sId, nullptr, 
nullptr);
             m_xTopLevelListBox->set_active_id(sId);
         }
@@ -471,7 +467,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const 
OString&, rIdent, void)
     {
         int nActEntry = m_xContentsListBox->get_selected_index();
         SvxConfigEntry* pEntry
-            = 
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+            = 
weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
 
         OUString aNewName(SvxConfigPageHelper::stripHotKey(pEntry->GetName()));
         OUString aDesc = CuiResId(RID_CUISTR_LABEL_NEW_NAME);
@@ -497,7 +493,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const 
OString&, rIdent, void)
     {
         int nActEntry = m_xContentsListBox->get_selected_index();
         SvxConfigEntry* pEntry
-            = 
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+            = 
weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
 
         SvxIconSelectorDialog aIconDialog(GetFrameWeld(), 
GetSaveInData()->GetImageManager(),
                                           
GetSaveInData()->GetParentImageManager());
@@ -532,7 +528,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const 
OString&, rIdent, void)
 
                     m_xContentsListBox->remove(nActEntry);
 
-                    OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+                    OUString sId(weld::toId(pEntry));
                     m_xContentsListBox->insert(nActEntry, sId);
                     m_xContentsListBox->set_toggle(nActEntry, 
pEntry->IsVisible() ? TRISTATE_TRUE
                                                                                
   : TRISTATE_FALSE);
@@ -554,7 +550,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const 
OString&, rIdent, void)
     {
         int nActEntry = m_xContentsListBox->get_selected_index();
         SvxConfigEntry* pEntry
-            = 
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+            = 
weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
 
         css::uno::Reference<css::graphic::XGraphic> backup = 
pEntry->GetBackupGraphic();
 
@@ -569,7 +565,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const 
OString&, rIdent, void)
 
             m_xContentsListBox->remove(nActEntry);
 
-            OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+            OUString sId(weld::toId(pEntry));
             m_xContentsListBox->insert(nActEntry, sId);
             m_xContentsListBox->set_toggle(nActEntry,
                                            pEntry->IsVisible() ? TRISTATE_TRUE 
: TRISTATE_FALSE);
@@ -592,7 +588,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const 
OString&, rIdent, void)
     {
         int nActEntry = m_xContentsListBox->get_selected_index();
         SvxConfigEntry* pEntry
-            = 
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+            = 
weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry));
 
         ToolbarSaveInData* pSaveInData = 
static_cast<ToolbarSaveInData*>(GetSaveInData());
 
@@ -620,7 +616,7 @@ IMPL_LINK(SvxToolbarConfigPage, ModifyItemHdl, const 
OString&, rIdent, void)
 
             m_xContentsListBox->remove(nActEntry);
 
-            OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+            OUString sId(weld::toId(pEntry));
             m_xContentsListBox->insert(nActEntry, sId);
             m_xContentsListBox->set_toggle(nActEntry,
                                            pEntry->IsVisible() ? TRISTATE_TRUE 
: TRISTATE_FALSE);
@@ -655,7 +651,7 @@ IMPL_LINK_NOARG(SvxToolbarConfigPage, ResetToolbarHdl, 
weld::Button&, void)
     sal_Int32 nSelectionPos = m_xTopLevelListBox->get_active();
 
     SvxConfigEntry* pToolbar
-        = 
reinterpret_cast<SvxConfigEntry*>(m_xTopLevelListBox->get_id(nSelectionPos).toInt64());
+        = 
weld::fromId<SvxConfigEntry*>(m_xTopLevelListBox->get_id(nSelectionPos));
 
     std::unique_ptr<weld::MessageDialog> 
xQueryBox(Application::CreateMessageDialog(
         GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
@@ -677,8 +673,7 @@ void SvxToolbarConfigPage::UpdateButtonStates()
 
     bool bIsSeparator
         = selection != -1
-          && 
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(selection).toInt64())
-                 ->IsSeparator();
+          && 
weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(selection))->IsSeparator();
     bool bIsValidSelection = (m_xContentsListBox->n_children() != 0 && 
selection != -1);
 
     m_xMoveUpButton->set_sensitive(bIsValidSelection);
@@ -751,7 +746,7 @@ void SvxToolbarConfigPage::SelectElement()
     SvxEntries* pEntries = pToolbar->GetEntries();
     for (auto const& entry : *pEntries)
     {
-        OUString sId(OUString::number(reinterpret_cast<sal_Int64>(entry)));
+        OUString sId(weld::toId(entry));
         m_xContentsListBox->insert(i, sId);
         if (entry->IsBinding() && !entry->IsSeparator())
             m_xContentsListBox->set_toggle(i, entry->IsVisible() ? 
TRISTATE_TRUE : TRISTATE_FALSE);
@@ -775,8 +770,7 @@ void SvxToolbarConfigPage::AddFunction(int nTarget)
     if (nNewLBEntry == -1)
         return;
 
-    SvxConfigEntry* pEntry
-        = 
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nNewLBEntry).toInt64());
+    SvxConfigEntry* pEntry = 
weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nNewLBEntry));
 
     if (pEntry->IsBinding()) //TODO sep ?
     {
@@ -811,8 +805,7 @@ SvxToolbarEntriesListBox::~SvxToolbarEntriesListBox() {}
 
 void SvxToolbarEntriesListBox::ChangedVisibility(int nRow)
 {
-    SvxConfigEntry* pEntryData
-        = 
reinterpret_cast<SvxConfigEntry*>(m_xControl->get_id(nRow).toInt64());
+    SvxConfigEntry* pEntryData = 
weld::fromId<SvxConfigEntry*>(m_xControl->get_id(nRow));
 
     if (pEntryData->IsBinding())
     {
@@ -838,8 +831,7 @@ IMPL_LINK(SvxToolbarEntriesListBox, KeyInputHdl, const 
KeyEvent&, rKeyEvent, boo
     if (rKeyEvent.GetKeyCode() == KEY_SPACE)
     {
         int nRow = m_xControl->get_selected_index();
-        SvxConfigEntry* pEntryData
-            = 
reinterpret_cast<SvxConfigEntry*>(m_xControl->get_id(nRow).toInt64());
+        SvxConfigEntry* pEntryData = 
weld::fromId<SvxConfigEntry*>(m_xControl->get_id(nRow));
         if (pEntryData->IsBinding() && !pEntryData->IsSeparator())
         {
             m_xControl->set_toggle(nRow, m_xControl->get_toggle(nRow) == 
TRISTATE_TRUE
@@ -870,8 +862,7 @@ IMPL_LINK(SvxToolbarConfigPage, ContentContextMenuHdl, 
const CommandEvent&, rCEv
 
     bool bIsSeparator
         = nSelectIndex != -1
-          && 
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nSelectIndex).toInt64())
-                 ->IsSeparator();
+          && 
weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nSelectIndex))->IsSeparator();
     bool bIsValidSelection = (m_xContentsListBox->n_children() != 0 && 
nSelectIndex != -1);
 
     std::unique_ptr<weld::Builder> xBuilder(
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index 398ca509dbd7..09891003b784 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -804,7 +804,7 @@ IMPL_LINK(SfxAcceleratorConfigPage, KeyInputHdl, const 
KeyEvent&, rKey, bool)
 
     for (int i = 0, nCount = m_xEntriesBox->n_children(); i < nCount; ++i)
     {
-        TAccInfo* pUserData = 
reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(i).toInt64());
+        TAccInfo* pUserData = 
weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(i));
         if (pUserData)
         {
             sal_uInt16 nCode2 = pUserData->m_aKey.GetCode();
@@ -918,7 +918,7 @@ SfxAcceleratorConfigPage::~SfxAcceleratorConfigPage()
     // free memory - remove all dynamic user data
     for (int i = 0, nCount = m_xEntriesBox->n_children(); i < nCount; ++i)
     {
-        TAccInfo* pUserData = 
reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(i).toInt64());
+        TAccInfo* pUserData = 
weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(i));
         delete pUserData;
     }
 }
@@ -1003,7 +1003,7 @@ void SfxAcceleratorConfigPage::Init(const 
uno::Reference<ui::XAcceleratorConfigu
         if (sKey.isEmpty())
             continue;
         TAccInfo* pEntry = new TAccInfo(i1, 0 /*nListPos*/, aKey);
-        
m_xEntriesBox->append(OUString::number(reinterpret_cast<sal_Int64>(pEntry)), 
sKey);
+        m_xEntriesBox->append(weld::toId(pEntry), sKey);
         int nPos = m_xEntriesBox->n_children() - 1;
         m_xEntriesBox->set_text(nPos, OUString(), 1);
         m_xEntriesBox->set_sensitive(nPos, true);
@@ -1027,7 +1027,7 @@ void SfxAcceleratorConfigPage::Init(const 
uno::Reference<ui::XAcceleratorConfigu
 
         m_xEntriesBox->set_text(nPos, sLabel, 1);
 
-        TAccInfo* pEntry = 
reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(nPos).toInt64());
+        TAccInfo* pEntry = 
weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(nPos));
         pEntry->m_bIsConfigurable = true;
 
         pEntry->m_sCommand = sCommand;
@@ -1045,7 +1045,7 @@ void SfxAcceleratorConfigPage::Init(const 
uno::Reference<ui::XAcceleratorConfigu
             continue;
 
         // Hardcoded function mapped so no ID possible and mark entry as not 
changeable
-        TAccInfo* pEntry = 
reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(nPos).toInt64());
+        TAccInfo* pEntry = 
weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(nPos));
         pEntry->m_bIsConfigurable = false;
 
         m_xEntriesBox->set_sensitive(nPos, false);
@@ -1062,7 +1062,7 @@ void SfxAcceleratorConfigPage::Apply(const 
uno::Reference<ui::XAcceleratorConfig
     // physical ones!
     for (int i = 0, nCount = m_xEntriesBox->n_children(); i < nCount; ++i)
     {
-        TAccInfo* pUserData = 
reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(i).toInt64());
+        TAccInfo* pUserData = 
weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(i));
         OUString sCommand;
         awt::KeyEvent aAWTKey;
 
@@ -1141,7 +1141,7 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, ChangeHdl, 
weld::Button&, void)
     if (nPos == -1)
         return;
 
-    TAccInfo* pEntry = 
reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(nPos).toInt64());
+    TAccInfo* pEntry = weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(nPos));
     OUString sNewCommand = m_xFunctionBox->GetCurCommand();
     OUString sLabel = m_xFunctionBox->GetCurLabel();
     if (sLabel.isEmpty())
@@ -1160,7 +1160,7 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, RemoveHdl, 
weld::Button&, void)
     if (nPos == -1)
         return;
 
-    TAccInfo* pEntry = 
reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(nPos).toInt64());
+    TAccInfo* pEntry = weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(nPos));
 
     // remove function name from selected entry
     m_xEntriesBox->set_text(nPos, OUString(), 1);
@@ -1173,7 +1173,7 @@ IMPL_LINK(SfxAcceleratorConfigPage, SelectHdl, 
weld::TreeView&, rListBox, void)
 {
     if (&rListBox == m_xEntriesBox.get())
     {
-        TAccInfo* pEntry = 
reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_selected_id().toInt64());
+        TAccInfo* pEntry = 
weld::fromId<TAccInfo*>(m_xEntriesBox->get_selected_id());
 
         OUString sPossibleNewCommand = m_xFunctionBox->GetCurCommand();
 
@@ -1215,7 +1215,7 @@ IMPL_LINK(SfxAcceleratorConfigPage, SelectHdl, 
weld::TreeView&, rListBox, void)
         m_xChangeButton->set_sensitive(false);
 
         // #i36994 First selected can return null!
-        TAccInfo* pEntry = 
reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_selected_id().toInt64());
+        TAccInfo* pEntry = 
weld::fromId<TAccInfo*>(m_xEntriesBox->get_selected_id());
         if (pEntry)
         {
             OUString sPossibleNewCommand = m_xFunctionBox->GetCurCommand();
@@ -1234,12 +1234,10 @@ IMPL_LINK(SfxAcceleratorConfigPage, SelectHdl, 
weld::TreeView&, rListBox, void)
             {
                 for (int i = 0, nCount = m_xEntriesBox->n_children(); i < 
nCount; ++i)
                 {
-                    TAccInfo* pUserData
-                        = 
reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(i).toInt64());
+                    TAccInfo* pUserData = 
weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(i));
                     if (pUserData && pUserData->m_sCommand == 
sPossibleNewCommand)
                     {
-                        
m_xKeyBox->append(OUString::number(reinterpret_cast<sal_Int64>(pUserData)),
-                                          pUserData->m_aKey.GetName());
+                        m_xKeyBox->append(weld::toId(pUserData), 
pUserData->m_aKey.GetName());
                     }
                 }
             }
@@ -1249,7 +1247,7 @@ IMPL_LINK(SfxAcceleratorConfigPage, SelectHdl, 
weld::TreeView&, rListBox, void)
     {
         // goto selected "key" entry of the key box
         int nP2 = -1;
-        TAccInfo* pU2 = 
reinterpret_cast<TAccInfo*>(m_xKeyBox->get_selected_id().toInt64());
+        TAccInfo* pU2 = weld::fromId<TAccInfo*>(m_xKeyBox->get_selected_id());
         if (pU2)
             nP2 = MapKeyCodeToPos(pU2->m_aKey);
         if (nP2 != -1)
@@ -1528,7 +1526,7 @@ sal_Int32 SfxAcceleratorConfigPage::MapKeyCodeToPos(const 
vcl::KeyCode& aKey) co
     sal_uInt16 nCode1 = aKey.GetCode() + aKey.GetModifier();
     for (int i = 0, nCount = m_xEntriesBox->n_children(); i < nCount; ++i)
     {
-        TAccInfo* pUserData = 
reinterpret_cast<TAccInfo*>(m_xEntriesBox->get_id(i).toInt64());
+        TAccInfo* pUserData = 
weld::fromId<TAccInfo*>(m_xEntriesBox->get_id(i));
         if (pUserData)
         {
             sal_uInt16 nCode2 = pUserData->m_aKey.GetCode() + 
pUserData->m_aKey.GetModifier();
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index dc4788b7a983..53e8b8580a4c 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -1021,7 +1021,7 @@ SvxConfigPage::~SvxConfigPage()
     int cnt = m_xSaveInListBox->get_count();
     for(int i=0; i < cnt; ++i)
     {
-        SaveInData *pData = 
reinterpret_cast<SaveInData*>(m_xSaveInListBox->get_id(i).toInt64());
+        SaveInData *pData = 
weld::fromId<SaveInData*>(m_xSaveInListBox->get_id(i));
         delete pData;
     }
 }
@@ -1073,7 +1073,7 @@ void SvxConfigPage::Reset( const SfxItemSet* )
 
         if ( pModuleData != nullptr )
         {
-            OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(pModuleData)));
+            OUString sId(weld::toId(pModuleData));
             m_xSaveInListBox->append(sId, utl::ConfigManager::getProductName() 
+ " " + aModuleName);
         }
 
@@ -1104,7 +1104,7 @@ void SvxConfigPage::Reset( const SfxItemSet* )
 
             if ( !pDocData->IsReadOnly() )
             {
-                OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(pDocData)));
+                OUString sId(weld::toId(pDocData));
                 m_xSaveInListBox->append(sId, aTitle);
             }
         }
@@ -1213,7 +1213,7 @@ void SvxConfigPage::Reset( const SfxItemSet* )
 
                             if ( pData && !pData->IsReadOnly() )
                             {
-                                OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(pData)));
+                                OUString sId(weld::toId(pData));
                                 m_xSaveInListBox->append(sId, aTitle2);
                             }
                         }
@@ -1283,7 +1283,7 @@ OUString SvxConfigPage::GetScriptURL() const
 {
     OUString result;
 
-    SfxGroupInfo_Impl *pData = 
reinterpret_cast<SfxGroupInfo_Impl*>(m_xFunctions->get_selected_id().toInt64());
+    SfxGroupInfo_Impl *pData = 
weld::fromId<SfxGroupInfo_Impl*>(m_xFunctions->get_selected_id());
     if (pData)
     {
         if  (   ( pData->nKind == SfxCfgKind::FUNCTION_SLOT ) ||
@@ -1311,7 +1311,7 @@ bool SvxConfigPage::FillItemSet( SfxItemSet* )
         OUString sId = m_xSaveInListBox->get_id(i);
         if (sId != notebookbarTabScope)
         {
-            SaveInData* pData = reinterpret_cast<SaveInData*>(sId.toInt64());
+            SaveInData* pData = weld::fromId<SaveInData*>(sId);
             result = pData->Apply();
         }
     }
@@ -1322,7 +1322,7 @@ IMPL_LINK_NOARG(SvxConfigPage, SelectSaveInLocation, 
weld::ComboBox&, void)
 {
     OUString sId = m_xSaveInListBox->get_active_id();
     if (sId != notebookbarTabScope)
-        pCurrentSaveInData = reinterpret_cast<SaveInData*>(sId.toInt64());
+        pCurrentSaveInData = weld::fromId<SaveInData*>(sId);
     Init();
 }
 
@@ -1335,7 +1335,7 @@ void SvxConfigPage::ReloadTopLevelListBox( SvxConfigEntry 
const * pToSelect )
     {
         for (auto const& entryData : *GetSaveInData()->GetEntries())
         {
-            OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(entryData)));
+            OUString sId(weld::toId(entryData));
             m_xTopLevelListBox->append(sId, 
SvxConfigPageHelper::stripHotKey(entryData->GetName()));
 
             if (entryData == pToSelect)
@@ -1369,7 +1369,7 @@ void SvxConfigPage::AddSubMenusToUI(
         {
             OUString subMenuTitle = OUString::Concat(rBaseTitle) + 
aMenuSeparatorStr + SvxConfigPageHelper::stripHotKey(entryData->GetName());
 
-            OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(entryData)));
+            OUString sId(weld::toId(entryData));
             m_xTopLevelListBox->append(sId, subMenuTitle);
 
             AddSubMenusToUI( subMenuTitle, entryData );
@@ -1494,7 +1494,7 @@ int SvxConfigPage::AppendEntry(
     int nCurEntry =
         nTarget != -1 ? nTarget : m_xContentsListBox->get_selected_index();
 
-    OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewEntryData)));
+    OUString sId(weld::toId(pNewEntryData));
 
     if (nCurEntry == -1 || nCurEntry == m_xContentsListBox->n_children() - 1)
     {
@@ -1505,7 +1505,7 @@ int SvxConfigPage::AppendEntry(
     else
     {
         SvxConfigEntry* pEntryData =
-            
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nCurEntry).toInt64());
+            
weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nCurEntry));
 
         SvxEntries::iterator iter = pEntries->begin();
         SvxEntries::const_iterator end = pEntries->end();
@@ -1547,7 +1547,7 @@ namespace
     template<typename itertype> void TmplInsertEntryIntoUI(SvxConfigEntry* 
pNewEntryData, weld::TreeView& rTreeView, itertype& rIter, SaveInData* 
pSaveInData,
                                                            VirtualDevice& 
rDropDown, bool bMenu)
     {
-        OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(pNewEntryData)));
+        OUString sId(weld::toId(pNewEntryData));
 
         rTreeView.set_id(rIter, sId);
 
@@ -1617,7 +1617,7 @@ IMPL_LINK_NOARG(SvxConfigPage, SelectFunctionHdl, 
weld::TreeView&, void)
         }
         else
         {
-            SfxGroupInfo_Impl *pData = 
reinterpret_cast<SfxGroupInfo_Impl*>(m_xFunctions->get_selected_id().toInt64());
+            SfxGroupInfo_Impl *pData = 
weld::fromId<SfxGroupInfo_Impl*>(m_xFunctions->get_selected_id());
             if (pData)
             {
                 bool bIsExperimental
@@ -1715,10 +1715,10 @@ bool SvxConfigPage::MoveEntryData(int nSourceEntry, int 
nTargetEntry)
     SvxEntries* pEntries = GetTopLevelSelection()->GetEntries();
 
     SvxConfigEntry* pSourceData =
-        
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nSourceEntry).toInt64());
+        
weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nSourceEntry));
 
     SvxConfigEntry* pTargetData =
-        
reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nTargetEntry).toInt64());
+        
weld::fromId<SvxConfigEntry*>(m_xContentsListBox->get_id(nTargetEntry));
 
     if ( pSourceData == nullptr || pTargetData == nullptr )
         return false;
@@ -1759,7 +1759,7 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
         mpEntries.reset( new SvxEntries );
         for (auto const& entry : *entries)
         {
-            
m_xMenuListBox->append(OUString::number(reinterpret_cast<sal_uInt64>(entry)),
+            m_xMenuListBox->append(weld::toId(entry),
                                    
SvxConfigPageHelper::stripHotKey(entry->GetName()));
             mpEntries->push_back(entry);
             if (entry == selection)
@@ -1783,7 +1783,7 @@ SvxMainMenuOrganizerDialog::SvxMainMenuOrganizerDialog(
         pNewEntryData->SetUserDefined();
         pNewEntryData->SetMain();
 
-        m_sNewMenuEntryId = 
OUString::number(reinterpret_cast<sal_uInt64>(pNewEntryData));
+        m_sNewMenuEntryId = weld::toId(pNewEntryData);
         m_xMenuListBox->append(m_sNewMenuEntryId,
                                
SvxConfigPageHelper::stripHotKey(pNewEntryData->GetName()));
         m_xMenuListBox->select(m_xMenuListBox->n_children() - 1);
@@ -1822,7 +1822,7 @@ IMPL_LINK_NOARG(SvxMainMenuOrganizerDialog, ModifyHdl, 
weld::Entry&, void)
         return;
     }
 
-    SvxConfigEntry* pNewEntryData = 
reinterpret_cast<SvxConfigEntry*>(m_sNewMenuEntryId.toUInt64());
+    SvxConfigEntry* pNewEntryData = 
weld::fromId<SvxConfigEntry*>(m_sNewMenuEntryId);
     pNewEntryData->SetName(m_xMenuNameEdit->get_text());
 
     const int nNewMenuPos = m_xMenuListBox->find_id(m_sNewMenuEntryId);
@@ -1879,7 +1879,7 @@ SvxConfigEntry* 
SvxMainMenuOrganizerDialog::GetSelectedEntry()
     const int nSelected(m_xMenuListBox->get_selected_index());
     if (nSelected == -1)
         return nullptr;
-    return 
reinterpret_cast<SvxConfigEntry*>(m_xMenuListBox->get_id(nSelected).toUInt64());
+    return weld::fromId<SvxConfigEntry*>(m_xMenuListBox->get_id(nSelected));
 }
 
 SvxConfigEntry::SvxConfigEntry( const OUString& rDisplayName,
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index baf37c92ce8a..aab25aa9bb8d 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -242,7 +242,7 @@ std::vector< SfxStyleInfo_Impl > 
SfxStylesInfo_Impl::getStyles(const OUString& s
 
 OUString CuiConfigFunctionListBox::GetHelpText( bool bConsiderParent )
 {
-    SfxGroupInfo_Impl *pData = 
reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
+    SfxGroupInfo_Impl *pData = 
weld::fromId<SfxGroupInfo_Impl*>(get_selected_id());
     if (pData)
     {
         if ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
@@ -262,7 +262,7 @@ OUString CuiConfigFunctionListBox::GetHelpText( bool 
bConsiderParent )
 
 OUString CuiConfigFunctionListBox::GetCurCommand() const
 {
-    SfxGroupInfo_Impl *pData = 
reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
+    SfxGroupInfo_Impl *pData = 
weld::fromId<SfxGroupInfo_Impl*>(get_selected_id());
     if (!pData)
         return OUString();
     return pData->sCommand;
@@ -270,7 +270,7 @@ OUString CuiConfigFunctionListBox::GetCurCommand() const
 
 OUString CuiConfigFunctionListBox::GetCurLabel() const
 {
-    SfxGroupInfo_Impl *pData = 
reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
+    SfxGroupInfo_Impl *pData = 
weld::fromId<SfxGroupInfo_Impl*>(get_selected_id());
     if (!pData)
         return OUString();
     if (!pData->sLabel.isEmpty())
@@ -294,7 +294,7 @@ CuiConfigFunctionListBox::~CuiConfigFunctionListBox()
 
 IMPL_LINK(CuiConfigFunctionListBox, QueryTooltip, const weld::TreeIter&, 
rIter, OUString)
 {
-    SfxGroupInfo_Impl *pData = 
reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(rIter).toInt64());
+    SfxGroupInfo_Impl *pData = 
weld::fromId<SfxGroupInfo_Impl*>(m_xTreeView->get_id(rIter));
     if (!pData)
         return OUString();
     OUString aLabel = CuiResId(RID_CUISTR_COMMANDLABEL) + ": ";
@@ -336,7 +336,7 @@ void CuiConfigFunctionListBox::ClearAll()
 
 OUString CuiConfigFunctionListBox::GetSelectedScriptURI() const
 {
-    SfxGroupInfo_Impl *pData = 
reinterpret_cast<SfxGroupInfo_Impl*>(get_selected_id().toInt64());
+    SfxGroupInfo_Impl *pData = 
weld::fromId<SfxGroupInfo_Impl*>(get_selected_id());
     if (pData && pData->nKind == SfxCfgKind::FUNCTION_SCRIPT)
         return *static_cast<OUString*>(pData->pObject);
     return OUString();
@@ -480,8 +480,7 @@ void CuiConfigGroupListBox::InitModule()
         {
             // Add All Commands category
             
aArr.push_back(std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_ALLFUNCTIONS,
 0));
-            
m_xTreeView->append(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())),
-                                CuiResId(RID_CUISTR_ALLFUNCTIONS));
+            m_xTreeView->append(weld::toId(aArr.back().get()), 
CuiResId(RID_CUISTR_ALLFUNCTIONS));
         }
 
         for (i1=0; i1<c1; ++i1)
@@ -500,8 +499,7 @@ void CuiConfigGroupListBox::InitModule()
                 { continue; }
 
             aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( 
SfxCfgKind::GROUP_FUNCTION, nGroupID ) );
-            
m_xTreeView->append(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())),
-                                sGroupName);
+            m_xTreeView->append(weld::toId(aArr.back().get()), sGroupName);
         }
     }
     catch(const css::uno::RuntimeException&)
@@ -594,7 +592,7 @@ void CuiConfigGroupListBox::FillScriptList(const 
css::uno::Reference< css::scrip
                     aArr.push_back( 
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SCRIPTCONTAINER,
                             0, static_cast<void *>( theChild.get())));
 
-                    OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
+                    OUString sId(weld::toId(aArr.back().get()));
                     m_xTreeView->insert(pParentEntry, -1, &uiName, &sId, 
nullptr, nullptr, bChildOnDemand, m_xScratchIter.get());
                     m_xTreeView->set_image(*m_xScratchIter, aImage);
                 }
@@ -619,7 +617,7 @@ void CuiConfigGroupListBox::FillFunctionsList(const 
css::uno::Sequence<DispatchI
         pGrpInfo->sCommand = rInfo.Command;
         pGrpInfo->sLabel   = sUIName;
         pGrpInfo->sTooltip = 
vcl::CommandInfoProvider::GetTooltipForCommand(rInfo.Command, aProperties, 
m_xFrame);
-        
m_pFunctionListBox->append(OUString::number(reinterpret_cast<sal_Int64>(pGrpInfo)),
 sUIName);
+        m_pFunctionListBox->append(weld::toId(pGrpInfo), sUIName);
     }
     m_pFunctionListBox->thaw();
 }
@@ -670,7 +668,7 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< 
css::uno::XComponent
             aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( 
SfxCfgKind::GROUP_SCRIPTCONTAINER, 0,
                     static_cast<void *>(rootNode.get())));
             OUString aTitle(xImp->m_sDlgMacros);
-            OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
+            OUString sId(weld::toId(aArr.back().get()));
             m_xTreeView->insert(nullptr, -1, &aTitle, &sId, nullptr, nullptr, 
true, nullptr);
         }
         else
@@ -686,12 +684,12 @@ void CuiConfigGroupListBox::Init(const 
css::uno::Reference< css::uno::XComponent
     {
         aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( 
SfxCfgKind::GROUP_STYLES, 0, nullptr ) ); // TODO last parameter should contain 
user data
         OUString sStyle(xImp->m_aStrGroupStyles);
-        OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
+        OUString sId(weld::toId(aArr.back().get()));
         m_xTreeView->insert(nullptr, -1, &sStyle, &sId, nullptr, nullptr, 
true, nullptr);
 
         aArr.push_back( 
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SIDEBARDECKS, 0));
         OUString sSidebarDecks(xImp->m_aStrGroupSidebarDecks);
-        sId = OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get()));
+        sId = weld::toId(aArr.back().get());
         m_xTreeView->insert(nullptr, -1, &sSidebarDecks, &sId, nullptr, 
nullptr, false, nullptr);
     }
 
@@ -826,7 +824,7 @@ void CuiConfigGroupListBox::GroupSelected()
     if (!m_xTreeView->get_selected(xIter.get()))
         return;
 
-    SfxGroupInfo_Impl *pInfo = 
reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(*xIter).toInt64());
+    SfxGroupInfo_Impl *pInfo = 
weld::fromId<SfxGroupInfo_Impl*>(m_xTreeView->get_id(*xIter));
     m_pFunctionListBox->freeze();
     m_pFunctionListBox->ClearAll();
 
@@ -838,7 +836,7 @@ void CuiConfigGroupListBox::GroupSelected()
             bool bValidIter = m_xTreeView->get_iter_first(*xIter);
             while (bValidIter)
             {
-                SfxGroupInfo_Impl *pCurrentInfo = 
reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(*xIter).toInt64());
+                SfxGroupInfo_Impl *pCurrentInfo = 
weld::fromId<SfxGroupInfo_Impl*>(m_xTreeView->get_id(*xIter));
                 if (pCurrentInfo->nKind == SfxCfgKind::GROUP_FUNCTION)
                 {
                     css::uno::Sequence< css::frame::DispatchInformation > 
lCommands;
@@ -911,7 +909,7 @@ void CuiConfigGroupListBox::GroupSelected()
                                 m_pFunctionListBox->aArr.back()->sLabel = 
childNode->getName();
                                 m_pFunctionListBox->aArr.back()->sHelpText = 
description;
 
-                                OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(m_pFunctionListBox->aArr.back().get())));
+                                OUString 
sId(weld::toId(m_pFunctionListBox->aArr.back().get()));
                                 m_pFunctionListBox->append(sId, 
childNode->getName(), aImage);
                             }
                         }
@@ -936,7 +934,7 @@ void CuiConfigGroupListBox::GroupSelected()
                     
m_pFunctionListBox->aArr.push_back(std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_STYLES,
 0, pStyle));
                     m_pFunctionListBox->aArr.back()->sCommand = 
pStyle->sCommand;
                     m_pFunctionListBox->aArr.back()->sLabel = pStyle->sLabel;
-                    OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(m_pFunctionListBox->aArr.back().get())));
+                    OUString 
sId(weld::toId(m_pFunctionListBox->aArr.back().get()));
                     m_pFunctionListBox->append(sId, pStyle->sLabel);
                 }
             }
@@ -960,8 +958,7 @@ void CuiConfigGroupListBox::GroupSelected()
                 m_pFunctionListBox->aArr.back()->sLabel = rDeck.msId;
                 m_pFunctionListBox->aArr.back()->sTooltip =
                         vcl::CommandInfoProvider::GetCommandShortcut(sCommand, 
m_xFrame);
-                
m_pFunctionListBox->append(OUString::number(reinterpret_cast<sal_Int64>(
-                                                 
m_pFunctionListBox->aArr.back().get())),
+                
m_pFunctionListBox->append(weld::toId(m_pFunctionListBox->aArr.back().get()),
                                            rDeck.msId);
             }
 
@@ -985,7 +982,7 @@ void CuiConfigGroupListBox::GroupSelected()
 */
 IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, const weld::TreeIter&, rIter, 
bool)
 {
-    SfxGroupInfo_Impl *pInfo = 
reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(rIter).toInt64());
+    SfxGroupInfo_Impl *pInfo = 
weld::fromId<SfxGroupInfo_Impl*>(m_xTreeView->get_id(rIter));
     switch ( pInfo->nKind )
     {
         case SfxCfgKind::GROUP_SCRIPTCONTAINER:
@@ -1008,7 +1005,7 @@ IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, const 
weld::TreeIter&, rIter, boo
                 {
                     SfxStyleInfo_Impl* pFamily = new 
SfxStyleInfo_Impl(lStyleFamily);
                     aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( 
SfxCfgKind::GROUP_STYLES, 0, pFamily ));
-                    OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(aArr.back().get())));
+                    OUString sId(weld::toId(aArr.back().get()));
                     m_xTreeView->insert(&rIter, -1, &pFamily->sLabel, &sId, 
nullptr, nullptr, false, nullptr);
                 }
             }
@@ -1255,7 +1252,7 @@ SvxScriptSelectorDialog::GetScriptURL() const
     std::unique_ptr<weld::TreeIter> xIter = m_xCommands->make_iterator();
     if (m_xCommands->get_selected(xIter.get()))
     {
-        SfxGroupInfo_Impl *pData = 
reinterpret_cast<SfxGroupInfo_Impl*>(m_xCommands->get_id(*xIter).toInt64());
+        SfxGroupInfo_Impl *pData = 
weld::fromId<SfxGroupInfo_Impl*>(m_xCommands->get_id(*xIter));
         if  (   ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
             ||  ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
             ||  ( pData->nKind == SfxCfgKind::GROUP_STYLES )
diff --git a/cui/source/dialogs/cuicharmap.cxx 
b/cui/source/dialogs/cuicharmap.cxx
index 0cba92656090..0d7f5b57e7eb 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -691,7 +691,7 @@ IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl, 
weld::ComboBox&, void)
         // update subset listbox for new font's unicode subsets
         for (auto const& subset : pSubsetMap->GetSubsetMap())
         {
-            
m_xSubsetLB->append(OUString::number(reinterpret_cast<sal_uInt64>(&subset)), 
subset.GetName());
+            m_xSubsetLB->append(weld::toId(&subset), subset.GetName());
             // NOTE: subset must live at least as long as the selected font
         }
 
@@ -748,7 +748,7 @@ void SvxCharacterMap::setCharName(sal_UCS4 nDecimalValue)
 IMPL_LINK_NOARG(SvxCharacterMap, SubsetSelectHdl, weld::ComboBox&, void)
 {
     const sal_Int32 nPos = m_xSubsetLB->get_active();
-    const Subset* pSubset = reinterpret_cast<const 
Subset*>(m_xSubsetLB->get_active_id().toUInt64());
+    const Subset* pSubset = weld::fromId<const 
Subset*>(m_xSubsetLB->get_active_id());
 
     if( pSubset && !isSearchMode)
     {
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index c8233360ce7a..966b7cceb483 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -92,7 +92,7 @@ bool SvxHyperlinkNewDocTp::ImplGetURLObject( const OUString& 
rPath, const OUStri
         {
             sal_Int32 nPos = m_xLbDocTypes->get_selected_index();
             if (nPos != -1)
-                
aURLObject.SetExtension(reinterpret_cast<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos).toInt64())->aStrExt);
+                
aURLObject.SetExtension(weld::fromId<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos))->aStrExt);
         }
 
     }
@@ -136,7 +136,7 @@ SvxHyperlinkNewDocTp::~SvxHyperlinkNewDocTp ()
     if (m_xLbDocTypes)
     {
         for (sal_Int32 n = 0, nEntryCount = m_xLbDocTypes->n_children(); n < 
nEntryCount; ++n)
-            delete 
reinterpret_cast<DocumentTypeData*>(m_xLbDocTypes->get_id(n).toInt64());
+            delete weld::fromId<DocumentTypeData*>(m_xLbDocTypes->get_id(n));
         m_xLbDocTypes = nullptr;
     }
 }
@@ -184,7 +184,7 @@ void SvxHyperlinkNewDocTp::FillDocumentList()
 
                 OUString aStrDefExt(pFilter->GetDefaultExtension());
                 DocumentTypeData *pTypeData = new 
DocumentTypeData(aDocumentUrl, aStrDefExt.copy(2));
-                OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(pTypeData)));
+                OUString sId(weld::toId(pTypeData));
                 m_xLbDocTypes->append(sId, aTitleName);
             }
         }
@@ -367,7 +367,7 @@ void SvxHyperlinkNewDocTp::DoApply()
     if (nPos == -1)
         nPos = 0;
     pExecuteInfo->aURL = aURL;
-    pExecuteInfo->aStrDocName = 
reinterpret_cast<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos).toInt64())->aStrURL;
+    pExecuteInfo->aStrDocName = 
weld::fromId<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos))->aStrURL;
 
     // current document
     pExecuteInfo->xFrame = 
GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface();
@@ -431,7 +431,7 @@ IMPL_LINK_NOARG(SvxHyperlinkNewDocTp, ClickNewHdl_Impl, 
weld::Button&, void)
     {
         // get private-url
         const sal_Int32 nPos = m_xLbDocTypes->get_selected_index();
-        
aNewURL.setExtension(reinterpret_cast<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos).toInt64())->aStrExt);
+        
aNewURL.setExtension(weld::fromId<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos))->aStrExt);
     }
 
     if( aNewURL.GetProtocol() == INetProtocol::File )
diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx
index c317e26792e6..9c441629bb6b 100644
--- a/cui/source/dialogs/hlmarkwn.cxx
+++ b/cui/source/dialogs/hlmarkwn.cxx
@@ -334,7 +334,7 @@ int SvxHlinkDlgMarkWnd::FillTree( const uno::Reference< 
container::XNameAccess >
 
                 // create userdata
                 TargetData *pData = new TargetData ( aLink, bIsTarget );
-                OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(pData)));
+                OUString sId(weld::toId(pData));
 
                 std::unique_ptr<weld::TreeIter> 
xEntry(mxLbTree->make_iterator());
                 if (pParentEntry)
@@ -420,7 +420,7 @@ void SvxHlinkDlgMarkWnd::ClearTree()
 
     while (bEntry)
     {
-        TargetData* pUserData = 
reinterpret_cast<TargetData*>(mxLbTree->get_id(*xEntry).toInt64());
+        TargetData* pUserData = 
weld::fromId<TargetData*>(mxLbTree->get_id(*xEntry));
         delete pUserData;
 
         bEntry = mxLbTree->iter_next(*xEntry);
@@ -438,7 +438,7 @@ std::unique_ptr<weld::TreeIter> 
SvxHlinkDlgMarkWnd::FindEntry (std::u16string_vi
 
     while (bEntry && !bFound)
     {
-        TargetData* pUserData = 
reinterpret_cast<TargetData*>(mxLbTree->get_id(*xEntry).toInt64());
+        TargetData* pUserData = 
weld::fromId<TargetData*>(mxLbTree->get_id(*xEntry));
         if (aStrName == pUserData->aUStrLinkname)
             bFound = true;
         else
@@ -475,7 +475,7 @@ IMPL_LINK_NOARG(SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl, 
weld::Button&, void)
     bool bEntry = mxLbTree->get_cursor(xEntry.get());
     if (bEntry)
     {
-        TargetData* pData = 
reinterpret_cast<TargetData*>(mxLbTree->get_id(*xEntry).toInt64());
+        TargetData* pData = 
weld::fromId<TargetData*>(mxLbTree->get_id(*xEntry));
         if (pData->bIsTarget)
         {
             mpParent->SetMarkStr(pData->aUStrLinkname);
@@ -490,7 +490,7 @@ IMPL_LINK_NOARG(SvxHlinkDlgMarkWnd, ClickCloseHdl_Impl, 
weld::Button&, void)
     bool bEntry = mxLbTree->get_cursor(xEntry.get());
     if (bEntry)
     {
-        TargetData* pUserData = 
reinterpret_cast<TargetData*>(mxLbTree->get_id(*xEntry).toInt64());
+        TargetData* pUserData = 
weld::fromId<TargetData*>(mxLbTree->get_id(*xEntry));
         OUString sLastSelectedMark = pUserData->aUStrLinkname;
 
         std::deque<OUString> aLastSelectedPath;
diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index ffee53198b39..055721d739a0 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -149,7 +149,7 @@ void SvBaseLinksDlg::LinksSelectHdl(weld::TreeView* 
pSvTabListBox)
     {
         // possibly deselect old entries in case of multi-selection
         int nSelEntry = pSvTabListBox->get_selected_index();
-        SvBaseLink* pLink = 
reinterpret_cast<SvBaseLink*>(pSvTabListBox->get_id(nSelEntry).toInt64());
+        SvBaseLink* pLink = 
weld::fromId<SvBaseLink*>(pSvTabListBox->get_id(nSelEntry));
         SvBaseLinkObjectType nObjectType = pLink->GetObjType();
         if(!isClientFileType(nObjectType))
         {
@@ -161,7 +161,7 @@ void SvBaseLinksDlg::LinksSelectHdl(weld::TreeView* 
pSvTabListBox)
             std::vector<int> aRows = pSvTabListBox->get_selected_rows();
             for (auto nEntry : aRows)
             {
-                pLink = 
reinterpret_cast<SvBaseLink*>(pSvTabListBox->get_id(nEntry).toInt64());
+                pLink = 
weld::fromId<SvBaseLink*>(pSvTabListBox->get_id(nEntry));
                 DBG_ASSERT(pLink, "Where is the Link?");
                 if (!pLink)
                     continue;
@@ -255,7 +255,7 @@ IMPL_LINK_NOARG(SvBaseLinksDlg, UpdateNowClickHdl, 
weld::Button&, void)
     std::vector<int> aRows = m_xTbLinks->get_selected_rows();
     for (int nFndPos : aRows)
     {
-        aLnkArr.push_back( reinterpret_cast<SvBaseLink*>( 
m_xTbLinks->get_id(nFndPos).toInt64() ) );
+        aLnkArr.push_back( weld::fromId<SvBaseLink*>( 
m_xTbLinks->get_id(nFndPos) ) );
         aPosArr.push_back( nFndPos );
     }
 
@@ -281,7 +281,7 @@ IMPL_LINK_NOARG(SvBaseLinksDlg, UpdateNowClickHdl, 
weld::Button&, void)
     SetManager( pNewMgr );
 
 
-    OUString sId = OUString::number(reinterpret_cast<sal_Int64>(aLnkArr[0]));
+    OUString sId = weld::toId(aLnkArr[0]);
     int nE = m_xTbLinks->find_id(sId);
     if (nE == -1)
         nE = m_xTbLinks->get_selected_index();
@@ -306,7 +306,7 @@ IMPL_LINK_NOARG(SvBaseLinksDlg, ChangeSourceClickHdl, 
weld::Button&, void)
 
             OUString sType, sFile, sLinkName;
             OUString sFilter;
-            SvBaseLink* pLink = 
reinterpret_cast<SvBaseLink*>(m_xTbLinks->get_id(aRows[0]).toInt64());
+            SvBaseLink* pLink = 
weld::fromId<SvBaseLink*>(m_xTbLinks->get_id(aRows[0]));
             sfx2::LinkManager::GetDisplayNames( pLink, &sType, &sFile );
             INetURLObject aUrl(sFile);
             if(aUrl.GetProtocol() == INetProtocol::File)
@@ -322,7 +322,7 @@ IMPL_LINK_NOARG(SvBaseLinksDlg, ChangeSourceClickHdl, 
weld::Button&, void)
 
                 for (auto nRow : aRows)
                 {
-                    pLink = 
reinterpret_cast<SvBaseLink*>(m_xTbLinks->get_id(nRow).toInt64());
+                    pLink = 
weld::fromId<SvBaseLink*>(m_xTbLinks->get_id(nRow));
                     DBG_ASSERT(pLink,"Where is the link?");
                     if (!pLink)
                         continue;
@@ -409,7 +409,7 @@ IMPL_LINK_NOARG( SvBaseLinksDlg, BreakLinkClickHdl, 
weld::Button&, void )
             SvBaseLinkMemberList aLinkList;
             for (auto nRow : aRows)
             {
-                SvBaseLink* pLink = 
reinterpret_cast<SvBaseLink*>(m_xTbLinks->get_id(nRow).toInt64());
+                SvBaseLink* pLink = 
weld::fromId<SvBaseLink*>(m_xTbLinks->get_id(nRow));
                 if (pLink)
                     aLinkList.push_back(pLink);
             }
@@ -452,7 +452,7 @@ IMPL_LINK_NOARG( SvBaseLinksDlg, UpdateWaitingHdl, Timer*, 
void )
     m_xTbLinks->freeze();
     for (int nPos = m_xTbLinks->n_children(); nPos; --nPos)
     {
-        tools::SvRef<SvBaseLink> xLink( 
reinterpret_cast<SvBaseLink*>(m_xTbLinks->get_id(nPos).toInt64()) );
+        tools::SvRef<SvBaseLink> xLink( 
weld::fromId<SvBaseLink*>(m_xTbLinks->get_id(nPos)) );
         if( xLink.is() )
         {
             OUString sCur( ImplGetStateStr( *xLink ) ),
@@ -583,7 +583,7 @@ void SvBaseLinksDlg::InsertEntry(const SvBaseLink& rLink, 
int nPos, bool bSelect
         nPos = m_xTbLinks->n_children();
     m_xTbLinks->insert(nPos);
     m_xTbLinks->set_text(nPos, aTxt, 0);
-    m_xTbLinks->set_id(nPos, 
OUString::number(reinterpret_cast<sal_Int64>(&rLink)));
+    m_xTbLinks->set_id(nPos, weld::toId(&rLink));
     if( SvBaseLinkObjectType::ClientGraphic == rLink.GetObjType() )
         m_xTbLinks->set_text(nPos, sFilter, 1);
     else
@@ -601,7 +601,7 @@ SvBaseLink* SvBaseLinksDlg::GetSelEntry(int* pPos)
     {
         if (pPos)
             *pPos = nPos;
-        return 
reinterpret_cast<SvBaseLink*>(m_xTbLinks->get_id(nPos).toInt64());
+        return weld::fromId<SvBaseLink*>(m_xTbLinks->get_id(nPos));
     }
     return nullptr;
 }
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 61df93178f90..4294e56ebac0 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -63,7 +63,7 @@ using namespace css::document;
 
 void SvxScriptOrgDialog::delUserData(const weld::TreeIter& rIter)
 {
-    SFEntry* pUserData = 
reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(rIter).toInt64());
+    SFEntry* pUserData = weld::fromId<SFEntry*>(m_xScriptsBox->get_id(rIter));
     if (pUserData)
     {
         delete pUserData;
@@ -313,7 +313,7 @@ void SvxScriptOrgDialog::insertEntry(
     const OUString& rText, const OUString& rBitmap, const weld::TreeIter* 
pParent,
     bool bChildrenOnDemand, std::unique_ptr<SFEntry> && aUserData, bool 
bSelect)
 {
-    OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(aUserData.release()))); // XXX 
possible leak
+    OUString sId(weld::toId(aUserData.release())); // XXX possible leak
     m_xScriptsBox->insert(pParent, -1, &rText, &sId, nullptr, nullptr,
                           bChildrenOnDemand, m_xScratchIter.get());
     m_xScriptsBox->set_image(*m_xScratchIter, rBitmap);
@@ -326,7 +326,7 @@ void SvxScriptOrgDialog::insertEntry(
 
 IMPL_LINK(SvxScriptOrgDialog, ExpandingHdl, const weld::TreeIter&, rIter, bool)
 {
-    SFEntry* userData = 
reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(rIter).toInt64());
+    SFEntry* userData = weld::fromId<SFEntry*>(m_xScriptsBox->get_id(rIter));
 
     Reference< browse::XBrowseNode > node;
     Reference< XModel > model;
@@ -530,7 +530,7 @@ IMPL_LINK_NOARG(SvxScriptOrgDialog, ScriptSelectHdl, 
weld::TreeView&, void)
     if (!m_xScriptsBox->get_selected(xIter.get()))
         return;
 
-    SFEntry* userData = 
reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(*xIter).toInt64());
+    SFEntry* userData = weld::fromId<SFEntry*>(m_xScriptsBox->get_id(*xIter));
 
     Reference< browse::XBrowseNode > node;
     if (userData)
@@ -558,7 +558,7 @@ IMPL_LINK(SvxScriptOrgDialog, ButtonHdl, weld::Button&, 
rButton, void)
     std::unique_ptr<weld::TreeIter> xIter = m_xScriptsBox->make_iterator();
     if (!m_xScriptsBox->get_selected(xIter.get()))
         return;
-    SFEntry* userData = 
reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(*xIter).toInt64());
+    SFEntry* userData = weld::fromId<SFEntry*>(m_xScriptsBox->get_id(*xIter));
     if (!userData)
         return;
 
@@ -602,7 +602,7 @@ IMPL_LINK(SvxScriptOrgDialog, ButtonHdl, weld::Button&, 
rButton, void)
         bool bParent = m_xScriptsBox->iter_parent(*xParentIter);
         while (bParent && !mspNode.is() )
         {
-            SFEntry* mspUserData = 
reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(*xParentIter).toInt64());
+            SFEntry* mspUserData = 
weld::fromId<SFEntry*>(m_xScriptsBox->get_id(*xParentIter));
             mspNode.set( mspUserData->GetNode() , UNO_QUERY );
             bParent = m_xScriptsBox->iter_parent(*xParentIter);
         }
@@ -679,7 +679,7 @@ IMPL_LINK(SvxScriptOrgDialog, ButtonHdl, weld::Button&, 
rButton, void)
 Reference< browse::XBrowseNode > SvxScriptOrgDialog::getBrowseNode(const 
weld::TreeIter& rEntry)
 {
     Reference< browse::XBrowseNode > node;
-    SFEntry* userData = 
reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(rEntry).toInt64());
+    SFEntry* userData = weld::fromId<SFEntry*>(m_xScriptsBox->get_id(rEntry));
     if (userData)
     {
         node = userData->GetNode();
@@ -690,7 +690,7 @@ Reference< browse::XBrowseNode > 
SvxScriptOrgDialog::getBrowseNode(const weld::T
 Reference< XModel > SvxScriptOrgDialog::getModel(const weld::TreeIter& rEntry)
 {
     Reference< XModel > model;
-    SFEntry* userData = 
reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(rEntry).toInt64());
+    SFEntry* userData = weld::fromId<SFEntry*>(m_xScriptsBox->get_id(rEntry));
     if ( userData )
     {
         model = userData->GetModel();
@@ -852,7 +852,7 @@ void SvxScriptOrgDialog::createEntry(const weld::TreeIter& 
rEntry)
             // loaded, this will prevent RequestingChildren ( called
             // from vcl via RequestingChildren ) from
             // creating new ( duplicate ) children
-            SFEntry* userData = 
reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(rEntry).toInt64());
+            SFEntry* userData = 
weld::fromId<SFEntry*>(m_xScriptsBox->get_id(rEntry));
             if ( userData &&  !userData->isLoaded() )
             {
                 userData->setLoaded();
diff --git a/cui/source/options/dbregister.cxx 
b/cui/source/options/dbregister.cxx
index 80f26c2bd893..8438fb3dcf2d 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -120,7 +120,7 @@ 
DbRegistrationOptionsPage::DbRegistrationOptionsPage(weld::Container* pPage, wel
 DbRegistrationOptionsPage::~DbRegistrationOptionsPage()
 {
     for (int i = 0, nCount = m_xPathBox->n_children(); i < nCount; ++i )
-        delete 
reinterpret_cast<DatabaseRegistration*>(m_xPathBox->get_id(i).toInt64());
+        delete weld::fromId<DatabaseRegistration*>(m_xPathBox->get_id(i));
 }
 
 std::unique_ptr<SfxTabPage> DbRegistrationOptionsPage::Create( 
weld::Container* pPage, weld::DialogController* pController,
@@ -137,7 +137,7 @@ bool DbRegistrationOptionsPage::FillItemSet( SfxItemSet* 
rCoreSet )
     int nCount = m_xPathBox->n_children();
     for (int i = 0; i < nCount; ++i)
     {
-        DatabaseRegistration* pRegistration = 
reinterpret_cast<DatabaseRegistration*>(m_xPathBox->get_id(i).toInt64());
+        DatabaseRegistration* pRegistration = 
weld::fromId<DatabaseRegistration*>(m_xPathBox->get_id(i));
         if ( pRegistration && !pRegistration->sLocation.isEmpty() )
         {
             OUString sName(m_xPathBox->get_text(i, 0));
@@ -225,7 +225,7 @@ IMPL_LINK_NOARG(DbRegistrationOptionsPage, EditHdl, 
weld::Button&, void)
     if (nEntry == -1)
         return;
 
-    DatabaseRegistration* pOldRegistration = 
reinterpret_cast<DatabaseRegistration*>(m_xPathBox->get_id(nEntry).toInt64());
+    DatabaseRegistration* pOldRegistration = 
weld::fromId<DatabaseRegistration*>(m_xPathBox->get_id(nEntry));
     if (!pOldRegistration || pOldRegistration->bReadOnly)
         return;
 
@@ -250,7 +250,7 @@ IMPL_LINK( DbRegistrationOptionsPage, HeaderSelect_Impl, 
int, nCol, void )
 
 IMPL_LINK_NOARG(DbRegistrationOptionsPage, PathSelect_Impl, weld::TreeView&, 
void)
 {
-    DatabaseRegistration* pRegistration = 
reinterpret_cast<DatabaseRegistration*>(m_xPathBox->get_selected_id().toInt64());
+    DatabaseRegistration* pRegistration = 
weld::fromId<DatabaseRegistration*>(m_xPathBox->get_selected_id());
 
     bool bReadOnly = true;
     if (pRegistration)
@@ -264,7 +264,7 @@ IMPL_LINK_NOARG(DbRegistrationOptionsPage, PathSelect_Impl, 
weld::TreeView&, voi
 
 void DbRegistrationOptionsPage::insertNewEntry(const OUString& _sName,const 
OUString& _sLocation, const bool _bReadOnly)
 {
-    OUString sId(OUString::number(reinterpret_cast<sal_Int64>(new 
DatabaseRegistration(_sLocation, _bReadOnly))));
+    OUString sId(weld::toId(new DatabaseRegistration(_sLocation, _bReadOnly)));
     m_xPathBox->insert(nullptr, -1, &_sName, &sId, nullptr, nullptr, false, 
m_xIter.get());
 
     if (_bReadOnly)
@@ -289,7 +289,7 @@ void DbRegistrationOptionsPage::openLinkDialog(const 
OUString& sOldName, const O
     {
         if (nEntry != -1)
         {
-            delete 
reinterpret_cast<DatabaseRegistration*>(m_xPathBox->get_id(nEntry).toInt64());
+            delete 
weld::fromId<DatabaseRegistration*>(m_xPathBox->get_id(nEntry));
             m_xPathBox->remove(nEntry);
         }
         insertNewEntry( sNewName, sNewLocation, false );
diff --git a/cui/source/options/optaboutconfig.cxx 
b/cui/source/options/optaboutconfig.cxx
index 55941f765dd9..728134a55575 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -207,7 +207,7 @@ void CuiAboutConfigTabPage::InsertEntry(const OUString& 
rPropertyPath, const OUS
     m_vectorUserData.push_back(std::make_unique<UserData>(rPropertyPath));
     if (bInsertToPrefBox)
     {
-        OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(m_vectorUserData.back().get())));
+        OUString sId(weld::toId(m_vectorUserData.back().get()));
         m_xPrefBox->insert(pParentEntry, -1, &rProp, &sId, nullptr, nullptr, 
false, m_xScratchIter.get());
         m_xPrefBox->set_text(*m_xScratchIter, rStatus, 1);
         m_xPrefBox->set_text(*m_xScratchIter, rType, 2);
@@ -289,7 +289,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< 
XNameAccess >& xNameAcces
             {
                 // not leaf node
                 
m_vectorUserData.push_back(std::make_unique<UserData>(xNextNameAccess, lineage 
+ 1));
-                OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(m_vectorUserData.back().get())));
+                OUString sId(weld::toId(m_vectorUserData.back().get()));
 
                 m_xPrefBox->insert(pParentEntry, -1, &item, &sId, nullptr, 
nullptr, true, m_xScratchIter.get());
                 // Necessary, without this the selection line will be 
truncated.
@@ -573,7 +573,7 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, 
weld::Button&, void )
     if (!m_xPrefBox->get_selected(m_xScratchIter.get()))
         return;
 
-    UserData *pUserData = 
reinterpret_cast<UserData*>(m_xPrefBox->get_id(*m_xScratchIter).toInt64());
+    UserData *pUserData = 
weld::fromId<UserData*>(m_xPrefBox->get_id(*m_xScratchIter));
     if (!(pUserData && pUserData->bIsPropertyPath))
         return;
 
@@ -856,7 +856,7 @@ void CuiAboutConfigTabPage::InsertEntry(const prefBoxEntry& 
rEntry)
         // deal with no parent case (tdf#107811)
         if (index < 0)
         {
-            OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(rEntry.pUserData)));
+            OUString sId(weld::toId(rEntry.pUserData));
             m_xPrefBox->insert(nullptr, -1, &rEntry.sProp, &sId, nullptr, 
nullptr, false, m_xScratchIter.get());
             m_xPrefBox->set_text(*m_xScratchIter, rEntry.sStatus, 1);
             m_xPrefBox->set_text(*m_xScratchIter, rEntry.sType, 2);
@@ -900,7 +900,7 @@ void CuiAboutConfigTabPage::InsertEntry(const prefBoxEntry& 
rEntry)
         xGrandParentEntry = m_xPrefBox->make_iterator(xParentEntry.get());
     } while(index < sPath.getLength() - 1);
 
-    OUString 
sId(OUString::number(reinterpret_cast<sal_Int64>(rEntry.pUserData)));
+    OUString sId(weld::toId(rEntry.pUserData));
     m_xPrefBox->insert(xParentEntry.get(), -1, &rEntry.sProp, &sId, nullptr, 
nullptr, false, m_xScratchIter.get());
     m_xPrefBox->set_text(*m_xScratchIter, rEntry.sStatus, 1);
     m_xPrefBox->set_text(*m_xScratchIter, rEntry.sType, 2);
@@ -911,7 +911,7 @@ IMPL_LINK(CuiAboutConfigTabPage, ExpandingHdl_Impl, const 
weld::TreeIter&, rEntr
 {
     if (m_xPrefBox->iter_has_child(rEntry))
         return true;
-    UserData *pUserData = 
reinterpret_cast<UserData*>(m_xPrefBox->get_id(rEntry).toInt64());
+    UserData *pUserData = weld::fromId<UserData*>(m_xPrefBox->get_id(rEntry));
     if (pUserData && !pUserData->bIsPropertyPath)
     {
         assert(pUserData->aXNameAccess.is());
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index f31044aeaaff..f34e59bc3696 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1168,7 +1168,7 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(weld::Container* 
pPage, weld::DialogCon
         aStr_ = ApplyLreOrRleEmbedding( aStr_ ) +
                 aTwoSpace +
                 ApplyLreOrRleEmbedding( SvtLanguageTable::GetLanguageString( 
v->GetLanguage() ) );
-        
m_xCurrencyLB->append(OUString::number(reinterpret_cast<sal_Int64>(v)), aStr_);
+        m_xCurrencyLB->append(weld::toId(v), aStr_);
     }
 
     m_xCurrencyLB->set_active(0);
@@ -1336,7 +1336,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
     // Configured currency, for example, USD-en-US or EUR-de-DE, or empty for 
locale default.
     OUString sOldCurr = 
pLangConfig->aSysLocaleOptions.GetCurrencyConfigString();
     OUString sId = m_xCurrencyLB->get_active_id();
-    const NfCurrencyEntry* pCurr = sId == "default" ? nullptr : 
reinterpret_cast<const NfCurrencyEntry*>(sId.toInt64());
+    const NfCurrencyEntry* pCurr = sId == "default" ? nullptr : 
weld::fromId<const NfCurrencyEntry*>(sId);
     OUString sNewCurr;
     if ( pCurr )
         sNewCurr = SvtSysLocaleOptions::CreateCurrencyConfigString(
@@ -1496,7 +1496,7 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet* rSet )
         pCurr = SvNumberFormatter::GetCurrencyEntry( aAbbrev, eLang );
     }
     // if pCurr==nullptr the SYSTEM entry is selected
-    OUString sId = !pCurr ? OUString("default") : 
OUString::number(reinterpret_cast<sal_Int64>(pCurr));
+    OUString sId = !pCurr ? OUString("default") : weld::toId(pCurr);
     m_xCurrencyLB->set_active_id(sId);
     bReadonly = 
pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::EOption::Currency);
     m_xCurrencyLB->set_sensitive(!bReadonly);
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 6a38e014d580..21f91debc8fd 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -1133,7 +1133,7 @@ void SvxLinguTabPage::UpdateModulesBox_Impl()
     {
         const ServiceInfo_Impl &rInfo = rAllDispSrvcArr[i];
         m_xLinguModulesCLB->append();
-        m_xLinguModulesCLB->set_id(i, 
OUString::number(reinterpret_cast<sal_Int64>(&rInfo)));
+        m_xLinguModulesCLB->set_id(i, weld::toId(&rInfo));
         m_xLinguModulesCLB->set_toggle(i, rInfo.bConfigured ? TRISTATE_TRUE : 
TRISTATE_FALSE);
         m_xLinguModulesCLB->set_text(i, rInfo.sDisplayName, 0);
     }
@@ -1596,7 +1596,7 @@ SvxEditModulesDlg::SvxEditModulesDlg(weld::Window* 
pParent, SvxLinguData_Impl& r
 SvxEditModulesDlg::~SvxEditModulesDlg()
 {
     for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < 
nEntryCount; ++i)
-        delete 
reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
+        delete weld::fromId<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i));
 }
 
 IMPL_LINK( SvxEditModulesDlg, SelectHdl_Impl, weld::TreeView&, rBox, void )
@@ -1607,16 +1607,16 @@ IMPL_LINK( SvxEditModulesDlg, SelectHdl_Impl, 
weld::TreeView&, rBox, void )
 
     bool bDisableUp = true;
     bool bDisableDown = true;
-    ModuleUserData_Impl* pData = 
reinterpret_cast<ModuleUserData_Impl*>(rBox.get_id(nCurPos).toInt64());
+    ModuleUserData_Impl* pData = 
weld::fromId<ModuleUserData_Impl*>(rBox.get_id(nCurPos));
     if (!pData->IsParent() && pData->GetType() != TYPE_HYPH)
     {
         if (nCurPos < rBox.n_children() - 1)
         {
-            bDisableDown = 
reinterpret_cast<ModuleUserData_Impl*>(rBox.get_id(nCurPos + 
1).toInt64())->IsParent();
+            bDisableDown = 
weld::fromId<ModuleUserData_Impl*>(rBox.get_id(nCurPos + 1))->IsParent();
         }
         if (nCurPos > 1)
         {
-            bDisableUp = 
reinterpret_cast<ModuleUserData_Impl*>(rBox.get_id(nCurPos - 
1).toInt64())->IsParent();
+            bDisableUp = 
weld::fromId<ModuleUserData_Impl*>(rBox.get_id(nCurPos - 1))->IsParent();
         }
     }
     m_xPrioUpPB->set_sensitive(!bDisableUp);
@@ -1625,7 +1625,7 @@ IMPL_LINK( SvxEditModulesDlg, SelectHdl_Impl, 
weld::TreeView&, rBox, void )
 
 IMPL_LINK( SvxEditModulesDlg, BoxCheckButtonHdl_Impl, const 
weld::TreeView::iter_col&, rRowCol, void )
 {
-    ModuleUserData_Impl* pData = 
reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(rRowCol.first).toInt64());
+    ModuleUserData_Impl* pData = 
weld::fromId<ModuleUserData_Impl*>(m_xModulesCLB->get_id(rRowCol.first));
     if (pData->IsParent() || pData->GetType() != TYPE_HYPH)
         return;
 
@@ -1634,7 +1634,7 @@ IMPL_LINK( SvxEditModulesDlg, BoxCheckButtonHdl_Impl, 
const weld::TreeView::iter
     auto nPos = m_xModulesCLB->get_iter_index_in_parent(rRowCol.first);
     for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < 
nEntryCount; ++i)
     {
-        pData = 
reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
+        pData = weld::fromId<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i));
         if (!pData->IsParent() && pData->GetType() == TYPE_HYPH && i != nPos)
         {
             m_xModulesCLB->set_toggle(i, TRISTATE_FALSE);
@@ -1665,7 +1665,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const 
SvxLanguageBox* pBox)
         bool bChanged = false;
         for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < 
nEntryCount; ++i)
         {
-            ModuleUserData_Impl* pData = 
reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
+            ModuleUserData_Impl* pData = 
weld::fromId<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i));
             if (pData->IsParent())
             {
                 if (bChanged)
@@ -1708,7 +1708,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const 
SvxLanguageBox* pBox)
     }
 
     for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < 
nEntryCount; ++i)
-        delete 
reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
+        delete weld::fromId<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i));
     m_xModulesCLB->clear();
 
     // display entries for new selected language
@@ -1723,7 +1723,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const 
SvxLanguageBox* pBox)
 
         ModuleUserData_Impl* pUserData = new ModuleUserData_Impl(
                                          OUString(), true, false, TYPE_SPELL, 
0 );
-        OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pUserData)));
+        OUString sId(weld::toId(pUserData));
         m_xModulesCLB->append(nullptr);
         m_xModulesCLB->set_id(nRow, sId);
         m_xModulesCLB->set_text(nRow, sSpell, 0);
@@ -1759,7 +1759,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const 
SvxLanguageBox* pBox)
                 const bool bCheck = bHasLang && lcl_SeqGetEntryPos( rTable[ 
eCurLanguage ], aImplName ) >= 0;
                 pUserData = new ModuleUserData_Impl( aImplName, false,
                                         bCheck, TYPE_SPELL, 
static_cast<sal_uInt8>(nLocalIndex++) );
-                sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+                sId = weld::toId(pUserData);
 
                 m_xModulesCLB->append(nullptr);
                 m_xModulesCLB->set_id(nRow, sId);
@@ -1773,7 +1773,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const 
SvxLanguageBox* pBox)
         // grammar checker entries
 
         pUserData = new ModuleUserData_Impl( OUString(), true, false, 
TYPE_GRAMMAR, 0 );
-        sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+        sId = weld::toId(pUserData);
         m_xModulesCLB->append(nullptr);
         m_xModulesCLB->set_id(nRow, sId);
         m_xModulesCLB->set_text(nRow, sGrammar, 0);
@@ -1810,7 +1810,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const 
SvxLanguageBox* pBox)
                 pUserData = new ModuleUserData_Impl( aImplName, false,
                                         bCheck, TYPE_GRAMMAR, 
static_cast<sal_uInt8>(nLocalIndex++) );
 
-                sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));

... etc. - the rest is truncated

Reply via email to