summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-02-04 09:13:52 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-02-04 15:02:03 +0100
commite00032ba6a2ddd4c08ae6f03b1982d3c099d288e (patch)
tree33f52e795971fd330922e21857b12c6097727ca8 /fpicker
parent8d3f658aa58ddee8c7bc32ddea070c1bb3bf19b8 (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 'fpicker')
-rw-r--r--fpicker/source/office/fileview.cxx28
-rw-r--r--fpicker/source/office/iodlgimp.cxx2
2 files changed, 15 insertions, 15 deletions
diff --git a/fpicker/source/office/fileview.cxx b/fpicker/source/office/fileview.cxx
index 7086d17597a9..a0597203ee63 100644
--- a/fpicker/source/office/fileview.cxx
+++ b/fpicker/source/office/fileview.cxx
@@ -509,8 +509,8 @@ IMPL_LINK(ViewTabListBox_Impl, CommandHdl, const CommandEvent&, rCEvt, bool)
::ucbhelper::Content aCnt;
try
{
- OUString aURL(reinterpret_cast<SvtContentEntry*>(
- mxTreeView->get_id(rEntry).toInt64())->maURL);
+ OUString aURL(weld::fromId<SvtContentEntry*>(
+ mxTreeView->get_id(rEntry))->maURL);
aCnt = ::ucbhelper::Content( aURL, mxCmdEnv, comphelper::getProcessComponentContext() );
}
catch( Exception const & )
@@ -602,7 +602,7 @@ void ViewTabListBox_Impl::DeleteEntries()
mxTreeView->selected_foreach([this, &eResult](weld::TreeIter& rCurEntry){
OUString aURL;
if (!mxTreeView->get_id(rCurEntry).isEmpty())
- aURL = reinterpret_cast<SvtContentEntry*>(mxTreeView->get_id(rCurEntry).toInt64())->maURL;
+ aURL = weld::fromId<SvtContentEntry*>(mxTreeView->get_id(rCurEntry))->maURL;
if (aURL.isEmpty())
{
mxTreeView->unselect(rCurEntry);
@@ -677,7 +677,7 @@ IMPL_LINK(ViewTabListBox_Impl, EditedEntryHdl, const IterString&, rIterString, b
bool bRet = false;
OUString aURL;
- SvtContentEntry* pData = reinterpret_cast<SvtContentEntry*>(mxTreeView->get_id(rEntry).toInt64());
+ SvtContentEntry* pData = weld::fromId<SvtContentEntry*>(mxTreeView->get_id(rEntry));
if ( pData )
aURL = pData->maURL;
@@ -719,7 +719,7 @@ IMPL_LINK(ViewTabListBox_Impl, EditedEntryHdl, const IterString&, rIterString, b
if (pData)
pData->maURL = aURL;
- mxTreeView->set_id(rEntry, OUString::number(reinterpret_cast<sal_Int64>(pData)));
+ mxTreeView->set_id(rEntry, weld::toId(pData));
bRet = true;
}
@@ -831,9 +831,9 @@ OUString SvtFileView::GetURL(const weld::TreeIter& rEntry) const
{
SvtContentEntry* pEntry;
if (mpImpl->mxView->get_visible())
- pEntry = reinterpret_cast<SvtContentEntry*>(mpImpl->mxView->get_id(rEntry).toInt64());
+ pEntry = weld::fromId<SvtContentEntry*>(mpImpl->mxView->get_id(rEntry));
else
- pEntry = reinterpret_cast<SvtContentEntry*>(mpImpl->mxIconView->get_id(rEntry).toInt64());
+ pEntry = weld::fromId<SvtContentEntry*>(mpImpl->mxIconView->get_id(rEntry));
if (pEntry)
return pEntry->maURL;
return OUString();
@@ -847,13 +847,13 @@ OUString SvtFileView::GetCurrentURL() const
{
std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxView->make_iterator();
if (mpImpl->mxView->get_selected(xEntry.get()))
- pEntry = reinterpret_cast<SvtContentEntry*>(mpImpl->mxView->get_id(*xEntry).toInt64());
+ pEntry = weld::fromId<SvtContentEntry*>(mpImpl->mxView->get_id(*xEntry));
}
else
{
std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxIconView->make_iterator();
if (mpImpl->mxIconView->get_selected(xEntry.get()))
- pEntry = reinterpret_cast<SvtContentEntry*>(mpImpl->mxIconView->get_id(*xEntry).toInt64());
+ pEntry = weld::fromId<SvtContentEntry*>(mpImpl->mxIconView->get_id(*xEntry));
}
if (pEntry)
aURL = pEntry->maURL;
@@ -865,7 +865,7 @@ void SvtFileView::CreatedFolder( const OUString& rUrl, const OUString& rNewFolde
const SortingData_Impl& rEntry = mpImpl->FolderInserted( rUrl, rNewFolder );
mpImpl->maEntries.emplace_back(std::make_unique<SvtContentEntry>(rUrl, true));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(mpImpl->maEntries.back().get())));
+ OUString sId(weld::toId(mpImpl->maEntries.back().get()));
std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxView->make_iterator();
mpImpl->mxView->insert(rEntry.maDisplayName, sId, mpImpl->maFolderImage, *xEntry);
@@ -1006,14 +1006,14 @@ SvtContentEntry* SvtFileView::FirstSelected() const
SvtContentEntry* pRet = nullptr;
std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxView->make_iterator();
if (mpImpl->mxView->get_selected(xEntry.get()))
- pRet = reinterpret_cast<SvtContentEntry*>(mpImpl->mxView->get_id(*xEntry).toInt64());
+ pRet = weld::fromId<SvtContentEntry*>(mpImpl->mxView->get_id(*xEntry));
return pRet;
}
SvtContentEntry* pRet = nullptr;
std::unique_ptr<weld::TreeIter> xEntry = mpImpl->mxIconView->make_iterator();
if (mpImpl->mxIconView->get_selected(xEntry.get()))
- pRet = reinterpret_cast<SvtContentEntry*>(mpImpl->mxIconView->get_id(*xEntry).toInt64());
+ pRet = weld::fromId<SvtContentEntry*>(mpImpl->mxIconView->get_id(*xEntry));
return pRet;
}
@@ -1369,7 +1369,7 @@ void SvtFileView_Impl::OpenFolder_Impl()
// insert entry and set user data
maEntries.emplace_back(std::make_unique<SvtContentEntry>(elem->maTargetURL, elem->mbIsFolder));
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(maEntries.back().get())));
+ OUString sId(weld::toId(maEntries.back().get()));
mxView->append(sId, elem->maDisplayName, elem->maType, elem->maDisplaySize, elem->maDisplayDate, elem->maImage);
mxIconView->append(sId, elem->maDisplayName, elem->maImage);
}
@@ -1553,7 +1553,7 @@ void SvtFileView_Impl::Resort_Impl( sal_Int16 nColumn, bool bAscending )
OUString aEntryURL;
if (bEntry && !mxView->get_id(*xEntry).isEmpty())
- aEntryURL = reinterpret_cast<SvtContentEntry*>(mxView->get_id(*xEntry).toInt64())->maURL;
+ aEntryURL = weld::fromId<SvtContentEntry*>(mxView->get_id(*xEntry))->maURL;
mnSortColumn = nColumn;
mbAscending = bAscending;
diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx
index 1b651cbdd3fe..070664576a69 100644
--- a/fpicker/source/office/iodlgimp.cxx
+++ b/fpicker/source/office/iodlgimp.cxx
@@ -161,7 +161,7 @@ void SvtExpFileDlg_Impl::SetCurFilter( SvtFileDialogFilter_Impl const * pFilter,
void SvtExpFileDlg_Impl::InsertFilterListEntry(const SvtFileDialogFilter_Impl* pFilterDesc)
{
// insert and set user data
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pFilterDesc)));
+ OUString sId(weld::toId(pFilterDesc));
OUString sName = pFilterDesc->GetName();
if (pFilterDesc->isGroupSeparator())
m_xLbFilter->append_separator(sId);