summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-09-13 11:29:37 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-09-15 06:08:14 +0200
commit3f65724ec5fc92d5a0078a99932358ef7091435c (patch)
tree94dd9bf1d0ecd42dbf7f94db45bc7e1bf29b83ce /sc/source
parent6444b026b4039458d01ada5fee58eae98166585b (diff)
Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 4
- Change implementations of getSomething to use getSomethingImpl Or where that's impossible, use getSomething_cast to unify this and reduce number of places where we reinterpret_cast. All static methods getting tunnel ids were renamed to getUnoTunnelId, to comply with the convention used in <comphelper/servicehelper.hxx>. TODO (in separate commits): - Revise uses of getSomething to use getFromUnoTunnel Change-Id: Ifde9e214b52e5df678de71fcc32d2199c82e85cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122100 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/app/drwtrans.cxx10
-rw-r--r--sc/source/ui/app/transobj.cxx10
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx6
-rw-r--r--sc/source/ui/unoobj/docuno.cxx4
-rw-r--r--sc/source/ui/unoobj/nameuno.cxx6
-rw-r--r--sc/source/ui/unoobj/textuno.cxx6
-rw-r--r--sc/source/ui/vba/vbaworkbook.cxx4
-rw-r--r--sc/source/ui/vba/vbaworksheet.cxx6
8 files changed, 12 insertions, 40 deletions
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx
index ed18de670554..180571472da5 100644
--- a/sc/source/ui/app/drwtrans.cxx
+++ b/sc/source/ui/app/drwtrans.cxx
@@ -743,14 +743,8 @@ const css::uno::Sequence< sal_Int8 >& ScDrawTransferObj::getUnoTunnelId()
sal_Int64 SAL_CALL ScDrawTransferObj::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
{
- sal_Int64 nRet;
- if( comphelper::isUnoTunnelId<ScDrawTransferObj>(rId) )
- {
- nRet = reinterpret_cast< sal_Int64 >( this );
- }
- else
- nRet = TransferDataContainer::getSomething(rId);
- return nRet;
+ return comphelper::getSomethingImpl(
+ rId, this, comphelper::FallbackToGetSomethingOf<TransferDataContainer>{});
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index a9bc88b03e83..9a3d12059945 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -928,14 +928,8 @@ const css::uno::Sequence< sal_Int8 >& ScTransferObj::getUnoTunnelId()
sal_Int64 SAL_CALL ScTransferObj::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
{
- sal_Int64 nRet;
- if( comphelper::isUnoTunnelId<ScTransferObj>(rId) )
- {
- nRet = reinterpret_cast< sal_Int64 >( this );
- }
- else
- nRet = TransferDataContainer::getSomething(rId);
- return nRet;
+ return comphelper::getSomethingImpl(
+ rId, this, comphelper::FallbackToGetSomethingOf<TransferDataContainer>{});
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 1ce82e6bc1d0..e5f058f8aaa8 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -980,11 +980,7 @@ Reference< XDataPilotField > SAL_CALL ScDataPilotDescriptorBase::getDataLayoutFi
sal_Int64 SAL_CALL ScDataPilotDescriptorBase::getSomething(
const Sequence<sal_Int8 >& rId )
{
- if ( comphelper::isUnoTunnelId<ScDataPilotDescriptorBase>(rId) )
- {
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
- }
- return 0;
+ return comphelper::getSomethingImpl(rId, this);
}
const Sequence<sal_Int8>& ScDataPilotDescriptorBase::getUnoTunnelId()
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 2f814cd37f3e..96b2e03e06a2 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -3094,12 +3094,12 @@ sal_Int64 SAL_CALL ScModelObj::getSomething(
{
if ( comphelper::isUnoTunnelId<ScModelObj>(rId) )
{
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
+ return comphelper::getSomething_cast(this);
}
if ( comphelper::isUnoTunnelId<SfxObjectShell>(rId) )
{
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(pDocShell ));
+ return comphelper::getSomething_cast(pDocShell);
}
// aggregated number formats supplier has XUnoTunnel, too
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index f1b439cb54cb..b327ef6bab0a 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -426,11 +426,7 @@ uno::Sequence<OUString> SAL_CALL ScNamedRangeObj::getSupportedServiceNames()
sal_Int64 SAL_CALL ScNamedRangeObj::getSomething(
const uno::Sequence<sal_Int8 >& rId )
{
- if ( comphelper::isUnoTunnelId<ScNamedRangeObj>(rId) )
- {
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
- }
- return 0;
+ return comphelper::getSomethingImpl(rId, this);
}
const uno::Sequence<sal_Int8>& ScNamedRangeObj::getUnoTunnelId()
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index bb1135ac3d87..683f85f8cdfc 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -135,11 +135,7 @@ uno::Reference<text::XText> SAL_CALL ScHeaderFooterContentObj::getRightText()
sal_Int64 SAL_CALL ScHeaderFooterContentObj::getSomething(
const uno::Sequence<sal_Int8 >& rId )
{
- if ( comphelper::isUnoTunnelId<ScHeaderFooterContentObj>(rId) )
- {
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
- }
- return 0;
+ return comphelper::getSomethingImpl(rId, this);
}
const uno::Sequence<sal_Int8>& ScHeaderFooterContentObj::getUnoTunnelId()
diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx
index 07e35344a371..cabe2fe375e8 100644
--- a/sc/source/ui/vba/vbaworkbook.cxx
+++ b/sc/source/ui/vba/vbaworkbook.cxx
@@ -408,9 +408,9 @@ ScVbaWorkbook::getCodeName()
sal_Int64
ScVbaWorkbook::getSomething(const uno::Sequence<sal_Int8 >& rId )
{
- if (comphelper::isUnoTunnelId<ScVbaWorksheet>(rId))
+ if (comphelper::isUnoTunnelId<ScVbaWorksheet>(rId)) // ???
{
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
+ return comphelper::getSomething_cast(this);
}
return 0;
}
diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx
index ef5c851ed938..1cdc1c111b97 100644
--- a/sc/source/ui/vba/vbaworksheet.cxx
+++ b/sc/source/ui/vba/vbaworksheet.cxx
@@ -1039,11 +1039,7 @@ ScVbaWorksheet::PrintOut( const uno::Any& From, const uno::Any& To, const uno::A
sal_Int64 SAL_CALL
ScVbaWorksheet::getSomething(const uno::Sequence<sal_Int8 > & rId)
{
- if (comphelper::isUnoTunnelId<ScVbaWorksheet>(rId))
- {
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
- }
- return 0;
+ return comphelper::getSomethingImpl(rId, this);
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*