summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-02-04 09:13:52 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-02-04 15:02:03 +0100
commite00032ba6a2ddd4c08ae6f03b1982d3c099d288e (patch)
tree33f52e795971fd330922e21857b12c6097727ca8
parentofz#44398 defer getting resolution if Pdfium disabled (diff)
downloadcore-e00032ba6a2ddd4c08ae6f03b1982d3c099d288e.tar.gz
core-e00032ba6a2ddd4c08ae6f03b1982d3c099d288e.zip
add toId/fromId to tidy up some ugly casting
Change-Id: I70f34ac5e9b5d2f2d6c0375e823908eaa2e540b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129487 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--basctl/source/basicide/IDEComboBox.cxx14
-rw-r--r--basctl/source/basicide/baside2b.cxx24
-rw-r--r--basctl/source/basicide/bastype2.cxx8
-rw-r--r--basctl/source/basicide/moduldl2.cxx6
-rw-r--r--basctl/source/dlged/managelang.cxx8
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx30
-rw-r--r--cui/source/customize/CommandCategoryListBox.cxx43
-rw-r--r--cui/source/customize/SvxMenuConfigPage.cxx19
-rw-r--r--cui/source/customize/SvxToolbarConfigPage.cxx57
-rw-r--r--cui/source/customize/acccfg.cxx30
-rw-r--r--cui/source/customize/cfg.cxx38
-rw-r--r--cui/source/customize/cfgutil.cxx43
-rw-r--r--cui/source/dialogs/cuicharmap.cxx4
-rw-r--r--cui/source/dialogs/hldocntp.cxx10
-rw-r--r--cui/source/dialogs/hlmarkwn.cxx10
-rw-r--r--cui/source/dialogs/linkdlg.cxx20
-rw-r--r--cui/source/dialogs/scriptdlg.cxx18
-rw-r--r--cui/source/options/dbregister.cxx12
-rw-r--r--cui/source/options/optaboutconfig.cxx12
-rw-r--r--cui/source/options/optgdlg.cxx6
-rw-r--r--cui/source/options/optlingu.cxx34
-rw-r--r--cui/source/options/optpath.cxx14
-rw-r--r--cui/source/options/optsave.cxx2
-rw-r--r--cui/source/options/treeopt.cxx34
-rw-r--r--cui/source/tabpages/autocdlg.cxx36
-rw-r--r--cui/source/tabpages/swpossizetabpage.cxx20
-rw-r--r--dbaccess/source/ui/app/AppDetailView.cxx8
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx76
-rw-r--r--dbaccess/source/ui/misc/WColumnSelect.cxx14
-rw-r--r--dbaccess/source/ui/misc/WNameMatch.cxx8
-rw-r--r--dbaccess/source/ui/misc/WTypeSelect.cxx16
-rw-r--r--dbaccess/source/ui/querydesign/TableWindow.cxx6
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.cxx13
-rw-r--r--extensions/source/propctrlr/selectlabeldialog.cxx2
-rw-r--r--extensions/source/propctrlr/taborder.cxx4
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.cxx14
-rw-r--r--formula/source/ui/dlg/funcpage.cxx14
-rw-r--r--formula/source/ui/dlg/structpg.cxx6
-rw-r--r--fpicker/source/office/fileview.cxx28
-rw-r--r--fpicker/source/office/iodlgimp.cxx2
-rw-r--r--include/vcl/weld.hxx10
-rw-r--r--reportdesign/source/ui/dlg/AddField.cxx8
-rw-r--r--reportdesign/source/ui/dlg/Navigator.cxx14
-rw-r--r--sc/source/filter/orcus/xmlcontext.cxx2
-rw-r--r--sc/source/ui/cctrl/checklistmenu.cxx6
-rw-r--r--sc/source/ui/dbgui/PivotLayoutTreeList.cxx9
-rw-r--r--sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx4
-rw-r--r--sc/source/ui/dbgui/PivotLayoutTreeListData.cxx14
-rw-r--r--sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx2
-rw-r--r--sc/source/ui/formdlg/dwfunctr.cxx8
-rw-r--r--sc/source/ui/miscdlgs/acredlin.cxx46
-rw-r--r--sc/source/ui/miscdlgs/conflictsdlg.cxx8
-rw-r--r--sc/source/ui/miscdlgs/mvtabdlg.cxx4
-rw-r--r--sc/source/ui/miscdlgs/solveroptions.cxx8
-rw-r--r--sd/source/ui/animations/CustomAnimationList.cxx34
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.cxx16
-rw-r--r--sd/source/ui/dlg/custsdlg.cxx8
-rw-r--r--sd/source/ui/dlg/sdtreelb.cxx10
-rw-r--r--sfx2/source/appl/newhelp.cxx36
-rw-r--r--sfx2/source/devtools/DocumentModelTreeHandler.cxx16
-rw-r--r--sfx2/source/devtools/ObjectInspectorTreeHandler.cxx12
-rw-r--r--sfx2/source/dialog/versdlg.cxx10
-rw-r--r--sfx2/source/doc/autoredactdialog.cxx13
-rw-r--r--starmath/source/dialog.cxx4
-rw-r--r--svx/source/form/datanavi.cxx30
-rw-r--r--svx/source/form/navigatortree.cxx52
-rw-r--r--svx/source/form/tabwin.cxx6
-rw-r--r--svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx6
-rw-r--r--sw/source/ui/config/optload.cxx12
-rw-r--r--sw/source/ui/config/optpage.cxx12
-rw-r--r--sw/source/ui/dbui/addresslistdialog.cxx24
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx46
-rw-r--r--sw/source/ui/frmdlg/frmpage.cxx22
-rw-r--r--sw/source/ui/misc/bookmark.cxx18
-rw-r--r--sw/source/ui/misc/glosbib.cxx20
-rw-r--r--sw/source/ui/misc/glossary.cxx2
-rw-r--r--sw/source/uibase/misc/redlndlg.cxx14
-rw-r--r--sw/source/uibase/utlui/content.cxx232
-rw-r--r--sw/source/uibase/utlui/glbltree.cxx28
-rw-r--r--vcl/unx/generic/print/prtsetup.cxx18
-rw-r--r--xmlsecurity/source/dialogs/certificatechooser.cxx10
-rw-r--r--xmlsecurity/source/dialogs/certificateviewer.cxx10
82 files changed, 800 insertions, 827 deletions
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));
+ sId = weld::toId(pUserData);
m_xModulesCLB->append(nullptr);
m_xModulesCLB->set_id(nRow, sId);
@@ -1824,7 +1824,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
// hyphenator entries
pUserData = new ModuleUserData_Impl( OUString(), true, false, TYPE_HYPH, 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, sHyph, 0);
@@ -1860,7 +1860,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_HYPH, 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);
@@ -1874,7 +1874,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(const SvxLanguageBox* pBox)
// thesaurus entries
pUserData = new ModuleUserData_Impl( OUString(), true, false, TYPE_THES, 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, sThes, 0);
@@ -1910,7 +1910,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_THES, 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);
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index d6ccbf113e25..a6c4a2ca5ad6 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -211,7 +211,7 @@ IMPL_LINK(SvxPathTabPage, HeaderBarClick, int, nColumn, void)
SvxPathTabPage::~SvxPathTabPage()
{
for (int i = 0, nEntryCount = m_xPathBox->n_children(); i < nEntryCount; ++i)
- delete reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(i).toInt64());
+ delete weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(i));
}
std::unique_ptr<SfxTabPage> SvxPathTabPage::Create( weld::Container* pPage, weld::DialogController* pController,
@@ -224,7 +224,7 @@ bool SvxPathTabPage::FillItemSet( SfxItemSet* )
{
for (int i = 0, nEntryCount = m_xPathBox->n_children(); i < nEntryCount; ++i)
{
- PathUserData_Impl* pPathImpl = reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(i).toInt64());
+ PathUserData_Impl* pPathImpl = weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(i));
SvtPathOptions::Paths nRealId = pPathImpl->nRealId;
if (pPathImpl->bItemStateSet )
SetPathList( nRealId, pPathImpl->sUserPath, pPathImpl->sWritablePath );
@@ -322,7 +322,7 @@ void SvxPathTabPage::Reset( const SfxItemSet* )
pPathImpl->sWritablePath = sWritable;
pPathImpl->bReadOnly = bReadOnly;
- OUString sId = OUString::number(reinterpret_cast<sal_Int64>(pPathImpl));
+ OUString sId = weld::toId(pPathImpl);
m_xPathBox->set_id(*xIter, sId);
}
}
@@ -338,7 +338,7 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathSelect_Impl, weld::TreeView&, void)
int nEntry = m_xPathBox->get_selected_index();
if (nEntry != -1)
{
- PathUserData_Impl* pPathImpl = reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(nEntry).toInt64());
+ PathUserData_Impl* pPathImpl = weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(nEntry));
bEnable = !pPathImpl->bReadOnly;
}
sal_uInt16 nSelCount = m_xPathBox->count_selected_rows();
@@ -349,7 +349,7 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathSelect_Impl, weld::TreeView&, void)
IMPL_LINK_NOARG(SvxPathTabPage, StandardHdl_Impl, weld::Button&, void)
{
m_xPathBox->selected_foreach([this](weld::TreeIter& rEntry){
- PathUserData_Impl* pPathImpl = reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(rEntry).toInt64());
+ PathUserData_Impl* pPathImpl = weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(rEntry));
OUString aOldPath = SvtDefaultOptions::GetDefaultPath( pPathImpl->nRealId );
if ( !aOldPath.isEmpty() )
@@ -420,7 +420,7 @@ void SvxPathTabPage::ChangeCurrentEntry( const OUString& _rFolder )
}
OUString sInternal, sUser, sWritable;
- PathUserData_Impl* pPathImpl = reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(nEntry).toInt64());
+ PathUserData_Impl* pPathImpl = weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(nEntry));
bool bReadOnly = false;
GetPathList( pPathImpl->nRealId, sInternal, sUser, sWritable, bReadOnly );
sUser = pPathImpl->sUserPath;
@@ -470,7 +470,7 @@ IMPL_LINK_NOARG(SvxPathTabPage, DoubleClickPathHdl_Impl, weld::TreeView&, bool)
IMPL_LINK_NOARG(SvxPathTabPage, PathHdl_Impl, weld::Button&, void)
{
int nEntry = m_xPathBox->get_cursor_index();
- PathUserData_Impl* pPathImpl = nEntry != -1 ? reinterpret_cast<PathUserData_Impl*>(m_xPathBox->get_id(nEntry).toInt64()) : nullptr;
+ PathUserData_Impl* pPathImpl = nEntry != -1 ? weld::fromId<PathUserData_Impl*>(m_xPathBox->get_id(nEntry)) : nullptr;
if (!pPathImpl || pPathImpl->bReadOnly)
return;
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index 1a9932e91442..4c783e15298e 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -564,7 +564,7 @@ IMPL_LINK( SvxSaveTabPage, FilterHdl_Impl, weld::ComboBox&, rBox, void )
{
OUString sId;
if (pImpl->aODFArr[nData][i])
- sId = OUString::number(reinterpret_cast<sal_Int64>(pImpl.get()));
+ sId = weld::toId(pImpl.get());
m_xSaveAsLB->append(sId, rUIFilters[i]);
if (rFilters[i] == pImpl->aDefaultArr[nData])
sSelect = rUIFilters[i];
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 583f83d2a1c3..9e3bca32e10c 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -528,7 +528,7 @@ OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
// if Child (has parent), then OptionsPageInfo
if (xTreeLB->get_iter_depth(*xEntry))
{
- OptionsPageInfo *pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xEntry).toInt64());
+ OptionsPageInfo *pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xEntry));
if(pPageInfo->m_xPage)
{
pPageInfo->m_xPage->FillUserData();
@@ -564,7 +564,7 @@ OfaTreeOptionsDialog::~OfaTreeOptionsDialog()
{
if (!xTreeLB->get_iter_depth(*xEntry))
{
- OptionsGroupInfo* pGroupInfo = reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xEntry).toInt64());
+ OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xEntry));
delete pGroupInfo;
}
bEntry = xTreeLB->iter_next(*xEntry);
@@ -581,7 +581,7 @@ OptionsPageInfo* OfaTreeOptionsDialog::AddTabPage(
xTreeLB->iter_nth_sibling(*xParent, nGroup);
OptionsPageInfo* pPageInfo = new OptionsPageInfo( nId );
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pPageInfo)));
+ OUString sId(weld::toId(pPageInfo));
xTreeLB->insert(xParent.get(), -1, &rPageName, &sId, nullptr, nullptr, false, nullptr);
return pPageInfo;
}
@@ -594,7 +594,7 @@ sal_uInt16 OfaTreeOptionsDialog::AddGroup(const OUString& rGroupName,
{
OptionsGroupInfo* pInfo =
new OptionsGroupInfo( pCreateShell, pCreateModule, nDialogId );
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pInfo)));
+ OUString sId(weld::toId(pInfo));
xTreeLB->append(sId, rGroupName);
sal_uInt16 nRet = 0;
@@ -619,13 +619,13 @@ void OfaTreeOptionsDialog::ResetCurrentPageFromConfig()
if (!(xCurrentPageEntry && xTreeLB->get_iter_depth(*xCurrentPageEntry)))
return;
- OptionsPageInfo* pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry).toInt64());
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry));
if (pPageInfo->m_xPage)
{
std::unique_ptr<weld::TreeIter> xParent = xTreeLB->make_iterator(xCurrentPageEntry.get());
xTreeLB->iter_parent(*xParent);
OptionsGroupInfo* pGroupInfo =
- reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xParent).toInt64());
+ weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
pPageInfo->m_xPage->Reset( &*pGroupInfo->m_pInItemSet );
}
else if ( pPageInfo->m_xExtPage )
@@ -645,13 +645,13 @@ void OfaTreeOptionsDialog::ApplyOptions()
{
if (xTreeLB->get_iter_depth(*xEntry))
{
- OptionsPageInfo* pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xEntry).toInt64());
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xEntry));
if ( pPageInfo->m_xPage && !pPageInfo->m_xPage->HasExchangeSupport() )
{
std::unique_ptr<weld::TreeIter> xParent = xTreeLB->make_iterator(xEntry.get());
xTreeLB->iter_parent(*xParent);
OptionsGroupInfo* pGroupInfo =
- reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xParent).toInt64());
+ weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
pPageInfo->m_xPage->FillItemSet(pGroupInfo->m_pOutItemSet.get());
}
@@ -675,7 +675,7 @@ IMPL_LINK_NOARG(OfaTreeOptionsDialog, HelpHdl_Impl, weld::Widget&, bool)
Help* pHelp = Application::GetHelp();
if (pHelp && xCurrentPageEntry && xTreeLB->get_iter_depth(*xCurrentPageEntry))
{
- OptionsPageInfo* pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry).toInt64());
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry));
if (pPageInfo->m_xPage)
{
OString sHelpId(pPageInfo->m_xPage->GetHelpId());
@@ -694,13 +694,13 @@ IMPL_LINK(OfaTreeOptionsDialog, ApplyHdl_Impl, weld::Button&, rButton, void)
if (xCurrentPageEntry && xTreeLB->get_iter_depth(*xCurrentPageEntry))
{
- OptionsPageInfo* pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry).toInt64());
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry));
if ( pPageInfo->m_xPage )
{
std::unique_ptr<weld::TreeIter> xParent = xTreeLB->make_iterator(xCurrentPageEntry.get());
xTreeLB->iter_parent(*xParent);
- pGroupInfo = reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xParent).toInt64());
+ pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
if ( RID_SVXPAGE_COLOR != pPageInfo->m_nPageId
&& pPageInfo->m_xPage->HasExchangeSupport() )
{
@@ -772,7 +772,7 @@ void OfaTreeOptionsDialog::ApplyItemSets()
{
if (!xTreeLB->get_iter_depth(*xEntry))
{
- OptionsGroupInfo* pGroupInfo = reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xEntry).toInt64());
+ OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xEntry));
if(pGroupInfo->m_pOutItemSet)
{
if(pGroupInfo->m_pShell)
@@ -848,7 +848,7 @@ void OfaTreeOptionsDialog::ActivateLastSelection()
// restore only selection of a leaf
if (xTreeLB->get_iter_depth(*xTemp) && xTreeLB->get_id(*xTemp).toInt64())
{
- OptionsPageInfo* pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xTemp).toInt64());
+ OptionsPageInfo* pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xTemp));
OUString sPageURL = pPageInfo->m_sPageURL;
if ( bMustExpand )
{
@@ -921,14 +921,14 @@ void OfaTreeOptionsDialog::SelectHdl_Impl()
BuilderPage* pNewPage = nullptr;
OptionsPageInfo* pOptPageInfo = (xCurrentPageEntry && xTreeLB->get_iter_depth(*xCurrentPageEntry))
- ? reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry).toInt64()) : nullptr;
+ ? weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xCurrentPageEntry)) : nullptr;
if (pOptPageInfo && pOptPageInfo->m_xPage && pOptPageInfo->m_xPage->IsVisible())
{
std::unique_ptr<weld::TreeIter> xCurParent(xTreeLB->make_iterator(xCurrentPageEntry.get()));
xTreeLB->iter_parent(*xCurParent);
- OptionsGroupInfo* pGroupInfo = reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xCurParent).toInt64());
+ OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xCurParent));
DeactivateRC nLeave = DeactivateRC::LeavePage;
if ( RID_SVXPAGE_COLOR != pOptPageInfo->m_nPageId && pOptPageInfo->m_xPage->HasExchangeSupport() )
nLeave = pOptPageInfo->m_xPage->DeactivatePage( pGroupInfo->m_pOutItemSet.get() );
@@ -949,8 +949,8 @@ void OfaTreeOptionsDialog::SelectHdl_Impl()
pOptPageInfo->m_xExtPage->DeactivatePage();
}
- OptionsPageInfo *pPageInfo = reinterpret_cast<OptionsPageInfo*>(xTreeLB->get_id(*xEntry).toInt64());
- OptionsGroupInfo* pGroupInfo = reinterpret_cast<OptionsGroupInfo*>(xTreeLB->get_id(*xParent).toInt64());
+ OptionsPageInfo *pPageInfo = weld::fromId<OptionsPageInfo*>(xTreeLB->get_id(*xEntry));
+ OptionsGroupInfo* pGroupInfo = weld::fromId<OptionsGroupInfo*>(xTreeLB->get_id(*xParent));
if(!pPageInfo->m_xPage && pPageInfo->m_nPageId > 0)
{
InitItemSets(*pGroupInfo);
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index e7a0883dc267..86c86d5c6eb8 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -399,9 +399,9 @@ void OfaSwAutoFmtOptionsPage::CreateEntry(const OUString& rTxt, sal_uInt16 nCol)
OfaSwAutoFmtOptionsPage::~OfaSwAutoFmtOptionsPage()
{
- delete reinterpret_cast<ImpUserData*>(m_xCheckLB->get_id(REPLACE_BULLETS).toInt64());
- delete reinterpret_cast<ImpUserData*>(m_xCheckLB->get_id(APPLY_NUMBERING).toInt64());
- delete reinterpret_cast<ImpUserData*>(m_xCheckLB->get_id(MERGE_SINGLE_LINE_PARA).toInt64());
+ delete weld::fromId<ImpUserData*>(m_xCheckLB->get_id(REPLACE_BULLETS));
+ delete weld::fromId<ImpUserData*>(m_xCheckLB->get_id(APPLY_NUMBERING));
+ delete weld::fromId<ImpUserData*>(m_xCheckLB->get_id(MERGE_SINGLE_LINE_PARA));
}
std::unique_ptr<SfxTabPage> OfaSwAutoFmtOptionsPage::Create(weld::Container* pPage, weld::DialogController* pController,
@@ -599,15 +599,15 @@ void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet* )
m_xCheckLB->set_toggle(MERGE_SINGLE_LINE_PARA, pOpt->bRightMargin ? TRISTATE_TRUE : TRISTATE_FALSE, CBCOL_FIRST);
ImpUserData* pUserData = new ImpUserData(&sBulletChar, &aBulletFont);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pUserData)));
+ OUString sId(weld::toId(pUserData));
m_xCheckLB->set_id(REPLACE_BULLETS, sId);
pUserData = new ImpUserData(&sMargin, nullptr);
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData));
+ sId = weld::toId(pUserData);
m_xCheckLB->set_id(MERGE_SINGLE_LINE_PARA, sId);
ImpUserData* pUserData2 = new ImpUserData(&sByInputBulletChar, &aByInputBulletFont);
- sId = OUString::number(reinterpret_cast<sal_Int64>(pUserData2));
+ sId = weld::toId(pUserData2);
m_xCheckLB->set_id(APPLY_NUMBERING, sId);
m_xCheckLB->thaw();
@@ -630,7 +630,7 @@ IMPL_LINK_NOARG(OfaSwAutoFmtOptionsPage, EditHdl, weld::Button&, void)
if (nSelEntryPos == REPLACE_BULLETS || nSelEntryPos == APPLY_NUMBERING)
{
SvxCharacterMap aMapDlg(GetFrameWeld(), nullptr, nullptr);
- ImpUserData* pUserData = reinterpret_cast<ImpUserData*>(m_xCheckLB->get_id(nSelEntryPos).toInt64());
+ ImpUserData* pUserData = weld::fromId<ImpUserData*>(m_xCheckLB->get_id(nSelEntryPos));
aMapDlg.SetCharFont(*pUserData->pFont);
aMapDlg.SetChar( (*pUserData->pString)[0] );
if (RET_OK == aMapDlg.run())
@@ -808,7 +808,7 @@ void OfaAutocorrReplacePage::RefillReplaceBox(bool bFromReset,
pArray->push_back(DoubleString(m_xReplaceTLB->get_text(rIter, 0),
m_xReplaceTLB->get_text(rIter, 1)));
DoubleString& rDouble = pArray->back();
- rDouble.pUserData = reinterpret_cast<void*>(m_xReplaceTLB->get_id(rIter).toInt64());
+ rDouble.pUserData = weld::fromId<void*>(m_xReplaceTLB->get_id(rIter));
return false;
});
}
@@ -829,7 +829,7 @@ void OfaAutocorrReplacePage::RefillReplaceBox(bool bFromReset,
if (!bTextOnly)
{
// that means: with format info or even with selection text
- OUString sId = OUString::number(reinterpret_cast<sal_Int64>(rDouble.pUserData));
+ OUString sId = weld::toId(rDouble.pUserData);
m_xReplaceTLB->set_id(rIter, sId);
}
m_xReplaceTLB->set_text(rIter, rDouble.sShort, 0);
@@ -855,7 +855,7 @@ void OfaAutocorrReplacePage::RefillReplaceBox(bool bFromReset,
if (!bTextOnly)
{
// that means: with format info or even with selection text
- OUString sId = OUString::number(reinterpret_cast<sal_Int64>(m_xTextOnlyCB.get()));
+ OUString sId = weld::toId(m_xTextOnlyCB.get());
m_xReplaceTLB->set_id(rIter, sId);
}
m_xReplaceTLB->set_text(rIter, elem.GetShort(), 0);
@@ -1063,7 +1063,7 @@ bool OfaAutocorrReplacePage::NewDelHdl(const weld::Widget* pBtn)
OUString sId;
if (bKeepSourceFormatting)
{
- sId = OUString::number(reinterpret_cast<sal_Int64>(&bHasSelectionText)); // new formatted text
+ sId = weld::toId(&bHasSelectionText); // new formatted text
}
m_xReplaceTLB->insert(nPos, sEntry, &sId, nullptr, nullptr);
@@ -2051,7 +2051,7 @@ void OfaAutoCompleteTabPage::Reset( const SfxItemSet* )
{
const OUString* pStr =
&(*m_pAutoCompleteList)[n]->GetAutoCompleteString();
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pStr)));
+ OUString sId(weld::toId(pStr));
m_xLBEntries->append(sId, *pStr);
}
}
@@ -2077,7 +2077,7 @@ IMPL_LINK_NOARG(OfaAutoCompleteTabPage, DeleteHdl, weld::Button&, void)
while (!rows.empty())
{
sal_Int32 nPos = rows.back();
- OUString* pStr = reinterpret_cast<OUString*>(m_xLBEntries->get_id(nPos).toInt64());
+ OUString* pStr = weld::fromId<OUString*>(m_xLBEntries->get_id(nPos));
m_xLBEntries->remove(nPos);
editeng::IAutoCompleteString hack(*pStr); // UGLY
m_pAutoCompleteList->erase(&hack);
@@ -2201,7 +2201,7 @@ void OfaSmartTagOptionsTabPage::ClearListBox()
const int nCount = m_xSmartTagTypesLB->n_children();
for (int i = 0; i < nCount; ++i)
{
- const ImplSmartTagLBUserData* pUserData = reinterpret_cast<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(i).toInt64());
+ const ImplSmartTagLBUserData* pUserData = weld::fromId<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(i));
delete pUserData;
}
@@ -2241,7 +2241,7 @@ void OfaSmartTagOptionsTabPage::FillListBox( const SmartTagMgr& rSmartTagMgr )
const bool bCheck = rSmartTagMgr.IsSmartTagTypeEnabled( aSmartTagType );
m_xSmartTagTypesLB->set_toggle(nRow, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xSmartTagTypesLB->set_text(nRow, aLBEntry, 0);
- m_xSmartTagTypesLB->set_id(nRow, OUString::number(reinterpret_cast<sal_Int64>(new ImplSmartTagLBUserData(aSmartTagType, xRec, j))));
+ m_xSmartTagTypesLB->set_id(nRow, weld::toId(new ImplSmartTagLBUserData(aSmartTagType, xRec, j)));
}
}
}
@@ -2251,7 +2251,7 @@ void OfaSmartTagOptionsTabPage::FillListBox( const SmartTagMgr& rSmartTagMgr )
IMPL_LINK_NOARG(OfaSmartTagOptionsTabPage, ClickHdl, weld::Button&, void)
{
const int nPos = m_xSmartTagTypesLB->get_selected_index();
- const ImplSmartTagLBUserData* pUserData = reinterpret_cast<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(nPos).toInt64());
+ const ImplSmartTagLBUserData* pUserData = weld::fromId<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(nPos));
uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec;
const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx;
@@ -2283,7 +2283,7 @@ IMPL_LINK_NOARG(OfaSmartTagOptionsTabPage, SelectHdl, weld::TreeView&, void)
const int nPos = m_xSmartTagTypesLB->get_selected_index();
if (nPos == -1)
return;
- const ImplSmartTagLBUserData* pUserData = reinterpret_cast<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(nPos).toInt64());
+ const ImplSmartTagLBUserData* pUserData = weld::fromId<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(nPos));
uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec;
const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx;
@@ -2313,7 +2313,7 @@ bool OfaSmartTagOptionsTabPage::FillItemSet( SfxItemSet* )
for (int i = 0; i < nCount; ++i)
{
- const ImplSmartTagLBUserData* pUserData = reinterpret_cast<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(i).toInt64());
+ const ImplSmartTagLBUserData* pUserData = weld::fromId<ImplSmartTagLBUserData*>(m_xSmartTagTypesLB->get_id(i));
const bool bChecked = m_xSmartTagTypesLB->get_toggle(i) == TRISTATE_TRUE;
const bool bIsCurrentlyEnabled = pSmartTagMgr->IsSmartTagTypeEnabled( pUserData->maSmartTagType );
diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx
index 0d1475193610..82a7672d5b5d 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -1268,7 +1268,7 @@ IMPL_LINK(SvxSwPosSizeTabPage, PosHdl, weld::ComboBox&, rLB, void)
if (rLB.get_active() != -1)
{
if (pRelLB->get_active() != -1)
- nRel = reinterpret_cast<RelationMap*>(pRelLB->get_active_id().toUInt64())->nRelation;
+ nRel = weld::fromId<RelationMap*>(pRelLB->get_active_id())->nRelation;
FillRelLB(pMap, nMapPos, nAlign, nRel, *pRelLB, *pRelFT);
}
@@ -1371,7 +1371,7 @@ short SvxSwPosSizeTabPage::GetRelation(const weld::ComboBox& rRelationLB)
int nPos = rRelationLB.get_active();
if (nPos != -1)
{
- RelationMap *pEntry = reinterpret_cast<RelationMap*>(rRelationLB.get_id(nPos).toUInt64());
+ RelationMap *pEntry = weld::fromId<RelationMap*>(rRelationLB.get_id(nPos));
nRel = pEntry->nRelation;
}
@@ -1389,7 +1389,7 @@ short SvxSwPosSizeTabPage::GetAlignment(FrmMap const *pMap, sal_uInt16 nMapPos,
{
if (rRelationLB.get_active() != -1)
{
- LB nRel = reinterpret_cast<RelationMap*>(rRelationLB.get_active_id().toUInt64())->nLBRelation;
+ LB nRel = weld::fromId<RelationMap*>(rRelationLB.get_active_id())->nLBRelation;
std::size_t nMapCount = ::lcl_GetFrmMapCount(pMap);
SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId;
@@ -1459,7 +1459,7 @@ void SvxSwPosSizeTabPage::InitPos(RndStdIds nAnchor,
m_nOldV = m_pVMap[nPos].nAlign;
nPos = m_xVertToLB->get_active();
if (nPos != -1)
- m_nOldVRel = reinterpret_cast<RelationMap*>(m_xVertToLB->get_id(nPos).toUInt64())->nRelation;
+ m_nOldVRel = weld::fromId<RelationMap*>(m_xVertToLB->get_id(nPos))->nRelation;
}
nPos = m_xHoriLB->get_active();
@@ -1469,7 +1469,7 @@ void SvxSwPosSizeTabPage::InitPos(RndStdIds nAnchor,
nPos = m_xHoriToLB->get_active();
if (nPos != -1)
- m_nOldHRel = reinterpret_cast<RelationMap*>(m_xHoriToLB->get_id(nPos).toUInt64())->nRelation;
+ m_nOldHRel = weld::fromId<RelationMap*>(m_xHoriToLB->get_id(nPos))->nRelation;
}
bool bEnable = true;
@@ -1652,7 +1652,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, sal_uInt16 nMapPos, sal_
sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, m_bIsVerticalFrame, m_bIsInRightToLeft);
OUString sEntry = SvxSwFramePosString::GetString(sStrId1);
- rLB.append(OUString::number(reinterpret_cast<sal_uInt64>(&aAsCharRelationMap[nRelPos])), sEntry);
+ rLB.append(weld::toId(&aAsCharRelationMap[nRelPos]), sEntry);
if (pMap[_nMapPos].nAlign == nAlign)
sSelEntry = sEntry;
break;
@@ -1669,7 +1669,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, sal_uInt16 nMapPos, sal_
{
for (int i = 0; i < rLB.get_count(); i++)
{
- RelationMap *pEntry = reinterpret_cast<RelationMap*>(rLB.get_id(i).toUInt64());
+ RelationMap *pEntry = weld::fromId<RelationMap*>(rLB.get_id(i));
if (pEntry->nLBRelation == LB::RelChar) // Default
{
rLB.set_active(i);
@@ -1707,7 +1707,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, sal_uInt16 nMapPos, sal_
SvxSwFramePosString::StringId sStrId1 = m_xHoriMirrorCB->get_active() ? aRelationMap[nRelPos].eMirrorStrId : aRelationMap[nRelPos].eStrId;
sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, m_bIsVerticalFrame, m_bIsInRightToLeft);
OUString sEntry = SvxSwFramePosString::GetString(sStrId1);
- rLB.append(OUString::number(reinterpret_cast<sal_uInt64>(&aRelationMap[nRelPos])), sEntry);
+ rLB.append(weld::toId(&aRelationMap[nRelPos]), sEntry);
if (sSelEntry.isEmpty() && aRelationMap[nRelPos].nRelation == nRel)
sSelEntry = sEntry;
}
@@ -1733,7 +1733,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, sal_uInt16 nMapPos, sal_
default:
if (rLB.get_count())
{
- RelationMap *pEntry = reinterpret_cast<RelationMap*>(rLB.get_id(rLB.get_count() - 1).toUInt64());
+ RelationMap *pEntry = weld::fromId<RelationMap*>(rLB.get_id(rLB.get_count() - 1));
nRel = pEntry->nRelation;
}
break;
@@ -1741,7 +1741,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, sal_uInt16 nMapPos, sal_
for (int i = 0; i < rLB.get_count(); ++i)
{
- RelationMap *pEntry = reinterpret_cast<RelationMap*>(rLB.get_id(i).toUInt64());
+ RelationMap *pEntry = weld::fromId<RelationMap*>(rLB.get_id(i));
if (pEntry->nRelation == nRel)
{
rLB.set_active(i);
diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx
index 8491ea4a7ef1..63a9f7f39f14 100644
--- a/dbaccess/source/ui/app/AppDetailView.cxx
+++ b/dbaccess/source/ui/app/AppDetailView.cxx
@@ -63,7 +63,7 @@ void OTasksWindow::updateHelpText()
TranslateId pHelpTextId;
int nCurEntry = m_xTreeView->get_selected_index();
if (nCurEntry != -1)
- pHelpTextId = reinterpret_cast<TaskEntry*>(m_xTreeView->get_id(nCurEntry).toUInt64())->pHelpID;
+ pHelpTextId = weld::fromId<TaskEntry*>(m_xTreeView->get_id(nCurEntry))->pHelpID;
setHelpText(pHelpTextId);
}
@@ -73,7 +73,7 @@ IMPL_LINK(OTasksWindow, onSelected, weld::TreeView&, rTreeView, bool)
if (m_nCursorIndex != -1)
{
URL aCommand;
- aCommand.Complete = reinterpret_cast<TaskEntry*>(rTreeView.get_id(m_nCursorIndex).toUInt64())->sUNOCommand;
+ aCommand.Complete = weld::fromId<TaskEntry*>(rTreeView.get_id(m_nCursorIndex))->sUNOCommand;
getDetailView()->getBorderWin().getView()->getAppController().executeChecked( aCommand, Sequence< PropertyValue >() );
}
return true;
@@ -175,7 +175,7 @@ void OTasksWindow::fillTaskEntryList( const TaskEntryList& _rList )
size_t nIndex = 0;
for (auto const& task : _rList)
{
- OUString sId = OUString::number(reinterpret_cast<sal_uInt64>(new TaskEntry(task)));
+ OUString sId = weld::toId(new TaskEntry(task));
m_xTreeView->append(sId, task.sTitle);
m_xTreeView->set_image(nIndex++, *pImages++);
}
@@ -192,7 +192,7 @@ void OTasksWindow::fillTaskEntryList( const TaskEntryList& _rList )
void OTasksWindow::Clear()
{
m_xTreeView->all_foreach([this](weld::TreeIter& rEntry){
- TaskEntry* pUserData = reinterpret_cast<TaskEntry*>(m_xTreeView->get_id(rEntry).toUInt64());
+ TaskEntry* pUserData = weld::fromId<TaskEntry*>(m_xTreeView->get_id(rEntry));
delete pUserData;
return false;
});
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 4d6cb342dc44..0ea6c5400fb3 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -469,7 +469,7 @@ bool SbaTableQueryBrowser::InitializeForm( const Reference< XPropertySet > & i_f
try
{
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*m_xCurrentlyDisplayed).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*m_xCurrentlyDisplayed));
ENSURE_OR_RETURN_FALSE( pData, "SbaTableQueryBrowser::InitializeForm: No user data set at the currently displayed entry!" );
ENSURE_OR_RETURN_FALSE( pData->xObjectProperties.is(), "SbaTableQueryBrowser::InitializeForm: No table available!" );
@@ -549,7 +549,7 @@ void SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm
Sequence< Any> aValues(7 + ( m_bPreview ? 5 : 0 ));
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*m_xCurrentlyDisplayed).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*m_xCurrentlyDisplayed));
OSL_ENSURE( pData->xObjectProperties.is(), "SbaTableQueryBrowser::InitializeGridModel: No table available!" );
if ( !pData->xObjectProperties.is() )
return;
@@ -761,7 +761,7 @@ static Reference<XPropertySet> getColumnHelper(const weld::TreeView& rTreeView,
Reference<XPropertySet> xRet;
if (pCurrentlyDisplayed)
{
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*pCurrentlyDisplayed).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*pCurrentlyDisplayed));
Reference<XColumnsSupplier> xColumnsSup(pData->xObjectProperties,UNO_QUERY);
Reference<XNameAccess> xNames = xColumnsSup->getColumns();
OUString aName;
@@ -777,7 +777,7 @@ void SbaTableQueryBrowser::transferChangedControlProperty(const OUString& _rProp
if (m_xCurrentlyDisplayed)
{
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*m_xCurrentlyDisplayed).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*m_xCurrentlyDisplayed));
Reference< XPropertySet > xObjectProps = pData->xObjectProperties;
OSL_ENSURE(xObjectProps.is(),"SbaTableQueryBrowser::transferChangedControlProperty: no table/query object!");
if (xObjectProps.is())
@@ -862,7 +862,7 @@ void SbaTableQueryBrowser::propertyChange(const PropertyChangeEvent& evt)
{
if (m_xCurrentlyDisplayed)
{
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*m_xCurrentlyDisplayed).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*m_xCurrentlyDisplayed));
OSL_ENSURE( pData->xObjectProperties.is(), "No table available!" );
bool bDefault = !evt.NewValue.hasValue();
@@ -1054,7 +1054,7 @@ namespace
OUString SbaTableQueryBrowser::getDataSourceAccessor(const weld::TreeIter& rDataSourceEntry) const
{
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(rDataSourceEntry).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rDataSourceEntry));
OSL_ENSURE( pData, "SbaTableQueryBrowser::getDataSourceAccessor: invalid entry data!" );
OSL_ENSURE( pData->eType == etDatasource, "SbaTableQueryBrowser::getDataSourceAccessor: entry does not denote a data source!" );
return !pData->sAccessor.isEmpty() ? pData->sAccessor : GetEntryText(rDataSourceEntry);
@@ -1167,7 +1167,7 @@ std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::getObjectEntry(const OUStr
{
if (ensureEntryObject(*xObject))
{
- DBTreeListUserData* pParentData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xObject).toUInt64());
+ DBTreeListUserData* pParentData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xObject));
Reference< XNameAccess > xCollection( pParentData->xContainer, UNO_QUERY );
sal_Int32 nIndex2 = nIndex;
sPath = _rCommand.getToken( 0, '/', nIndex2 );
@@ -1345,7 +1345,7 @@ void SAL_CALL SbaTableQueryBrowser::disposing( const css::lang::EventObject& _rS
{
do
{
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xDSLoop).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xDSLoop));
if ( pData && pData->xConnection == xCon )
{
// we set the connection to null to avoid a second disposing of the connection
@@ -1645,7 +1645,7 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const
std::unique_ptr<weld::TreeIter> xDataSourceEntry = m_pTreeView->GetRootLevelParent(xCurrentEntry.get());
DBTreeListUserData* pDSData
= xDataSourceEntry
- ? reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xDataSourceEntry).toUInt64())
+ ? weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xDataSourceEntry))
: nullptr;
if ( nId == ID_TREE_CLOSE_CONN )
@@ -2034,7 +2034,7 @@ void SbaTableQueryBrowser::implAddDatasource(const OUString& _rDbName, OUString&
pDSData->eType = etDatasource;
pDSData->sAccessor = sDataSourceId;
pDSData->xConnection = _rxConnection;
- OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(pDSData)));
+ OUString sId(weld::toId(pDSData));
std::unique_ptr<weld::TreeIter> xDatasourceEntry(rTreeView.make_iterator());
rTreeView.insert(nullptr, -1, &sDSDisplayName, &sId, nullptr, nullptr, false, xDatasourceEntry.get());
@@ -2045,7 +2045,7 @@ void SbaTableQueryBrowser::implAddDatasource(const OUString& _rDbName, OUString&
{
DBTreeListUserData* pQueriesData = new DBTreeListUserData;
pQueriesData->eType = etQueryContainer;
- sId = OUString::number(reinterpret_cast<sal_uInt64>(pQueriesData));
+ sId = weld::toId(pQueriesData);
std::unique_ptr<weld::TreeIter> xRet(rTreeView.make_iterator());
rTreeView.insert(xDatasourceEntry.get(), -1, &_rQueryName, &sId,
@@ -2058,7 +2058,7 @@ void SbaTableQueryBrowser::implAddDatasource(const OUString& _rDbName, OUString&
{
DBTreeListUserData* pTablesData = new DBTreeListUserData;
pTablesData->eType = etTableContainer;
- sId = OUString::number(reinterpret_cast<sal_uInt64>(pTablesData));
+ sId = weld::toId(pTablesData);
std::unique_ptr<weld::TreeIter> xRet(rTreeView.make_iterator());
rTreeView.insert(xDatasourceEntry.get(), -1, &_rTableName, &sId,
@@ -2089,7 +2089,7 @@ void SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xNameAcce
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
rTreeView.make_unsorted();
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(rParent).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rParent));
if (pData) // don't ask if the nameaccess is already set see OnExpandEntry views and tables
pData->xContainer = _xNameAccess;
@@ -2128,7 +2128,7 @@ std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::implAppendEntry(const weld
OUString aImage = xImageProvider->getImageId(rName, getDatabaseObjectType(eEntryType));
- OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(pUserData)));
+ OUString sId(weld::toId(pUserData));
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
std::unique_ptr<weld::TreeIter> xNewEntry(rTreeView.make_iterator());
rTreeView.insert(pParent, -1, &rName, &sId, nullptr, nullptr, eEntryType == etQueryContainer, xNewEntry.get());
@@ -2150,7 +2150,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, const weld::TreeIter&, rParent, b
std::unique_ptr<weld::TreeIter> xFirstParent = m_pTreeView->GetRootLevelParent(&rParent);
OSL_ENSURE(xFirstParent,"SbaTableQueryBrowser::OnExpandEntry: No rootlevelparent!");
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(rParent).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rParent));
assert(pData && "SbaTableQueryBrowser::OnExpandEntry: No user data!");
if (etTableContainer == pData->eType)
@@ -2238,7 +2238,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, const weld::TreeIter&, rParent, b
// we have to expand the queries or bookmarks
if (ensureEntryObject(rParent))
{
- DBTreeListUserData* pParentData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(rParent).toUInt64());
+ DBTreeListUserData* pParentData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rParent));
Reference< XNameAccess > xCollection( pParentData->xContainer, UNO_QUERY );
populateTree(xCollection, rParent, etQuery);
}
@@ -2252,7 +2252,7 @@ bool SbaTableQueryBrowser::ensureEntryObject(const weld::TreeIter& rEntry)
// the user data of the entry
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- DBTreeListUserData* pEntryData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(rEntry).toUInt64());
+ DBTreeListUserData* pEntryData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(rEntry));
OSL_ENSURE(pEntryData,"ensureEntryObject: user data should already be set!");
std::unique_ptr<weld::TreeIter> xDataSourceEntry = m_pTreeView->GetRootLevelParent(&rEntry);
@@ -2275,7 +2275,7 @@ bool SbaTableQueryBrowser::ensureEntryObject(const weld::TreeIter& rEntry)
if (rTreeView.iter_compare(*xParent, *xDataSourceEntry) != 0)
{
OUString aName(rTreeView.get_text(rEntry));
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xParent).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xParent));
try
{
Reference< XNameAccess > xNameAccess(pData->xContainer,UNO_QUERY);
@@ -2482,11 +2482,11 @@ std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::implGetConnectionEntry(con
{
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
std::unique_ptr<weld::TreeIter> xCurrentEntry(rTreeView.make_iterator(&rEntry));
- DBTreeListUserData* pEntryData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xCurrentEntry).toUInt64());
+ DBTreeListUserData* pEntryData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xCurrentEntry));
while (pEntryData->eType != etDatasource)
{
rTreeView.iter_parent(*xCurrentEntry);
- pEntryData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xCurrentEntry).toUInt64());
+ pEntryData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xCurrentEntry));
}
return xCurrentEntry;
}
@@ -2497,7 +2497,7 @@ bool SbaTableQueryBrowser::implSelect(const weld::TreeIter* pEntry)
return false;
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- DBTreeListUserData* pEntryData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*pEntry).toUInt64());
+ DBTreeListUserData* pEntryData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*pEntry));
switch (pEntryData->eType)
{
case etTableOrView:
@@ -2513,11 +2513,11 @@ bool SbaTableQueryBrowser::implSelect(const weld::TreeIter* pEntry)
// get the entry for the tables or queries
std::unique_ptr<weld::TreeIter> xContainer = rTreeView.make_iterator(pEntry);
rTreeView.iter_parent(*xContainer);
- DBTreeListUserData* pContainerData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xContainer).toUInt64());
+ DBTreeListUserData* pContainerData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xContainer));
// get the entry for the datasource
std::unique_ptr<weld::TreeIter> xConnection = implGetConnectionEntry(*xContainer);
- DBTreeListUserData* pConData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xConnection).toUInt64());
+ DBTreeListUserData* pConData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xConnection));
// reinitialize the rowset
// but first check if it is necessary
@@ -2624,7 +2624,7 @@ bool SbaTableQueryBrowser::implSelect(const weld::TreeIter* pEntry)
bool bEscapeProcessing = true;
if(xNameAccess.is() && xNameAccess->hasByName(sSimpleName))
{
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*pEntry).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*pEntry));
if ( !pData->xObjectProperties.is() )
{
Reference<XInterface> xObject;
@@ -2725,14 +2725,14 @@ std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::getEntryFromContainer(cons
if (rTreeView.iter_children(*xContainer))
{
// 1st child is queries
- DBTreeListUserData* pQueriesData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xContainer).toUInt64());
+ DBTreeListUserData* pQueriesData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xContainer));
if (pQueriesData && pQueriesData->xContainer == rxNameAccess)
break;
if (rTreeView.iter_next_sibling(*xContainer))
{
// 2nd child is tables
- DBTreeListUserData* pTablesData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xContainer).toUInt64());
+ DBTreeListUserData* pTablesData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xContainer));
if (pTablesData && pTablesData->xContainer == rxNameAccess)
break;
}
@@ -2759,7 +2759,7 @@ void SAL_CALL SbaTableQueryBrowser::elementInserted(const ContainerEvent& rEvent
rTreeView.make_unsorted();
// insert the new entry into the tree
- DBTreeListUserData* pContainerData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xEntry).toUInt64());
+ DBTreeListUserData* pContainerData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xEntry));
OSL_ENSURE(pContainerData, "elementInserted: There must be user data for this type!");
DBTreeListUserData* pNewData = new DBTreeListUserData;
@@ -2824,7 +2824,7 @@ void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEven
// unload
unloadAndCleanup( false ); // don't dispose the connection
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xTemp).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xTemp));
rTreeView.set_id(*xTemp, OUString());
delete pData; // the data could be null because we have a table which isn't correct
rTreeView.remove(*xTemp);
@@ -2839,7 +2839,7 @@ void SAL_CALL SbaTableQueryBrowser::elementRemoved( const ContainerEvent& _rEven
{
if (rTreeView.get_text(*xChild) == aName)
{
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xChild).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xChild));
rTreeView.set_id(*xChild, OUString());
delete pData;
rTreeView.remove(*xChild);
@@ -2875,7 +2875,7 @@ void SAL_CALL SbaTableQueryBrowser::elementReplaced( const ContainerEvent& _rEve
std::unique_ptr<weld::TreeIter> xTemp = rTreeView.make_iterator(m_xCurrentlyDisplayed.get());
unloadAndCleanup( false ); // don't dispose the connection
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xTemp).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xTemp));
if (pData)
{
if ( etTableOrView == pData->eType )
@@ -2900,7 +2900,7 @@ void SAL_CALL SbaTableQueryBrowser::elementReplaced( const ContainerEvent& _rEve
{
if (rTreeView.get_text(*xChild) == aName)
{
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xChild).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xChild));
if (pData)
{
if ( etTableOrView == pData->eType )
@@ -2968,7 +2968,7 @@ void SbaTableQueryBrowser::disposeConnection(const weld::TreeIter* pDSEntry)
if (pDSEntry)
{
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
- DBTreeListUserData* pTreeListData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*pDSEntry).toUInt64());
+ DBTreeListUserData* pTreeListData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*pDSEntry));
if (pTreeListData)
impl_releaseConnection(pTreeListData->xConnection);
}
@@ -3004,7 +3004,7 @@ void SbaTableQueryBrowser::closeConnection(const weld::TreeIter& rDSEntry, bool
{
std::unique_ptr<weld::TreeIter> xRemove(rTreeView.make_iterator(xElements.get()));
bElements = rTreeView.iter_next_sibling(*xElements);
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xRemove).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xRemove));
rTreeView.set_id(*xRemove, OUString());
delete pData;
rTreeView.remove(*xRemove);
@@ -3306,7 +3306,7 @@ bool SbaTableQueryBrowser::ensureConnection(const weld::TreeIter* pAnyEntry, Sha
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
DBTreeListUserData* pDSData =
xDSEntry
- ? reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xDSEntry).toUInt64())
+ ? weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xDSEntry))
: nullptr;
return ensureConnection(xDSEntry.get(), pDSData, rConnection);
@@ -3327,7 +3327,7 @@ bool SbaTableQueryBrowser::getExistentConnectionFor(const weld::TreeIter* pAnyEn
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
DBTreeListUserData* pDSData =
xDSEntry
- ? reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xDSEntry).toUInt64())
+ ? weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xDSEntry))
: nullptr;
if (pDSData)
rConnection = pDSData->xConnection;
@@ -3523,7 +3523,7 @@ Any SbaTableQueryBrowser::getCurrentSelection(weld::TreeView& rControl) const
return Any();
NamedDatabaseObject aSelectedObject;
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xSelected).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xSelected));
aSelectedObject.Type = static_cast< sal_Int32 >( pData->eType );
switch ( aSelectedObject.Type )
@@ -3781,14 +3781,14 @@ void SbaTableQueryBrowser::impl_cleanupDataSourceEntry(std::u16string_view rData
do
{
// delete any user data of the child entries of the to-be-removed entry
- const DBTreeListUserData* pData = reinterpret_cast<const DBTreeListUserData*>(rTreeView.get_id(*xChild).toUInt64());
+ const DBTreeListUserData* pData = weld::fromId<const DBTreeListUserData*>(rTreeView.get_id(*xChild));
rTreeView.set_id(*xChild, OUString());
delete pData;
} while (rTreeView.iter_next_sibling(*xChild));
}
// remove the entry
- DBTreeListUserData* pData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(*xDataSourceEntry).toUInt64());
+ DBTreeListUserData* pData = weld::fromId<DBTreeListUserData*>(rTreeView.get_id(*xDataSourceEntry));
rTreeView.set_id(*xDataSourceEntry, OUString());
delete pData;
rTreeView.remove(*xDataSourceEntry);
diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx
index 544b79d03267..a24c2e25468b 100644
--- a/dbaccess/source/ui/misc/WColumnSelect.cxx
+++ b/dbaccess/source/ui/misc/WColumnSelect.cxx
@@ -73,7 +73,7 @@ OWizColumnSelect::~OWizColumnSelect()
{
while (m_xNewColumnNames->n_children())
{
- delete reinterpret_cast<OFieldDescription*>(m_xNewColumnNames->get_id(0).toInt64());
+ delete weld::fromId<OFieldDescription*>(m_xNewColumnNames->get_id(0));
m_xNewColumnNames->remove(0);
}
}
@@ -90,7 +90,7 @@ void OWizColumnSelect::Reset()
for (auto const& column : rSrcColumns)
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(column->second)));
+ OUString sId(weld::toId(column->second));
m_xOrgColumnNames->append(sId, column->first);
}
@@ -121,7 +121,7 @@ void OWizColumnSelect::Activate( )
{
if (rSrcColumns.find(column->first) != rSrcColumns.end())
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(new OFieldDescription(*(column->second)))));
+ OUString sId(weld::toId(new OFieldDescription(*(column->second))));
m_xNewColumnNames->append(sId, column->first);
int nRemove = m_xOrgColumnNames->find_text(column->first);
if (nRemove != -1)
@@ -140,7 +140,7 @@ bool OWizColumnSelect::LeavePage()
for(sal_Int32 i=0 ; i< m_xNewColumnNames->n_children();++i)
{
- OFieldDescription* pField = reinterpret_cast<OFieldDescription*>(m_xNewColumnNames->get_id(i).toInt64());
+ OFieldDescription* pField = weld::fromId<OFieldDescription*>(m_xNewColumnNames->get_id(i));
OSL_ENSURE(pField,"The field information can not be null!");
m_pParent->insertColumn(i,pField);
}
@@ -290,7 +290,7 @@ void OWizColumnSelect::createNewColumn( weld::TreeView* _pListbox,
if ( !m_pParent->supportsPrimaryKey() )
pNewField->SetPrimaryKey(false);
- _pListbox->append(OUString::number(reinterpret_cast<sal_Int64>(pNewField)), sConvertedName);
+ _pListbox->append(weld::toId(pNewField), sConvertedName);
_rRightColumns.push_back(sConvertedName);
if ( !bNotConvert )
@@ -308,7 +308,7 @@ void OWizColumnSelect::moveColumn( weld::TreeView* _pRight,
if(_pRight == m_xNewColumnNames.get())
{
// we copy the column into the new format for the dest
- OFieldDescription* pSrcField = reinterpret_cast<OFieldDescription*>(_pLeft->get_id(_pLeft->find_text(_sColumnName)).toInt64());
+ OFieldDescription* pSrcField = weld::fromId<OFieldDescription*>(_pLeft->get_id(_pLeft->find_text(_sColumnName)));
createNewColumn(_pRight,pSrcField,_rRightColumns,_sColumnName,_sExtraChars,_nMaxNameLen,_aCase);
}
else
@@ -332,7 +332,7 @@ void OWizColumnSelect::moveColumn( weld::TreeView* _pRight,
OSL_ENSURE( aPos != rSrcVector.end(),"Invalid position for the iterator here!");
ODatabaseExport::TColumnVector::size_type nPos = (aPos - rSrcVector.begin()) - adjustColumnPosition(_pLeft, _sColumnName, (aPos - rSrcVector.begin()), _aCase);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aSrcIter->second)));
+ OUString sId(weld::toId(aSrcIter->second));
const OUString& rStr = (*aIter).first;
_pRight->insert(nullptr, nPos, &rStr, &sId, nullptr, nullptr, false, nullptr);
_rRightColumns.push_back(rStr);
diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index 75ff6e3372f1..a6bb59da8eea 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -119,7 +119,7 @@ bool OWizNameMatching::LeavePage()
bool bRightEntry = m_xCTRL_RIGHT->get_iter_first(*xRightEntry);
while (bLeftEntry && bRightEntry)
{
- OFieldDescription* pSrcField = reinterpret_cast<OFieldDescription*>(m_xCTRL_LEFT->get_id(*xLeftEntry).toInt64());
+ OFieldDescription* pSrcField = weld::fromId<OFieldDescription*>(m_xCTRL_LEFT->get_id(*xLeftEntry));
OSL_ENSURE(pSrcField,"OWizNameMatching: OColumn can not be null!");
sal_Int32 nPos = 0;
@@ -132,7 +132,7 @@ bool OWizNameMatching::LeavePage()
if (m_xCTRL_LEFT->get_toggle(*xLeftEntry) == TRISTATE_TRUE)
{
- OFieldDescription* pDestField = reinterpret_cast<OFieldDescription*>(m_xCTRL_RIGHT->get_id(*xRightEntry).toInt64());
+ OFieldDescription* pDestField = weld::fromId<OFieldDescription*>(m_xCTRL_RIGHT->get_id(*xRightEntry));
OSL_ENSURE(pDestField,"OWizNameMatching: OColumn can not be null!");
const ODatabaseExport::TColumnVector& rDestColumns = m_pParent->getDestVector();
sal_Int32 nPosDest = 1;
@@ -268,7 +268,7 @@ IMPL_LINK_NOARG( OWizNameMatching, TableListRightSelectHdl, weld::TreeView&, voi
if (nPos == -1)
return;
- OFieldDescription* pColumn = reinterpret_cast<OFieldDescription*>(m_xCTRL_RIGHT->get_id(nPos).toInt64());
+ OFieldDescription* pColumn = weld::fromId<OFieldDescription*>(m_xCTRL_RIGHT->get_id(nPos));
if (pColumn->IsAutoIncrement())
{
m_xCTRL_RIGHT->unselect(nPos);
@@ -319,7 +319,7 @@ void OWizNameMatching::FillListBox(weld::TreeView& rTreeView, const ODatabaseExp
rTreeView.set_toggle(nRow, bChecked ? TRISTATE_TRUE : TRISTATE_FALSE);
}
rTreeView.set_text(nRow, elem->first, 0);
- rTreeView.set_id(nRow, OUString::number(reinterpret_cast<sal_Int64>(elem->second)));
+ rTreeView.set_id(nRow, weld::toId(elem->second));
++nRow;
}
diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx
index 6f3fbd79d22c..d5462ed3f083 100644
--- a/dbaccess/source/ui/misc/WTypeSelect.cxx
+++ b/dbaccess/source/ui/misc/WTypeSelect.cxx
@@ -86,7 +86,7 @@ void OWizTypeSelectControl::CellModified(sal_Int32 nRow, sal_uInt16 nColId )
OFieldDescription* pCurFieldDescr = getCurrentFieldDescData();
const sal_Int32 nPos = pListBox->find_text(pCurFieldDescr->GetName());
- pCurFieldDescr = reinterpret_cast< OFieldDescription* >( pListBox->get_id(nPos).toInt64() );
+ pCurFieldDescr = weld::fromId<OFieldDescription*>(pListBox->get_id(nPos));
OSL_ENSURE( pCurFieldDescr, "OWizTypeSelectControl::CellModified: Columnname/type not found in the listbox!" );
if ( !pCurFieldDescr )
return;
@@ -153,7 +153,7 @@ void OWizTypeSelectControl::CellModified(sal_Int32 nRow, sal_uInt16 nColId )
pListBox->remove(nPos);
pListBox->insert_text(nPos, pCurFieldDescr->GetName());
- pListBox->set_id(nPos, OUString::number(reinterpret_cast<sal_Int64>(pCurFieldDescr)));
+ pListBox->set_id(nPos, weld::toId(pCurFieldDescr));
pWiz->replaceColumn(nPos,pCurFieldDescr,sOldName);
}
@@ -248,7 +248,7 @@ OUString OWizTypeSelect::GetTitle() const
IMPL_LINK_NOARG(OWizTypeSelect, ColumnSelectHdl, weld::TreeView&, void)
{
- OFieldDescription* pField = reinterpret_cast<OFieldDescription*>(m_xColumnNames->get_selected_id().toInt64());
+ OFieldDescription* pField = weld::fromId<OFieldDescription*>(m_xColumnNames->get_selected_id());
if (pField)
m_xTypeControl->DisplayData(pField);
@@ -265,7 +265,7 @@ void OWizTypeSelect::Reset()
const ODatabaseExport::TColumnVector& rDestColumns = m_pParent->getDestVector();
for (auto const& column : rDestColumns)
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(column->second)));
+ OUString sId(weld::toId(column->second));
m_xColumnNames->append(sId, column->first);
if (column->second->IsPrimaryKey())
m_xColumnNames->set_image(nCount, BMP_PRIMARY_KEY);
@@ -288,7 +288,7 @@ void OWizTypeSelect::Activate( )
bool OWizTypeSelect::LeavePage()
{
bool bDuplicateName = false;
- OFieldDescription* pField = reinterpret_cast<OFieldDescription*>(m_xColumnNames->get_selected_id().toInt64());
+ OFieldDescription* pField = weld::fromId<OFieldDescription*>(m_xColumnNames->get_selected_id());
if ( pField )
{
m_xTypeControl->SaveData(pField);
@@ -339,7 +339,7 @@ bool OWizTypeSelectList::IsPrimaryKeyAllowed() const
for( sal_Int32 j = 0; m_bPKey && j < nCount; ++j )
{
- OFieldDescription* pField = reinterpret_cast<OFieldDescription*>(m_xControl->get_id(aRows[j]).toInt64());
+ OFieldDescription* pField = weld::fromId<OFieldDescription*>(m_xControl->get_id(aRows[j]));
if(!pField || pField->getTypeInfo()->nSearchType == ColumnSearch::NONE)
return false;
}
@@ -374,7 +374,7 @@ IMPL_LINK(OWizTypeSelectList, CommandHdl, const CommandEvent&, rCEvt, bool)
bool bCheckOk = false;
for(sal_Int32 j = 0 ; j < nCount ; ++j)
{
- OFieldDescription* pFieldDescr = reinterpret_cast<OFieldDescription*>(m_xControl->get_id(j).toInt64());
+ OFieldDescription* pFieldDescr = weld::fromId<OFieldDescription*>(m_xControl->get_id(j));
// if at least one of the fields is selected but not in the primary key,
// or is in the primary key but not selected, then don't check the
// primary key checkbox.
@@ -396,7 +396,7 @@ IMPL_LINK(OWizTypeSelectList, CommandHdl, const CommandEvent&, rCEvt, bool)
for (sal_Int32 j = 0 ; j < nCount; ++j)
{
- OFieldDescription* pFieldDescr = reinterpret_cast<OFieldDescription*>(m_xControl->get_id(j).toInt64());
+ OFieldDescription* pFieldDescr = weld::fromId<OFieldDescription*>(m_xControl->get_id(j));
if (pFieldDescr)
{
if(!bCheckOk && m_xControl->is_selected(j))
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx
index 8660a503f1a4..b8afc951d2d8 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -192,7 +192,7 @@ void OTableWindow::FillListBox()
if (GetData()->IsShowAll())
{
- rTreeView.append(OUString::number(reinterpret_cast<sal_uInt64>(createUserData(nullptr,false))), OUString("*"));
+ rTreeView.append(weld::toId(createUserData(nullptr,false)), OUString("*"));
}
Reference<XNameAccess> xPKeyColumns;
@@ -220,7 +220,7 @@ void OTableWindow::FillListBox()
OUString sId;
Reference<XPropertySet> xColumn(xColumns->getByName(*pIter),UNO_QUERY);
if (xColumn.is())
- sId = OUString::number(reinterpret_cast<sal_uInt64>(createUserData(xColumn, bPrimaryKeyColumn)));
+ sId = weld::toId(createUserData(xColumn, bPrimaryKeyColumn));
rTreeView.append(sId, *pIter);
@@ -255,7 +255,7 @@ void OTableWindow::clearListBox()
weld::TreeView& rTreeView = m_xListBox->get_widget();
rTreeView.all_foreach([this, &rTreeView](weld::TreeIter& rEntry){
- void* pUserData = reinterpret_cast<void*>(rTreeView.get_id(rEntry).toUInt64());
+ void* pUserData = weld::fromId<void*>(rTreeView.get_id(rEntry));
deleteUserData(pUserData);
return false;
});
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 26820c5ea97f..e97075d0ea9a 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -489,7 +489,7 @@ short UpdateDialog::run() {
IMPL_LINK(UpdateDialog, entryToggled, const weld::TreeView::iter_col&, rRowCol, void)
{
// error's can't be enabled
- const UpdateDialog::Index* p = reinterpret_cast<UpdateDialog::Index const *>(m_xUpdates->get_id(rRowCol.first).toInt64());
+ const UpdateDialog::Index* p = weld::fromId<UpdateDialog::Index const *>(m_xUpdates->get_id(rRowCol.first));
if (p->m_eKind == SPECIFIC_ERROR)
m_xUpdates->set_toggle(rRowCol.first, TRISTATE_FALSE);
@@ -502,7 +502,7 @@ void UpdateDialog::insertItem(UpdateDialog::Index *pEntry, bool bEnabledCheckBox
m_xUpdates->append();
m_xUpdates->set_toggle(nEntry, bEnabledCheckBox ? TRISTATE_TRUE : TRISTATE_FALSE);
m_xUpdates->set_text(nEntry, pEntry->m_aName, 0);
- m_xUpdates->set_id(nEntry, OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ m_xUpdates->set_id(nEntry, weld::toId(pEntry));
}
void UpdateDialog::addAdditional(UpdateDialog::Index * index, bool bEnabledCheckBox)
@@ -658,7 +658,7 @@ void UpdateDialog::notifyMenubar( bool bPrepareOnly, bool bRecheckOnly )
for (sal_uInt16 i = 0, nItemCount = m_xUpdates->n_children(); i < nItemCount; ++i)
{
- UpdateDialog::Index const * p = reinterpret_cast< UpdateDialog::Index const * >(m_xUpdates->get_id(i).toInt64());
+ UpdateDialog::Index const * p = weld::fromId<UpdateDialog::Index const*>(m_xUpdates->get_id(i));
if ( p->m_eKind == ENABLED_UPDATE )
{
@@ -829,7 +829,7 @@ IMPL_LINK_NOARG(UpdateDialog, selectionHandler, weld::TreeView&, void)
const UpdateDialog::Index* p = nullptr;
if (nSelectedPos != -1)
- p = reinterpret_cast<UpdateDialog::Index const *>(m_xUpdates->get_id(nSelectedPos).toInt64());
+ p = weld::fromId<UpdateDialog::Index const*>(m_xUpdates->get_id(nSelectedPos));
if (p != nullptr)
{
sal_uInt16 pos = p->m_nIndex;
@@ -941,7 +941,7 @@ IMPL_LINK_NOARG(UpdateDialog, allHandler, weld::Toggleable&, void)
for (sal_uInt16 i = m_xUpdates->n_children(); i != 0 ;)
{
i -= 1;
- UpdateDialog::Index const * p = reinterpret_cast< UpdateDialog::Index const * >( m_xUpdates->get_id(i).toInt64() );
+ UpdateDialog::Index const * p = weld::fromId<UpdateDialog::Index const*>(m_xUpdates->get_id(i));
if ( p->m_bIgnored || ( p->m_eKind != ENABLED_UPDATE ) )
{
m_xUpdates->remove(i);
@@ -976,8 +976,7 @@ IMPL_LINK_NOARG(UpdateDialog, okHandler, weld::Button&, void)
for (sal_uInt16 i = 0, nCount = m_xUpdates->n_children(); i < nCount; ++i)
{
UpdateDialog::Index const * p =
- reinterpret_cast< UpdateDialog::Index const * >(
- m_xUpdates->get_id(i).toInt64());
+ weld::fromId<UpdateDialog::Index const*>(m_xUpdates->get_id(i));
if (p->m_eKind == ENABLED_UPDATE && m_xUpdates->get_toggle(i) == TRISTATE_TRUE) {
m_updateData.push_back( m_enabledUpdates[ p->m_nIndex ] );
}
diff --git a/extensions/source/propctrlr/selectlabeldialog.cxx b/extensions/source/propctrlr/selectlabeldialog.cxx
index fabef68abf43..41749f9b4e5c 100644
--- a/extensions/source/propctrlr/selectlabeldialog.cxx
+++ b/extensions/source/propctrlr/selectlabeldialog.cxx
@@ -208,7 +208,7 @@ namespace pcr
// all requirements met -> insert
m_xUserData.emplace_back(new Reference<XPropertySet>(xAsSet));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_xUserData.back().get())));
+ OUString sId(weld::toId(m_xUserData.back().get()));
m_xControlTree->insert(&rContainerEntry, -1, &sDisplayName, &sId, nullptr, nullptr, false, m_xScratchIter.get());
m_xControlTree->set_image(*m_xScratchIter, m_aRequiredControlImage);
diff --git a/extensions/source/propctrlr/taborder.cxx b/extensions/source/propctrlr/taborder.cxx
index d41018a833b3..6ada66b5afa1 100644
--- a/extensions/source/propctrlr/taborder.cxx
+++ b/extensions/source/propctrlr/taborder.cxx
@@ -180,7 +180,7 @@ namespace pcr
aName = ::comphelper::getString( xControl->getPropertyValue( PROPERTY_NAME ) );
// TODO: do Basic controls have a name?
aImage = GetImage( xControl );
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(xControl.get())));
+ OUString sId(weld::toId(xControl.get()));
m_xLB_Controls->append(sId, aName, aImage);
}
}
@@ -243,7 +243,7 @@ namespace pcr
for (int i = 0; i < nEntryCount; ++i)
{
- XPropertySet* pEntry = reinterpret_cast<XPropertySet*>(m_xLB_Controls->get_id(i).toInt64());
+ XPropertySet* pEntry = weld::fromId<XPropertySet*>(m_xLB_Controls->get_id(i));
for( auto const& rControlModel : aControlModels )
{
Reference< XPropertySet > xSet(rControlModel, UNO_QUERY);
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index 8a0d901cb6e6..81dcba978f8a 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -183,7 +183,7 @@ void XMLFilterSettingsDialog::updateStates()
bool bIsDefault = false;
if (bHasSelection)
{
- filter_info_impl* pInfo = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_id(aRows[0]).toInt64());
+ filter_info_impl* pInfo = weld::fromId<filter_info_impl*>(m_xFilterListBox->get_id(aRows[0]));
bIsReadonly = pInfo->mbReadonly;
for( auto nFact : o3tl::enumrange<SvtModuleOptions::EFactory>())
@@ -232,7 +232,7 @@ void XMLFilterSettingsDialog::onNew()
void XMLFilterSettingsDialog::onEdit()
{
// get selected filter info
- filter_info_impl* pOldInfo = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_selected_id().toInt64());
+ filter_info_impl* pOldInfo = weld::fromId<filter_info_impl*>(m_xFilterListBox->get_selected_id());
if (!pOldInfo)
return;
@@ -713,7 +713,7 @@ bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const fi
void XMLFilterSettingsDialog::onTest()
{
// get the first selected filter
- filter_info_impl* pInfo = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_selected_id().toInt64());
+ filter_info_impl* pInfo = weld::fromId<filter_info_impl*>(m_xFilterListBox->get_selected_id());
if (pInfo)
{
XMLFilterTestDialog aDlg(m_xDialog.get(), mxContext);
@@ -726,7 +726,7 @@ void XMLFilterSettingsDialog::onDelete()
int nIndex = m_xFilterListBox->get_selected_index();
if (nIndex == -1)
return;
- filter_info_impl* pInfo = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_id(nIndex).toInt64());
+ filter_info_impl* pInfo = weld::fromId<filter_info_impl*>(m_xFilterListBox->get_id(nIndex));
if (pInfo)
{
OUString aMessage(XsltResId(STR_WARN_DELETE));
@@ -821,7 +821,7 @@ void XMLFilterSettingsDialog::onSave()
int nFilters = 0;
m_xFilterListBox->selected_foreach([&](weld::TreeIter& rEntry){
- filter_info_impl* pInfo = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_id(rEntry).toInt64());
+ filter_info_impl* pInfo = weld::fromId<filter_info_impl*>(m_xFilterListBox->get_id(rEntry));
aFilters.push_back(pInfo);
++nFilters;
return false;
@@ -1209,7 +1209,7 @@ OUString getApplicationUIName( std::u16string_view rServiceName )
void XMLFilterSettingsDialog::addFilterEntry( const filter_info_impl* pInfo )
{
int nRow = m_xFilterListBox->n_children();
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pInfo)));
+ OUString sId(weld::toId(pInfo));
m_xFilterListBox->append(sId, pInfo->maFilterName);
m_xFilterListBox->set_text(nRow, getEntryString(pInfo), 1);
}
@@ -1219,7 +1219,7 @@ void XMLFilterSettingsDialog::changeEntry( const filter_info_impl* pInfo )
const int nCount = m_xFilterListBox->n_children();
for(int nPos = 0; nPos < nCount; ++nPos)
{
- filter_info_impl* pEntry = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_id(nPos).toInt64());
+ filter_info_impl* pEntry = weld::fromId<filter_info_impl*>(m_xFilterListBox->get_id(nPos));
if (pEntry == pInfo)
{
m_xFilterListBox->set_text(nPos, pInfo->maFilterName, 0);
diff --git a/formula/source/ui/dlg/funcpage.cxx b/formula/source/ui/dlg/funcpage.cxx
index f591c73a21e6..553517ce778a 100644
--- a/formula/source/ui/dlg/funcpage.cxx
+++ b/formula/source/ui/dlg/funcpage.cxx
@@ -54,7 +54,7 @@ FuncPage::FuncPage(weld::Container* pParent, const IFunctionManager* _pFunctionM
for (sal_uInt32 j = 0; j < nCategoryCount; ++j)
{
const IFunctionCategory* pCategory = m_pFunctionManager->getCategory(j);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pCategory)));
+ OUString sId(weld::toId(pCategory));
m_xLbCategory->append(sId, pCategory->getName());
}
@@ -83,7 +83,7 @@ void FuncPage::impl_addFunctions(const IFunctionCategory* _pCategory)
TFunctionDesc pDesc(_pCategory->getFunction(i));
if (!pDesc->isHidden())
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pDesc)));
+ OUString sId(weld::toId(pDesc));
m_xLbFunction->append(sId, pDesc->getFunctionName());
}
}
@@ -100,7 +100,7 @@ void FuncPage::UpdateFunctionList(const OUString& aStr)
if (aStr.isEmpty() || nSelPos == 0)
{
const IFunctionCategory* pCategory
- = reinterpret_cast<const IFunctionCategory*>(m_xLbCategory->get_id(nSelPos).toInt64());
+ = weld::fromId<const IFunctionCategory*>(m_xLbCategory->get_id(nSelPos));
if (nSelPos > 0)
{
@@ -123,7 +123,7 @@ void FuncPage::UpdateFunctionList(const OUString& aStr)
{
if (elem) // may be null if a function is no longer available
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(elem)));
+ OUString sId(weld::toId(elem));
m_xLbFunction->append(sId, elem->getFunctionName());
}
}
@@ -163,7 +163,7 @@ void FuncPage::UpdateFunctionList(const OUString& aStr)
{
if (!pDesc->isHidden())
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pDesc)));
+ OUString sId(weld::toId(pDesc));
m_xLbFunction->append(sId, pDesc->getFunctionName());
}
}
@@ -221,7 +221,7 @@ void FuncPage::SetCategory(sal_Int32 nCat)
sal_Int32 FuncPage::GetFuncPos(const IFunctionDescription* _pDesc)
{
- return m_xLbFunction->find_id(OUString::number(reinterpret_cast<sal_Int64>(_pDesc)));
+ return m_xLbFunction->find_id(weld::toId(_pDesc));
}
void FuncPage::SetFunction(sal_Int32 nFunc)
@@ -249,7 +249,7 @@ const IFunctionDescription* FuncPage::GetFuncDesc(sal_Int32 nPos) const
if (nPos == -1)
return nullptr;
// not pretty, but hopefully rare
- return reinterpret_cast<const IFunctionDescription*>(m_xLbFunction->get_id(nPos).toInt64());
+ return weld::fromId<const IFunctionDescription*>(m_xLbFunction->get_id(nPos));
}
} // formula
diff --git a/formula/source/ui/dlg/structpg.cxx b/formula/source/ui/dlg/structpg.cxx
index 69a912206384..6cfc34a96ca1 100644
--- a/formula/source/ui/dlg/structpg.cxx
+++ b/formula/source/ui/dlg/structpg.cxx
@@ -64,7 +64,7 @@ bool StructPage::InsertEntry(const OUString& rText, const weld::TreeIter* pParen
{
SetActiveFlag(false);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pIFormulaToken)));
+ OUString sId(weld::toId(pIFormulaToken));
bool bEntry = false;
switch (nFlag)
@@ -107,7 +107,7 @@ const FormulaToken* StructPage::GetFunctionEntry(const weld::TreeIter* pEntry)
if (!pEntry)
return nullptr;
- const FormulaToken * pToken = reinterpret_cast<const FormulaToken *>(m_xTlbStruct->get_id(*pEntry).toInt64());
+ const FormulaToken * pToken = weld::fromId<const FormulaToken*>(m_xTlbStruct->get_id(*pEntry));
if (pToken)
{
if ( !(pToken->IsFunction() || pToken->GetParamCount() > 1 ) )
@@ -135,7 +135,7 @@ IMPL_LINK(StructPage, SelectHdl, weld::TreeView&, rTlb, void)
std::unique_ptr<weld::TreeIter> xCurEntry(m_xTlbStruct->make_iterator());
if (m_xTlbStruct->get_cursor(xCurEntry.get()))
{
- pSelectedToken = reinterpret_cast<const FormulaToken *>(m_xTlbStruct->get_id(*xCurEntry).toInt64());
+ pSelectedToken = weld::fromId<const FormulaToken*>(m_xTlbStruct->get_id(*xCurEntry));
if (pSelectedToken)
{
if ( !(pSelectedToken->IsFunction() || pSelectedToken->GetParamCount() > 1) )
diff --git a/fpicker/source/office/fileview.cxx b/fpicker/source/office/fileview.cxx
index 7086d17597a9..a0597203ee63 100644
--- a/fpicker/source/office/fileview.cxx
+++ b/fpicker/source/office/fileview.cxx
@@ -509,8 +509,8 @@ IMPL_LINK(ViewTabListBox_Impl, CommandHdl, const CommandEvent&, rCEvt, bool)
::ucbhelper::Content aCnt;
try
{
- OUString aURL(reinterpret_cast<SvtContentEntry*>(
- mxTreeView->get_id(rEntry).toInt64())->maURL);
+ OUString aURL(weld::fromId<SvtContentEntry*>(
+ mxTreeView->get_id(rEntry))->maURL);
aCnt = ::ucbhelper::Content( aURL, mxCmdEnv, comphelper::getProcessComponentContext() );
}
catch( Exception const & )
@@ -602,7 +602,7 @@ void ViewTabListBox_Impl::DeleteEntries()
mxTreeView->selected_foreach([this, &eResult](weld::TreeIter& rCurEntry){
OUString aURL;
if (!mxTreeView->get_id(rCurEntry).isEmpty())
- aURL = reinterpret_cast<SvtContentEntry*>(mxTreeView->get_id(rCurEntry).toInt64())->maURL;
+ aURL = weld::fromId<SvtContentEntry*>(mxTreeView->get_id(rCurEntry))->maURL;
if (aURL.isEmpty())
{
mxTreeView->unselect(rCurEntry);
@@ -677,7 +677,7 @@ IMPL_LINK(ViewTabListBox_Impl, EditedEntryHdl, const IterString&, rIterString, b
bool bRet = false;
OUString aURL;
- SvtContentEntry* pData = reinterpret_cast<SvtContentEntry*>(mxTreeView->get_id(rEntry).toInt64());
+ SvtContentEntry* pData = weld::fromId<SvtContentEntry*>(mxTreeView->get_id(rEntry));
if ( pData )
aURL = pData->maURL;
@@ -719,7 +719,7 @@ IMPL_LINK(ViewTabListBox_Impl, EditedEntryHdl, const IterString&, rIterString, b
if (pData)
pData->maURL = aURL;
- mxTreeView->set_id(rEntry, OUString::number(reinterpret_cast<sal_Int64>(pData)));
+ mxTreeView->set_id(rEntry, weld::toId(pData));
bRet = true;
}
@@ -831,9 +831,9 @@ OUString SvtFileView::GetURL(const weld::TreeIter& rEntry) const
{
SvtContentEntry* pEntry;
if (mpImpl->mxView->get_visible())
- pEntry = reinterpret_cast<SvtContentEntry*>(mpImpl->mxView->get_id(rEntry).toInt64());
+ pEntry = weld::fromId<SvtContentEntry*>(mpImpl->mxView->get_id(rEntry));
else
- pEntry = reinterpret_cast<SvtContentEntry*>(mpImpl->mxIconView->get_id(rEntry).toInt64());
+ pEntry = weld::fromId<SvtContentEntry*>(mpImpl->mxIconView->get_id(rEntry));
if (pEntry)
return pEntry->maURL;
return OUString();
@@ -847,13 +847,13 @@ OUString SvtFileView::GetCurrentURL() const
{
std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxView->make_iterator();
if (mpImpl->mxView->get_selected(xEntry.get()))
- pEntry = reinterpret_cast<SvtContentEntry*>(mpImpl->mxView->get_id(*xEntry).toInt64());
+ pEntry = weld::fromId<SvtContentEntry*>(mpImpl->mxView->get_id(*xEntry));
}
else
{
std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxIconView->make_iterator();
if (mpImpl->mxIconView->get_selected(xEntry.get()))
- pEntry = reinterpret_cast<SvtContentEntry*>(mpImpl->mxIconView->get_id(*xEntry).toInt64());
+ pEntry = weld::fromId<SvtContentEntry*>(mpImpl->mxIconView->get_id(*xEntry));
}
if (pEntry)
aURL = pEntry->maURL;
@@ -865,7 +865,7 @@ void SvtFileView::CreatedFolder( const OUString& rUrl, const OUString& rNewFolde
const SortingData_Impl& rEntry = mpImpl->FolderInserted( rUrl, rNewFolder );
mpImpl->maEntries.emplace_back(std::make_unique<SvtContentEntry>(rUrl, true));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(mpImpl->maEntries.back().get())));
+ OUString sId(weld::toId(mpImpl->maEntries.back().get()));
std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxView->make_iterator();
mpImpl->mxView->insert(rEntry.maDisplayName, sId, mpImpl->maFolderImage, *xEntry);
@@ -1006,14 +1006,14 @@ SvtContentEntry* SvtFileView::FirstSelected() const
SvtContentEntry* pRet = nullptr;
std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxView->make_iterator();
if (mpImpl->mxView->get_selected(xEntry.get()))
- pRet = reinterpret_cast<SvtContentEntry*>(mpImpl->mxView->get_id(*xEntry).toInt64());
+ pRet = weld::fromId<SvtContentEntry*>(mpImpl->mxView->get_id(*xEntry));
return pRet;
}
SvtContentEntry* pRet = nullptr;
std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxIconView->make_iterator();
if (mpImpl->mxIconView->get_selected(xEntry.get()))
- pRet = reinterpret_cast<SvtContentEntry*>(mpImpl->mxIconView->get_id(*xEntry).toInt64());
+ pRet = weld::fromId<SvtContentEntry*>(mpImpl->mxIconView->get_id(*xEntry));
return pRet;
}
@@ -1369,7 +1369,7 @@ void SvtFileView_Impl::OpenFolder_Impl()
// insert entry and set user data
maEntries.emplace_back(std::make_unique<SvtContentEntry>(elem->maTargetURL, elem->mbIsFolder));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(maEntries.back().get())));
+ OUString sId(weld::toId(maEntries.back().get()));
mxView->append(sId, elem->maDisplayName, elem->maType, elem->maDisplaySize, elem->maDisplayDate, elem->maImage);
mxIconView->append(sId, elem->maDisplayName, elem->maImage);
}
@@ -1553,7 +1553,7 @@ void SvtFileView_Impl::Resort_Impl( sal_Int16 nColumn, bool bAscending )
OUString aEntryURL;
if (bEntry && !mxView->get_id(*xEntry).isEmpty())
- aEntryURL = reinterpret_cast<SvtContentEntry*>(mxView->get_id(*xEntry).toInt64())->maURL;
+ aEntryURL = weld::fromId<SvtContentEntry*>(mxView->get_id(*xEntry))->maURL;
mnSortColumn = nColumn;
mbAscending = bAscending;
diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx
index 1b651cbdd3fe..070664576a69 100644
--- a/fpicker/source/office/iodlgimp.cxx
+++ b/fpicker/source/office/iodlgimp.cxx
@@ -161,7 +161,7 @@ void SvtExpFileDlg_Impl::SetCurFilter( SvtFileDialogFilter_Impl const * pFilter,
void SvtExpFileDlg_Impl::InsertFilterListEntry(const SvtFileDialogFilter_Impl* pFilterDesc)
{
// insert and set user data
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pFilterDesc)));
+ OUString sId(weld::toId(pFilterDesc));
OUString sName = pFilterDesc->GetName();
if (pFilterDesc->isGroupSeparator())
m_xLbFilter->append_separator(sId);
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 4190072690b7..d02f5b43c086 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -642,6 +642,16 @@ public:
void connect_jump_page(const Link<const OString&, bool>& rLink) { m_aJumpPageHdl = rLink; }
};
+inline OUString toId(const void* pValue)
+{
+ return OUString::number(reinterpret_cast<const sal_uInt64>(pValue));
+}
+
+template <typename T> T fromId(const OUString& rValue)
+{
+ return reinterpret_cast<T>(rValue.toUInt64());
+}
+
struct VCL_DLLPUBLIC ComboBoxEntry
{
OUString sString;
diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx
index 80c868eb5fd9..e3e1fb3a71ea 100644
--- a/reportdesign/source/ui/dlg/AddField.cxx
+++ b/reportdesign/source/ui/dlg/AddField.cxx
@@ -151,7 +151,7 @@ void OAddFieldWindow::addToList(const uno::Sequence< OUString >& rEntries)
for (const OUString& rEntry : rEntries)
{
m_aListBoxData.emplace_back(new ColumnInfo(rEntry));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_aListBoxData.back().get())));
+ OUString sId(weld::toId(m_aListBoxData.back().get()));
m_xListBox->append(sId, rEntry);
}
}
@@ -166,7 +166,7 @@ void OAddFieldWindow::addToList(const uno::Reference< container::XNameAccess>& i
if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
m_aListBoxData.emplace_back(new ColumnInfo(rEntry, sLabel));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_aListBoxData.back().get())));
+ OUString sId(weld::toId(m_aListBoxData.back().get()));
if ( !sLabel.isEmpty() )
m_xListBox->append(sId, sLabel);
else
@@ -272,7 +272,7 @@ void OAddFieldWindow::fillDescriptor(const weld::TreeIter& rSelected, svx::OData
rDescriptor[ svx::DataAccessDescriptorProperty::EscapeProcessing ] <<= m_bEscapeProcessing;
rDescriptor[ svx::DataAccessDescriptorProperty::Connection ] <<= getConnection();
- ColumnInfo* pInfo = reinterpret_cast<ColumnInfo*>(m_xListBox->get_id(rSelected).toInt64());
+ ColumnInfo* pInfo = weld::fromId<ColumnInfo*>(m_xListBox->get_id(rSelected));
rDescriptor[ svx::DataAccessDescriptorProperty::ColumnName ] <<= pInfo->sColumnName;
if ( m_xColumns->hasByName( pInfo->sColumnName ) )
rDescriptor[ svx::DataAccessDescriptorProperty::ColumnObject ] = m_xColumns->getByName(pInfo->sColumnName);
@@ -289,7 +289,7 @@ void OAddFieldWindow::_elementInserted( const container::ContainerEvent& _rEvent
if ( xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_LABEL) )
xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel;
m_aListBoxData.emplace_back(new ColumnInfo(sName, sLabel));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_aListBoxData.back().get())));
+ OUString sId(weld::toId(m_aListBoxData.back().get()));
if (!sLabel.isEmpty())
m_xListBox->append(sId, sLabel);
else
diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx
index 2a9f4f3ac010..64bc04129c54 100644
--- a/reportdesign/source/ui/dlg/Navigator.cxx
+++ b/reportdesign/source/ui/dlg/Navigator.cxx
@@ -234,7 +234,7 @@ NavigatorTree::NavigatorTree(std::unique_ptr<weld::TreeView> xTreeView, OReportC
NavigatorTree::~NavigatorTree()
{
m_xTreeView->all_foreach([this](weld::TreeIter& rIter) {
- UserData* pData = reinterpret_cast<UserData*>(m_xTreeView->get_id(rIter).toInt64());
+ UserData* pData = weld::fromId<UserData*>(m_xTreeView->get_id(rIter));
delete pData;
return false;
});
@@ -268,7 +268,7 @@ IMPL_LINK(NavigatorTree, CommandHdl, const CommandEvent&, rEvt, bool)
{
case CommandEventId::ContextMenu:
{
- UserData* pData = reinterpret_cast<UserData*>(m_xTreeView->get_selected_id().toInt64());
+ UserData* pData = weld::fromId<UserData*>(m_xTreeView->get_selected_id());
if (!pData)
break;
@@ -337,7 +337,7 @@ IMPL_LINK_NOARG(NavigatorTree, OnEntrySelDesel, weld::TreeView&, void)
bool bEntry = m_xTreeView->get_cursor(xEntry.get());
uno::Any aSelection;
if (bEntry && m_xTreeView->is_selected(*xEntry))
- aSelection <<= reinterpret_cast<UserData*>(m_xTreeView->get_id(*xEntry).toInt64())->getContent();
+ aSelection <<= weld::fromId<UserData*>(m_xTreeView->get_id(*xEntry))->getContent();
m_rController.select(aSelection);
m_pSelectionListener->unlock();
}
@@ -381,7 +381,7 @@ void NavigatorTree::_selectionChanged( const lang::EventObject& aEvent )
void NavigatorTree::insertEntry(const OUString& rName, const weld::TreeIter* pParent, const OUString& rImageId,
int nPosition, UserData* pData, weld::TreeIter& rRet)
{
- OUString sId = pData ? OUString::number(reinterpret_cast<sal_Int64>(pData)) : OUString();
+ OUString sId = pData ? weld::toId(pData) : OUString();
m_xTreeView->insert(pParent, nPosition, &rName, &sId, nullptr, nullptr, false, &rRet);
if (!rImageId.isEmpty())
m_xTreeView->set_image(rRet, rImageId);
@@ -430,7 +430,7 @@ bool NavigatorTree::find(const uno::Reference<uno::XInterface>& xContent, weld::
if (xContent.is())
{
m_xTreeView->all_foreach([this, &xContent, &bRet, &rRet](weld::TreeIter& rIter) {
- UserData* pData = reinterpret_cast<UserData*>(m_xTreeView->get_id(rIter).toInt64());
+ UserData* pData = weld::fromId<UserData*>(m_xTreeView->get_id(rIter));
if (pData->getContent() == xContent)
{
m_xTreeView->copy_iterator(rIter, rRet);
@@ -647,7 +647,7 @@ void NavigatorTree::_elementReplaced( const container::ContainerEvent& _rEvent )
bool bEntry = find(xProp, *xEntry);
if (bEntry)
{
- UserData* pData = reinterpret_cast<UserData*>(m_xTreeView->get_id(*xEntry).toInt64());
+ UserData* pData = weld::fromId<UserData*>(m_xTreeView->get_id(*xEntry));
xProp.set(_rEvent.Element,uno::UNO_QUERY);
pData->setContent(xProp);
OUString sName;
@@ -672,7 +672,7 @@ void NavigatorTree::removeEntry(const weld::TreeIter& rEntry, bool bRemove)
removeEntry(*xChild, false);
bChild = m_xTreeView->iter_next_sibling(*xChild);
}
- delete reinterpret_cast<UserData*>(m_xTreeView->get_id(rEntry).toInt64());
+ delete weld::fromId<UserData*>(m_xTreeView->get_id(rEntry));
if (bRemove)
m_xTreeView->remove(rEntry);
}
diff --git a/sc/source/filter/orcus/xmlcontext.cxx b/sc/source/filter/orcus/xmlcontext.cxx
index 9c73a75436bf..94ef50159764 100644
--- a/sc/source/filter/orcus/xmlcontext.cxx
+++ b/sc/source/filter/orcus/xmlcontext.cxx
@@ -42,7 +42,7 @@ ScOrcusXMLTreeParam::EntryData& setUserDataToEntry(weld::TreeView& rControl,
const weld::TreeIter& rEntry, ScOrcusXMLTreeParam::UserDataStoreType& rStore, ScOrcusXMLTreeParam::EntryType eType)
{
rStore.push_back(std::make_unique<ScOrcusXMLTreeParam::EntryData>(eType));
- rControl.set_id(rEntry, OUString::number(reinterpret_cast<sal_Int64>(rStore.back().get())));
+ rControl.set_id(rEntry, weld::toId(rStore.back().get()));
return *rStore.back();
}
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index 290a6468d1d2..a941076cfef7 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -1612,7 +1612,7 @@ void ScListSubMenuControl::addItem(ScCheckListMenuControl::Action* pAction)
void ScListSubMenuControl::addMenuItem(const OUString& rText, ScCheckListMenuControl::Action* pAction)
{
addItem(pAction);
- mxMenu->append(OUString::number(reinterpret_cast<sal_Int64>(pAction)), rText);
+ mxMenu->append(weld::toId(pAction), rText);
}
void ScListSubMenuControl::addMenuColorItem(const OUString& rText, bool bActive, VirtualDevice& rImage,
@@ -1623,7 +1623,7 @@ void ScListSubMenuControl::addMenuColorItem(const OUString& rText, bool bActive,
weld::TreeView& rColorMenu = nMenu == 0 ? *mxBackColorMenu : *mxTextColorMenu;
rColorMenu.show();
- OUString sId = OUString::number(reinterpret_cast<sal_Int64>(pAction));
+ OUString sId = weld::toId(pAction);
rColorMenu.insert(nullptr, -1, &rText, &sId, nullptr, nullptr, false, mxScratchIter.get());
rColorMenu.set_toggle(*mxScratchIter, bActive ? TRISTATE_TRUE : TRISTATE_FALSE);
rColorMenu.set_image(*mxScratchIter, rImage);
@@ -1731,7 +1731,7 @@ IMPL_LINK(ScListSubMenuControl, ColorSelChangedHdl, weld::TreeView&, rMenu, void
IMPL_LINK(ScListSubMenuControl, RowActivatedHdl, weld::TreeView&, rMenu, bool)
{
- executeMenuItem(reinterpret_cast<ScCheckListMenuControl::Action*>(rMenu.get_selected_id().toInt64()));
+ executeMenuItem(weld::fromId<ScCheckListMenuControl::Action*>(rMenu.get_selected_id()));
return true;
}
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
index 083dd509438d..c173d7ca7d8f 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
@@ -44,8 +44,7 @@ IMPL_LINK_NOARG(ScPivotLayoutTreeList, DoubleClickHdl, weld::TreeView&, bool)
if (nEntry == -1)
return true;
- ScItemValue* pCurrentItemValue
- = reinterpret_cast<ScItemValue*>(mxControl->get_id(nEntry).toInt64());
+ ScItemValue* pCurrentItemValue = weld::fromId<ScItemValue*>(mxControl->get_id(nEntry));
ScPivotFuncData& rCurrentFunctionData = pCurrentItemValue->maFunctionData;
SCCOL nCurrentColumn = rCurrentFunctionData.mnCol;
@@ -86,14 +85,14 @@ void ScPivotLayoutTreeList::FillFields(ScPivotFieldVector& rFieldVector)
OUString aLabel = mpParent->GetItem(rField.nCol)->maName;
ScItemValue* pItemValue = new ScItemValue(aLabel, rField.nCol, rField.nFuncMask);
maItemValues.push_back(std::unique_ptr<ScItemValue>(pItemValue));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue)));
+ OUString sId(weld::toId(pItemValue));
mxControl->append(sId, pItemValue->maName);
}
}
void ScPivotLayoutTreeList::InsertEntryForSourceTarget(weld::TreeView& rSource, int nTarget)
{
- ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(rSource.get_selected_id().toInt64());
+ ScItemValue* pItemValue = weld::fromId<ScItemValue*>(rSource.get_selected_id());
ScItemValue* pOriginalItemValue = pItemValue->mpOriginalItemValue;
// Don't allow to add "Data" element to page fields
@@ -110,7 +109,7 @@ void ScPivotLayoutTreeList::InsertEntryForItem(const ScItemValue* pItemValue, in
ScItemValue* pListItemValue = new ScItemValue(pItemValue);
maItemValues.push_back(std::unique_ptr<ScItemValue>(pListItemValue));
OUString sName = pListItemValue->maName;
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pListItemValue)));
+ OUString sId(weld::toId(pListItemValue));
mxControl->insert(nullptr, nPosition, &sName, &sId, nullptr, nullptr, false, nullptr);
}
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
index 6cc8efc6d5be..45af29a4f1a4 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
@@ -69,7 +69,7 @@ void ScPivotLayoutTreeListBase::PushEntriesToPivotFieldVector(ScPivotFieldVector
return;
do
{
- ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(*xEachEntry).toInt64());
+ ScItemValue* pItemValue = weld::fromId<ScItemValue*>(mxControl->get_id(*xEachEntry));
ScPivotFuncData& rFunctionData = pItemValue->maFunctionData;
ScPivotField aField;
@@ -88,7 +88,7 @@ void ScPivotLayoutTreeListBase::InsertEntryForSourceTarget(weld::TreeView& /*pSo
void ScPivotLayoutTreeListBase::RemoveEntryForItem(const ScItemValue* pItemValue)
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue)));
+ OUString sId(weld::toId(pItemValue));
int nPos = mxControl->find_id(sId);
if (nPos == -1)
return;
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
index a894a03d14c4..19992fc31831 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
@@ -84,7 +84,7 @@ IMPL_LINK_NOARG(ScPivotLayoutTreeListData, DoubleClickHdl, weld::TreeView&, bool
if (nEntry == -1)
return true;
- ScItemValue* pCurrentItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(nEntry).toInt64());
+ ScItemValue* pCurrentItemValue = weld::fromId<ScItemValue*>(mxControl->get_id(nEntry));
ScPivotFuncData& rCurrentFunctionData = pCurrentItemValue->maFunctionData;
SCCOL nCurrentColumn = rCurrentFunctionData.mnCol;
@@ -151,7 +151,7 @@ void ScPivotLayoutTreeListData::FillDataField(ScPivotFieldVector& rDataFields)
pItemValue->maFunctionData.mnDupCount);
maDataItemValues.push_back(std::unique_ptr<ScItemValue>(pItemValue));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue)));
+ OUString sId(weld::toId(pItemValue));
mxControl->append(sId, sDataItemName);
}
}
@@ -164,7 +164,7 @@ void ScPivotLayoutTreeListData::PushDataFieldNames(std::vector<ScDPName>& rDataF
do
{
- ScItemValue* pEachItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(*xLoopEntry).toInt64());
+ ScItemValue* pEachItemValue = weld::fromId<ScItemValue*>(mxControl->get_id(*xLoopEntry));
SCCOL nColumn = pEachItemValue->maFunctionData.mnCol;
ScDPLabelData& rLabelData = mpParent->GetLabelData(nColumn);
@@ -190,7 +190,7 @@ void ScPivotLayoutTreeListData::InsertEntryForSourceTarget(weld::TreeView& rSour
if (rSource.count_selected_rows() <=0)
return;
- ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(rSource.get_selected_id().toInt64());
+ ScItemValue* pItemValue = weld::fromId<ScItemValue*>(rSource.get_selected_id());
if (mpParent->IsDataElement(pItemValue->maFunctionData.mnCol))
return;
@@ -198,7 +198,7 @@ void ScPivotLayoutTreeListData::InsertEntryForSourceTarget(weld::TreeView& rSour
if (&rSource == mxControl.get())
{
OUString sText = mxControl->get_selected_text();
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue)));
+ OUString sId(weld::toId(pItemValue));
mxControl->remove_id(sId);
mxControl->insert(nullptr, nTarget, &sText, &sId, nullptr, nullptr, false, nullptr);
}
@@ -229,7 +229,7 @@ void ScPivotLayoutTreeListData::InsertEntryForItem(ScItemValue* pItemValue, int
pDataItemValue->maName,
rFunctionData.mnDupCount);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pDataItemValue)));
+ OUString sId(weld::toId(pDataItemValue));
mxControl->insert(nullptr, nPosition, &sDataName, &sId, nullptr, nullptr, false, nullptr);
}
@@ -247,7 +247,7 @@ void ScPivotLayoutTreeListData::AdjustDuplicateCount(ScItemValue* pInputItemValu
return;
do
{
- ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(*xEachEntry).toInt64());
+ ScItemValue* pItemValue = weld::fromId<ScItemValue*>(mxControl->get_id(*xEachEntry));
if (pItemValue == pInputItemValue)
continue;
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
index 053d766deb76..e4a2276dacee 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
@@ -42,7 +42,7 @@ void ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector& rLabelVect
if (pLabelData->mnOriginalDim < 0 && !pLabelData->mbDataLayout)
{
- mxControl->append(OUString::number(reinterpret_cast<sal_Int64>(pValue)), pLabelData->maName);
+ mxControl->append(weld::toId(pValue), pLabelData->maName);
}
}
}
diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx
index d42e99371fb3..424c0ee99ca8 100644
--- a/sc/source/ui/formdlg/dwfunctr.cxx
+++ b/sc/source/ui/formdlg/dwfunctr.cxx
@@ -164,7 +164,7 @@ void ScFunctionWin::SetDescription()
{
xFiFuncDesc->set_label(OUString());
const ScFuncDesc* pDesc =
- reinterpret_cast<const ScFuncDesc*>(xFuncList->get_selected_id().toInt64());
+ weld::fromId<const ScFuncDesc*>(xFuncList->get_selected_id());
if (pDesc)
{
pDesc->initArgumentInfo(); // full argument info is needed
@@ -209,7 +209,7 @@ void ScFunctionWin::UpdateFunctionList()
const ScFuncDesc* pDesc = pFuncMgr->First( nCategory );
while ( pDesc )
{
- xFuncList->append(OUString::number(reinterpret_cast<sal_Int64>(pDesc)), *(pDesc->mxFuncName));
+ xFuncList->append(weld::toId(pDesc), *(pDesc->mxFuncName));
pDesc = pFuncMgr->Next();
}
}
@@ -219,7 +219,7 @@ void ScFunctionWin::UpdateFunctionList()
{
if (pDesc)
{
- xFuncList->append(OUString::number(reinterpret_cast<sal_Int64>(pDesc)), pDesc->getFunctionName());
+ xFuncList->append(weld::toId(pDesc), pDesc->getFunctionName());
}
}
}
@@ -277,7 +277,7 @@ void ScFunctionWin::DoEnter()
pHdl->ClearText();
}
const ScFuncDesc* pDesc =
- reinterpret_cast<const ScFuncDesc*>(xFuncList->get_selected_id().toInt64());
+ weld::fromId<const ScFuncDesc*>(xFuncList->get_selected_id());
if (pDesc)
{
pFuncDesc=pDesc;
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index cec8465ae93e..c3c0179c28d7 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -279,7 +279,7 @@ void ScAcceptChgDlg::ClearView()
rTreeView.all_foreach(
[&rTreeView](weld::TreeIter& rEntry)
{
- ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64());
+ ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry));
delete pEntryData;
return false;
});
@@ -480,7 +480,7 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendChangeAction(
weld::TreeView& rTreeView = pTheView->GetWidget();
std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
OUString sString(aBuf.makeStringAndClear());
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewData.release())));
+ OUString sId(weld::toId(pNewData.release()));
rTreeView.insert(pParent, -1, &sString, &sId, nullptr, nullptr, bCreateOnDemand, xEntry.get());
if (!bFlag && bUseColor && !pParent)
{
@@ -598,7 +598,7 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendFilteredAction(
{
weld::TreeView& rTreeView = pTheView->GetWidget();
xEntry = rTreeView.make_iterator();
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewData.release())));
+ OUString sId(weld::toId(pNewData.release()));
rTreeView.insert(pParent, -1, &aActionString, &sId, nullptr, nullptr, bCreateOnDemand, xEntry.get());
OUString aRefStr = pScChangeAction->GetRefString(*pDoc, true);
@@ -724,7 +724,7 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::InsertChangeActionContent(const
weld::TreeView& rTreeView = pTheView->GetWidget();
std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewData.release())));
+ OUString sId(weld::toId(pNewData.release()));
rTreeView.insert(&rParent, -1, &aString, &sId, nullptr, nullptr, false, xEntry.get());
if (pTheView->IsValidComment(aComment) && bFlag)
bHasFilterEntry=true;
@@ -883,7 +883,7 @@ IMPL_LINK( ScAcceptChgDlg, RejectHandle, SvxTPView*, pRef, void )
{
weld::TreeView& rTreeView = pTheView->GetWidget();
rTreeView.selected_foreach([this, pChanges, &rTreeView](weld::TreeIter& rEntry){
- ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64());
+ ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry));
if (pEntryData)
{
ScChangeAction* pScChangeAction= static_cast<ScChangeAction*>(pEntryData->pData);
@@ -916,7 +916,7 @@ IMPL_LINK( ScAcceptChgDlg, AcceptHandle, SvxTPView*, pRef, void )
{
weld::TreeView& rTreeView = pTheView->GetWidget();
rTreeView.selected_foreach([pChanges, &rTreeView](weld::TreeIter& rEntry) {
- ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64());
+ ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry));
if (pEntryData)
{
ScChangeAction* pScChangeAction=
@@ -1053,7 +1053,7 @@ void ScAcceptChgDlg::GetDependents(const ScChangeAction* pScChangeAction,
std::unique_ptr<weld::TreeIter> xParent(rTreeView.make_iterator(&rEntry));
if (rTreeView.iter_parent(*xParent))
{
- ScRedlinData *pParentData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xParent).toInt64());
+ ScRedlinData *pParentData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xParent));
ScChangeAction* pParentAction=static_cast<ScChangeAction*>(pParentData->pData);
if(pParentAction!=pScChangeAction)
@@ -1072,7 +1072,7 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap, const
{
bool bTheTestFlag = true;
weld::TreeView& rTreeView = pTheView->GetWidget();
- ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rParent).toInt64());
+ ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rParent));
const ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
bool bParentInserted = false;
// If the parent is a MatrixOrigin then place it in the right order before
@@ -1101,7 +1101,7 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap, const
if (xOriginal)
{
bTheTestFlag=false;
- ScRedlinData *pParentData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xOriginal).toInt64());
+ ScRedlinData *pParentData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xOriginal));
pParentData->pData=const_cast<ScChangeAction *>(pScChangeAction);
pParentData->nActionNo=pScChangeAction->GetActionNumber();
pParentData->bIsAcceptable=pScChangeAction->IsRejectable(); // select old value
@@ -1131,7 +1131,7 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap, const
if (xEntry)
{
bTheTestFlag=false;
- ScRedlinData *pParentData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
+ ScRedlinData *pParentData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
pParentData->pData=const_cast<ScChangeAction *>(pScChangeAction);
pParentData->nActionNo=pScChangeAction->GetActionNumber();
pParentData->bIsAcceptable=pScChangeAction->IsClickable();
@@ -1186,7 +1186,7 @@ bool ScAcceptChgDlg::InsertChildren(ScChangeActionMap* pActionMap, const weld::T
bTheTestFlag=false;
weld::TreeView& rTreeView = pTheView->GetWidget();
- ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
+ ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
pEntryData->bIsRejectable=false;
pEntryData->bIsAcceptable=false;
pEntryData->bDisabled=true;
@@ -1216,7 +1216,7 @@ bool ScAcceptChgDlg::InsertDeletedChildren(const ScChangeAction* pScChangeAction
if (xEntry)
{
weld::TreeView& rTreeView = pTheView->GetWidget();
- ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
+ ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
pEntryData->bIsRejectable=false;
pEntryData->bIsAcceptable=false;
pEntryData->bDisabled=true;
@@ -1277,7 +1277,7 @@ IMPL_LINK(ScAcceptChgDlg, ExpandingHandle, const weld::TreeIter&, rEntry, bool)
m_xDialog->set_busy_cursor(true);
ScChangeActionMap aActionMap;
weld::TreeView& rTreeView = pTheView->GetWidget();
- ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64());
+ ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry));
if (!rTreeView.iter_has_child(rEntry))
{
bool bTheTestFlag = true;
@@ -1407,7 +1407,7 @@ void ScAcceptChgDlg::RemoveEntries(sal_uLong nStartAction,sal_uLong nEndAction)
ScRedlinData *pEntryData=nullptr;
std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
if (rTreeView.get_cursor(xEntry.get()))
- pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
+ pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
if (!rTreeView.get_iter_first(*xEntry))
return;
@@ -1424,7 +1424,7 @@ void ScAcceptChgDlg::RemoveEntries(sal_uLong nStartAction,sal_uLong nEndAction)
do
{
OUString sId(rTreeView.get_id(*xEntry));
- pEntryData = reinterpret_cast<ScRedlinData *>(sId.toInt64());
+ pEntryData = weld::fromId<ScRedlinData*>(sId);
if (pEntryData)
{
nAction = pEntryData->nActionNo;
@@ -1461,7 +1461,7 @@ void ScAcceptChgDlg::UpdateEntries(const ScChangeTrack* pChgTrack, sal_uLong nSt
while (bEntry)
{
bool bRemove = false;
- ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
+ ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
if (pEntryData)
{
ScChangeAction* pScChangeAction=
@@ -1565,7 +1565,7 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, UpdateSelectionHdl, Timer *, void)
weld::TreeView& rTreeView = pTheView->GetWidget();
std::vector<const ScChangeAction*> aActions;
rTreeView.selected_foreach([&rTreeView, &bAcceptFlag, &bRejectFlag, &aActions](weld::TreeIter& rEntry){
- ScRedlinData* pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64());
+ ScRedlinData* pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry));
if (pEntryData)
{
bRejectFlag &= pEntryData->bIsRejectable;
@@ -1623,7 +1623,7 @@ IMPL_LINK(ScAcceptChgDlg, CommandHdl, const CommandEvent&, rCEvt, bool)
if (pDoc->IsDocEditable() && bEntry)
{
- ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
+ ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
if (pEntryData)
{
ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
@@ -1640,7 +1640,7 @@ IMPL_LINK(ScAcceptChgDlg, CommandHdl, const CommandEvent&, rCEvt, bool)
{
if (bEntry)
{
- ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
+ ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
if (pEntryData)
{
ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
@@ -1764,8 +1764,8 @@ int ScAcceptChgDlg::ColCompareHdl(const weld::TreeIter& rLeft, const weld::TreeI
if (CALC_DATE == nSortCol)
{
- RedlinData *pLeftData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rLeft).toInt64());
- RedlinData *pRightData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rRight).toInt64());
+ RedlinData *pLeftData = weld::fromId<RedlinData*>(rTreeView.get_id(rLeft));
+ RedlinData *pRightData = weld::fromId<RedlinData*>(rTreeView.get_id(rRight));
if (pLeftData && pRightData)
{
if(pLeftData->aDateTime < pRightData->aDateTime)
@@ -1777,8 +1777,8 @@ int ScAcceptChgDlg::ColCompareHdl(const weld::TreeIter& rLeft, const weld::TreeI
}
else if (CALC_POS == nSortCol)
{
- ScRedlinData *pLeftData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rLeft).toInt64());
- ScRedlinData *pRightData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rRight).toInt64());
+ ScRedlinData *pLeftData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rLeft));
+ ScRedlinData *pRightData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rRight));
if (pLeftData && pRightData)
{
nCompare = 1;
diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx
index 6e97d262c82b..1559f5419899 100644
--- a/sc/source/ui/miscdlgs/conflictsdlg.cxx
+++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx
@@ -481,7 +481,7 @@ IMPL_LINK_NOARG(ScConflictsDlg, UpdateSelectionHdl, Timer *, void)
rTreeView.selected_foreach([&rTreeView, &aActions](weld::TreeIter& rEntry){
if (rTreeView.get_iter_depth(rEntry))
{
- RedlinData* pUserData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rEntry).toInt64());
+ RedlinData* pUserData = weld::fromId<RedlinData*>(rTreeView.get_id(rEntry));
if (pUserData)
{
ScChangeAction* pAction = static_cast< ScChangeAction* >( pUserData->pData );
@@ -511,7 +511,7 @@ IMPL_LINK_NOARG(ScConflictsDlg, UpdateSelectionHdl, Timer *, void)
void ScConflictsDlg::SetConflictAction(const weld::TreeIter& rRootEntry, ScConflictAction eConflictAction)
{
weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
- RedlinData* pUserData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rRootEntry).toInt64());
+ RedlinData* pUserData = weld::fromId<RedlinData*>(rTreeView.get_id(rRootEntry));
ScConflictsListEntry* pConflictEntry = static_cast< ScConflictsListEntry* >( pUserData ? pUserData->pData : nullptr );
if ( pConflictEntry )
{
@@ -595,7 +595,7 @@ void ScConflictsDlg::UpdateView()
std::unique_ptr<RedlinData> pRootUserData(new RedlinData());
pRootUserData->pData = static_cast<void*>(&rConflictEntry);
OUString sString(GetConflictString(rConflictEntry));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pRootUserData.release())));
+ OUString sId(weld::toId(pRootUserData.release()));
std::unique_ptr<weld::TreeIter> xRootEntry(rTreeView.make_iterator());
std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
rTreeView.insert(nullptr, -1, &sString, &sId, nullptr, nullptr, false, xRootEntry.get());
@@ -637,7 +637,7 @@ void ScConflictsDlg::UpdateView()
std::unique_ptr<RedlinData> pUserData(new RedlinData());
pUserData->pData = static_cast< void* >( pAction );
- OUString aId(OUString::number(reinterpret_cast<sal_Int64>(pUserData.release())));
+ OUString aId(weld::toId(pUserData.release()));
rTreeView.insert(xRootEntry.get(), -1, nullptr, &aId, nullptr, nullptr, false, xEntry.get());
SetActionString(pAction, mpOwnDoc, *xEntry);
}
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx
index b753b678b631..6ec7712f87ea 100644
--- a/sc/source/ui/miscdlgs/mvtabdlg.cxx
+++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx
@@ -177,7 +177,7 @@ void ScMoveTableDlg::CheckNewTabName()
ScDocument* ScMoveTableDlg::GetSelectedDoc()
{
- return reinterpret_cast<ScDocument*>(m_xLbDoc->get_active_id().toUInt64());
+ return weld::fromId<ScDocument*>(m_xLbDoc->get_active_id());
}
void ScMoveTableDlg::Init()
@@ -223,7 +223,7 @@ void ScMoveTableDlg::InitDocListBox()
aEntryName += " " + msCurrentDoc;
}
- OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(&pScSh->GetDocument())));
+ OUString sId(weld::toId(&pScSh->GetDocument()));
m_xLbDoc->insert(i, aEntryName, &sId, nullptr, nullptr);
i++;
diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx
index 35d5f956797e..41603b6d517e 100644
--- a/sc/source/ui/miscdlgs/solveroptions.cxx
+++ b/sc/source/ui/miscdlgs/solveroptions.cxx
@@ -129,7 +129,7 @@ const uno::Sequence<beans::PropertyValue>& ScSolverOptionsDialog::GetProperties(
for (sal_Int32 nEntryPos=0; nEntryPos<nEntryCount; ++nEntryPos)
{
uno::Any& rValue = maPropertiesRange[nEntryPos].Value;
- if (ScSolverOptionsString* pStringItem = reinterpret_cast<ScSolverOptionsString*>(m_xLbSettings->get_id(nEntryPos).toInt64()))
+ if (ScSolverOptionsString* pStringItem = weld::fromId<ScSolverOptionsString*>(m_xLbSettings->get_id(nEntryPos)))
{
if (pStringItem->IsDouble())
rValue <<= pStringItem->GetDoubleValue();
@@ -224,7 +224,7 @@ void ScSolverOptionsDialog::FillListBox()
m_xLbSettings->set_text(nPos, sTxt, 0);
}
- m_xLbSettings->set_id(nPos, OUString::number(reinterpret_cast<sal_Int64>(m_aOptions.back().get())));
+ m_xLbSettings->set_id(nPos, weld::toId(m_aOptions.back().get()));
}
}
@@ -241,7 +241,7 @@ void ScSolverOptionsDialog::EditOption()
int nEntry = m_xLbSettings->get_selected_index();
if (nEntry == -1)
return;
- ScSolverOptionsString* pStringItem = reinterpret_cast<ScSolverOptionsString*>(m_xLbSettings->get_id(nEntry).toInt64());
+ ScSolverOptionsString* pStringItem = weld::fromId<ScSolverOptionsString*>(m_xLbSettings->get_id(nEntry));
if (!pStringItem)
return;
@@ -331,7 +331,7 @@ IMPL_LINK_NOARG(ScSolverOptionsDialog, SettingsSelHdl, weld::TreeView&, void)
int nEntry = m_xLbSettings->get_selected_index();
if (nEntry != -1)
{
- ScSolverOptionsString* pStringItem = reinterpret_cast<ScSolverOptionsString*>(m_xLbSettings->get_id(nEntry).toInt64());
+ ScSolverOptionsString* pStringItem = weld::fromId<ScSolverOptionsString*>(m_xLbSettings->get_id(nEntry));
if (!pStringItem)
bCheckbox = true;
}
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index 2ae97e5cc5dc..356093d69810 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -265,7 +265,7 @@ IMPL_STATIC_LINK(CustomAnimationList, CustomRenderHdl, weld::TreeView::render_ar
bool bSelected = std::get<2>(aPayload);
const OUString& rId = std::get<3>(aPayload);
- CustomAnimationListEntryItem* pItem = reinterpret_cast<CustomAnimationListEntryItem*>(rId.toInt64());
+ CustomAnimationListEntryItem* pItem = weld::fromId<CustomAnimationListEntryItem*>(rId);
pItem->Paint(rRenderContext, rRect, bSelected);
}
@@ -275,7 +275,7 @@ IMPL_STATIC_LINK(CustomAnimationList, CustomGetSizeHdl, weld::TreeView::get_size
vcl::RenderContext& rRenderContext = aPayload.first;
const OUString& rId = aPayload.second;
- CustomAnimationListEntryItem* pItem = reinterpret_cast<CustomAnimationListEntryItem*>(rId.toInt64());
+ CustomAnimationListEntryItem* pItem = weld::fromId<CustomAnimationListEntryItem*>(rId);
if (!pItem)
return Size(CustomAnimationListEntryItem::nIconWidth, CustomAnimationListEntryItem::nItemMinHeight);
return pItem->GetSize(rRenderContext);
@@ -514,14 +514,14 @@ sal_Int8 CustomAnimationList::ExecuteDrop(const ExecuteDropEvent& rEvt)
if( bMovingEffect && bMoveNotSelf && bHaveSequence )
{
CustomAnimationListEntryItem* pTarget = xDndEffectInsertBefore ?
- reinterpret_cast<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xDndEffectInsertBefore).toInt64()) :
+ weld::fromId<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xDndEffectInsertBefore)) :
nullptr;
// Build list of effects
std::vector< CustomAnimationEffectPtr > aEffects;
for( const auto &pEntry : mDndEffectsSelected )
{
- CustomAnimationListEntryItem* pCustomAnimationEffect = reinterpret_cast<CustomAnimationListEntryItem*>(mxTreeView->get_id(*pEntry).toInt64());
+ CustomAnimationListEntryItem* pCustomAnimationEffect = weld::fromId<CustomAnimationListEntryItem*>(mxTreeView->get_id(*pEntry));
aEffects.push_back(pCustomAnimationEffect->getEffect());
}
@@ -599,7 +599,7 @@ void CustomAnimationList::select( const CustomAnimationEffectPtr& pEffect )
{
do
{
- CustomAnimationListEntryItem* pTestEntry = reinterpret_cast<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xEntry).toInt64());
+ CustomAnimationListEntryItem* pTestEntry = weld::fromId<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xEntry));
if (pTestEntry->getEffect() == pEffect)
{
mxTreeView->select(*xEntry);
@@ -678,7 +678,7 @@ void CustomAnimationList::update()
// save selection, current, and expand (visible) states
mxTreeView->all_foreach([this, &aVisible, &nFirstVis, &xLastVisibleEntry,
&aSelected, &nFirstSelOld, &pFirstSelEffect, &xLastSelectedEntry](weld::TreeIter& rEntry){
- CustomAnimationListEntryItem* pEntry = reinterpret_cast<CustomAnimationListEntryItem*>(mxTreeView->get_id(rEntry).toInt64());
+ CustomAnimationListEntryItem* pEntry = weld::fromId<CustomAnimationListEntryItem*>(mxTreeView->get_id(rEntry));
CustomAnimationEffectPtr pEffect(pEntry->getEffect());
if (pEffect)
{
@@ -714,7 +714,7 @@ void CustomAnimationList::update()
if (xLastSelectedEntry)
{
- CustomAnimationListEntryItem* pEntry = reinterpret_cast<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xLastSelectedEntry).toInt64());
+ CustomAnimationListEntryItem* pEntry = weld::fromId<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xLastSelectedEntry));
pLastSelEffect = pEntry->getEffect();
nLastSelOld = weld::GetAbsPos(*mxTreeView, *xLastSelectedEntry);
}
@@ -724,7 +724,7 @@ void CustomAnimationList::update()
if (mxTreeView->get_cursor(xEntry.get()))
{
- CustomAnimationListEntryItem* pEntry = reinterpret_cast<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xEntry).toInt64());
+ CustomAnimationListEntryItem* pEntry = weld::fromId<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xEntry));
aCurrent = pEntry->getEffect();
}
}
@@ -752,7 +752,7 @@ void CustomAnimationList::update()
mxEntries.emplace_back(std::make_unique<CustomAnimationListEntryItem>(aDescription, nullptr));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(mxEntries.back().get())));
+ OUString sId(weld::toId(mxEntries.back().get()));
mxTreeView->insert(nullptr, -1, &aDescription, &sId, nullptr, nullptr, false, nullptr);
std::for_each( pIS->getBegin(), pIS->getEnd(), stl_append_effect_func( *this ) );
mxLastParentEntry.reset();
@@ -780,7 +780,7 @@ void CustomAnimationList::update()
{
do
{
- CustomAnimationListEntryItem* pEntry = reinterpret_cast<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xEntry).toInt64());
+ CustomAnimationListEntryItem* pEntry = weld::fromId<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xEntry));
CustomAnimationEffectPtr pEffect( pEntry->getEffect() );
if (pEffect)
@@ -891,7 +891,7 @@ void CustomAnimationList::append( CustomAnimationEffectPtr pEffect )
mxEntries.emplace_back(std::make_unique<CustomAnimationListEntryItem>(aDescription, pEffect));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(mxEntries.back().get())));
+ OUString sId(weld::toId(mxEntries.back().get()));
if (xParentEntry)
{
@@ -923,7 +923,7 @@ static void selectShape(weld::TreeView* pTreeList, const Reference< XShape >& xS
do
{
- CustomAnimationListEntryItem* pEntry = reinterpret_cast<CustomAnimationListEntryItem*>(pTreeList->get_id(*xEntry).toInt64());
+ CustomAnimationListEntryItem* pEntry = weld::fromId<CustomAnimationListEntryItem*>(pTreeList->get_id(*xEntry));
CustomAnimationEffectPtr pEffect(pEntry->getEffect());
if (pEffect)
{
@@ -1059,7 +1059,7 @@ bool CustomAnimationList::isExpanded( const CustomAnimationEffectPtr& pEffect )
do
{
CustomAnimationListEntryItem* pEntry =
- reinterpret_cast<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xEntry).toInt64());
+ weld::fromId<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xEntry));
if (pEntry->getEffect() == pEffect)
{
if (mxTreeView->get_iter_depth(*xEntry)) // no parent, keep expanded default of true
@@ -1083,7 +1083,7 @@ bool CustomAnimationList::isVisible(const CustomAnimationEffectPtr& pEffect) con
{
do
{
- CustomAnimationListEntryItem* pTestEntry = reinterpret_cast<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xEntry).toInt64());
+ CustomAnimationListEntryItem* pTestEntry = weld::fromId<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xEntry));
if (pTestEntry->getEffect() == pEffect)
return weld::IsEntryVisible(*mxTreeView, *xEntry);
} while (mxTreeView->iter_next(*xEntry));
@@ -1096,7 +1096,7 @@ EffectSequence CustomAnimationList::getSelection() const
EffectSequence aSelection;
mxTreeView->selected_foreach([this, &aSelection](weld::TreeIter& rEntry){
- CustomAnimationListEntryItem* pEntry = reinterpret_cast<CustomAnimationListEntryItem*>(mxTreeView->get_id(rEntry).toInt64());
+ CustomAnimationListEntryItem* pEntry = weld::fromId<CustomAnimationListEntryItem*>(mxTreeView->get_id(rEntry));
CustomAnimationEffectPtr pEffect(pEntry->getEffect());
if (pEffect)
aSelection.push_back(pEffect);
@@ -1112,7 +1112,7 @@ EffectSequence CustomAnimationList::getSelection() const
{
if (!mxTreeView->is_selected(*xChild))
{
- CustomAnimationListEntryItem* pChild = reinterpret_cast<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xChild).toInt64());
+ CustomAnimationListEntryItem* pChild = weld::fromId<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xChild));
const CustomAnimationEffectPtr& pChildEffect( pChild->getEffect() );
if( pChildEffect )
aSelection.push_back( pChildEffect );
@@ -1144,7 +1144,7 @@ IMPL_LINK(CustomAnimationList, CommandHdl, const CommandEvent&, rCEvt, bool)
sal_Int16 nEntries = 0;
mxTreeView->selected_foreach([this, &nNodeType, &nEntries](weld::TreeIter& rEntry){
- CustomAnimationListEntryItem* pEntry = reinterpret_cast<CustomAnimationListEntryItem*>(mxTreeView->get_id(rEntry).toInt64());
+ CustomAnimationListEntryItem* pEntry = weld::fromId<CustomAnimationListEntryItem*>(mxTreeView->get_id(rEntry));
CustomAnimationEffectPtr pEffect(pEntry->getEffect());
nEntries++;
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index 6004a5386b79..66ded2c772c9 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -598,10 +598,10 @@ void CustomAnimationPane::updateControls()
sal_Int32 nAnimationPos = mxLBAnimation->n_children();
while( nAnimationPos-- )
{
- auto nEntryData = mxLBAnimation->get_id(nAnimationPos).toInt64();
- if (nEntryData)
+ auto pEntryData = weld::fromId<CustomAnimationPresetPtr*>(mxLBAnimation->get_id(nAnimationPos));
+ if (pEntryData)
{
- CustomAnimationPresetPtr& pPtr = *reinterpret_cast<CustomAnimationPresetPtr*>(nEntryData);
+ CustomAnimationPresetPtr& pPtr = *pEntryData;
if( pPtr && pPtr->getPresetId() == rsPresetId )
{
mxLBAnimation->select( nAnimationPos );
@@ -1797,9 +1797,9 @@ void CustomAnimationPane::onAdd()
mnLastSelectedAnimation = nFirstEffect;
}
- auto nEntryData = mxLBAnimation->get_selected_id().toInt64();
- if (nEntryData)
- pDescriptor = *reinterpret_cast<CustomAnimationPresetPtr*>(nEntryData);
+ auto pEntryData = weld::fromId<CustomAnimationPresetPtr*>(mxLBAnimation->get_selected_id());
+ if (pEntryData)
+ pDescriptor = *pEntryData;
if( pDescriptor )
{
@@ -2097,7 +2097,7 @@ IMPL_LINK_NOARG(CustomAnimationPane, SelectionHandler, Timer*, void)
mnLastSelectedAnimation = nSelected;
- CustomAnimationPresetPtr* pPreset = reinterpret_cast<CustomAnimationPresetPtr*>(mxLBAnimation->get_id(nSelected).toInt64());
+ CustomAnimationPresetPtr* pPreset = weld::fromId<CustomAnimationPresetPtr*>(mxLBAnimation->get_id(nSelected));
PathKind ePathKind = getCreatePathKind();
if ( ePathKind != PathKind::NONE )
@@ -2237,7 +2237,7 @@ sal_Int32 CustomAnimationPane::fillAnimationLB( bool bHasText )
if( pDescriptor && ( !pDescriptor->isTextOnly() || bHasText ) )
{
auto pCustomPtr = new CustomAnimationPresetPtr(pDescriptor);
- OUString sId = OUString::number(reinterpret_cast<sal_Int64>(pCustomPtr));
+ OUString sId = weld::toId(pCustomPtr);
mxLBAnimation->append(sId, pDescriptor->getLabel());
mxLBAnimation->set_text_emphasis(nPos, false, 0);
diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx
index 78274f3f4492..bc421d7e48a5 100644
--- a/sd/source/ui/dlg/custsdlg.cxx
+++ b/sd/source/ui/dlg/custsdlg.cxx
@@ -288,7 +288,7 @@ SdDefineCustomShowDlg::SdDefineCustomShowDlg(weld::Window* pWindow, SdDrawDocume
// fill ListBox with CustomShow pages
for( const auto& rpPage : rpCustomShow->PagesVector() )
{
- m_xLbCustomPages->append(OUString::number(reinterpret_cast<sal_uInt64>(rpPage)), rpPage->GetName(), "");
+ m_xLbCustomPages->append(weld::toId(rpPage), rpPage->GetName(), "");
}
}
else
@@ -355,7 +355,7 @@ void SdDefineCustomShowDlg::ClickButtonHdl2(void const * p)
{
OUString aStr = m_xLbPages->get_text(i);
SdPage* pPage = rDoc.GetSdPage(i, PageKind::Standard);
- OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(pPage)));
+ OUString sId(weld::toId(pPage));
m_xLbCustomPages->insert(nPosCP, aStr, &sId, nullptr, nullptr);
m_xLbCustomPages->select(nPosCP != -1 ? nPosCP : m_xLbCustomPages->n_children() - 1);
@@ -405,7 +405,7 @@ void SdDefineCustomShowDlg::CheckCustomShow()
size_t i = 0;
for (const auto& rpPage : rpCustomShow->PagesVector())
{
- SdPage* pPage = reinterpret_cast<SdPage*>(m_xLbCustomPages->get_id(i).toUInt64());
+ SdPage* pPage = weld::fromId<SdPage*>(m_xLbCustomPages->get_id(i));
if (rpPage != pPage)
{
rpCustomShow->PagesVector().clear();
@@ -422,7 +422,7 @@ void SdDefineCustomShowDlg::CheckCustomShow()
{
for (size_t i = 0; i < nCount; ++i)
{
- SdPage* pPage = reinterpret_cast<SdPage*>(m_xLbCustomPages->get_id(i).toUInt64());
+ SdPage* pPage = weld::fromId<SdPage*>(m_xLbCustomPages->get_id(i));
rpCustomShow->PagesVector().push_back(pPage);
}
bModified = true;
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 53306fffc0b6..b1a7330874f9 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -343,7 +343,7 @@ namespace
if (!bSourceHasParent || rTreeView.get_iter_depth(*xSourceParent))
return false;
- SdrObject* pSourceObject = reinterpret_cast<SdrObject*>(rTreeView.get_id(*xSource).toInt64());
+ SdrObject* pSourceObject = weld::fromId<SdrObject*>(rTreeView.get_id(*xSource));
if (pSourceObject == reinterpret_cast<SdrObject*>(1))
pSourceObject = nullptr;
@@ -493,8 +493,8 @@ sal_Int8 SdPageObjsTLVDropTarget::ExecuteDrop( const ExecuteDropEvent& rEvt )
return DND_ACTION_NONE;
int nTargetPos = m_rTreeView.get_iter_index_in_parent(*xTarget) + 1;
- SdrObject* pTargetObject = reinterpret_cast<SdrObject*>(m_rTreeView.get_id(*xTarget).toInt64());
- SdrObject* pSourceObject = reinterpret_cast<SdrObject*>(m_rTreeView.get_id(*xSource).toInt64());
+ SdrObject* pTargetObject = weld::fromId<SdrObject*>(m_rTreeView.get_id(*xTarget));
+ SdrObject* pSourceObject = weld::fromId<SdrObject*>(m_rTreeView.get_id(*xSource));
if (pSourceObject == reinterpret_cast<SdrObject*>(1))
pSourceObject = nullptr;
@@ -1022,7 +1022,7 @@ void SdPageObjsTLV::AddShapeList (
OUString aUserData("1");
if (pShape != nullptr)
- aUserData = OUString::number(reinterpret_cast<sal_Int64>(pShape));
+ aUserData = weld::toId(pShape);
std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->make_iterator();
InsertEntry(pParentEntry, aUserData, rsName, aIcon, xEntry.get());
@@ -1039,7 +1039,7 @@ void SdPageObjsTLV::AddShapeList (
// Get the shape name.
OUString aStr (GetObjectName( pObj ) );
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pObj)));
+ OUString sId(weld::toId(pObj));
if( !aStr.isEmpty() )
{
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index ee4e2c32b955..674c1717f6c9 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -225,7 +225,7 @@ void ContentTabPage_Impl::InitRoot()
bool bIsFolder = ( '1' == cFolder );
OUString sId;
if (bIsFolder)
- sId = OUString::number(reinterpret_cast<sal_Int64>(new ContentEntry_Impl(aURL, true)));
+ sId = weld::toId(new ContentEntry_Impl(aURL, true));
m_xContentBox->insert(nullptr, -1, &aTitle, &sId, nullptr, nullptr, true, m_xScratchIter.get());
m_xContentBox->set_image(*m_xScratchIter, aClosedBookImage);
}
@@ -238,7 +238,7 @@ void ContentTabPage_Impl::ClearChildren(const weld::TreeIter* pParent)
while (bEntry)
{
ClearChildren(xEntry.get());
- delete reinterpret_cast<ContentEntry_Impl*>(m_xContentBox->get_id(*xEntry).toInt64());
+ delete weld::fromId<ContentEntry_Impl*>(m_xContentBox->get_id(*xEntry));
bEntry = m_xContentBox->iter_next_sibling(*xEntry);
}
@@ -246,7 +246,7 @@ void ContentTabPage_Impl::ClearChildren(const weld::TreeIter* pParent)
IMPL_LINK(ContentTabPage_Impl, ExpandingHdl, const weld::TreeIter&, rIter, bool)
{
- ContentEntry_Impl* pContentEntry = reinterpret_cast<ContentEntry_Impl*>(m_xContentBox->get_id(rIter).toInt64());
+ ContentEntry_Impl* pContentEntry = weld::fromId<ContentEntry_Impl*>(m_xContentBox->get_id(rIter));
if (!m_xContentBox->iter_has_child(rIter))
{
try
@@ -264,7 +264,7 @@ IMPL_LINK(ContentTabPage_Impl, ExpandingHdl, const weld::TreeIter&, rIter, bool)
bool bIsFolder = ( '1' == cFolder );
if ( bIsFolder )
{
- OUString sId = OUString::number(reinterpret_cast<sal_Int64>(new ContentEntry_Impl(aURL, true)));
+ OUString sId = weld::toId(new ContentEntry_Impl(aURL, true));
m_xContentBox->insert(&rIter, -1, &aTitle, &sId, nullptr, nullptr, true, m_xScratchIter.get());
m_xContentBox->set_image(*m_xScratchIter, aClosedBookImage);
}
@@ -274,7 +274,7 @@ IMPL_LINK(ContentTabPage_Impl, ExpandingHdl, const weld::TreeIter&, rIter, bool)
OUString sId;
OUString aTargetURL;
if ( aAny >>= aTargetURL )
- sId = OUString::number(reinterpret_cast<sal_Int64>(new ContentEntry_Impl(aTargetURL, false)));
+ sId = weld::toId(new ContentEntry_Impl(aTargetURL, false));
m_xContentBox->insert(&rIter, -1, &aTitle, &sId, nullptr, nullptr, false, m_xScratchIter.get());
m_xContentBox->set_image(*m_xScratchIter, aDocumentImage);
}
@@ -295,7 +295,7 @@ IMPL_LINK(ContentTabPage_Impl, ExpandingHdl, const weld::TreeIter&, rIter, bool)
IMPL_LINK(ContentTabPage_Impl, CollapsingHdl, const weld::TreeIter&, rIter, bool)
{
- ContentEntry_Impl* pContentEntry = reinterpret_cast<ContentEntry_Impl*>(m_xContentBox->get_id(rIter).toInt64());
+ ContentEntry_Impl* pContentEntry = weld::fromId<ContentEntry_Impl*>(m_xContentBox->get_id(rIter));
if (!pContentEntry || pContentEntry->bIsFolder)
m_xContentBox->set_image(rIter, aClosedBookImage);
@@ -305,7 +305,7 @@ IMPL_LINK(ContentTabPage_Impl, CollapsingHdl, const weld::TreeIter&, rIter, bool
OUString ContentTabPage_Impl::GetSelectedEntry() const
{
OUString aRet;
- ContentEntry_Impl* pEntry = reinterpret_cast<ContentEntry_Impl*>(m_xContentBox->get_selected_id().toInt64());
+ ContentEntry_Impl* pEntry = weld::fromId<ContentEntry_Impl*>(m_xContentBox->get_selected_id());
if (pEntry && !pEntry->bIsFolder)
aRet = pEntry->aURL;
return aRet;
@@ -360,7 +360,7 @@ ContentTabPage_Impl::~ContentTabPage_Impl()
while (bEntry)
{
ClearChildren(xEntry.get());
- delete reinterpret_cast<ContentEntry_Impl*>(m_xContentBox->get_id(*xEntry).toInt64());
+ delete weld::fromId<ContentEntry_Impl*>(m_xContentBox->get_id(*xEntry));
bEntry = m_xContentBox->iter_next_sibling(*xEntry);
}
}
@@ -373,11 +373,11 @@ void IndexTabPage_Impl::SelectExecutableEntry()
sal_Int32 nOldPos = nPos;
OUString aEntryText;
- IndexEntry_Impl* pEntry = reinterpret_cast<IndexEntry_Impl*>(m_xIndexList->get_id(nPos).toInt64());
+ IndexEntry_Impl* pEntry = weld::fromId<IndexEntry_Impl*>(m_xIndexList->get_id(nPos));
sal_Int32 nCount = m_xIndexList->n_children();
while ( nPos < nCount && ( !pEntry || pEntry->m_aURL.isEmpty() ) )
{
- pEntry = reinterpret_cast<IndexEntry_Impl*>(m_xIndexList->get_id(++nPos).toInt64());
+ pEntry = weld::fromId<IndexEntry_Impl*>(m_xIndexList->get_id(++nPos));
aEntryText = m_xIndexList->get_text(nPos);
}
@@ -445,7 +445,7 @@ IMPL_LINK(IndexTabPage_Impl, CustomRenderHdl, weld::TreeView::render_args, aPayl
int nIndex = m_xIndexList->find_id(rId);
OUString aEntry(m_xIndexList->get_text(nIndex));
- IndexEntry_Impl* pEntry = reinterpret_cast<IndexEntry_Impl*>(rId.toInt64());
+ IndexEntry_Impl* pEntry = weld::fromId<IndexEntry_Impl*>(rId);
if (pEntry && pEntry->m_bSubEntry)
{
// indent sub entries
@@ -609,7 +609,7 @@ void IndexTabPage_Impl::InitializeIndex()
{
aIndex = aTempString;
it = aInfo.emplace(aTempString, 0).first;
- sId = OUString::number(reinterpret_cast<sal_Int64>(new IndexEntry_Impl(OUString(), false)));
+ sId = weld::toId(new IndexEntry_Impl(OUString(), false));
if ( (tmp = it->second++) != 0)
m_xIndexList->append(
sId, aTempString + std::u16string_view(append, tmp));
@@ -630,10 +630,10 @@ void IndexTabPage_Impl::InitializeIndex()
if ( aAnchorList[0].getLength() > 0 )
{
aData.append( aRefList[0] ).append( '#' ).append( aAnchorList[0] );
- sId = OUString::number(reinterpret_cast<sal_Int64>(new IndexEntry_Impl(aData.makeStringAndClear(), insert)));
+ sId = weld::toId(new IndexEntry_Impl(aData.makeStringAndClear(), insert));
}
else
- sId = OUString::number(reinterpret_cast<sal_Int64>(new IndexEntry_Impl(aRefList[0], insert)));
+ sId = weld::toId(new IndexEntry_Impl(aRefList[0], insert));
}
// Assume the token is trimmed
@@ -657,10 +657,10 @@ void IndexTabPage_Impl::InitializeIndex()
if ( aAnchorList[j].getLength() > 0 )
{
aData.append( aRefList[j] ).append( '#' ).append( aAnchorList[j] );
- sId = OUString::number(reinterpret_cast<sal_Int64>(new IndexEntry_Impl(aData.makeStringAndClear(), insert)));
+ sId = weld::toId(new IndexEntry_Impl(aData.makeStringAndClear(), insert));
}
else
- sId = OUString::number(reinterpret_cast<sal_Int64>(new IndexEntry_Impl(aRefList[j], insert)));
+ sId = weld::toId(new IndexEntry_Impl(aRefList[j], insert));
it = aInfo.emplace(aTempString, 0).first;
if ( (tmp = it->second++) != 0 )
@@ -688,7 +688,7 @@ void IndexTabPage_Impl::ClearIndex()
{
const sal_Int32 nCount = m_xIndexList->n_children();
for ( sal_Int32 i = 0; i < nCount; ++i )
- delete reinterpret_cast<IndexEntry_Impl*>(m_xIndexList->get_id(i).toInt64());
+ delete weld::fromId<IndexEntry_Impl*>(m_xIndexList->get_id(i));
m_xIndexList->clear();
}
@@ -821,7 +821,7 @@ void IndexTabPage_Impl::SetFactory( const OUString& rFactory )
OUString IndexTabPage_Impl::GetSelectedEntry() const
{
OUString aRet;
- IndexEntry_Impl* pEntry = reinterpret_cast<IndexEntry_Impl*>(m_xIndexList->get_id(m_xIndexList->find_text(m_xIndexEntry->get_text())).toInt64());
+ IndexEntry_Impl* pEntry = weld::fromId<IndexEntry_Impl*>(m_xIndexList->get_id(m_xIndexList->find_text(m_xIndexEntry->get_text())));
if (pEntry)
aRet = pEntry->m_aURL;
return aRet;
diff --git a/sfx2/source/devtools/DocumentModelTreeHandler.cxx b/sfx2/source/devtools/DocumentModelTreeHandler.cxx
index 7373cb1e603c..49484309dfd4 100644
--- a/sfx2/source/devtools/DocumentModelTreeHandler.cxx
+++ b/sfx2/source/devtools/DocumentModelTreeHandler.cxx
@@ -93,7 +93,7 @@ public:
void lclAppendToParentEntry(const std::unique_ptr<weld::TreeView>& rTree,
weld::TreeIter const& rParent, DocumentModelTreeEntry* pEntry)
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ OUString sId(weld::toId(pEntry));
OUString const& rString = pEntry->getString();
rTree->insert(&rParent, -1, &rString, &sId, nullptr, nullptr, pEntry->shouldShowExpander(),
nullptr);
@@ -102,7 +102,7 @@ void lclAppendToParentEntry(const std::unique_ptr<weld::TreeView>& rTree,
// append a root entry to a input TreeView
OUString lclAppend(const std::unique_ptr<weld::TreeView>& rTree, DocumentModelTreeEntry* pEntry)
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ OUString sId(weld::toId(pEntry));
OUString const& rString = pEntry->getString();
rTree->insert(nullptr, -1, &rString, &sId, nullptr, nullptr, pEntry->shouldShowExpander(),
nullptr);
@@ -714,7 +714,7 @@ uno::Reference<uno::XInterface> DocumentModelTreeHandler::getObjectByID(OUString
uno::Reference<uno::XInterface> xObject;
if (rID.isEmpty())
return xObject;
- auto* pEntry = reinterpret_cast<DocumentModelTreeEntry*>(rID.toInt64());
+ auto* pEntry = weld::fromId<DocumentModelTreeEntry*>(rID);
return pEntry->getMainObject();
}
@@ -723,7 +723,7 @@ void DocumentModelTreeHandler::clearAll()
// destroy all DocumentModelTreeEntries from the tree
mpDocumentModelTree->all_foreach([this](weld::TreeIter& rEntry) {
OUString sID = mpDocumentModelTree->get_id(rEntry);
- auto* pEntry = reinterpret_cast<DocumentModelTreeEntry*>(sID.toInt64());
+ auto* pEntry = weld::fromId<DocumentModelTreeEntry*>(sID);
delete pEntry;
return false;
});
@@ -744,7 +744,7 @@ void DocumentModelTreeHandler::clearChildren(weld::TreeIter const& rParent)
{
clearChildren(*pChild);
OUString sID = mpDocumentModelTree->get_id(*pChild);
- auto* pEntry = reinterpret_cast<DocumentModelTreeEntry*>(sID.toInt64());
+ auto* pEntry = weld::fromId<DocumentModelTreeEntry*>(sID);
delete pEntry;
mpDocumentModelTree->remove(*pChild);
}
@@ -756,7 +756,7 @@ void DocumentModelTreeHandler::dispose()
{
mpDocumentModelTree->all_foreach([this](weld::TreeIter& rEntry) {
OUString sID = mpDocumentModelTree->get_id(rEntry);
- auto* pEntry = reinterpret_cast<DocumentModelTreeEntry*>(sID.toInt64());
+ auto* pEntry = weld::fromId<DocumentModelTreeEntry*>(sID);
delete pEntry;
return false;
});
@@ -769,7 +769,7 @@ IMPL_LINK(DocumentModelTreeHandler, ExpandingHandler, weld::TreeIter const&, rPa
return true;
clearChildren(rParent);
- auto* pEntry = reinterpret_cast<DocumentModelTreeEntry*>(sID.toInt64());
+ auto* pEntry = weld::fromId<DocumentModelTreeEntry*>(sID);
pEntry->fill(mpDocumentModelTree, rParent);
return true;
@@ -782,7 +782,7 @@ void DocumentModelTreeHandler::selectObject(
mpDocumentModelTree->all_foreach([this, xInterface](weld::TreeIter& rEntry) {
OUString sID = mpDocumentModelTree->get_id(rEntry);
- auto* pEntry = reinterpret_cast<DocumentModelTreeEntry*>(sID.toInt64());
+ auto* pEntry = weld::fromId<DocumentModelTreeEntry*>(sID);
if (xInterface == pEntry->getMainObject())
{
mpDocumentModelTree->select(rEntry);
diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
index 7228f48e13ca..7787c61d9468 100644
--- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
+++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
@@ -351,7 +351,7 @@ OUString lclAppendNode(const std::unique_ptr<weld::TreeView>& pTree,
ObjectInspectorNodeInterface* pEntry)
{
OUString sName = pEntry->getObjectName();
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ OUString sId(weld::toId(pEntry));
std::unique_ptr<weld::TreeIter> pCurrent = pTree->make_iterator();
pTree->insert(nullptr, -1, &sName, &sId, nullptr, nullptr, pEntry->shouldShowExpander(),
pCurrent.get());
@@ -370,7 +370,7 @@ OUString lclAppendNodeToParent(const std::unique_ptr<weld::TreeView>& pTree,
const weld::TreeIter* pParent, ObjectInspectorNodeInterface* pEntry)
{
OUString sName = pEntry->getObjectName();
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ OUString sId(weld::toId(pEntry));
std::unique_ptr<weld::TreeIter> pCurrent = pTree->make_iterator();
pTree->insert(pParent, -1, &sName, &sId, nullptr, nullptr, pEntry->shouldShowExpander(),
pCurrent.get());
@@ -902,7 +902,7 @@ ObjectInspectorNodeInterface* getSelectedNode(weld::TreeView const& rTreeView)
if (sID.isEmpty())
return nullptr;
- if (auto* pNode = reinterpret_cast<ObjectInspectorNodeInterface*>(sID.toInt64()))
+ if (auto* pNode = weld::fromId<ObjectInspectorNodeInterface*>(sID))
return pNode;
return nullptr;
@@ -1000,7 +1000,7 @@ void ObjectInspectorTreeHandler::handleExpanding(std::unique_ptr<weld::TreeView>
return;
clearObjectInspectorChildren(pTreeView, rParent);
- auto* pNode = reinterpret_cast<ObjectInspectorNodeInterface*>(sID.toInt64());
+ auto* pNode = weld::fromId<ObjectInspectorNodeInterface*>(sID);
pNode->fillChildren(pTreeView, &rParent);
}
@@ -1206,7 +1206,7 @@ void ObjectInspectorTreeHandler::clearObjectInspectorChildren(
{
clearObjectInspectorChildren(pTreeView, *pChild);
OUString sID = pTreeView->get_id(*pChild);
- auto* pEntry = reinterpret_cast<ObjectInspectorNodeInterface*>(sID.toInt64());
+ auto* pEntry = weld::fromId<ObjectInspectorNodeInterface*>(sID);
delete pEntry;
pTreeView->remove(*pChild);
}
@@ -1220,7 +1220,7 @@ void ObjectInspectorTreeHandler::clearAll(std::unique_ptr<weld::TreeView>& pTree
// destroy all ObjectInspectorNodes from the tree
pTreeView->all_foreach([&pTreeView](weld::TreeIter& rEntry) {
OUString sID = pTreeView->get_id(rEntry);
- auto* pEntry = reinterpret_cast<ObjectInspectorNodeInterface*>(sID.toInt64());
+ auto* pEntry = weld::fromId<ObjectInspectorNodeInterface*>(sID);
delete pEntry;
return false;
});
diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx
index 6de0d866c30b..4b0a05d40eae 100644
--- a/sfx2/source/dialog/versdlg.cxx
+++ b/sfx2/source/dialog/versdlg.cxx
@@ -126,7 +126,7 @@ namespace
for (int i = 0; i < rVersionBox.n_children(); ++i)
{
- aAuthors.insert(reinterpret_cast<SfxVersionInfo*>(rVersionBox.get_id(i).toInt64())->aAuthor);
+ aAuthors.insert(weld::fromId<SfxVersionInfo*>(rVersionBox.get_id(i))->aAuthor);
}
int nMaxAuthorWidth = nRest/4;
@@ -218,7 +218,7 @@ void SfxVersionDialog::Init_Impl()
{
SfxVersionInfo *pInfo = m_pTable->at( n );
OUString aEntry = formatTime(pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper());
- m_xVersionBox->append(OUString::number(reinterpret_cast<sal_Int64>(pInfo)), aEntry);
+ m_xVersionBox->append(weld::toId(pInfo), aEntry);
auto nLastRow = m_xVersionBox->n_children() - 1;
m_xVersionBox->set_text(nLastRow, pInfo->aAuthor, 1);
m_xVersionBox->set_text(nLastRow, ConvertWhiteSpaces_Impl(pInfo->aComment), 2);
@@ -331,7 +331,7 @@ IMPL_LINK(SfxVersionDialog, ButtonHdl_Impl, weld::Button&, rButton, void)
}
else if (&rButton == m_xDeleteButton.get() && nEntry != -1)
{
- SfxVersionInfo* pInfo = reinterpret_cast<SfxVersionInfo*>(m_xVersionBox->get_id(nEntry).toInt64());
+ SfxVersionInfo* pInfo = weld::fromId<SfxVersionInfo*>(m_xVersionBox->get_id(nEntry));
pObjShell->GetMedium()->RemoveVersion_Impl(pInfo->aName);
pObjShell->SetModified();
m_xVersionBox->freeze();
@@ -345,7 +345,7 @@ IMPL_LINK(SfxVersionDialog, ButtonHdl_Impl, weld::Button&, rButton, void)
}
else if (&rButton == m_xViewButton.get() && nEntry != -1)
{
- SfxVersionInfo* pInfo = reinterpret_cast<SfxVersionInfo*>(m_xVersionBox->get_id(nEntry).toInt64());
+ SfxVersionInfo* pInfo = weld::fromId<SfxVersionInfo*>(m_xVersionBox->get_id(nEntry));
SfxViewVersionDialog_Impl aDlg(m_xDialog.get(), *pInfo, false);
aDlg.run();
}
@@ -460,7 +460,7 @@ void SfxCmisVersionsDialog::LoadVersions()
{
SfxVersionInfo *pInfo = m_pTable->at( n );
OUString aEntry = formatTime(pInfo->aCreationDate, Application::GetSettings().GetLocaleDataWrapper());
- m_xVersionBox->append(OUString::number(reinterpret_cast<sal_Int64>(pInfo)), aEntry);
+ m_xVersionBox->append(weld::toId(pInfo), aEntry);
auto nLastRow = m_xVersionBox->n_children() - 1;
m_xVersionBox->set_text(nLastRow, pInfo->aAuthor, 1);
m_xVersionBox->set_text(nLastRow, ConvertWhiteSpaces_Impl(pInfo->aComment), 2);
diff --git a/sfx2/source/doc/autoredactdialog.cxx b/sfx2/source/doc/autoredactdialog.cxx
index 4acbb8ea7816..ea1fa8fb218c 100644
--- a/sfx2/source/doc/autoredactdialog.cxx
+++ b/sfx2/source/doc/autoredactdialog.cxx
@@ -29,8 +29,7 @@ int TargetsTable::GetRowByTargetName(std::u16string_view sName)
{
for (int i = 0, nCount = m_xControl->n_children(); i < nCount; ++i)
{
- RedactionTarget* pTarget
- = reinterpret_cast<RedactionTarget*>(m_xControl->get_id(i).toInt64());
+ RedactionTarget* pTarget = weld::fromId<RedactionTarget*>(m_xControl->get_id(i));
if (pTarget->sName == sName)
{
return i;
@@ -122,7 +121,7 @@ void TargetsTable::InsertTarget(RedactionTarget* pTarget)
// Add to the end
int nRow = m_xControl->n_children();
- m_xControl->append(OUString::number(reinterpret_cast<sal_Int64>(pTarget)), pTarget->sName);
+ m_xControl->append(weld::toId(pTarget), pTarget->sName);
m_xControl->set_text(nRow, getTypeName(pTarget->sType), 1);
m_xControl->set_text(nRow, sContent, 2);
m_xControl->set_text(
@@ -138,7 +137,7 @@ RedactionTarget* TargetsTable::GetTargetByName(std::u16string_view sName)
if (nEntry == -1)
return nullptr;
- return reinterpret_cast<RedactionTarget*>(m_xControl->get_id(nEntry).toInt64());
+ return weld::fromId<RedactionTarget*>(m_xControl->get_id(nEntry));
}
OUString TargetsTable::GetNameProposal() const
@@ -147,8 +146,7 @@ OUString TargetsTable::GetNameProposal() const
sal_Int32 nHighestTargetId = 0;
for (int i = 0, nCount = m_xControl->n_children(); i < nCount; ++i)
{
- RedactionTarget* pTarget
- = reinterpret_cast<RedactionTarget*>(m_xControl->get_id(i).toInt64());
+ RedactionTarget* pTarget = weld::fromId<RedactionTarget*>(m_xControl->get_id(i));
const OUString& sName = pTarget->sName;
sal_Int32 nIndex = 0;
if (sName.getToken(0, ' ', nIndex) == sDefaultTargetName)
@@ -269,8 +267,7 @@ IMPL_LINK_NOARG(SfxAutoRedactDialog, EditHdl, weld::Button&, void)
}
// Get the redaction target to be edited
- RedactionTarget* pTarget
- = reinterpret_cast<RedactionTarget*>(m_xTargetsBox->get_id(nSelectedRow).toInt64());
+ RedactionTarget* pTarget = weld::fromId<RedactionTarget*>(m_xTargetsBox->get_id(nSelectedRow));
// Construct and run the edit target dialog
SfxAddTargetDialog aEditTargetDialog(getDialog(), pTarget->sName, pTarget->sType,
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 0c720927280a..51a923023c36 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -1561,7 +1561,7 @@ IMPL_LINK_NOARG(SmSymDefineDialog, SubsetChangeHdl, weld::ComboBox&, void)
int nPos = m_xFontsSubsetLB->get_active();
if (nPos != -1)
{
- const Subset* pSubset = reinterpret_cast<const Subset*>(m_xFontsSubsetLB->get_active_id().toUInt64());
+ const Subset* pSubset = weld::fromId<const Subset*>(m_xFontsSubsetLB->get_active_id());
if (pSubset)
{
m_xCharsetDisplay->SelectCharacter( pSubset->GetRangeMin() );
@@ -1975,7 +1975,7 @@ void SmSymDefineDialog::SetFont(const OUString &rFontName, std::u16string_view r
bool bFirst = true;
for (auto & subset : m_xSubsetMap->GetSubsetMap())
{
- m_xFontsSubsetLB->append(OUString::number(reinterpret_cast<sal_uInt64>(&subset)), subset.GetName());
+ m_xFontsSubsetLB->append(weld::toId(&subset), subset.GetName());
// subset must live at least as long as the selected font !!!
if (bFirst)
m_xFontsSubsetLB->set_active(0);
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index ea553e28810e..e72b0e035c78 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -179,7 +179,7 @@ namespace svxform
void XFormsPage::DeleteAndClearTree()
{
m_xItemList->all_foreach([this](weld::TreeIter& rEntry) {
- delete reinterpret_cast<ItemNode*>(m_xItemList->get_id(rEntry).toInt64());
+ delete weld::fromId<ItemNode*>(m_xItemList->get_id(rEntry));
return false;
});
m_xItemList->clear();
@@ -272,7 +272,7 @@ namespace svxform
if(!xDataTypes.is())
return;
- ItemNode *pItemNode = reinterpret_cast<ItemNode*>(m_xItemList->get_id(*m_xScratchIter).toInt64());
+ ItemNode *pItemNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*m_xScratchIter));
if (!pItemNode)
{
// the only known (and allowed?) case where this happens are sub-entries of a submission
@@ -282,7 +282,7 @@ namespace svxform
DBG_ASSERT(bSelected && !m_xItemList->get_iter_depth(*m_xScratchIter), "DataTreeListBox::StartDrag: what kind of entry *is* this?");
// on the submission page, we have only top-level entries (the submission themself)
// plus direct children of those (facets of a submission)
- pItemNode = bSelected ? reinterpret_cast<ItemNode*>(m_xItemList->get_id(*m_xScratchIter).toInt64()) : nullptr;
+ pItemNode = bSelected ? weld::fromId<ItemNode*>(m_xItemList->get_id(*m_xScratchIter)) : nullptr;
if (!pItemNode)
return;
}
@@ -339,7 +339,7 @@ namespace svxform
if ( !sName.isEmpty() )
{
ItemNode* pNode = new ItemNode( xChild );
- OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(pNode)));
+ OUString sId(weld::toId(pNode));
std::unique_ptr<weld::TreeIter> xEntry = m_xItemList->make_iterator();
m_xItemList->insert(_pParent, -1, &sName, &sId, nullptr, nullptr, false, xEntry.get());
m_xItemList->set_image(*xEntry, aExpImg);
@@ -355,7 +355,7 @@ namespace svxform
{
Reference< css::xml::dom::XNode > xAttr = xMap->item(j);
pNode = new ItemNode( xAttr );
- OUString sSubId(OUString::number(reinterpret_cast<sal_uInt64>(pNode)));
+ OUString sSubId(weld::toId(pNode));
OUString sAttrName = m_xUIHelper->getNodeDisplayName( xAttr, bShowDetails );
m_xItemList->insert(xEntry.get(), -1, &sAttrName, &sSubId, nullptr, nullptr, false, m_xScratchIter.get());
m_xItemList->set_image(*m_xScratchIter, aExpImg);
@@ -427,7 +427,7 @@ namespace svxform
}
DBG_ASSERT( bEntry, "XFormsPage::DoToolBoxAction(): no entry" );
- ItemNode* pParentNode = reinterpret_cast<ItemNode*>(m_xItemList->get_id(*xEntry).toInt64());
+ ItemNode* pParentNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xEntry));
DBG_ASSERT( pParentNode, "XFormsPage::DoToolBoxAction(): no parent node" );
xParentNode = pParentNode->m_xNode;
Reference< css::xml::dom::XNode > xNewNode;
@@ -573,7 +573,7 @@ namespace svxform
{
m_xItemList->iter_parent(*xEntry);
}
- ItemNode* pNode = reinterpret_cast<ItemNode*>(m_xItemList->get_id(*xEntry).toInt64());
+ ItemNode* pNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xEntry));
if ( DGTInstance == m_eGroup || DGTBinding == m_eGroup )
{
if ( DGTInstance == m_eGroup && !m_sInstanceURL.isEmpty() )
@@ -699,7 +699,7 @@ namespace svxform
{
DBG_UNHANDLED_EXCEPTION("svx");
}
- OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(_pNewNode.release())));
+ OUString sId(weld::toId(_pNewNode.release()));
m_xItemList->insert(xParent.get(), -1, &sName, &sId, nullptr, nullptr, false, pRet);
m_xItemList->set_image(*pRet, aImage);
if (xParent && !m_xItemList->get_row_expanded(*xParent) && m_xItemList->iter_has_child(*xParent))
@@ -722,7 +722,7 @@ namespace svxform
{
// ID
_rEntry->getPropertyValue( PN_SUBMISSION_ID ) >>= sTemp;
- OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(pNode)));
+ OUString sId(weld::toId(pNode));
m_xItemList->insert(nullptr, -1, &sTemp, &sId, nullptr, nullptr, false, pRet);
m_xItemList->set_image(*pRet, aImage);
std::unique_ptr<weld::TreeIter> xRes(m_xItemList->make_iterator());
@@ -769,7 +769,7 @@ namespace svxform
_rEntry->getPropertyValue( PN_BINDING_EXPR ) >>= sTemp;
sName += sTemp;
- OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(pNode)));
+ OUString sId(weld::toId(pNode));
m_xItemList->insert(nullptr, -1, &sName, &sId, nullptr, nullptr, false, pRet);
m_xItemList->set_image(*pRet, aImage);
}
@@ -863,7 +863,7 @@ namespace svxform
{
Reference< css::xforms::XModel > xModel( m_xUIHelper, UNO_QUERY );
DBG_ASSERT( xModel.is(), "XFormsPage::RemoveEntry(): no model" );
- ItemNode* pNode = reinterpret_cast<ItemNode*>(m_xItemList->get_id(*xEntry).toInt64());
+ ItemNode* pNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xEntry));
DBG_ASSERT( pNode, "XFormsPage::RemoveEntry(): no node" );
if ( DGTInstance == m_eGroup )
@@ -887,7 +887,7 @@ namespace svxform
std::unique_ptr<weld::TreeIter> xParent(m_xItemList->make_iterator(xEntry.get()));
bool bParent = m_xItemList->iter_parent(*xParent); (void)bParent;
assert(bParent && "XFormsPage::RemoveEntry(): no parent entry");
- ItemNode* pParentNode = reinterpret_cast<ItemNode*>((m_xItemList->get_id(*xParent).toInt64()));
+ ItemNode* pParentNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xParent));
DBG_ASSERT( pParentNode && pParentNode->m_xNode.is(), "XFormsPage::RemoveEntry(): no parent XNode" );
Reference< css::xml::dom::XNode > xPNode;
@@ -1084,7 +1084,7 @@ namespace svxform
ItemNode* pNode = new ItemNode( xPropSet );
- OUString sId(OUString::number(reinterpret_cast<sal_uInt64>(pNode)));
+ OUString sId(weld::toId(pNode));
m_xItemList->insert(nullptr, -1, &sEntry, &sId, nullptr, nullptr, false, xRes.get());
m_xItemList->set_image(*xRes, aImage);
}
@@ -1178,7 +1178,7 @@ namespace svxform
m_xItemList->iter_parent(*xEntry);
bSubmitChild = true;
}
- ItemNode* pNode = reinterpret_cast<ItemNode*>(m_xItemList->get_id(*xEntry).toInt64());
+ ItemNode* pNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xEntry));
if ( pNode && ( pNode->m_xNode.is() || pNode->m_xPropSet.is() ) )
{
bEnableEdit = true;
@@ -1227,7 +1227,7 @@ namespace svxform
TranslateId pResId2 = RID_STR_DATANAV_REMOVE_ELEMENT;
if (bEntry)
{
- ItemNode* pNode = reinterpret_cast<ItemNode*>(m_xItemList->get_id(*xEntry).toInt64());
+ ItemNode* pNode = weld::fromId<ItemNode*>(m_xItemList->get_id(*xEntry));
if ( pNode && pNode->m_xNode.is() )
{
try
diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx
index 84a3839af30f..22323f9feb0e 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -241,7 +241,7 @@ namespace svxform
// I may add a format to pCtrlExch
bool bHasNonHidden = std::any_of(m_arrCurrentSelection.begin(), m_arrCurrentSelection.end(),
[this](const auto& rEntry) {
- FmEntryData* pCurrent = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*rEntry).toInt64());
+ FmEntryData* pCurrent = weld::fromId<FmEntryData*>(m_xTreeView->get_id(*rEntry));
return !IsHiddenControl( pCurrent );
});
@@ -277,7 +277,7 @@ namespace svxform
Reference< XInterface >* pArray = seqIFaces.getArray();
for (const auto& rpEntry : m_arrCurrentSelection)
{
- *pArray = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*rpEntry).toInt64())->GetElement();
+ *pArray = weld::fromId<FmEntryData*>(m_xTreeView->get_id(*rpEntry))->GetElement();
++pArray;
}
// and the new format
@@ -435,7 +435,7 @@ namespace svxform
FmXFormShell::GetConversionMenu_Lock(*xConversionMenu);
#if OSL_DEBUG_LEVEL > 0
const std::unique_ptr<weld::TreeIter>& rIter = *m_arrCurrentSelection.begin();
- FmControlData* pCurrent = reinterpret_cast<FmControlData*>(m_xTreeView->get_id(*rIter).toInt64());
+ FmControlData* pCurrent = weld::fromId<FmControlData*>(m_xTreeView->get_id(*rIter));
OSL_ENSURE( pFormShell->GetImpl()->isSolelySelected_Lock( pCurrent->GetFormComponent() ),
"NavigatorTree::Command: inconsistency between the navigator selection, and the selection as the shell knows it!" );
#endif
@@ -490,7 +490,7 @@ namespace svxform
const std::unique_ptr<weld::TreeIter>& rSelectedForm = *m_arrCurrentSelection.begin();
DBG_ASSERT( IsFormEntry(*rSelectedForm), "NavigatorTree::Command: This entry must be a FormEntry." );
- FmFormData* pFormData = reinterpret_cast<FmFormData*>(m_xTreeView->get_id(*rSelectedForm).toInt64());
+ FmFormData* pFormData = weld::fromId<FmFormData*>(m_xTreeView->get_id(*rSelectedForm));
const Reference< XForm >& xForm( pFormData->GetFormIface());
Reference< XTabControllerModel > xTabController(xForm, UNO_QUERY);
@@ -520,7 +520,7 @@ namespace svxform
else if (FmXFormShell::isControlConversionSlot(sIdent))
{
const std::unique_ptr<weld::TreeIter>& rIter = *m_arrCurrentSelection.begin();
- FmControlData* pCurrent = reinterpret_cast<FmControlData*>(m_xTreeView->get_id(*rIter).toInt64());
+ FmControlData* pCurrent = weld::fromId<FmControlData*>(m_xTreeView->get_id(*rIter));
if (pFormShell->GetImpl()->executeControlConversionSlot_Lock(pCurrent->GetFormComponent(), sIdent))
ShowSelectionProperties();
}
@@ -541,7 +541,7 @@ namespace svxform
return xRet;
m_xTreeView->all_foreach([this, pEntryData, &xRet](weld::TreeIter& rEntry){
- FmEntryData* pCurEntryData = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(rEntry).toInt64());
+ FmEntryData* pCurEntryData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(rEntry));
if (pCurEntryData && pCurEntryData->IsEqualWithoutChildren(pEntryData))
{
xRet = m_xTreeView->make_iterator(&rEntry);
@@ -613,7 +613,7 @@ namespace svxform
// insert current entry
std::unique_ptr<weld::TreeIter> xParentEntry = FindEntry( pEntryData->GetParent() );
std::unique_ptr<weld::TreeIter> xNewEntry(m_xTreeView->make_iterator());
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntryData)));
+ OUString sId(weld::toId(pEntryData));
if(!xParentEntry)
{
@@ -682,13 +682,13 @@ namespace svxform
bool NavigatorTree::IsFormEntry(const weld::TreeIter& rEntry)
{
- FmEntryData* pEntryData = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(rEntry).toInt64());
+ FmEntryData* pEntryData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(rEntry));
return !pEntryData || dynamic_cast<const FmFormData*>( pEntryData) != nullptr;
}
bool NavigatorTree::IsFormComponentEntry(const weld::TreeIter& rEntry)
{
- FmEntryData* pEntryData = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(rEntry).toInt64());
+ FmEntryData* pEntryData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(rEntry));
return dynamic_cast<const FmControlData*>( pEntryData) != nullptr;
}
@@ -967,7 +967,7 @@ namespace svxform
// some data for the target
bool bDropTargetIsForm = IsFormEntry(*_pTargetEntry);
- FmFormData* pTargetData = bDropTargetIsForm ? reinterpret_cast<FmFormData*>(m_xTreeView->get_id(*_pTargetEntry).toInt64()) : nullptr;
+ FmFormData* pTargetData = bDropTargetIsForm ? weld::fromId<FmFormData*>(m_xTreeView->get_id(*_pTargetEntry)) : nullptr;
DBG_ASSERT( DND_ACTION_COPY != _nAction, "NavigatorTree::implExecuteDataTransfer: somebody changed the logics!" );
@@ -1013,7 +1013,7 @@ namespace svxform
DBG_ASSERT(m_xTreeView->get_iter_depth(*rCurrent) != 0, "NavigatorTree::implExecuteDataTransfer: invalid entry");
// don't drag root
- FmEntryData* pCurrentUserData = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*rCurrent).toInt64());
+ FmEntryData* pCurrentUserData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(*rCurrent));
Reference< XChild > xCurrentChild = pCurrentUserData->GetChildIFace();
Reference< XIndexContainer > xContainer(xCurrentChild->getParent(), UNO_QUERY);
@@ -1270,7 +1270,7 @@ namespace svxform
if (!IsFormEntry(rParentEntry))
return;
- FmFormData* pParentFormData = reinterpret_cast<FmFormData*>(m_xTreeView->get_id(rParentEntry).toInt64());
+ FmFormData* pParentFormData = weld::fromId<FmFormData*>(m_xTreeView->get_id(rParentEntry));
// create new form
@@ -1332,7 +1332,7 @@ namespace svxform
if (!IsFormEntry(rParentEntry))
return nullptr;
- FmFormData* pParentFormData = reinterpret_cast<FmFormData*>(m_xTreeView->get_id(rParentEntry).toInt64());
+ FmFormData* pParentFormData = weld::fromId<FmFormData*>(m_xTreeView->get_id(rParentEntry));
Reference<XForm> xParentForm(pParentFormData->GetFormIface());
// create new component
@@ -1402,7 +1402,7 @@ namespace svxform
const weld::TreeIter& rIter = rIterString.first;
- FmEntryData* pEntryData = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(rIter).toInt64());
+ FmEntryData* pEntryData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(rIter));
bool bRes = NavigatorTreeModel::Rename(pEntryData, rIterString.second);
if (!bRes)
{
@@ -1490,12 +1490,12 @@ namespace svxform
const std::unique_ptr<weld::TreeIter>& rIter = *m_arrCurrentSelection.begin();
if (m_nFormsSelected > 0)
{ // exactly one form is selected
- FmFormData* pFormData = reinterpret_cast<FmFormData*>(m_xTreeView->get_id(*rIter).toInt64());
+ FmFormData* pFormData = weld::fromId<FmFormData*>(m_xTreeView->get_id(*rIter));
aSelection.insert( Reference< XInterface >( pFormData->GetFormIface(), UNO_QUERY ) );
}
else
{ // exactly one control is selected (whatever hidden or normal)
- FmEntryData* pEntryData = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*rIter).toInt64());
+ FmEntryData* pEntryData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(*rIter));
aSelection.insert( Reference< XInterface >( pEntryData->GetElement(), UNO_QUERY ) );
}
@@ -1509,7 +1509,7 @@ namespace svxform
for ( sal_Int32 i = 0; i < m_nFormsSelected; ++i )
{
const std::unique_ptr<weld::TreeIter>& rIter = *it;
- FmFormData* pFormData = reinterpret_cast<FmFormData*>(m_xTreeView->get_id(*rIter).toInt64());
+ FmFormData* pFormData = weld::fromId<FmFormData*>(m_xTreeView->get_id(*rIter));
aSelection.insert( pFormData->GetPropertySet() );
++it;
}
@@ -1522,7 +1522,7 @@ namespace svxform
for ( sal_Int32 i = 0; i < m_nHiddenControls; ++i )
{
const std::unique_ptr<weld::TreeIter>& rIter = *it;
- FmEntryData* pEntryData = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*rIter).toInt64());
+ FmEntryData* pEntryData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(*rIter));
aSelection.insert( pEntryData->GetPropertySet() );
++it;
}
@@ -1599,7 +1599,7 @@ namespace svxform
it != m_arrCurrentSelection.rend(); )
{
const std::unique_ptr<weld::TreeIter>& rIter = *it;
- FmEntryData* pCurrent = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*rIter).toInt64());
+ FmEntryData* pCurrent = weld::fromId<FmEntryData*>(m_xTreeView->get_id(*rIter));
// a form ?
auto pFormData = dynamic_cast<FmFormData*>(pCurrent);
@@ -1668,7 +1668,7 @@ namespace svxform
// remove remaining structure
for (const auto& rpSelection : m_arrCurrentSelection)
{
- FmEntryData* pCurrent = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*rpSelection).toInt64());
+ FmEntryData* pCurrent = weld::fromId<FmEntryData*>(m_xTreeView->get_id(*rpSelection));
// if the entry still has children, we skipped deletion of one of those children.
// This may for instance be because the shape is in a hidden layer, where we're unable
@@ -1711,7 +1711,7 @@ namespace svxform
else
{
++m_nControlsSelected;
- if (IsHiddenControl(reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(rSelectionLoop).toInt64())))
+ if (IsHiddenControl(weld::fromId<FmEntryData*>(m_xTreeView->get_id(rSelectionLoop))))
++m_nHiddenControls;
}
}
@@ -1774,7 +1774,7 @@ namespace svxform
{
// compare current selection with requested SelectList
m_xTreeView->selected_foreach([this, &arredToSelect](weld::TreeIter& rSelection) {
- FmEntryData* pCurrent = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(rSelection).toInt64());
+ FmEntryData* pCurrent = weld::fromId<FmEntryData*>(m_xTreeView->get_id(rSelection));
if (pCurrent != nullptr)
{
FmEntryDataArray::iterator it = arredToSelect.find(pCurrent);
@@ -1805,7 +1805,7 @@ namespace svxform
// This may be a frequently used code ( at every change in mark of the view!),
// so i use latter one
m_xTreeView->all_foreach([this, &arredToSelect](weld::TreeIter& rLoop){
- FmEntryData* pCurEntryData = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(rLoop).toInt64());
+ FmEntryData* pCurEntryData = weld::fromId<FmEntryData*>(m_xTreeView->get_id(rLoop));
FmEntryDataArray::iterator it = arredToSelect.find(pCurEntryData);
if (it != arredToSelect.end())
{
@@ -1850,12 +1850,12 @@ namespace svxform
{
// When form selection, mark all controls of form
if (IsFormEntry(*rSelectionLoop) && m_xTreeView->iter_compare(*rSelectionLoop, *m_xRootEntry) != 0)
- MarkViewObj(reinterpret_cast<FmFormData*>(m_xTreeView->get_id(*rSelectionLoop).toInt64()), false/*deep*/);
+ MarkViewObj(weld::fromId<FmFormData*>(m_xTreeView->get_id(*rSelectionLoop)), false/*deep*/);
// When control selection, mark Control-SdrObjects
else if (IsFormComponentEntry(*rSelectionLoop))
{
- FmControlData* pControlData = reinterpret_cast<FmControlData*>(m_xTreeView->get_id(*rSelectionLoop).toInt64());
+ FmControlData* pControlData = weld::fromId<FmControlData*>(m_xTreeView->get_id(*rSelectionLoop));
if (pControlData)
{
@@ -1891,7 +1891,7 @@ namespace svxform
std::unique_ptr<weld::TreeIter> xSelected(m_xTreeView->make_iterator());
if (!m_xTreeView->get_selected(xSelected.get()))
xSelected.reset();
- FmFormData* pSingleSelectionData = xSelected ? dynamic_cast<FmFormData*>(reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*xSelected).toInt64()))
+ FmFormData* pSingleSelectionData = xSelected ? dynamic_cast<FmFormData*>(weld::fromId<FmEntryData*>(m_xTreeView->get_id(*xSelected)))
: nullptr;
DBG_ASSERT( pSingleSelectionData, "NavigatorTree::SynchronizeMarkList: invalid selected form!" );
if ( pSingleSelectionData )
diff --git a/svx/source/form/tabwin.cxx b/svx/source/form/tabwin.cxx
index 19fb11131751..536a21227d81 100644
--- a/svx/source/form/tabwin.cxx
+++ b/svx/source/form/tabwin.cxx
@@ -77,7 +77,7 @@ void FmFieldWin::addToList(const uno::Reference< container::XNameAccess>& i_xCol
if ( xColumn->getPropertySetInfo()->hasPropertyByName(FM_PROP_LABEL) )
xColumn->getPropertyValue(FM_PROP_LABEL) >>= sLabel;
m_aListBoxData.emplace_back(new ColumnInfo(rEntry));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_aListBoxData.back().get())));
+ OUString sId(weld::toId(m_aListBoxData.back().get()));
if ( !sLabel.isEmpty() )
m_xListBox->append(sId, sLabel);
else
@@ -89,7 +89,7 @@ IMPL_LINK(FmFieldWin, DragBeginHdl, bool&, rUnsetDragIcon, bool)
{
rUnsetDragIcon = false;
- ColumnInfo* pSelected = reinterpret_cast<ColumnInfo*>(m_xListBox->get_selected_id().toInt64());
+ ColumnInfo* pSelected = weld::fromId<ColumnInfo*>(m_xListBox->get_selected_id());
if (!pSelected)
{
// no drag without a field
@@ -147,7 +147,7 @@ IMPL_LINK_NOARG(FmFieldWin, RowActivatedHdl, weld::TreeView&, bool)
bool FmFieldWin::createSelectionControls()
{
- ColumnInfo* pSelected = reinterpret_cast<ColumnInfo*>(m_xListBox->get_selected_id().toInt64());
+ ColumnInfo* pSelected = weld::fromId<ColumnInfo*>(m_xListBox->get_selected_id());
if (pSelected)
{
// build a descriptor for the currently selected field
diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
index 345a0ce803e8..ed81ba92f53e 100644
--- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
+++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx
@@ -147,7 +147,7 @@ void DictionaryList::refillFromDictionary( sal_Int32 nTextConversionOptions )
m_xControl->set_text(*m_xIter, pEntry->m_aTerm, 0);
m_xControl->set_text(*m_xIter, pEntry->m_aMapping, 1);
m_xControl->set_text(*m_xIter, getPropertyTypeName(pEntry->m_nConversionPropertyType), 2);
- m_xControl->set_id(*m_xIter, OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ m_xControl->set_id(*m_xIter, weld::toId(pEntry));
}
}
@@ -163,7 +163,7 @@ DictionaryEntry* DictionaryList::getFirstSelectedEntry() const
DictionaryEntry* DictionaryList::getEntryOnPos(sal_Int32 nPos) const
{
OUString sLBEntry = m_xControl->get_id(nPos);
- return reinterpret_cast<DictionaryEntry*>(sLBEntry.toInt64());
+ return weld::fromId<DictionaryEntry*>(sLBEntry);
}
DictionaryEntry* DictionaryList::getTermEntry( std::u16string_view rTerm ) const
@@ -194,7 +194,7 @@ void DictionaryList::addEntry(const OUString& rTerm, const OUString& rMapping,
m_xControl->set_text(*m_xIter, pEntry->m_aTerm, 0);
m_xControl->set_text(*m_xIter, pEntry->m_aMapping, 1);
m_xControl->set_text(*m_xIter, getPropertyTypeName(pEntry->m_nConversionPropertyType), 2);
- m_xControl->set_id(*m_xIter, OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
+ m_xControl->set_id(*m_xIter, weld::toId(pEntry));
m_xControl->select(*m_xIter);
}
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 0d46719043d6..33229f313884 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -551,7 +551,7 @@ bool SwCaptionOptPage::FillItemSet( SfxItemSet* )
{
if (m_xCheckLB->get_toggle(i) == TRISTATE_TRUE)
++nCheckCount;
- InsCaptionOpt* pData = reinterpret_cast<InsCaptionOpt*>(m_xCheckLB->get_id(i).toInt64());
+ InsCaptionOpt* pData = weld::fromId<InsCaptionOpt*>(m_xCheckLB->get_id(i));
bRet |= pModOpt->SetCapOption(bHTMLMode, pData);
}
@@ -629,13 +629,13 @@ void SwCaptionOptPage::SetOptions(const sal_uLong nPos,
if (pOpt)
{
InsCaptionOpt* pIns = new InsCaptionOpt(*pOpt);
- m_xCheckLB->set_id(nPos, OUString::number(reinterpret_cast<sal_Int64>(pIns)));
+ m_xCheckLB->set_id(nPos, weld::toId(pIns));
m_xCheckLB->set_toggle(nPos, pOpt->UseCaption() ? TRISTATE_TRUE : TRISTATE_FALSE);
}
else
{
InsCaptionOpt* pIns = new InsCaptionOpt(eObjType, pOleId);
- m_xCheckLB->set_id(nPos, OUString::number(reinterpret_cast<sal_Int64>(pIns)));
+ m_xCheckLB->set_id(nPos, weld::toId(pIns));
}
}
@@ -643,7 +643,7 @@ void SwCaptionOptPage::DelUserData()
{
for (int i = 0, nCount = m_xCheckLB->n_children(); i < nCount; ++i)
{
- delete reinterpret_cast<InsCaptionOpt*>(m_xCheckLB->get_id(i).toInt64());
+ delete weld::fromId<InsCaptionOpt*>(m_xCheckLB->get_id(i));
m_xCheckLB->set_id(i, "0");
}
}
@@ -665,7 +665,7 @@ void SwCaptionOptPage::UpdateEntry(int nSelEntry)
SwWrtShell *pSh = ::GetActiveWrtShell();
- InsCaptionOpt* pOpt = reinterpret_cast<InsCaptionOpt*>(m_xCheckLB->get_id(nSelEntry).toInt64());
+ InsCaptionOpt* pOpt = weld::fromId<InsCaptionOpt*>(m_xCheckLB->get_id(nSelEntry));
m_xCategoryBox->clear();
m_xCategoryBox->append_text(m_sNone);
@@ -773,7 +773,7 @@ void SwCaptionOptPage::SaveEntry(int nEntry)
if (nEntry == -1)
return;
- InsCaptionOpt* pOpt = reinterpret_cast<InsCaptionOpt*>(m_xCheckLB->get_id(nEntry).toInt64());
+ InsCaptionOpt* pOpt = weld::fromId<InsCaptionOpt*>(m_xCheckLB->get_id(nEntry));
pOpt->UseCaption() = m_xCheckLB->get_toggle(nEntry) == TRISTATE_TRUE;
const OUString aName(m_xCategoryBox->get_active_text());
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 30a3c4cac6e4..d75cd17c40c2 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1550,7 +1550,7 @@ namespace
for (size_t i = 0; i != nAttrMapSize; ++i)
{
CharAttr const & rAttr(aRedlineAttr[pAttrMap[i]]);
- rLB.set_id(i, OUString::number(reinterpret_cast<sal_Int64>(&rAttr)));
+ rLB.set_id(i, weld::toId(&rAttr));
if (rAttr.nItemId == rAttrToSelect.m_nItemId &&
rAttr.nAttr == rAttrToSelect.m_nAttr)
rLB.set_active(i);
@@ -1661,7 +1661,7 @@ bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* )
sal_Int32 nPos = m_xInsertLB->get_active();
if (nPos != -1)
{
- pAttr = reinterpret_cast<CharAttr*>(m_xInsertLB->get_id(nPos).toInt64());
+ pAttr = weld::fromId<CharAttr*>(m_xInsertLB->get_id(nPos));
aInsertedAttr.m_nItemId = pAttr->nItemId;
aInsertedAttr.m_nAttr = pAttr->nAttr;
aInsertedAttr.m_nColor = m_xInsertColorLB->GetSelectEntryColor();
@@ -1671,7 +1671,7 @@ bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* )
nPos = m_xDeletedLB->get_active();
if (nPos != -1)
{
- pAttr = reinterpret_cast<CharAttr*>(m_xDeletedLB->get_id(nPos).toInt64());
+ pAttr = weld::fromId<CharAttr*>(m_xDeletedLB->get_id(nPos));
aDeletedAttr.m_nItemId = pAttr->nItemId;
aDeletedAttr.m_nAttr = pAttr->nAttr;
aDeletedAttr.m_nColor = m_xDeletedColorLB->GetSelectEntryColor();
@@ -1681,7 +1681,7 @@ bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* )
nPos = m_xChangedLB->get_active();
if (nPos != -1)
{
- pAttr = reinterpret_cast<CharAttr*>(m_xChangedLB->get_id(nPos).toInt64());
+ pAttr = weld::fromId<CharAttr*>(m_xChangedLB->get_id(nPos));
aChangedAttr.m_nItemId = pAttr->nItemId;
aChangedAttr.m_nAttr = pAttr->nAttr;
aChangedAttr.m_nColor = m_xChangedColorLB->GetSelectEntryColor();
@@ -1830,7 +1830,7 @@ IMPL_LINK( SwRedlineOptionsTabPage, AttribHdl, weld::ComboBox&, rLB, void )
if( nPos == -1)
nPos = 0;
- CharAttr* pAttr = reinterpret_cast<CharAttr*>(rLB.get_id(nPos).toInt64());
+ CharAttr* pAttr = weld::fromId<CharAttr*>(rLB.get_id(nPos));
//switch off preview background color
pPrev->ResetColor();
switch (pAttr->nItemId)
@@ -1904,7 +1904,7 @@ IMPL_LINK(SwRedlineOptionsTabPage, ColorHdl, ColorListBox&, rListBox, void)
if( nPos == -1)
nPos = 0;
- CharAttr* pAttr = reinterpret_cast<CharAttr*>(pLB->get_id(nPos).toInt64());
+ CharAttr* pAttr = weld::fromId<CharAttr*>(pLB->get_id(nPos));
if( pAttr->nItemId == SID_ATTR_BRUSH )
{
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx
index 2b5933096ac8..f80fe38d6b92 100644
--- a/sw/source/ui/dbui/addresslistdialog.cxx
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -179,7 +179,7 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent)
m_xListLB->set_text(*m_xIter, rName, 0);
m_aUserData.emplace_back(new AddressUserData_Impl);
AddressUserData_Impl* pUserData = m_aUserData.back().get();
- m_xListLB->set_id(*m_xIter, OUString::number(reinterpret_cast<sal_Int64>(pUserData)));
+ m_xListLB->set_id(*m_xIter, weld::toId(pUserData));
if (rName == rCurrentData.sDataSource)
{
m_xListLB->select(*m_xIter);
@@ -236,7 +236,7 @@ IMPL_LINK_NOARG(SwAddressListDialog, FilterHdl_Impl, weld::Button&, void)
if (sCommand.isEmpty())
return;
- AddressUserData_Impl* pUserData = reinterpret_cast<AddressUserData_Impl*>(m_xListLB->get_id(nSelect).toInt64());
+ AddressUserData_Impl* pUserData = weld::fromId<AddressUserData_Impl*>(m_xListLB->get_id(nSelect));
if (!pUserData->xConnection.is() )
return;
@@ -289,7 +289,7 @@ IMPL_LINK_NOARG(SwAddressListDialog, LoadHdl_Impl, weld::Button&, void)
m_xListLB->set_text(*m_xIter, sNewSource, 0);
m_aUserData.emplace_back(new AddressUserData_Impl);
AddressUserData_Impl* pUserData = m_aUserData.back().get();
- m_xListLB->set_id(*m_xIter, OUString::number(reinterpret_cast<sal_Int64>(pUserData)));
+ m_xListLB->set_id(*m_xIter, weld::toId(pUserData));
m_xListLB->select(*m_xIter);
ListBoxSelectHdl_Impl(*m_xListLB);
m_xRemovePB->set_sensitive(true);
@@ -386,7 +386,7 @@ IMPL_LINK_NOARG(SwAddressListDialog, CreateHdl_Impl, weld::Button&, void)
m_xListLB->set_text(*m_xIter, aFilters[0], 1);
m_aUserData.emplace_back(new AddressUserData_Impl);
AddressUserData_Impl* pUserData = m_aUserData.back().get();
- m_xListLB->set_id(*m_xIter, OUString::number(reinterpret_cast<sal_Int64>(pUserData)));
+ m_xListLB->set_id(*m_xIter, weld::toId(pUserData));
m_xListLB->select(*m_xIter);
ListBoxSelectHdl_Impl(*m_xListLB);
m_xCreateListPB->set_sensitive(false);
@@ -400,7 +400,7 @@ IMPL_LINK_NOARG(SwAddressListDialog, CreateHdl_Impl, weld::Button&, void)
IMPL_LINK_NOARG(SwAddressListDialog, EditHdl_Impl, weld::Button&, void)
{
int nEntry = m_xListLB->get_selected_index();
- AddressUserData_Impl* pUserData = nEntry != -1 ? reinterpret_cast<AddressUserData_Impl*>(m_xListLB->get_id(nEntry).toInt64()) : nullptr;
+ AddressUserData_Impl* pUserData = nEntry != -1 ? weld::fromId<AddressUserData_Impl*>(m_xListLB->get_id(nEntry)) : nullptr;
if (!pUserData || pUserData->sURL.isEmpty())
return;
@@ -446,7 +446,7 @@ IMPL_LINK(SwAddressListDialog, StaticListBoxSelectHdl_Impl, void*, p, void)
m_xListLB->set_text(nSelect, m_sConnecting, 1);
}
- pUserData = reinterpret_cast<AddressUserData_Impl*>(m_xListLB->get_id(nSelect).toInt64());
+ pUserData = weld::fromId<AddressUserData_Impl*>(m_xListLB->get_id(nSelect));
if(pUserData->nTableAndQueryCount > 1 || pUserData->nTableAndQueryCount == -1)
{
DetectTablesAndQueries(nSelect, sTable.isEmpty());
@@ -476,7 +476,7 @@ void SwAddressListDialog::DetectTablesAndQueries(
{
try
{
- AddressUserData_Impl* pUserData = reinterpret_cast<AddressUserData_Impl*>(m_xListLB->get_id(nSelect).toInt64());
+ AddressUserData_Impl* pUserData = weld::fromId<AddressUserData_Impl*>(m_xListLB->get_id(nSelect));
uno::Reference<XCompletedConnection> xComplConnection;
if(!pUserData->xConnection.is())
{
@@ -577,7 +577,7 @@ void SwAddressListDialog::TableSelectHdl(const weld::Button* pButton)
int nSelect = m_xListLB->get_selected_index();
if (nSelect != -1)
{
- AddressUserData_Impl* pUserData = reinterpret_cast<AddressUserData_Impl*>(m_xListLB->get_id(nSelect).toInt64());
+ AddressUserData_Impl* pUserData = weld::fromId<AddressUserData_Impl*>(m_xListLB->get_id(nSelect));
//only call the table select dialog if tables have not been searched for or there
//are more than 1
const OUString sTable = m_xListLB->get_text(nSelect, 1);
@@ -599,7 +599,7 @@ uno::Reference< XDataSource> SwAddressListDialog::GetSource() const
int nSelect = m_xListLB->get_selected_index();
if (nSelect != -1)
{
- AddressUserData_Impl* pUserData = reinterpret_cast<AddressUserData_Impl*>(m_xListLB->get_id(nSelect).toInt64());
+ AddressUserData_Impl* pUserData = weld::fromId<AddressUserData_Impl*>(m_xListLB->get_id(nSelect));
xRet = pUserData->xSource;
}
return xRet;
@@ -612,7 +612,7 @@ SharedConnection SwAddressListDialog::GetConnection() const
int nSelect = m_xListLB->get_selected_index();
if (nSelect != -1)
{
- AddressUserData_Impl* pUserData = reinterpret_cast<AddressUserData_Impl*>(m_xListLB->get_id(nSelect).toInt64());
+ AddressUserData_Impl* pUserData = weld::fromId<AddressUserData_Impl*>(m_xListLB->get_id(nSelect));
xRet = pUserData->xConnection;
}
return xRet;
@@ -624,7 +624,7 @@ uno::Reference< XColumnsSupplier> SwAddressListDialog::GetColumnsSupplier() cons
int nSelect = m_xListLB->get_selected_index();
if (nSelect != -1)
{
- AddressUserData_Impl* pUserData = reinterpret_cast<AddressUserData_Impl*>(m_xListLB->get_id(nSelect).toInt64());
+ AddressUserData_Impl* pUserData = weld::fromId<AddressUserData_Impl*>(m_xListLB->get_id(nSelect));
xRet = pUserData->xColumnsSupplier;
}
return xRet;
@@ -635,7 +635,7 @@ OUString SwAddressListDialog::GetFilter() const
int nSelect = m_xListLB->get_selected_index();
if (nSelect != -1)
{
- AddressUserData_Impl* pUserData = reinterpret_cast<AddressUserData_Impl*>(m_xListLB->get_id(nSelect).toInt64());
+ AddressUserData_Impl* pUserData = weld::fromId<AddressUserData_Impl*>(m_xListLB->get_id(nSelect));
return pUserData->sFilter;
}
return OUString();
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index 9ff77c893263..6e45abc1c697 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -405,7 +405,7 @@ bool SwEditRegionDlg::CheckPasswd(weld::Toggleable* pBox)
bool bRet = true;
m_xTree->selected_foreach([this, &bRet](weld::TreeIter& rEntry){
- SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(rEntry).toInt64());
+ SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
if (!pRepr->GetTempPasswd().hasElements()
&& pRepr->GetSectionData().GetPassword().hasElements())
{
@@ -463,7 +463,7 @@ void SwEditRegionDlg::RecurseList(const SwSectionFormat* pFormat, const weld::Tr
OUString sText(pSect->GetSectionName());
OUString sImage(BuildBitmap(pSect->IsProtect(),pSect->IsHidden()));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pSectRepr)));
+ OUString sId(weld::toId(pSectRepr));
m_xTree->insert(nullptr, -1, &sText, &sId, nullptr, nullptr, false, xIter.get());
m_xTree->set_image(*xIter, sImage);
@@ -496,7 +496,7 @@ void SwEditRegionDlg::RecurseList(const SwSectionFormat* pFormat, const weld::Tr
OUString sText(pSect->GetSectionName());
OUString sImage = BuildBitmap(pSect->IsProtect(), pSect->IsHidden());
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pSectRepr)));
+ OUString sId(weld::toId(pSectRepr));
m_xTree->insert(pEntry, -1, &sText, &sId, nullptr, nullptr, false, xIter.get());
m_xTree->set_image(*xIter, sImage);
@@ -532,7 +532,7 @@ SwEditRegionDlg::~SwEditRegionDlg( )
{
do
{
- delete reinterpret_cast<SectRepr*>(m_xTree->get_id(*xIter).toInt64());
+ delete weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
} while (m_xTree->iter_next(*xIter));
}
}
@@ -545,7 +545,7 @@ void SwEditRegionDlg::SelectSection(std::u16string_view rSectionName)
do
{
- SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(*xIter).toInt64());
+ SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
if (pRepr->GetSectionData().GetSectionName() == rSectionName)
{
m_xTree->unselect_all();
@@ -595,7 +595,7 @@ IMPL_LINK(SwEditRegionDlg, GetFirstEntryHdl, weld::TreeView&, rBox, void)
bool bPasswdValid = true;
m_xTree->selected_foreach([&](weld::TreeIter& rEntry){
- SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(rEntry).toInt64());
+ SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
SwSectionData const& rData( pRepr->GetSectionData() );
if(bFirst)
{
@@ -667,7 +667,7 @@ IMPL_LINK(SwEditRegionDlg, GetFirstEntryHdl, weld::TreeView&, rBox, void)
{
m_xCurName->set_sensitive(true);
m_xOptionsPB->set_sensitive(true);
- SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(*xIter).toInt64());
+ SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
SwSectionData const& rData( pRepr->GetSectionData() );
m_xConditionED->set_text(rData.GetCondition());
m_xHideCB->set_sensitive(true);
@@ -741,7 +741,7 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl, weld::Button&, void)
{
do
{
- SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(*xIter).toInt64());
+ SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
SwSectionFormat* pFormat = aOrigArray[ pRepr->GetArrPos() ];
if (!pRepr->GetSectionData().IsProtectFlag())
{
@@ -805,7 +805,7 @@ IMPL_LINK(SwEditRegionDlg, ChangeProtectHdl, weld::Toggleable&, rButton, void)
return;
bool bCheck = TRISTATE_TRUE == rButton.get_state();
m_xTree->selected_foreach([this, bCheck](weld::TreeIter& rEntry){
- SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(rEntry).toInt64());
+ SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
pRepr->GetSectionData().SetProtectFlag(bCheck);
OUString aImage = BuildBitmap(bCheck, TRISTATE_TRUE == m_xHideCB->get_state());
m_xTree->set_image(rEntry, aImage);
@@ -821,7 +821,7 @@ IMPL_LINK( SwEditRegionDlg, ChangeHideHdl, weld::Toggleable&, rButton, void)
if (!CheckPasswd(&rButton))
return;
m_xTree->selected_foreach([this, &rButton](weld::TreeIter& rEntry){
- SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(rEntry).toInt64());
+ SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
pRepr->GetSectionData().SetHidden(TRISTATE_TRUE == rButton.get_state());
OUString aImage = BuildBitmap(TRISTATE_TRUE == m_xProtectCB->get_state(),
TRISTATE_TRUE == rButton.get_state());
@@ -839,7 +839,7 @@ IMPL_LINK(SwEditRegionDlg, ChangeEditInReadonlyHdl, weld::Toggleable&, rButton,
if (!CheckPasswd(&rButton))
return;
m_xTree->selected_foreach([this, &rButton](weld::TreeIter& rEntry){
- SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(rEntry).toInt64());
+ SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
pRepr->GetSectionData().SetEditInReadonlyFlag(
TRISTATE_TRUE == rButton.get_state());
return false;
@@ -853,7 +853,7 @@ IMPL_LINK_NOARG(SwEditRegionDlg, ChangeDismissHdl, weld::Button&, void)
return;
// at first mark all selected
m_xTree->selected_foreach([this](weld::TreeIter& rEntry){
- SectRepr* const pSectRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(rEntry).toInt64());
+ SectRepr* const pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
pSectRepr->SetSelected();
return false;
});
@@ -863,7 +863,7 @@ IMPL_LINK_NOARG(SwEditRegionDlg, ChangeDismissHdl, weld::Button&, void)
// then delete
while (bEntry)
{
- SectRepr* const pSectRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(*xEntry).toInt64());
+ SectRepr* const pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xEntry));
std::unique_ptr<weld::TreeIter> xRemove;
bool bRestart = false;
if (pSectRepr->IsSelected())
@@ -929,7 +929,7 @@ IMPL_LINK(SwEditRegionDlg, UseFileHdl, weld::Toggleable&, rButton, void)
if (m_xTree->get_selected(nullptr))
{
m_xTree->selected_foreach([&](weld::TreeIter& rEntry){
- SectRepr* const pSectRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(rEntry).toInt64());
+ SectRepr* const pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
bool bContent = pSectRepr->IsContent();
if( rButton.get_active() && bContent && rSh.HasSelection() )
{
@@ -987,7 +987,7 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl, weld::Button&, void)
{
if(!CheckPasswd())
return;
- SectRepr* pSectRepr = reinterpret_cast<SectRepr*>(m_xTree->get_selected_id().toInt64());
+ SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
if (!pSectRepr)
return;
@@ -1056,7 +1056,7 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl, weld::Button&, void)
return;
m_xTree->selected_foreach([&](weld::TreeIter& rEntry){
- SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(rEntry).toInt64());
+ SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
if( SfxItemState::SET == eColState )
pRepr->GetCol() = *static_cast<const SwFormatCol*>(pColItem);
if( SfxItemState::SET == eBrushState )
@@ -1082,7 +1082,7 @@ IMPL_LINK(SwEditRegionDlg, FileNameComboBoxHdl, weld::ComboBox&, rEdit, void)
if (!CheckPasswd())
return;
rEdit.select_entry_region(nStartPos, nEndPos);
- SectRepr* pSectRepr = reinterpret_cast<SectRepr*>(m_xTree->get_selected_id().toInt64());
+ SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
pSectRepr->SetSubRegion( rEdit.get_active_text() );
}
@@ -1094,7 +1094,7 @@ IMPL_LINK(SwEditRegionDlg, FileNameEntryHdl, weld::Entry&, rEdit, void)
if (!CheckPasswd())
return;
rEdit.select_region(nStartPos, nEndPos);
- SectRepr* pSectRepr = reinterpret_cast<SectRepr*>(m_xTree->get_selected_id().toInt64());
+ SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
m_xSubRegionED->clear();
m_xSubRegionED->append_text(""); // put in a dummy entry, which is replaced when m_bSubRegionsFilled is set
m_bSubRegionsFilled = false;
@@ -1132,7 +1132,7 @@ IMPL_LINK(SwEditRegionDlg, DDEHdl, weld::Toggleable&, rButton, void)
{
if (!CheckPasswd(&rButton))
return;
- SectRepr* pSectRepr = reinterpret_cast<SectRepr*>(m_xTree->get_selected_id().toInt64());
+ SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
if (!pSectRepr)
return;
@@ -1187,7 +1187,7 @@ void SwEditRegionDlg::ChangePasswd(bool bChange)
bool bSet = bChange ? bChange : m_xPasswdCB->get_active();
m_xTree->selected_foreach([this, bChange, bSet](weld::TreeIter& rEntry){
- SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(rEntry).toInt64());
+ SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
if(bSet)
{
if(!pRepr->GetTempPasswd().hasElements() || bChange)
@@ -1249,7 +1249,7 @@ IMPL_LINK_NOARG(SwEditRegionDlg, NameEditHdl, weld::Entry&, void)
{
const OUString aName = m_xCurName->get_text();
m_xTree->set_text(*xIter, aName);
- SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(*xIter).toInt64());
+ SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(*xIter));
pRepr->GetSectionData().SetSectionName(aName);
m_xOK->set_sensitive(!aName.isEmpty());
@@ -1265,7 +1265,7 @@ IMPL_LINK( SwEditRegionDlg, ConditionEditHdl, weld::Entry&, rEdit, void )
rEdit.select_region(nStartPos, nEndPos);
m_xTree->selected_foreach([this, &rEdit](weld::TreeIter& rEntry){
- SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(rEntry).toInt64());
+ SectRepr* pRepr = weld::fromId<SectRepr*>(m_xTree->get_id(rEntry));
pRepr->GetSectionData().SetCondition(rEdit.get_text());
return false;
});
@@ -1288,7 +1288,7 @@ IMPL_LINK( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg, v
}
}
- SectRepr* pSectRepr = reinterpret_cast<SectRepr*>(m_xTree->get_selected_id().toInt64());
+ SectRepr* pSectRepr = weld::fromId<SectRepr*>(m_xTree->get_selected_id());
if (pSectRepr)
{
pSectRepr->SetFile( sFileName );
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 01852be91771..49999bb82586 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -1244,7 +1244,7 @@ void SwFramePage::InitPos(RndStdIds eId,
nPos = m_xVertRelationLB->get_active();
if (nPos != -1)
- m_nOldVRel = reinterpret_cast<RelationMap*>(m_xVertRelationLB->get_id(nPos).toInt64())->nRelation;
+ m_nOldVRel = weld::fromId<RelationMap*>(m_xVertRelationLB->get_id(nPos))->nRelation;
}
nPos = m_xHorizontalDLB->get_active();
@@ -1254,7 +1254,7 @@ void SwFramePage::InitPos(RndStdIds eId,
nPos = m_xHoriRelationLB->get_active();
if (nPos != -1)
- m_nOldHRel = reinterpret_cast<RelationMap*>(m_xHoriRelationLB->get_id(nPos).toInt64())->nRelation;
+ m_nOldHRel = weld::fromId<RelationMap*>(m_xHoriRelationLB->get_id(nPos))->nRelation;
}
bool bEnable = true;
@@ -1445,7 +1445,7 @@ void SwFramePage::FillRelLB(const FrameMap* _pMap,
m_bIsVerticalL2R,
m_bIsInRightToLeft);
const OUString sEntry = SvxSwFramePosString::GetString(sStrId1);
- _rLB.append(OUString::number(reinterpret_cast<sal_Int64>(&rCharMap)), sEntry);
+ _rLB.append(weld::toId(&rCharMap), sEntry);
if (_pMap[nMapPos].nAlign == _nAlign)
sSelEntry = sEntry;
break;
@@ -1463,7 +1463,7 @@ void SwFramePage::FillRelLB(const FrameMap* _pMap,
{
for (int i = 0; i < _rLB.get_count(); i++)
{
- RelationMap *pEntry = reinterpret_cast<RelationMap*>(_rLB.get_id(i).toInt64());
+ RelationMap *pEntry = weld::fromId<RelationMap*>(_rLB.get_id(i));
if (pEntry->nLBRelation == LB::RelChar) // default
{
_rLB.set_active(i);
@@ -1507,7 +1507,7 @@ void SwFramePage::FillRelLB(const FrameMap* _pMap,
m_bIsVerticalL2R,
m_bIsInRightToLeft);
const OUString sEntry = SvxSwFramePosString::GetString(eStrId1);
- _rLB.append(OUString::number(reinterpret_cast<sal_Int64>(&rMap)), sEntry);
+ _rLB.append(weld::toId(&rMap), sEntry);
if (sSelEntry.isEmpty() && rMap.nRelation == _nRel)
sSelEntry = sEntry;
}
@@ -1550,7 +1550,7 @@ void SwFramePage::FillRelLB(const FrameMap* _pMap,
default:
if (_rLB.get_active() != -1)
{
- RelationMap *pEntry = reinterpret_cast<RelationMap*>(_rLB.get_id(_rLB.get_count() - 1).toInt64());
+ RelationMap *pEntry = weld::fromId<RelationMap*>(_rLB.get_id(_rLB.get_count() - 1));
nSimRel = pEntry->nRelation;
}
break;
@@ -1558,7 +1558,7 @@ void SwFramePage::FillRelLB(const FrameMap* _pMap,
for (int i = 0; i < _rLB.get_count(); i++)
{
- RelationMap *pEntry = reinterpret_cast<RelationMap*>(_rLB.get_id(i).toInt64());
+ RelationMap *pEntry = weld::fromId<RelationMap*>(_rLB.get_id(i));
if (pEntry->nRelation == nSimRel)
{
_rLB.set_active(i);
@@ -1585,7 +1585,7 @@ sal_Int16 SwFramePage::GetRelation(const weld::ComboBox& rRelationLB)
const auto nPos = rRelationLB.get_active();
if (nPos != -1)
{
- RelationMap *pEntry = reinterpret_cast<RelationMap *>(rRelationLB.get_id(nPos).toInt64());
+ RelationMap *pEntry = weld::fromId<RelationMap *>(rRelationLB.get_id(nPos));
return pEntry->nRelation;
}
@@ -1611,8 +1611,8 @@ sal_Int16 SwFramePage::GetAlignment(FrameMap const *pMap, sal_Int32 nMapPos,
if (rRelationLB.get_active() == -1)
return 0;
- const RelationMap *const pRelationMap = reinterpret_cast<const RelationMap *>(
- rRelationLB.get_active_id().toInt64());
+ const RelationMap *const pRelationMap = weld::fromId<const RelationMap*>(
+ rRelationLB.get_active_id());
const LB nRel = pRelationMap->nLBRelation;
const SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId;
@@ -1930,7 +1930,7 @@ IMPL_LINK( SwFramePage, PosHdl, weld::ComboBox&, rLB, void )
if (rLB.get_active() != -1)
{
if (pRelLB->get_active() != -1)
- nRel = reinterpret_cast<RelationMap*>(pRelLB->get_active_id().toInt64())->nRelation;
+ nRel = weld::fromId<RelationMap*>(pRelLB->get_active_id())->nRelation;
FillRelLB(pMap, nMapPos, nAlign, nRel, *pRelLB, *pRelFT);
}
else
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index 90c905d7a408..d912a266f143 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -101,7 +101,7 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, DeleteHdl, weld::Button&, void)
m_xBookmarksBox->selected_foreach([this, &nSelectedRows](weld::TreeIter& rEntry) {
// remove from model
sw::mark::IMark* pBookmark
- = reinterpret_cast<sw::mark::IMark*>(m_xBookmarksBox->get_id(rEntry).toInt64());
+ = weld::fromId<sw::mark::IMark*>(m_xBookmarksBox->get_id(rEntry));
OUString sRemoved = pBookmark->GetName();
IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
pMarkAccess->deleteMark(pMarkAccess->findMark(sRemoved));
@@ -153,7 +153,7 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, SelectionChangedHdl, weld::TreeView&, void)
m_xBookmarksBox->selected_foreach(
[this, &sEditBoxText, &nSelectedRows](weld::TreeIter& rEntry) {
sw::mark::IMark* pBookmark
- = reinterpret_cast<sw::mark::IMark*>(m_xBookmarksBox->get_id(rEntry).toInt64());
+ = weld::fromId<sw::mark::IMark*>(m_xBookmarksBox->get_id(rEntry));
const OUString& sEntryName = pBookmark->GetName();
if (!sEditBoxText.isEmpty())
sEditBoxText.append(";");
@@ -187,7 +187,7 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, RenameHdl, weld::Button&, void)
return;
sw::mark::IMark* pBookmark
- = reinterpret_cast<sw::mark::IMark*>(m_xBookmarksBox->get_id(*xSelected).toInt64());
+ = weld::fromId<sw::mark::IMark*>(m_xBookmarksBox->get_id(*xSelected));
uno::Reference<frame::XModel> xModel = rSh.GetView().GetDocShell()->GetBaseModel();
uno::Reference<text::XBookmarksSupplier> xBkms(xModel, uno::UNO_QUERY);
uno::Reference<container::XNameAccess> xNameAccess = xBkms->getBookmarks();
@@ -239,7 +239,7 @@ void SwInsertBookmarkDlg::GotoSelectedBookmark()
return;
sw::mark::IMark* pBookmark
- = reinterpret_cast<sw::mark::IMark*>(m_xBookmarksBox->get_id(*xSelected).toInt64());
+ = weld::fromId<sw::mark::IMark*>(m_xBookmarksBox->get_id(*xSelected));
rSh.EnterStdMode();
rSh.GotoMark(pBookmark);
@@ -453,7 +453,7 @@ void BookmarkTable::InsertBookmark(sw::mark::IMark* pMark)
sHidden = SwResId(STR_BOOKMARK_YES);
OUString sPageNum = OUString::number(SwPaM(pMark->GetMarkStart()).GetPageNum());
int nRow = m_xControl->n_children();
- m_xControl->append(OUString::number(reinterpret_cast<sal_Int64>(pMark)), sPageNum);
+ m_xControl->append(weld::toId(pMark), sPageNum);
m_xControl->set_text(nRow, pBookmark->GetName(), 1);
m_xControl->set_text(nRow, sBookmarkNodeText, 2);
m_xControl->set_text(nRow, sHidden, 3);
@@ -464,8 +464,7 @@ std::unique_ptr<weld::TreeIter> BookmarkTable::GetRowByBookmarkName(const OUStri
{
std::unique_ptr<weld::TreeIter> xRet;
m_xControl->all_foreach([this, &sName, &xRet](weld::TreeIter& rEntry) {
- sw::mark::IMark* pBookmark
- = reinterpret_cast<sw::mark::IMark*>(m_xControl->get_id(rEntry).toInt64());
+ sw::mark::IMark* pBookmark = weld::fromId<sw::mark::IMark*>(m_xControl->get_id(rEntry));
if (pBookmark->GetName() == sName)
{
xRet = m_xControl->make_iterator(&rEntry);
@@ -482,7 +481,7 @@ sw::mark::IMark* BookmarkTable::GetBookmarkByName(const OUString& sName)
if (!xEntry)
return nullptr;
- return reinterpret_cast<sw::mark::IMark*>(m_xControl->get_id(*xEntry).toInt64());
+ return weld::fromId<sw::mark::IMark*>(m_xControl->get_id(*xEntry));
}
void BookmarkTable::SelectByName(const OUString& sName)
@@ -499,8 +498,7 @@ OUString BookmarkTable::GetNameProposal() const
sal_Int32 nHighestBookmarkId = 0;
for (int i = 0, nCount = m_xControl->n_children(); i < nCount; ++i)
{
- sw::mark::IMark* pBookmark
- = reinterpret_cast<sw::mark::IMark*>(m_xControl->get_id(i).toInt64());
+ sw::mark::IMark* pBookmark = weld::fromId<sw::mark::IMark*>(m_xControl->get_id(i));
const OUString& sName = pBookmark->GetName();
sal_Int32 nIndex = 0;
if (sName.getToken(0, ' ', nIndex) == sDefaultBookmarkName)
diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx
index 036ca954e680..74e81a87f9e1 100644
--- a/sw/source/ui/misc/glosbib.cxx
+++ b/sw/source/ui/misc/glosbib.cxx
@@ -103,7 +103,7 @@ SwGlossaryGroupDlg::SwGlossaryGroupDlg(weld::Window * pParent,
else
pData->sGroupTitle = sTitle;
pData->sPath = m_xPathLB->get_text(sGroup.getToken(1, GLOS_DELIM).toInt32());
- const OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pData)));
+ const OUString sId(weld::toId(pData));
m_xGroupTLB->append(sId, pData->sGroupTitle);
int nEntry = m_xGroupTLB->find_id(sId);
m_xGroupTLB->set_text(nEntry, pData->sPath, 1);
@@ -117,7 +117,7 @@ SwGlossaryGroupDlg::~SwGlossaryGroupDlg()
int nCount = m_xGroupTLB->n_children();
for (int i = 0; i < nCount; ++i)
{
- GlosBibUserData* pUserData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(i).toInt64());
+ GlosBibUserData* pUserData = weld::fromId<GlosBibUserData*>(m_xGroupTLB->get_id(i));
delete pUserData;
}
}
@@ -146,7 +146,7 @@ void SwGlossaryGroupDlg::Apply()
//when the current group is deleted, the current group has to be relocated
if (m_xGroupTLB->n_children())
{
- GlosBibUserData* pUserData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(0).toInt64());
+ GlosBibUserData* pUserData = weld::fromId<GlosBibUserData*>(m_xGroupTLB->get_id(0));
pGlosHdl->SetCurGroup(pUserData->sGroupName);
}
}
@@ -193,14 +193,14 @@ IMPL_LINK_NOARG( SwGlossaryGroupDlg, SelectHdl, weld::TreeView&, void )
if (nFirstEntry == -1)
return;
- GlosBibUserData* pUserData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(nFirstEntry).toInt64());
+ GlosBibUserData* pUserData = weld::fromId<GlosBibUserData*>(m_xGroupTLB->get_id(nFirstEntry));
const OUString sEntry(pUserData->sGroupName);
const OUString sName(m_xNameED->get_text());
bool bExists = false;
int nPos = m_xGroupTLB->find_text(sName);
if (nPos != -1)
{
- GlosBibUserData* pFoundData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(nPos).toInt64());
+ GlosBibUserData* pFoundData = weld::fromId<GlosBibUserData*>(m_xGroupTLB->get_id(nPos));
fprintf(stderr, "comparing %s and %s\n",
OUStringToOString(pFoundData->sGroupName, RTL_TEXTENCODING_UTF8).getStr(),
OUStringToOString(sEntry, RTL_TEXTENCODING_UTF8).getStr());
@@ -223,7 +223,7 @@ IMPL_LINK_NOARG(SwGlossaryGroupDlg, NewHdl, weld::Button&, void)
pData->sPath = m_xPathLB->get_active_text();
pData->sGroupName = sGroup;
pData->sGroupTitle = m_xNameED->get_text();
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pData)));
+ OUString sId(weld::toId(pData));
m_xGroupTLB->append(sId, m_xNameED->get_text());
int nEntry = m_xGroupTLB->find_id(sId);
m_xGroupTLB->set_text(nEntry, pData->sPath, 1);
@@ -251,7 +251,7 @@ IMPL_LINK( SwGlossaryGroupDlg, DeleteHdl, weld::Button&, rButton, void )
rButton.set_sensitive(false);
return;
}
- GlosBibUserData* pUserData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(nEntry).toInt64());
+ GlosBibUserData* pUserData = weld::fromId<GlosBibUserData*>(m_xGroupTLB->get_id(nEntry));
OUString const sEntry(pUserData->sGroupName);
// if the name to be deleted is among the new ones - get rid of it
bool bDelete = true;
@@ -288,7 +288,7 @@ IMPL_LINK( SwGlossaryGroupDlg, DeleteHdl, weld::Button&, rButton, void )
IMPL_LINK_NOARG(SwGlossaryGroupDlg, RenameHdl, weld::Button&, void)
{
int nEntry = m_xGroupTLB->get_selected_index();
- GlosBibUserData* pUserData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(nEntry).toInt64());
+ GlosBibUserData* pUserData = weld::fromId<GlosBibUserData*>(m_xGroupTLB->get_id(nEntry));
OUString sEntry(pUserData->sGroupName);
const OUString sNewTitle(m_xNameED->get_text());
@@ -320,7 +320,7 @@ IMPL_LINK_NOARG(SwGlossaryGroupDlg, RenameHdl, weld::Button&, void)
pData->sGroupName = sNewName;
pData->sGroupTitle = sNewTitle;
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pData)));
+ OUString sId(weld::toId(pData));
m_xGroupTLB->append(sId, m_xNameED->get_text());
nEntry = m_xGroupTLB->find_id(sId);
m_xGroupTLB->set_text(nEntry, m_xPathLB->get_active_text(), 1);
@@ -375,7 +375,7 @@ IMPL_LINK_NOARG(SwGlossaryGroupDlg, ModifyHdl, weld::Entry&, void)
int nEntry = m_xGroupTLB->get_selected_index();
if (nEntry != -1)
{
- GlosBibUserData* pUserData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(nEntry).toInt64());
+ GlosBibUserData* pUserData = weld::fromId<GlosBibUserData*>(m_xGroupTLB->get_id(nEntry));
bEnableDel = IsDeleteAllowed(pUserData->sGroupName);
}
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index e9e76d0500fe..842fc3f621e4 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -722,7 +722,7 @@ void SwGlossaryDlg::Init()
pData->bReadonly = m_pGlossaryHdl->IsReadOnly(&sGroupName);
m_xGroupData.emplace_back(pData);
- m_xCategoryBox->set_id(*xEntry, OUString::number(reinterpret_cast<sal_Int64>(pData)));
+ m_xCategoryBox->set_id(*xEntry, weld::toId(pData));
if (sSelStr == pData->sGroupName && nSelPath == nPath)
xSelEntry = m_xCategoryBox->make_iterator(xEntry.get());
diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index 12f9bdb1f101..8d59072d7b7a 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -594,7 +594,7 @@ void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRa
OUString sComment = rRedln.GetComment(nStack);
std::unique_ptr<weld::TreeIter> xChild(rTreeView.make_iterator());
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pData.get())));
+ OUString sId(weld::toId(pData.get()));
rTreeView.insert(pParent->xTLBParent.get(), -1, nullptr, &sId, nullptr, nullptr,
false, xChild.get());
m_RedlinData.push_back(std::move(pData));
@@ -829,7 +829,7 @@ void SwRedlineAcceptDlg::InsertParents(SwRedlineTable::size_type nStart, SwRedli
pData->eType = rChangeRedln.GetType(0);
OUString sDateEntry = GetAppLangDateTimeString(pData->aDateTime);
- OUString sId = OUString::number(reinterpret_cast<sal_Int64>(pData.get()));
+ OUString sId = weld::toId(pData.get());
std::unique_ptr<weld::TreeIter> xParent(rTreeView.make_iterator());
if ( !bRowChange || nNewTableParent != SwRedlineTable::npos )
@@ -898,7 +898,7 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept )
if (bSelect && nPos == -1)
nPos = rTreeView.get_iter_index_in_parent(rEntry);
- RedlinData *pData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rEntry).toInt64());
+ RedlinData *pData = weld::fromId<RedlinData*>(rTreeView.get_id(rEntry));
bool bIsNotFormatted = true;
@@ -943,7 +943,7 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept )
if ( bMoreRedlines && aRedlines.size() == 1 )
{
std::unique_ptr<weld::TreeIter> xChild(rTreeView.make_iterator( &*aRedlines[0] ));
- RedlinData *pData = reinterpret_cast<RedlinData*>(rTreeView.get_id(*xChild).toInt64());
+ RedlinData *pData = weld::fromId<RedlinData*>(rTreeView.get_id(*xChild));
if ( pData->bDisabled )
bMoreRedlines = false;
}
@@ -981,7 +981,7 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept )
std::unique_ptr<weld::TreeIter> xChild(rTreeView.make_iterator( &*rRedLine ));
if ( rTreeView.iter_children(*xChild) )
{
- RedlinData *pData = reinterpret_cast<RedlinData*>(rTreeView.get_id(*xChild).toInt64());
+ RedlinData *pData = weld::fromId<RedlinData*>(rTreeView.get_id(*xChild));
// disabled for redline stack, but not for redlines of table rows
if ( !pData->bDisabled )
{
@@ -1022,8 +1022,8 @@ SwRedlineTable::size_type SwRedlineAcceptDlg::GetRedlinePos(const weld::TreeIter
{
SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
weld::TreeView& rTreeView = m_pTable->GetWidget();
- return pSh->FindRedlineOfData( *static_cast<SwRedlineDataParent*>(reinterpret_cast<RedlinData*>(
- rTreeView.get_id(rEntry).toInt64())->pData)->pData );
+ return pSh->FindRedlineOfData( *static_cast<SwRedlineDataParent*>(weld::fromId<RedlinData*>(
+ rTreeView.get_id(rEntry))->pData)->pData );
}
IMPL_LINK_NOARG(SwRedlineAcceptDlg, AcceptHdl, SvxTPView*, void)
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 4adbee6781cf..9b4ab24e367c 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -145,17 +145,17 @@ namespace
{
bool lcl_IsContent(const weld::TreeIter& rEntry, const weld::TreeView& rTreeView)
{
- return reinterpret_cast<const SwTypeNumber*>(rTreeView.get_id(rEntry).toInt64())->GetTypeId() == CTYPE_CNT;
+ return weld::fromId<const SwTypeNumber*>(rTreeView.get_id(rEntry))->GetTypeId() == CTYPE_CNT;
}
bool lcl_IsContentType(const weld::TreeIter& rEntry, const weld::TreeView& rTreeView)
{
- return reinterpret_cast<const SwTypeNumber*>(rTreeView.get_id(rEntry).toInt64())->GetTypeId() == CTYPE_CTT;
+ return weld::fromId<const SwTypeNumber*>(rTreeView.get_id(rEntry))->GetTypeId() == CTYPE_CTT;
}
bool lcl_IsLowerOutlineContent(const weld::TreeIter& rEntry, const weld::TreeView& rTreeView, sal_uInt8 nLevel)
{
- return reinterpret_cast<const SwOutlineContent*>(rTreeView.get_id(rEntry).toInt64())->GetOutlineLevel() < nLevel;
+ return weld::fromId<const SwOutlineContent*>(rTreeView.get_id(rEntry))->GetOutlineLevel() < nLevel;
}
bool lcl_FindShell(SwWrtShell const * pShell)
@@ -1117,8 +1117,8 @@ sal_Int8 SwContentTree::ExecuteDrop(const ExecuteDropEvent& rEvt)
{
if (xDropEntry && lcl_IsContent(*xDropEntry, *m_xTreeView))
{
- assert(dynamic_cast<SwContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xDropEntry).toInt64())));
- SwOutlineContent* pOutlineContent = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xDropEntry).toInt64());
+ assert(dynamic_cast<SwContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xDropEntry))));
+ SwOutlineContent* pOutlineContent = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xDropEntry));
assert(pOutlineContent);
void* key = lcl_GetOutlineKey(*this, pOutlineContent);
@@ -1151,8 +1151,8 @@ sal_Int8 SwContentTree::ExecuteDrop(const ExecuteDropEvent& rEvt)
}
else
{
- assert(dynamic_cast<SwOutlineContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xDropEntry).toInt64())));
- nTargetPos = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xDropEntry).toInt64())->GetOutlinePos();
+ assert(dynamic_cast<SwOutlineContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xDropEntry))));
+ nTargetPos = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xDropEntry))->GetOutlinePos();
}
if( MAXLEVEL > m_nOutlineLevel && // Not all layers are displayed.
@@ -1162,8 +1162,8 @@ sal_Int8 SwContentTree::ExecuteDrop(const ExecuteDropEvent& rEvt)
bool bNext = m_xTreeView->iter_next(*xNext);
if (bNext)
{
- assert(dynamic_cast<SwOutlineContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xNext).toInt64())));
- nTargetPos = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xNext).toInt64())->GetOutlinePos() - 1;
+ assert(dynamic_cast<SwOutlineContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xNext))));
+ nTargetPos = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xNext))->GetOutlinePos() - 1;
}
else
nTargetPos = GetWrtShell()->getIDocumentOutlineNodesAccess()->getOutlineNodesCount() - 1;
@@ -1433,7 +1433,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
bool bRemoveGotoEntry = false;
if (State::HIDDEN == m_eState || !xEntry || !lcl_IsContent(*xEntry, *m_xTreeView) ||
- reinterpret_cast<SwContent*>(m_xTreeView->get_id(*xEntry).toInt64())->IsInvisible())
+ weld::fromId<SwContent*>(m_xTreeView->get_id(*xEntry))->IsInvisible())
bRemoveGotoEntry = true;
bool bRemovePostItEntries = true;
@@ -1465,10 +1465,10 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
{
const SwContentType* pType;
if (lcl_IsContentType(*xEntry, *m_xTreeView))
- pType = reinterpret_cast<SwContentType*>(m_xTreeView->get_id(*xEntry).toInt64());
+ pType = weld::fromId<SwContentType*>(m_xTreeView->get_id(*xEntry));
else
- pType = reinterpret_cast<SwContent*>(
- m_xTreeView->get_id(*xEntry).toInt64())->GetParent();
+ pType = weld::fromId<SwContent*>(
+ m_xTreeView->get_id(*xEntry))->GetParent();
const ContentTypeId nContentType = pType->GetType();
switch (nContentType)
{
@@ -1532,8 +1532,8 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
&& lcl_IsContent(*xEntry, *m_xTreeView))
{
const bool bReadonly = m_pActiveShell->GetView().GetDocShell()->IsReadOnly();
- const bool bVisible = !reinterpret_cast<SwContent*>(m_xTreeView->get_id(*xEntry).toInt64())->IsInvisible();
- const bool bProtected = reinterpret_cast<SwContent*>(m_xTreeView->get_id(*xEntry).toInt64())->IsProtect();
+ const bool bVisible = !weld::fromId<SwContent*>(m_xTreeView->get_id(*xEntry))->IsInvisible();
+ const bool bProtected = weld::fromId<SwContent*>(m_xTreeView->get_id(*xEntry))->IsProtect();
const bool bProtectBM = (ContentTypeId::BOOKMARK == nContentType)
&& m_pActiveShell->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_BOOKMARKS);
const bool bEditable = pType->IsEditable() &&
@@ -1552,7 +1552,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
if (ContentTypeId::FOOTNOTE == nContentType)
{
- void* pUserData = reinterpret_cast<void*>(m_xTreeView->get_id(*xEntry).toInt64());
+ void* pUserData = weld::fromId<void*>(m_xTreeView->get_id(*xEntry));
const SwTextFootnote* pFootnote =
static_cast<const SwTextFootnoteContent*>(pUserData)->GetTextFootnote();
if (!pFootnote)
@@ -1575,7 +1575,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
{
bRemoveIndexEntries = false;
- const SwTOXBase* pBase = reinterpret_cast<SwTOXBaseContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetTOXBase();
+ const SwTOXBase* pBase = weld::fromId<SwTOXBaseContent*>(m_xTreeView->get_id(*xEntry))->GetTOXBase();
if (!pBase->IsTOXBaseInReadonly())
bRemoveEditEntry = false;
@@ -1588,7 +1588,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
bRemoveEditEntry = false;
bRemoveUnprotectEntry = false;
bool bFull = false;
- OUString sTableName = reinterpret_cast<SwContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetName();
+ OUString sTableName = weld::fromId<SwContent*>(m_xTreeView->get_id(*xEntry))->GetName();
bool bProt = m_pActiveShell->HasTableAnyProtection( &sTableName, &bFull );
xPop->set_sensitive(OString::number(403), !bFull);
xPop->set_sensitive(OString::number(404), bProt);
@@ -1625,10 +1625,10 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
else
{
if (lcl_IsContentType(*xEntry, *m_xTreeView))
- pType = reinterpret_cast<SwContentType*>(m_xTreeView->get_id(*xEntry).toInt64());
+ pType = weld::fromId<SwContentType*>(m_xTreeView->get_id(*xEntry));
else
- pType = reinterpret_cast<SwContent*>(
- m_xTreeView->get_id(*xEntry).toInt64())->GetParent();
+ pType = weld::fromId<SwContent*>(
+ m_xTreeView->get_id(*xEntry))->GetParent();
if (pType)
{
if (ContentTypeId::OUTLINE == nContentType)
@@ -1814,8 +1814,8 @@ bool SwContentTree::RequestingChildren(const weld::TreeIter& rParent)
{
std::unique_ptr<weld::TreeIter> xChild = m_xTreeView->make_iterator();
- assert(dynamic_cast<SwContentType*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(rParent).toInt64())));
- SwContentType* pCntType = reinterpret_cast<SwContentType*>(m_xTreeView->get_id(rParent).toInt64());
+ assert(dynamic_cast<SwContentType*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(rParent))));
+ SwContentType* pCntType = weld::fromId<SwContentType*>(m_xTreeView->get_id(rParent));
const size_t nCount = pCntType->GetMemberCount();
// Add for outline plus/minus
@@ -1831,7 +1831,7 @@ bool SwContentTree::RequestingChildren(const weld::TreeIter& rParent)
OUString sEntry = pCnt->GetName();
if(sEntry.isEmpty())
sEntry = m_sSpace;
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pCnt)));
+ OUString sId(weld::toId(pCnt));
auto lamba = [nLevel, this](const std::unique_ptr<weld::TreeIter>& entry)
{
@@ -1870,7 +1870,7 @@ bool SwContentTree::RequestingChildren(const weld::TreeIter& rParent)
OUString sEntry = pCnt->GetName();
if (sEntry.isEmpty())
sEntry = m_sSpace;
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pCnt)));
+ OUString sId(weld::toId(pCnt));
insert(&rParent, sEntry, sId, false, xChild.get());
m_xTreeView->set_sensitive(*xChild, !pCnt->IsInvisible());
if (bRegion)
@@ -1923,12 +1923,12 @@ void SwContentTree::Expand(const weld::TreeIter& rParent, std::vector<std::uniqu
if (!m_bIsRoot
|| (lcl_IsContentType(rParent, *m_xTreeView) &&
- reinterpret_cast<SwContentType*>(m_xTreeView->get_id(rParent).toInt64())->GetType() == ContentTypeId::OUTLINE)
+ weld::fromId<SwContentType*>(m_xTreeView->get_id(rParent))->GetType() == ContentTypeId::OUTLINE)
|| (m_nRootType == ContentTypeId::OUTLINE))
{
if (lcl_IsContentType(rParent, *m_xTreeView))
{
- SwContentType* pCntType = reinterpret_cast<SwContentType*>(m_xTreeView->get_id(rParent).toInt64());
+ SwContentType* pCntType = weld::fromId<SwContentType*>(m_xTreeView->get_id(rParent));
const sal_Int32 nOr = 1 << static_cast<int>(pCntType->GetType()); //linear -> Bitposition
if (State::HIDDEN != m_eState)
{
@@ -1953,8 +1953,8 @@ void SwContentTree::Expand(const weld::TreeIter& rParent, std::vector<std::uniqu
{
if (m_xTreeView->iter_has_child(*xChild))
{
- assert(dynamic_cast<SwOutlineContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xChild).toInt64())));
- auto const nPos = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xChild).toInt64())->GetOutlinePos();
+ assert(dynamic_cast<SwOutlineContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xChild))));
+ auto const nPos = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xChild))->GetOutlinePos();
void* key = static_cast<void*>(pShell->getIDocumentOutlineNodesAccess()->getOutlineNode( nPos ));
aCurrOutLineNodeMap.emplace( key, false );
std::map<void*, bool>::iterator iter = mOutLineNodeMap.find( key );
@@ -1980,8 +1980,8 @@ void SwContentTree::Expand(const weld::TreeIter& rParent, std::vector<std::uniqu
{
SwWrtShell* pShell = GetWrtShell();
// paranoid assert now that outline type is checked
- assert(dynamic_cast<SwOutlineContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(rParent).toInt64())));
- auto const nPos = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(rParent).toInt64())->GetOutlinePos();
+ assert(dynamic_cast<SwOutlineContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(rParent))));
+ auto const nPos = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(rParent))->GetOutlinePos();
void* key = static_cast<void*>(pShell->getIDocumentOutlineNodesAccess()->getOutlineNode( nPos ));
mOutLineNodeMap[key] = true;
}
@@ -2020,7 +2020,7 @@ IMPL_LINK(SwContentTree, CollapseHdl, const weld::TreeIter&, rParent, bool)
}
return false; // return false to notify caller not to do collapse
}
- SwContentType* pCntType = reinterpret_cast<SwContentType*>(m_xTreeView->get_id(rParent).toInt64());
+ SwContentType* pCntType = weld::fromId<SwContentType*>(m_xTreeView->get_id(rParent));
const sal_Int32 nAnd = ~(1 << static_cast<int>(pCntType->GetType()));
if (State::HIDDEN != m_eState)
{
@@ -2033,8 +2033,8 @@ IMPL_LINK(SwContentTree, CollapseHdl, const weld::TreeIter&, rParent, bool)
else if (lcl_IsContent(rParent, *m_xTreeView))
{
SwWrtShell* pShell = GetWrtShell();
- assert(dynamic_cast<SwOutlineContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(rParent).toInt64())));
- auto const nPos = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(rParent).toInt64())->GetOutlinePos();
+ assert(dynamic_cast<SwOutlineContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(rParent))));
+ auto const nPos = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(rParent))->GetOutlinePos();
void* key = static_cast<void*>(pShell->getIDocumentOutlineNodesAccess()->getOutlineNode( nPos ));
mOutLineNodeMap[key] = false;
}
@@ -2060,8 +2060,8 @@ IMPL_LINK_NOARG(SwContentTree, ContentDoubleClickHdl, weld::TreeView&, bool)
}
else if (!lcl_IsContentType(*xEntry, *m_xTreeView) && (State::HIDDEN != m_eState))
{
- assert(dynamic_cast<SwContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xEntry).toInt64())));
- SwContent* pCnt = reinterpret_cast<SwContent*>(m_xTreeView->get_id(*xEntry).toInt64());
+ assert(dynamic_cast<SwContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xEntry))));
+ SwContent* pCnt = weld::fromId<SwContent*>(m_xTreeView->get_id(*xEntry));
assert(pCnt && "no UserData");
if (pCnt && !pCnt->IsInvisible())
{
@@ -2250,7 +2250,7 @@ void SwContentTree::Display( bool bActive )
OUString aImage(GetImageIdForContentTypeId(nCntType));
bool bChOnDemand = 0 != rpContentT->GetMemberCount();
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(rpContentT.get())));
+ OUString sId(weld::toId(rpContentT.get()));
insert(nullptr, rpContentT->GetName(), sId, bChOnDemand, xEntry.get());
m_xTreeView->set_image(*xEntry, aImage);
@@ -2338,7 +2338,7 @@ void SwContentTree::Display( bool bActive )
rpRootContentT.reset(new SwContentType(pShell, m_nRootType, m_nOutlineLevel ));
OUString aImage(GetImageIdForContentTypeId(m_nRootType));
bool bChOnDemand = m_nRootType == ContentTypeId::OUTLINE;
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(rpRootContentT.get())));
+ OUString sId(weld::toId(rpRootContentT.get()));
insert(nullptr, rpRootContentT->GetName(), sId, bChOnDemand, xEntry.get());
m_xTreeView->set_image(*xEntry, aImage);
@@ -2355,7 +2355,7 @@ void SwContentTree::Display( bool bActive )
OUString sEntry = pCnt->GetName();
if(sEntry.isEmpty())
sEntry = m_sSpace;
- OUString sSubId(OUString::number(reinterpret_cast<sal_Int64>(pCnt)));
+ OUString sSubId(weld::toId(pCnt));
insert(xEntry.get(), sEntry, sSubId, false, xChild.get());
m_xTreeView->set_sensitive(*xChild, !pCnt->IsInvisible());
if (bRegion)
@@ -2439,8 +2439,8 @@ bool SwContentTree::FillTransferData( TransferDataContainer& rTransfer,
if (!bEntry || lcl_IsContentType(*xEntry, *m_xTreeView) || !pWrtShell)
return false;
OUString sEntry;
- assert(dynamic_cast<SwContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xEntry).toInt64())));
- SwContent* pCnt = reinterpret_cast<SwContent*>(m_xTreeView->get_id(*xEntry).toInt64());
+ assert(dynamic_cast<SwContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xEntry))));
+ SwContent* pCnt = weld::fromId<SwContent*>(m_xTreeView->get_id(*xEntry));
const ContentTypeId nActType = pCnt->GetParent()->GetType();
OUString sUrl;
@@ -2577,13 +2577,13 @@ void SwContentTree::ToggleToRoot()
const SwContentType* pCntType;
if (lcl_IsContentType(*xEntry, *m_xTreeView))
{
- assert(dynamic_cast<SwContentType*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xEntry).toInt64())));
- pCntType = reinterpret_cast<SwContentType*>(m_xTreeView->get_id(*xEntry).toInt64());
+ assert(dynamic_cast<SwContentType*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xEntry))));
+ pCntType = weld::fromId<SwContentType*>(m_xTreeView->get_id(*xEntry));
}
else
{
- assert(dynamic_cast<SwContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xEntry).toInt64())));
- pCntType = reinterpret_cast<SwContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetParent();
+ assert(dynamic_cast<SwContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xEntry))));
+ pCntType = weld::fromId<SwContent*>(m_xTreeView->get_id(*xEntry))->GetParent();
}
m_nRootType = pCntType->GetType();
m_bIsRoot = true;
@@ -2650,10 +2650,10 @@ bool SwContentTree::HasContentChanged()
if (!m_xTreeView->get_iter_first(*xRootEntry))
return true;
- assert(dynamic_cast<SwContentType*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xRootEntry).toInt64())));
- const ContentTypeId nType = reinterpret_cast<SwContentType*>(m_xTreeView->get_id(*xRootEntry).toInt64())->GetType();
+ assert(dynamic_cast<SwContentType*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xRootEntry))));
+ const ContentTypeId nType = weld::fromId<SwContentType*>(m_xTreeView->get_id(*xRootEntry))->GetType();
SwContentType* pArrType = m_aActiveContentArr[nType].get();
- assert(OUString::number(reinterpret_cast<sal_Int64>(pArrType)) == m_xTreeView->get_id(*xRootEntry));
+ assert(weld::toId(pArrType) == m_xTreeView->get_id(*xRootEntry));
if (!pArrType)
return true;
@@ -2681,7 +2681,7 @@ bool SwContentTree::HasContentChanged()
// the member data in the array. The Display function will clear and recreate the
// treeview from the content type member arrays if content change is detected.
const SwContent* pCnt = pArrType->GetMember(j);
- OUString sSubId(OUString::number(reinterpret_cast<sal_Int64>(pCnt)));
+ OUString sSubId(weld::toId(pCnt));
m_xTreeView->set_id(*xEntry, sSubId);
OUString sEntryText = m_xTreeView->get_text(*xEntry);
@@ -2711,12 +2711,12 @@ bool SwContentTree::HasContentChanged()
for (bool bEntry = m_xTreeView->get_iter_first(*xEntry); bEntry;
bEntry = lcl_nextContentTypeEntry())
{
- assert(dynamic_cast<SwContentType*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xEntry).toInt64())));
- SwContentType* pCntType = reinterpret_cast<SwContentType*>(m_xTreeView->get_id(*xEntry).toInt64());
+ assert(dynamic_cast<SwContentType*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xEntry))));
+ SwContentType* pCntType = weld::fromId<SwContentType*>(m_xTreeView->get_id(*xEntry));
const size_t nCntCount = pCntType->GetMemberCount();
const ContentTypeId nType = pCntType->GetType();
SwContentType* pArrType = m_aActiveContentArr[nType].get();
- assert(OUString::number(reinterpret_cast<sal_Int64>(pArrType)) == m_xTreeView->get_id(*xEntry));
+ assert(weld::toId(pArrType) == m_xTreeView->get_id(*xEntry));
if (!pArrType)
{
@@ -2757,7 +2757,7 @@ bool SwContentTree::HasContentChanged()
}
const SwContent* pCnt = pArrType->GetMember(j);
- OUString sSubId(OUString::number(reinterpret_cast<sal_Int64>(pCnt)));
+ OUString sSubId(weld::toId(pCnt));
m_xTreeView->set_id(*xEntry, sSubId);
OUString sEntryText = m_xTreeView->get_text(*xEntry);
@@ -2786,7 +2786,7 @@ bool SwContentTree::HasContentChanged()
for (size_t j = 0; j < nOldChildCount; ++j)
{
const SwContent* pCnt = pArrType->GetMember(j);
- OUString sSubId(OUString::number(reinterpret_cast<sal_Int64>(pCnt)));
+ OUString sSubId(weld::toId(pCnt));
m_xTreeView->set_id(*xChild, sSubId);
OUString sEntryText = m_xTreeView->get_text(*xChild);
if( sEntryText != pCnt->GetName() &&
@@ -2827,11 +2827,11 @@ void SwContentTree::UpdateLastSelType()
{
while (m_xTreeView->get_iter_depth(*xEntry))
m_xTreeView->iter_parent(*xEntry);
- sal_Int64 nId = m_xTreeView->get_id(*xEntry).toInt64();
- if (nId && lcl_IsContentType(*xEntry, *m_xTreeView))
+ void* pId = weld::fromId<void*>(m_xTreeView->get_id(*xEntry));
+ if (pId && lcl_IsContentType(*xEntry, *m_xTreeView))
{
- assert(dynamic_cast<SwContentType*>(reinterpret_cast<SwTypeNumber*>(nId)));
- m_nLastSelType = reinterpret_cast<SwContentType*>(nId)->GetType();
+ assert(dynamic_cast<SwContentType*>(static_cast<SwTypeNumber*>(pId)));
+ m_nLastSelType = static_cast<SwContentType*>(pId)->GetType();
}
}
}
@@ -3048,12 +3048,12 @@ void SwContentTree::ExecCommand(std::string_view rCmd, bool bOutlineWithChildren
assert(pCurrentEntry && lcl_IsContent(*pCurrentEntry, *m_xTreeView));
if (lcl_IsContent(*pCurrentEntry, *m_xTreeView))
{
- assert(dynamic_cast<SwContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*pCurrentEntry).toInt64())));
+ assert(dynamic_cast<SwContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*pCurrentEntry))));
if ((m_bIsRoot && m_nRootType == ContentTypeId::OUTLINE) ||
- reinterpret_cast<SwContent*>(m_xTreeView->get_id(*pCurrentEntry).toInt64())->GetParent()->GetType()
+ weld::fromId<SwContent*>(m_xTreeView->get_id(*pCurrentEntry))->GetParent()->GetType()
== ContentTypeId::OUTLINE)
{
- nActPos = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*pCurrentEntry).toInt64())->GetOutlinePos();
+ nActPos = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*pCurrentEntry))->GetOutlinePos();
}
}
if (nActPos == SwOutlineNodes::npos || (bUpDown && !pShell->IsOutlineMovable(nActPos)))
@@ -3085,16 +3085,16 @@ void SwContentTree::ExecCommand(std::string_view rCmd, bool bOutlineWithChildren
{
SwOutlineNodes::size_type nActEndPos = nActPos;
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator(pCurrentEntry.get()));
- assert(dynamic_cast<SwOutlineContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*pCurrentEntry).toInt64())));
- const auto nActLevel = reinterpret_cast<SwOutlineContent*>(
- m_xTreeView->get_id(*pCurrentEntry).toInt64())->GetOutlineLevel();
+ assert(dynamic_cast<SwOutlineContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*pCurrentEntry))));
+ const auto nActLevel = weld::fromId<SwOutlineContent*>(
+ m_xTreeView->get_id(*pCurrentEntry))->GetOutlineLevel();
bool bEntry = m_xTreeView->iter_next(*xEntry);
while (bEntry && lcl_IsContent(*xEntry, *m_xTreeView))
{
- assert(dynamic_cast<SwOutlineContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xEntry).toInt64())));
- if (nActLevel >= reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetOutlineLevel())
+ assert(dynamic_cast<SwOutlineContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xEntry))));
+ if (nActLevel >= weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xEntry))->GetOutlineLevel())
break;
- nActEndPos = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetOutlinePos();
+ nActEndPos = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xEntry))->GetOutlinePos();
bEntry = m_xTreeView->iter_next(*xEntry);
}
if (nDir == 1) // move down
@@ -3109,37 +3109,37 @@ void SwContentTree::ExecCommand(std::string_view rCmd, bool bOutlineWithChildren
{
// xEntry now points to the entry following the last
// selected entry.
- SwOutlineNodes::size_type nDest = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetOutlinePos();
+ SwOutlineNodes::size_type nDest = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xEntry))->GetOutlinePos();
// here needs to found the next entry after next.
// The selection must be inserted in front of that.
while (bEntry)
{
bEntry = m_xTreeView->iter_next(*xEntry);
assert(!bEntry || !lcl_IsContent(*xEntry, *m_xTreeView)||
- dynamic_cast<SwOutlineContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xEntry).toInt64())));
+ dynamic_cast<SwOutlineContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xEntry))));
// nDest++ may only executed if bEntry
if (bEntry)
{
if (!lcl_IsContent(*xEntry, *m_xTreeView))
break;
- else if (nActLevel >= reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetOutlineLevel())
+ else if (nActLevel >= weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xEntry))->GetOutlineLevel())
{
// nDest needs adjusted if there are selected entries (including ancestral lineage)
// immediately before the current moved entry.
std::unique_ptr<weld::TreeIter> xTmp(m_xTreeView->make_iterator(xEntry.get()));
bool bTmp = m_xTreeView->iter_previous(*xTmp);
while (bTmp && lcl_IsContent(*xTmp, *m_xTreeView) &&
- nActLevel < reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xTmp).toInt64())->GetOutlineLevel())
+ nActLevel < weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xTmp))->GetOutlineLevel())
{
while (bTmp && lcl_IsContent(*xTmp, *m_xTreeView) && !m_xTreeView->is_selected(*xTmp) &&
- nActLevel < reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xTmp).toInt64())->GetOutlineLevel())
+ nActLevel < weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xTmp))->GetOutlineLevel())
{
bTmp = m_xTreeView->iter_parent(*xTmp);
}
if (!bTmp || !m_xTreeView->is_selected(*xTmp))
break;
bTmp = m_xTreeView->iter_previous(*xTmp);
- nDest = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xTmp).toInt64())->GetOutlinePos();
+ nDest = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xTmp))->GetOutlinePos();
}
std::unique_ptr<weld::TreeIter> xPrevSibling(m_xTreeView->make_iterator(xEntry.get()));
if (!m_xTreeView->iter_previous_sibling(*xPrevSibling) || !m_xTreeView->is_selected(*xPrevSibling))
@@ -3147,7 +3147,7 @@ void SwContentTree::ExecCommand(std::string_view rCmd, bool bOutlineWithChildren
}
else
{
- nDest = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetOutlinePos();
+ nDest = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xEntry))->GetOutlinePos();
}
}
}
@@ -3173,10 +3173,10 @@ void SwContentTree::ExecCommand(std::string_view rCmd, bool bOutlineWithChildren
{
bEntry = m_xTreeView->iter_previous(*xEntry);
assert(!bEntry || !lcl_IsContent(*xEntry, *m_xTreeView) ||
- dynamic_cast<SwOutlineContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xEntry).toInt64())));
+ dynamic_cast<SwOutlineContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xEntry))));
if (bEntry && lcl_IsContent(*xEntry, *m_xTreeView))
{
- nDest = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetOutlinePos();
+ nDest = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xEntry))->GetOutlinePos();
}
else
{
@@ -3186,24 +3186,24 @@ void SwContentTree::ExecCommand(std::string_view rCmd, bool bOutlineWithChildren
{
if (!lcl_IsContent(*xEntry, *m_xTreeView))
break;
- else if (nActLevel >= reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetOutlineLevel())
+ else if (nActLevel >= weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xEntry))->GetOutlineLevel())
{
// nDest needs adjusted if there are selected entries immediately
// after the level change.
std::unique_ptr<weld::TreeIter> xTmp(m_xTreeView->make_iterator(xEntry.get()));
bool bTmp = m_xTreeView->iter_next(*xTmp);
while (bTmp && lcl_IsContent(*xTmp, *m_xTreeView) &&
- nActLevel < reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xTmp).toInt64())->GetOutlineLevel() &&
+ nActLevel < weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xTmp))->GetOutlineLevel() &&
m_xTreeView->is_selected(*xTmp))
{
- nDest = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xTmp).toInt64())->GetOutlinePos();
- const auto nLevel = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xTmp).toInt64())->GetOutlineLevel();
+ nDest = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xTmp))->GetOutlinePos();
+ const auto nLevel = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xTmp))->GetOutlineLevel();
// account for selected entries' descendent lineage
bTmp = m_xTreeView->iter_next(*xTmp);
while (bTmp && lcl_IsContent(*xTmp, *m_xTreeView) &&
- nLevel < reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xTmp).toInt64())->GetOutlineLevel())
+ nLevel < weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xTmp))->GetOutlineLevel())
{
- nDest = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xTmp).toInt64())->GetOutlinePos();
+ nDest = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xTmp))->GetOutlinePos();
bTmp = m_xTreeView->iter_next(*xTmp);
}
}
@@ -3249,8 +3249,8 @@ void SwContentTree::ExecCommand(std::string_view rCmd, bool bOutlineWithChildren
bool bListEntry = m_xTreeView->get_iter_first(*xListEntry);
while ((bListEntry = m_xTreeView->iter_next(*xListEntry)) && lcl_IsContent(*xListEntry, *m_xTreeView))
{
- assert(dynamic_cast<SwOutlineContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xListEntry).toInt64())));
- if (reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xListEntry).toInt64())->GetOutlinePos() == nCurrPos)
+ assert(dynamic_cast<SwOutlineContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xListEntry))));
+ if (weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xListEntry))->GetOutlinePos() == nCurrPos)
{
std::unique_ptr<weld::TreeIter> xParent(m_xTreeView->make_iterator(xListEntry.get()));
if (m_xTreeView->iter_parent(*xParent) && !m_xTreeView->get_row_expanded(*xParent))
@@ -3309,7 +3309,7 @@ static void lcl_SelectByContentTypeAndAddress(SwContentTree* pThis, weld::TreeVi
bool bFoundEntry = rContentTree.get_iter_first(*xIter);
while (bFoundEntry)
{
- void* pUserData = reinterpret_cast<void*>(rContentTree.get_id(*xIter).toInt64());
+ void* pUserData = weld::fromId<void*>(rContentTree.get_id(*xIter));
assert(dynamic_cast<SwContentType*>(static_cast<SwTypeNumber*>(pUserData)));
if (nType == static_cast<SwContentType*>(pUserData)->GetType())
break;
@@ -3326,7 +3326,7 @@ static void lcl_SelectByContentTypeAndAddress(SwContentTree* pThis, weld::TreeVi
const void* p = nullptr;
while (rContentTree.iter_next(*xIter) && lcl_IsContent(*xIter, rContentTree))
{
- void* pUserData = reinterpret_cast<void*>(rContentTree.get_id(*xIter).toInt64());
+ void* pUserData = weld::fromId<void*>(rContentTree.get_id(*xIter));
switch( nType )
{
case ContentTypeId::FOOTNOTE:
@@ -3346,7 +3346,7 @@ static void lcl_SelectByContentTypeAndAddress(SwContentTree* pThis, weld::TreeVi
case ContentTypeId::TEXTFIELD:
{
assert(dynamic_cast<SwTextFieldContent*>(static_cast<SwTypeNumber*>(pUserData)));
- SwTextFieldContent* pCnt = static_cast/*reinterpret_cast*/<SwTextFieldContent*>(pUserData);
+ SwTextFieldContent* pCnt = static_cast<SwTextFieldContent*>(pUserData);
p = pCnt->GetFormatField()->GetField();
break;
}
@@ -3737,12 +3737,12 @@ void SwContentTree::UpdateTracking()
m_xTreeView->all_foreach([this, nActPos](weld::TreeIter& rEntry){
bool bRet = false;
- if (lcl_IsContent(rEntry, *m_xTreeView) && reinterpret_cast<SwContent*>(
- m_xTreeView->get_id(rEntry).toInt64())->GetParent()->GetType() ==
+ if (lcl_IsContent(rEntry, *m_xTreeView) && weld::fromId<SwContent*>(
+ m_xTreeView->get_id(rEntry))->GetParent()->GetType() ==
ContentTypeId::OUTLINE)
{
- if (reinterpret_cast<SwOutlineContent*>(
- m_xTreeView->get_id(rEntry).toInt64())->GetOutlinePos() == nActPos)
+ if (weld::fromId<SwOutlineContent*>(
+ m_xTreeView->get_id(rEntry))->GetOutlinePos() == nActPos)
{
std::unique_ptr<weld::TreeIter> xFirstSelected(
m_xTreeView->make_iterator());
@@ -3762,8 +3762,8 @@ void SwContentTree::UpdateTracking()
{
do
{
- if (reinterpret_cast<SwContent*>(
- m_xTreeView->get_id(*xChildEntry).toInt64())->
+ if (weld::fromId<SwContent*>(
+ m_xTreeView->get_id(*xChildEntry))->
GetParent()->GetType() == ContentTypeId::OUTLINE)
m_xTreeView->collapse_row(*xChildEntry);
else
@@ -3783,8 +3783,8 @@ void SwContentTree::UpdateTracking()
{
// use of this break assumes outline content type is first in tree
if (lcl_IsContentType(rEntry, *m_xTreeView) &&
- reinterpret_cast<SwContentType*>(
- m_xTreeView->get_id(rEntry).toInt64())->GetType() !=
+ weld::fromId<SwContentType*>(
+ m_xTreeView->get_id(rEntry))->GetType() !=
ContentTypeId::OUTLINE)
bRet = true;
}
@@ -3832,12 +3832,12 @@ void SwContentTree::SelectOutlinesWithSelection()
{
m_xTreeView->all_foreach([this, nOutlinePosition](const weld::TreeIter& rEntry){
if (lcl_IsContent(rEntry, *m_xTreeView) &&
- reinterpret_cast<SwContent*>(
- m_xTreeView->get_id(rEntry).toInt64())->GetParent()->GetType() ==
+ weld::fromId<SwContent*>(
+ m_xTreeView->get_id(rEntry))->GetParent()->GetType() ==
ContentTypeId::OUTLINE)
{
- if (reinterpret_cast<SwOutlineContent*>(
- m_xTreeView->get_id(rEntry).toInt64())->GetOutlinePos() ==
+ if (weld::fromId<SwOutlineContent*>(
+ m_xTreeView->get_id(rEntry))->GetOutlinePos() ==
nOutlinePosition)
{
std::unique_ptr<weld::TreeIter> xParent =
@@ -3871,7 +3871,7 @@ void SwContentTree::MoveOutline(SwOutlineNodes::size_type nTargetPos)
for (const auto& source : m_aDndOutlinesSelected)
{
- SwOutlineNodes::size_type nSourcePos = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*source).toInt64())->GetOutlinePos();
+ SwOutlineNodes::size_type nSourcePos = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*source))->GetOutlinePos();
// Done on the first selection move
if (bFirstMove) // only do once
@@ -3985,8 +3985,8 @@ IMPL_LINK(SwContentTree, KeyInputHdl, const KeyEvent&, rEvent, bool)
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
if (m_xTreeView->get_selected(xEntry.get()) && lcl_IsContent(*xEntry, *m_xTreeView))
{
- assert(dynamic_cast<SwContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xEntry).toInt64())));
- if (reinterpret_cast<SwContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetParent()->IsDeletable() &&
+ assert(dynamic_cast<SwContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xEntry))));
+ if (weld::fromId<SwContent*>(m_xTreeView->get_id(*xEntry))->GetParent()->IsDeletable() &&
!m_pActiveShell->GetView().GetDocShell()->IsReadOnly())
{
EditEntry(*xEntry, EditEntryMode::DELETE);
@@ -4007,7 +4007,7 @@ IMPL_LINK(SwContentTree, KeyInputHdl, const KeyEvent&, rEvent, bool)
m_pActiveShell->GetView().GetViewFrame()->GetWindow().ToTop();
}
- SwContent* pCnt = dynamic_cast<SwContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xEntry).toInt64()));
+ SwContent* pCnt = dynamic_cast<SwContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xEntry)));
if (pCnt && pCnt->GetParent()->GetType() == ContentTypeId::DRAWOBJECT)
{
@@ -4089,7 +4089,7 @@ IMPL_LINK(SwContentTree, KeyInputHdl, const KeyEvent&, rEvent, bool)
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
if (m_xTreeView->get_cursor(xEntry.get()))
{
- SwContent* pCnt = dynamic_cast<SwContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xEntry).toInt64()));
+ SwContent* pCnt = dynamic_cast<SwContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xEntry)));
if (pCnt && pCnt->GetParent()->GetType() == ContentTypeId::OUTLINE)
{
if (m_bIsRoot && aCode.GetCode() == KEY_LEFT && aCode.GetModifier() == 0)
@@ -4126,7 +4126,7 @@ IMPL_LINK(SwContentTree, QueryTooltipHdl, const weld::TreeIter&, rEntry, OUStrin
{
ContentTypeId nType;
bool bContent = false;
- void* pUserData = reinterpret_cast<void*>(m_xTreeView->get_id(rEntry).toInt64());
+ void* pUserData = weld::fromId<void*>(m_xTreeView->get_id(rEntry));
if (lcl_IsContentType(rEntry, *m_xTreeView))
{
assert(dynamic_cast<SwContentType*>(static_cast<SwTypeNumber*>(pUserData)));
@@ -4325,7 +4325,7 @@ void SwContentTree::ExecuteContextMenuAction(const OString& rSelectedPopupEntry)
{
m_pActiveShell->EnterStdMode();
m_bIgnoreDocChange = true;
- SwOutlineContent* pCntFirst = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xFirst).toInt64());
+ SwOutlineContent* pCntFirst = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(*xFirst));
// toggle the outline node outline content visible attribute
if (nSelectedPopupEntry == TOGGLE_OUTLINE_CONTENT_VISIBILITY)
@@ -4404,7 +4404,7 @@ void SwContentTree::ExecuteContextMenuAction(const OString& rSelectedPopupEntry)
break;
case 405 :
{
- const SwTOXBase* pBase = reinterpret_cast<SwTOXBaseContent*>(m_xTreeView->get_id(*xFirst).toInt64())
+ const SwTOXBase* pBase = weld::fromId<SwTOXBaseContent*>(m_xTreeView->get_id(*xFirst))
->GetTOXBase();
m_pActiveShell->SetTOXBaseReadonly(*pBase, !SwEditShell::IsTOXBaseReadonly(*pBase));
}
@@ -4454,16 +4454,16 @@ void SwContentTree::ExecuteContextMenuAction(const OString& rSelectedPopupEntry)
m_pActiveShell->KillPams();
m_pActiveShell->ClearMark();
m_pActiveShell->EnterAddMode();
- SwContent* pCnt = reinterpret_cast<SwContent*>(m_xTreeView->get_id(*xFirst).toInt64());
+ SwContent* pCnt = weld::fromId<SwContent*>(m_xTreeView->get_id(*xFirst));
const ContentTypeId eTypeId = pCnt->GetParent()->GetType();
if (eTypeId == ContentTypeId::OUTLINE)
{
- SwOutlineNodes::size_type nActPos = reinterpret_cast<SwOutlineContent*>(
- m_xTreeView->get_id(*xFirst).toInt64())->GetOutlinePos();
+ SwOutlineNodes::size_type nActPos = weld::fromId<SwOutlineContent*>(
+ m_xTreeView->get_id(*xFirst))->GetOutlinePos();
m_pActiveShell->GotoOutline(nActPos);
m_xTreeView->selected_foreach([this](weld::TreeIter& rEntry){
- SwOutlineNodes::size_type nPos = reinterpret_cast<SwOutlineContent*>(
- m_xTreeView->get_id(rEntry).toInt64())->GetOutlinePos();
+ SwOutlineNodes::size_type nPos = weld::fromId<SwOutlineContent*>(
+ m_xTreeView->get_id(rEntry))->GetOutlinePos();
m_pActiveShell->SttSelect();
// select children if not expanded and don't kill PaMs
m_pActiveShell->MakeOutlineSel(nPos, nPos,
@@ -4496,7 +4496,7 @@ void SwContentTree::ExecuteContextMenuAction(const OString& rSelectedPopupEntry)
break;
case 900:
{
- SwContent* pCnt = reinterpret_cast<SwContent*>(m_xTreeView->get_id(*xFirst).toInt64());
+ SwContent* pCnt = weld::fromId<SwContent*>(m_xTreeView->get_id(*xFirst));
GotoContent(pCnt);
}
break;
@@ -4541,7 +4541,7 @@ void SwContentTree::DeleteOutlineSelections()
{
nChapters += m_xTreeView->iter_n_children(rEntry);
}
- SwOutlineNodes::size_type nActPos = reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(rEntry).toInt64())->GetOutlinePos();
+ SwOutlineNodes::size_type nActPos = weld::fromId<SwOutlineContent*>(m_xTreeView->get_id(rEntry))->GetOutlinePos();
m_pActiveShell->SttSelect();
m_pActiveShell->MakeOutlineSel(nActPos, nActPos, !m_xTreeView->get_row_expanded(rEntry), false); // select children if not expanded
// The outline selection may already be to the start of the following outline paragraph
@@ -4709,7 +4709,7 @@ void SwContentTree::Select()
{
if ((m_bIsRoot && m_nRootType == ContentTypeId::OUTLINE) ||
(lcl_IsContent(*xEntry, *m_xTreeView) &&
- reinterpret_cast<SwContentType*>(m_xTreeView->get_id(*xParentEntry).toInt64())->GetType() == ContentTypeId::OUTLINE))
+ weld::fromId<SwContentType*>(m_xTreeView->get_id(*xParentEntry))->GetType() == ContentTypeId::OUTLINE))
{
bEnable = true;
}
@@ -4745,7 +4745,7 @@ OUString SwContentType::RemoveNewline(const OUString& rEntry)
void SwContentTree::EditEntry(const weld::TreeIter& rEntry, EditEntryMode nMode)
{
- SwContent* pCnt = reinterpret_cast<SwContent*>(m_xTreeView->get_id(rEntry).toInt64());
+ SwContent* pCnt = weld::fromId<SwContent*>(m_xTreeView->get_id(rEntry));
GotoContent(pCnt);
const ContentTypeId nType = pCnt->GetParent()->GetType();
sal_uInt16 nSlot = 0;
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index d658a6db7271..922b4fbc2059 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -180,7 +180,7 @@ sal_Int8 SwGlobalTreeDropTarget::ExecuteDrop( const ExecuteDropEvent& rEvt )
OUString sFileName;
const SwGlblDocContent* pCnt = xDropEntry ?
- reinterpret_cast<const SwGlblDocContent*>(rWidget.get_id(*xDropEntry).toInt64()) :
+ weld::fromId<const SwGlblDocContent*>(rWidget.get_id(*xDropEntry)) :
nullptr;
if( aData.HasFormat( SotClipboardFormatId::FILE_LIST ))
{
@@ -330,10 +330,10 @@ MenuEnableFlags SwGlobalTree::GetEnableFlags() const
if(nSelCount == 1)
{
nRet |= MenuEnableFlags::Edit;
- if (bEntry && reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetType() != GLBLDOC_UNKNOWN &&
- (!bPrevEntry || reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(*xPrevEntry).toInt64())->GetType() != GLBLDOC_UNKNOWN))
+ if (bEntry && weld::fromId<SwGlblDocContent*>(m_xTreeView->get_id(*xEntry))->GetType() != GLBLDOC_UNKNOWN &&
+ (!bPrevEntry || weld::fromId<SwGlblDocContent*>(m_xTreeView->get_id(*xPrevEntry))->GetType() != GLBLDOC_UNKNOWN))
nRet |= MenuEnableFlags::InsertText;
- if (bEntry && GLBLDOC_SECTION == reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(*xEntry).toInt64())->GetType())
+ if (bEntry && GLBLDOC_SECTION == weld::fromId<SwGlblDocContent*>(m_xTreeView->get_id(*xEntry))->GetType())
nRet |= MenuEnableFlags::EditLink;
}
else if(!nEntryCount)
@@ -351,7 +351,7 @@ IMPL_LINK(SwGlobalTree, QueryTooltipHdl, const weld::TreeIter&, rIter, OUString)
{
OUString sEntry;
- const SwGlblDocContent* pCont = reinterpret_cast<const SwGlblDocContent*>(m_xTreeView->get_id(rIter).toInt64());
+ const SwGlblDocContent* pCont = weld::fromId<const SwGlblDocContent*>(m_xTreeView->get_id(rIter));
if (pCont && GLBLDOC_SECTION == pCont->GetType())
{
const SwSection* pSect = pCont->GetSection();
@@ -434,7 +434,7 @@ void SwGlobalTree::Display(bool bOnlyUpdateUserData)
for (size_t i = 0; i < nCount && bEntry; i++)
{
const SwGlblDocContent* pCont = (*m_pSwGlblDocContents)[i].get();
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pCont)));
+ OUString sId(weld::toId(pCont));
m_xTreeView->set_id(*xEntry, sId);
if (pCont->GetType() == GLBLDOC_SECTION && !pCont->GetSection()->IsConnectFlag())
m_xTreeView->set_font_color(*xEntry, COL_LIGHTRED);
@@ -464,7 +464,7 @@ void SwGlobalTree::Display(bool bOnlyUpdateUserData)
{
const SwGlblDocContent* pCont = (*m_pSwGlblDocContents)[i].get();
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pCont)));
+ OUString sId(weld::toId(pCont));
OUString sEntry;
OUString aImage;
switch (pCont->GetType())
@@ -569,7 +569,7 @@ void SwGlobalTree::ExecuteContextMenuAction(std::string_view rSelectedPopupEntry
bool bUpdateHard = false;
int nEntry = m_xTreeView->get_selected_index();
- SwGlblDocContent* pCont = nEntry != -1 ? reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(nEntry).toInt64()) : nullptr;
+ SwGlblDocContent* pCont = nEntry != -1 ? weld::fromId<SwGlblDocContent*>(m_xTreeView->get_id(nEntry)) : nullptr;
// If a RequestHelp is called during the dialogue,
// then the content gets lost. Because of that a copy
// is created in which only the DocPos is set correctly.
@@ -582,7 +582,7 @@ void SwGlobalTree::ExecuteContextMenuAction(std::string_view rSelectedPopupEntry
{
// Two passes: first update the areas, then the directories.
m_xTreeView->selected_foreach([this](weld::TreeIter& rSelEntry){
- SwGlblDocContent* pContent = reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(rSelEntry).toInt64());
+ SwGlblDocContent* pContent = weld::fromId<SwGlblDocContent*>(m_xTreeView->get_id(rSelEntry));
if (GLBLDOC_SECTION == pContent->GetType() &&
pContent->GetSection()->IsConnected())
{
@@ -591,7 +591,7 @@ void SwGlobalTree::ExecuteContextMenuAction(std::string_view rSelectedPopupEntry
return false;
});
m_xTreeView->selected_foreach([this](weld::TreeIter& rSelEntry){
- SwGlblDocContent* pContent = reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(rSelEntry).toInt64());
+ SwGlblDocContent* pContent = weld::fromId<SwGlblDocContent*>(m_xTreeView->get_id(rSelEntry));
if (GLBLDOC_TOXBASE == pContent->GetType())
m_pActiveShell->UpdateTableOf(*pContent->GetTOX());
return false;
@@ -727,7 +727,7 @@ void SwGlobalTree::ExecuteContextMenuAction(std::string_view rSelectedPopupEntry
m_xTreeView->select(nEntry);
Select();
nEntry = m_xTreeView->get_selected_index();
- pCont = nEntry != -1 ? reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(nEntry).toInt64()) : nullptr;
+ pCont = nEntry != -1 ? weld::fromId<SwGlblDocContent*>(m_xTreeView->get_id(nEntry)) : nullptr;
}
else
{
@@ -841,8 +841,8 @@ void SwGlobalTree::ExecCommand(std::string_view rCmd)
return;
if (rCmd == "edit")
{
- const SwGlblDocContent* pCont = reinterpret_cast<const SwGlblDocContent*>(
- m_xTreeView->get_id(nEntry).toInt64());
+ const SwGlblDocContent* pCont = weld::fromId<const SwGlblDocContent*>(
+ m_xTreeView->get_id(nEntry));
EditContent(pCont);
}
else
@@ -979,7 +979,7 @@ void SwGlobalTree::OpenDoc(const SwGlblDocContent* pCont)
IMPL_LINK_NOARG( SwGlobalTree, DoubleClickHdl, weld::TreeView&, bool)
{
int nEntry = m_xTreeView->get_cursor_index();
- SwGlblDocContent* pCont = reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(nEntry).toInt64());
+ SwGlblDocContent* pCont = weld::fromId<SwGlblDocContent*>(m_xTreeView->get_id(nEntry));
if (pCont->GetType() == GLBLDOC_SECTION)
OpenDoc(pCont);
else
diff --git a/vcl/unx/generic/print/prtsetup.cxx b/vcl/unx/generic/print/prtsetup.cxx
index cca780e0eb6d..56ee475e701e 100644
--- a/vcl/unx/generic/print/prtsetup.cxx
+++ b/vcl/unx/generic/print/prtsetup.cxx
@@ -40,7 +40,7 @@ void RTSDialog::insertAllPPDValues(weld::ComboBox& rBox, const PPDParser* pParse
continue;
aOptionText = pParser->translateOption( pKey->getKey(), pValue->m_aOption) ;
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pValue)));
+ OUString sId(weld::toId(pValue));
int nCurrentPos = rBox.find_id(sId);
if( m_aJobData.m_aContext.checkConstraints( pKey, pValue ) )
{
@@ -56,7 +56,7 @@ void RTSDialog::insertAllPPDValues(weld::ComboBox& rBox, const PPDParser* pParse
pValue = m_aJobData.m_aContext.getValue( pKey );
if (pValue && !pValue->m_bCustomOption)
{
- OUString sId(OUString::number(reinterpret_cast<sal_IntPtr>(pValue)));
+ OUString sId(weld::toId(pValue));
int nPos = rBox.find_id(sId);
if (nPos != -1)
rBox.set_active(nPos);
@@ -241,7 +241,7 @@ IMPL_LINK( RTSPaperPage, SelectHdl, weld::ComboBox&, rBox, void )
}
if( pKey )
{
- PPDValue* pValue = reinterpret_cast<PPDValue*>(rBox.get_active_id().toInt64());
+ PPDValue* pValue = weld::fromId<PPDValue*>(rBox.get_active_id());
m_pParent->m_aJobData.m_aContext.setValue( pKey, pValue );
update();
}
@@ -360,7 +360,7 @@ RTSDevicePage::RTSDevicePage(weld::Widget* pPage, RTSDialog* pParent)
pKey->getGroup() != "InstallableOptions")
{
OUString aEntry( m_pParent->m_aJobData.m_pParser->translateKey( pKey->getKey() ) );
- m_xPPDKeyBox->append(OUString::number(reinterpret_cast<sal_Int64>(pKey)), aEntry);
+ m_xPPDKeyBox->append(weld::toId(pKey), aEntry);
}
}
}
@@ -425,13 +425,13 @@ IMPL_LINK( RTSDevicePage, SelectHdl, weld::TreeView&, rBox, void )
{
if (&rBox == m_xPPDKeyBox.get())
{
- const PPDKey* pKey = reinterpret_cast<PPDKey*>(m_xPPDKeyBox->get_selected_id().toInt64());
+ const PPDKey* pKey = weld::fromId<PPDKey*>(m_xPPDKeyBox->get_selected_id());
FillValueBox( pKey );
}
else if (&rBox == m_xPPDValueBox.get())
{
- const PPDKey* pKey = reinterpret_cast<PPDKey*>(m_xPPDKeyBox->get_selected_id().toInt64());
- const PPDValue* pValue = reinterpret_cast<PPDValue*>(m_xPPDValueBox->get_selected_id().toInt64());
+ const PPDKey* pKey = weld::fromId<PPDKey*>(m_xPPDKeyBox->get_selected_id());
+ const PPDValue* pValue = weld::fromId<PPDValue*>(m_xPPDValueBox->get_selected_id());
if (pKey && pValue)
{
m_pParent->m_aJobData.m_aContext.setValue( pKey, pValue );
@@ -466,11 +466,11 @@ void RTSDevicePage::FillValueBox( const PPDKey* pKey )
aEntry = VclResId(SV_PRINT_CUSTOM_TXT);
else
aEntry = m_pParent->m_aJobData.m_pParser->translateOption( pKey->getKey(), pValue->m_aOption);
- m_xPPDValueBox->append(OUString::number(reinterpret_cast<sal_Int64>(pValue)), aEntry);
+ m_xPPDValueBox->append(weld::toId(pValue), aEntry);
}
}
pValue = m_pParent->m_aJobData.m_aContext.getValue( pKey );
- m_xPPDValueBox->select_id(OUString::number(reinterpret_cast<sal_Int64>(pValue)));
+ m_xPPDValueBox->select_id(weld::toId(pValue));
ValueBoxChanged(pKey);
}
diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx
index 3d130d01887f..3ac503521e72 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -215,7 +215,7 @@ void CertificateChooser::ImplInitialize()
m_xCertLB->set_text(nRow, xmlsec::GetCertificateKind(xCert->getCertificateKind()), 2);
m_xCertLB->set_text(nRow, utl::GetDateString(xCert->getNotValidAfter()), 3);
m_xCertLB->set_text(nRow, UsageInClearText(xCert->getCertificateUsage()), 4);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(userData.get())));
+ OUString sId(weld::toId(userData.get()));
m_xCertLB->set_id(nRow, sId);
#if HAVE_FEATURE_GPGME
@@ -246,7 +246,7 @@ uno::Sequence<uno::Reference< css::security::XCertificate > > CertificateChooser
{
// for encryption, multiselection is enabled
m_xCertLB->selected_foreach([this, &aRet](weld::TreeIter& rEntry){
- UserData* userData = reinterpret_cast<UserData*>(m_xCertLB->get_id(rEntry).toInt64());
+ UserData* userData = weld::fromId<UserData*>(m_xCertLB->get_id(rEntry));
aRet.push_back( userData->xCertificate );
return false;
});
@@ -257,7 +257,7 @@ uno::Sequence<uno::Reference< css::security::XCertificate > > CertificateChooser
int nSel = m_xCertLB->get_selected_index();
if (nSel != -1)
{
- UserData* userData = reinterpret_cast<UserData*>(m_xCertLB->get_id(nSel).toInt64());
+ UserData* userData = weld::fromId<UserData*>(m_xCertLB->get_id(nSel));
xCert = userData->xCertificate;
}
aRet.push_back( xCert );
@@ -277,7 +277,7 @@ uno::Reference<xml::crypto::XXMLSecurityContext> CertificateChooser::GetSelected
if (nSel == -1)
return uno::Reference<xml::crypto::XXMLSecurityContext>();
- UserData* userData = reinterpret_cast<UserData*>(m_xCertLB->get_id(nSel).toInt64());
+ UserData* userData = weld::fromId<UserData*>(m_xCertLB->get_id(nSel));
uno::Reference<xml::crypto::XXMLSecurityContext> xCert = userData->xSecurityContext;
return xCert;
}
@@ -320,7 +320,7 @@ void CertificateChooser::ImplShowCertificateDetails()
if (nSel == -1)
return;
- UserData* userData = reinterpret_cast<UserData*>(m_xCertLB->get_id(nSel).toInt64());
+ UserData* userData = weld::fromId<UserData*>(m_xCertLB->get_id(nSel));
if (!userData->xSecurityEnvironment.is() || !userData->xCertificate.is())
return;
diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx
index 3e0480b9317b..1801cdf53192 100644
--- a/xmlsecurity/source/dialogs/certificateviewer.cxx
+++ b/xmlsecurity/source/dialogs/certificateviewer.cxx
@@ -151,7 +151,7 @@ void CertificateViewerDetailsTP::InsertElement(const OUString& rField, const OUS
const OUString& rDetails, bool bFixedWidthFont)
{
m_aUserData.emplace_back(std::make_unique<Details_UserDatat>(rDetails, bFixedWidthFont));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_aUserData.back().get())));
+ OUString sId(weld::toId(m_aUserData.back().get()));
m_xElementsLB->append(sId, rField);
m_xElementsLB->set_text(m_xElementsLB->n_children() -1, rValue, 1);
}
@@ -240,7 +240,7 @@ IMPL_LINK_NOARG(CertificateViewerDetailsTP, ElementSelectHdl, weld::TreeView&, v
bool bFixedWidthFont;
if (nEntry != -1)
{
- const Details_UserDatat* p = reinterpret_cast<Details_UserDatat*>(m_xElementsLB->get_id(nEntry).toInt64());
+ const Details_UserDatat* p = weld::fromId<Details_UserDatat*>(m_xElementsLB->get_id(nEntry));
aElementText = p->maTxt;
bFixedWidthFont = p->mbFixedWidthFont;
}
@@ -331,7 +331,7 @@ IMPL_LINK_NOARG(CertificateViewerCertPathTP, ViewCertHdl, weld::Button&, void)
if (mxCertificateViewer)
mxCertificateViewer->response(RET_OK);
- CertPath_UserData* pData = reinterpret_cast<CertPath_UserData*>(mxCertPathLB->get_id(*xIter).toInt64());
+ CertPath_UserData* pData = weld::fromId<CertPath_UserData*>(mxCertPathLB->get_id(*xIter));
mxCertificateViewer = std::make_shared<CertificateViewer>(mpDlg->getDialog(), mpDlg->mxSecurityEnvironment,
pData->mxCert, false, nullptr);
weld::DialogController::runAsync(mxCertificateViewer, [this] (sal_Int32) { mxCertificateViewer = nullptr; });
@@ -346,7 +346,7 @@ IMPL_LINK_NOARG(CertificateViewerCertPathTP, CertSelectHdl, weld::TreeView&, voi
bool bEntry = mxCertPathLB->get_selected(xIter.get());
if (bEntry)
{
- CertPath_UserData* pData = reinterpret_cast<CertPath_UserData*>(mxCertPathLB->get_id(*xIter).toInt64());
+ CertPath_UserData* pData = weld::fromId<CertPath_UserData*>(mxCertPathLB->get_id(*xIter));
if (pData)
sStatus = pData->mbValid ? mxCertOK->get_label() : mxCertNotValidated->get_label();
}
@@ -369,7 +369,7 @@ void CertificateViewerCertPathTP::InsertCert(const weld::TreeIter* pParent, cons
{
auto const sImage = bValid ? std::u16string_view(u"" BMP_CERT_OK) : std::u16string_view(u"" BMP_CERT_NOT_OK);
maUserData.emplace_back(std::make_unique<CertPath_UserData>(rxCert, bValid));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(maUserData.back().get())));
+ OUString sId(weld::toId(maUserData.back().get()));
mxCertPathLB->insert(pParent, -1, &rName, &sId, nullptr, nullptr, false, mxScratchIter.get());
mxCertPathLB->set_image(*mxScratchIter, OUString(sImage));
}