diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-02-04 09:13:52 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-02-04 15:02:03 +0100 |
commit | e00032ba6a2ddd4c08ae6f03b1982d3c099d288e (patch) | |
tree | 33f52e795971fd330922e21857b12c6097727ca8 /cui | |
parent | 8d3f658aa58ddee8c7bc32ddea070c1bb3bf19b8 (diff) |
add toId/fromId to tidy up some ugly casting
Change-Id: I70f34ac5e9b5d2f2d6c0375e823908eaa2e540b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129487
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/customize/CommandCategoryListBox.cxx | 43 | ||||
-rw-r--r-- | cui/source/customize/SvxMenuConfigPage.cxx | 19 | ||||
-rw-r--r-- | cui/source/customize/SvxToolbarConfigPage.cxx | 57 | ||||
-rw-r--r-- | cui/source/customize/acccfg.cxx | 30 | ||||
-rw-r--r-- | cui/source/customize/cfg.cxx | 38 | ||||
-rw-r--r-- | cui/source/customize/cfgutil.cxx | 43 | ||||
-rw-r--r-- | cui/source/dialogs/cuicharmap.cxx | 4 | ||||
-rw-r--r-- | cui/source/dialogs/hldocntp.cxx | 10 | ||||
-rw-r--r-- | cui/source/dialogs/hlmarkwn.cxx | 10 | ||||
-rw-r--r-- | cui/source/dialogs/linkdlg.cxx | 20 | ||||
-rw-r--r-- | cui/source/dialogs/scriptdlg.cxx | 18 | ||||
-rw-r--r-- | cui/source/options/dbregister.cxx | 12 | ||||
-rw-r--r-- | cui/source/options/optaboutconfig.cxx | 12 | ||||
-rw-r--r-- | cui/source/options/optgdlg.cxx | 6 | ||||
-rw-r--r-- | cui/source/options/optlingu.cxx | 34 | ||||
-rw-r--r-- | cui/source/options/optpath.cxx | 14 | ||||
-rw-r--r-- | cui/source/options/optsave.cxx | 2 | ||||
-rw-r--r-- | cui/source/options/treeopt.cxx | 34 | ||||
-rw-r--r-- | cui/source/tabpages/autocdlg.cxx | 36 | ||||
-rw-r--r-- | cui/source/tabpages/swpossizetabpage.cxx | 20 |
20 files changed, 216 insertions, 246 deletions
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); |