summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-09-14 08:19:47 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-09-15 06:07:36 +0200
commit05bc93db2de56000f65764d7e394d03747cac23d (patch)
tree975de9ae83572aac8a5c3ea8db281e1017ee5be0 /dbaccess
parent8cbb414ed737f9ffc76e1258e6671769bf63fc6c (diff)
Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 1
The header got some changes: 1. Move UnoTunnelIdInit and isUnoTunnelId into 'comphelper' namespace 2. Rename UnoTunnelIdInit to UnoIdInit, as a precondition to replace of uses of OImplementationId with it, including in XTypeProvider 3. Introduce convenience functions 'getSomething_cast' to cast between sal_Int64 and object pointers uniformly. 4. Rename getUnoTunnelImplementation to getFromUnoTunnel, both to make it a bit shorter, and to reflect its function better. Templatize it to take also css::uno::Any for convenience. 5. Introduce getSomethingImpl, inspired by sw::UnoTunnelImpl; allow it handle cases both with and without fallback to parent. 6. Adjust UNO3_GETIMPLEMENTATION_* macros TODO (in separate commits): - Drop sw::UnoTunnelImpl and sw::UnoTunnelGetImplementation - Replace all uses of OImplementationId in core with UnoIdInit - Deprecate OImplementationId in <cppuhelper/typeprovider.hxx> - Change implementations of getSomething to use getSomethingImpl - Revise uses of getSomething to use getFromUnoTunnel Change-Id: If4a3cb024130f1f552f988f0479589da1cd066e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122022 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/api/RowSet.cxx8
-rw-r--r--dbaccess/source/core/api/TableDeco.cxx2
-rw-r--r--dbaccess/source/core/api/querydescriptor.cxx2
-rw-r--r--dbaccess/source/core/api/table.cxx2
-rw-r--r--dbaccess/source/core/dataaccess/ContentHelper.cxx2
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx2
-rw-r--r--dbaccess/source/core/dataaccess/definitioncontainer.cxx4
-rw-r--r--dbaccess/source/core/dataaccess/documentcontainer.cxx2
-rw-r--r--dbaccess/source/ui/browser/brwview.cxx2
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx2
-rw-r--r--dbaccess/source/ui/control/FieldDescControl.cxx2
-rw-r--r--dbaccess/source/ui/misc/DExport.cxx2
-rw-r--r--dbaccess/source/ui/misc/TokenWriter.cxx2
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/JoinExchange.cxx4
-rw-r--r--dbaccess/source/ui/uno/ColumnControl.cxx2
16 files changed, 21 insertions, 21 deletions
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index f7deaa0c1d5e..798783587995 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -437,7 +437,7 @@ void SAL_CALL ORowSet::release() noexcept
// css::XUnoTunnel
sal_Int64 SAL_CALL ORowSet::getSomething( const Sequence< sal_Int8 >& rId )
{
- if (isUnoTunnelId<ORowSet>(rId))
+ if (comphelper::isUnoTunnelId<ORowSet>(rId))
return reinterpret_cast<sal_Int64>(this);
return 0;
@@ -2141,7 +2141,7 @@ void ORowSet::notifyRowSetAndClonesRowDelete( const Any& _rBookmark )
// notify the clones
for (auto const& elem : m_aClones)
{
- auto pClone = comphelper::getUnoTunnelImplementation<ORowSetClone>(elem.get());
+ auto pClone = comphelper::getFromUnoTunnel<ORowSetClone>(elem.get());
if(pClone)
pClone->onDeleteRow( _rBookmark );
}
@@ -2154,7 +2154,7 @@ void ORowSet::notifyRowSetAndClonesRowDeleted( const Any& _rBookmark, sal_Int32
// notify the clones
for (auto const& clone : m_aClones)
{
- auto pClone = comphelper::getUnoTunnelImplementation<ORowSetClone>(clone.get());
+ auto pClone = comphelper::getFromUnoTunnel<ORowSetClone>(clone.get());
if(pClone)
pClone->onDeletedRow( _rBookmark, _nPos );
}
@@ -2909,7 +2909,7 @@ Sequence< sal_Int8 > ORowSetClone::getUnoTunnelId()
// css::XUnoTunnel
sal_Int64 SAL_CALL ORowSetClone::getSomething( const Sequence< sal_Int8 >& rId )
{
- if (isUnoTunnelId<ORowSetClone>(rId))
+ if (comphelper::isUnoTunnelId<ORowSetClone>(rId))
return reinterpret_cast<sal_Int64>(this);
return 0;
diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx
index 6dff0b3b0964..e4b3a07e697d 100644
--- a/dbaccess/source/core/api/TableDeco.cxx
+++ b/dbaccess/source/core/api/TableDeco.cxx
@@ -451,7 +451,7 @@ OUString SAL_CALL ODBTableDecorator::getName()
sal_Int64 SAL_CALL ODBTableDecorator::getSomething( const Sequence< sal_Int8 >& rId )
{
- if (isUnoTunnelId<ODBTableDecorator>(rId))
+ if (comphelper::isUnoTunnelId<ODBTableDecorator>(rId))
return reinterpret_cast<sal_Int64>(this);
sal_Int64 nRet = 0;
diff --git a/dbaccess/source/core/api/querydescriptor.cxx b/dbaccess/source/core/api/querydescriptor.cxx
index 2ba824d0afbd..bd0c59c75fbf 100644
--- a/dbaccess/source/core/api/querydescriptor.cxx
+++ b/dbaccess/source/core/api/querydescriptor.cxx
@@ -140,7 +140,7 @@ OQueryDescriptor_Base::~OQueryDescriptor_Base()
sal_Int64 SAL_CALL OQueryDescriptor_Base::getSomething( const Sequence< sal_Int8 >& _rIdentifier )
{
- if (isUnoTunnelId<OQueryDescriptor_Base>(_rIdentifier))
+ if (comphelper::isUnoTunnelId<OQueryDescriptor_Base>(_rIdentifier))
return reinterpret_cast<sal_Int64>(this);
return 0;
diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx
index 054c1de241cb..94cb5646032d 100644
--- a/dbaccess/source/core/api/table.cxx
+++ b/dbaccess/source/core/api/table.cxx
@@ -297,7 +297,7 @@ void SAL_CALL ODBTable::alterColumnByName( const OUString& _rName, const Referen
sal_Int64 SAL_CALL ODBTable::getSomething( const Sequence< sal_Int8 >& rId )
{
sal_Int64 nRet(0);
- if (isUnoTunnelId<ODBTable>(rId))
+ if (comphelper::isUnoTunnelId<ODBTable>(rId))
nRet = reinterpret_cast<sal_Int64>(this);
else
nRet = OTable_Base::getSomething(rId);
diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx
index e08fc61b65bb..d18be06e882b 100644
--- a/dbaccess/source/core/dataaccess/ContentHelper.cxx
+++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx
@@ -545,7 +545,7 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent
// css::lang::XUnoTunnel
sal_Int64 OContentHelper::getSomething( const Sequence< sal_Int8 > & rId )
{
- if (isUnoTunnelId<OContentHelper>(rId))
+ if (comphelper::isUnoTunnelId<OContentHelper>(rId))
return reinterpret_cast<sal_Int64>(this);
return 0;
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index 8e17e0440abc..651dca08f674 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -709,7 +709,7 @@ void ODatabaseContext::databaseDocumentURLChange( const OUString& _rOldURL, cons
sal_Int64 SAL_CALL ODatabaseContext::getSomething( const Sequence< sal_Int8 >& rId )
{
- if (isUnoTunnelId<ODatabaseContext>(rId))
+ if (comphelper::isUnoTunnelId<ODatabaseContext>(rId))
return reinterpret_cast<sal_Int64>(this);
return 0;
diff --git a/dbaccess/source/core/dataaccess/definitioncontainer.cxx b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
index c9ca13c41ebb..5b3772983d7c 100644
--- a/dbaccess/source/core/dataaccess/definitioncontainer.cxx
+++ b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
@@ -526,7 +526,7 @@ void ODefinitionContainer::implAppend(const OUString& _rName, const Reference< X
// #i44786#
lcl_ensureName( _rxNewObject, _rName );
- ::rtl::Reference< OContentHelper > pContent = comphelper::getUnoTunnelImplementation<OContentHelper>( _rxNewObject );
+ ::rtl::Reference< OContentHelper > pContent = comphelper::getFromUnoTunnel<OContentHelper>( _rxNewObject );
if ( pContent.is() )
{
TContentPtr pImpl = pContent->getImpl();
@@ -585,7 +585,7 @@ void ODefinitionContainer::approveNewObject(const OUString& _sName,const Referen
DBA_RES( RID_STR_NAME_ALREADY_USED ),
*this );
- ::rtl::Reference< OContentHelper > pContent( comphelper::getUnoTunnelImplementation<OContentHelper>( _rxObject ) );
+ ::rtl::Reference< OContentHelper > pContent( comphelper::getFromUnoTunnel<OContentHelper>( _rxObject ) );
if ( !pContent.is() )
throw IllegalArgumentException(
DBA_RES( RID_STR_OBJECT_CONTAINER_MISMATCH ),
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx
index 4554a1fd4dcb..cfd552b36d7e 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx
@@ -636,7 +636,7 @@ OUString SAL_CALL ODocumentContainer::composeHierarchicalName( const OUString& i
::rtl::Reference<OContentHelper> pContent;
try
{
- pContent = comphelper::getUnoTunnelImplementation<OContentHelper>(const_cast<ODocumentContainer*>(this)->implGetByName( _sName, true ));
+ pContent = comphelper::getFromUnoTunnel<OContentHelper>(const_cast<ODocumentContainer*>(this)->implGetByName( _sName, true ));
}
catch(const Exception&)
{
diff --git a/dbaccess/source/ui/browser/brwview.cxx b/dbaccess/source/ui/browser/brwview.cxx
index 4aa7c4c5abb9..b68819d6740a 100644
--- a/dbaccess/source/ui/browser/brwview.cxx
+++ b/dbaccess/source/ui/browser/brwview.cxx
@@ -251,7 +251,7 @@ SbaGridControl* UnoDataBrowserView::getVclControl() const
Reference< css::awt::XWindowPeer > xPeer = m_xGrid->getPeer();
if ( xPeer.is() )
{
- SbaXGridPeer* pPeer = comphelper::getUnoTunnelImplementation<SbaXGridPeer>(xPeer);
+ SbaXGridPeer* pPeer = comphelper::getFromUnoTunnel<SbaXGridPeer>(xPeer);
UnoDataBrowserView* pTHIS = const_cast<UnoDataBrowserView*>(this);
if ( pPeer )
{
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index f9871eaee981..0006f45de56f 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -667,7 +667,7 @@ SvNumberFormatter* SbaGridControl::GetDatasourceFormatter()
{
Reference< css::util::XNumberFormatsSupplier > xSupplier = ::dbtools::getNumberFormats(::dbtools::getConnection(Reference< XRowSet > (getDataSource(),UNO_QUERY)), true, getContext());
- SvNumberFormatsSupplierObj* pSupplierImpl = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>( xSupplier );
+ SvNumberFormatsSupplierObj* pSupplierImpl = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>( xSupplier );
if ( !pSupplierImpl )
return nullptr;
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index d62d9ea3e482..336fa15bac9f 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -281,7 +281,7 @@ IMPL_LINK_NOARG(OFieldDescControl, FormatClickHdl, weld::Button&, void)
sal_Int32 nOldFormatKey(pActFieldDescr->GetFormatKey());
SvxCellHorJustify rOldJustify = pActFieldDescr->GetHorJustify();
Reference< XNumberFormatsSupplier > xSupplier = GetFormatter()->getNumberFormatsSupplier();
- SvNumberFormatsSupplierObj* pSupplierImpl = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>( xSupplier );
+ SvNumberFormatsSupplierObj* pSupplierImpl = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>( xSupplier );
if (!pSupplierImpl)
return;
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index 61a6481f1a11..adab71f29d8f 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -772,7 +772,7 @@ void ODatabaseExport::ensureFormatter()
if ( !m_pFormatter )
{
Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier();
- auto pSupplierImpl = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>(xSupplier);
+ auto pSupplierImpl = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(xSupplier);
m_pFormatter = pSupplierImpl ? pSupplierImpl->GetNumberFormatter() : nullptr;
Reference<XPropertySet> xNumberFormatSettings = xSupplier->getNumberFormatSettings();
xNumberFormatSettings->getPropertyValue("NullDate") >>= m_aNullDate;
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index bde1e9a138a5..c0401f591a6f 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -862,7 +862,7 @@ void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal
"=" +
pChar;
- SvNumberFormatsSupplierObj* pSupplierImpl = m_xFormatter.is() ? comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>(m_xFormatter->getNumberFormatsSupplier()) : nullptr;
+ SvNumberFormatsSupplierObj* pSupplierImpl = m_xFormatter.is() ? comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(m_xFormatter->getNumberFormatsSupplier()) : nullptr;
SvNumberFormatter* pFormatter = pSupplierImpl ? pSupplierImpl->GetNumberFormatter() : nullptr;
if(pFormatter)
{
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index 2f60f2c33421..4086e7b442f2 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -1036,7 +1036,7 @@ void setEvalDateFormatForFormatter(Reference< css::util::XNumberFormatter > cons
Reference< css::util::XNumberFormatsSupplier > xSupplier = _rxFormatter->getNumberFormatsSupplier();
- auto pSupplierImpl = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>(xSupplier);
+ auto pSupplierImpl = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(xSupplier);
OSL_ENSURE(pSupplierImpl,"No Supplier!");
if ( pSupplierImpl )
diff --git a/dbaccess/source/ui/querydesign/JoinExchange.cxx b/dbaccess/source/ui/querydesign/JoinExchange.cxx
index 2fda531e716c..d2c5c98b94e1 100644
--- a/dbaccess/source/ui/querydesign/JoinExchange.cxx
+++ b/dbaccess/source/ui/querydesign/JoinExchange.cxx
@@ -56,7 +56,7 @@ namespace dbaui
OJoinExchangeData OJoinExchObj::GetSourceDescription(const Reference< XTransferable >& _rxObject)
{
OJoinExchangeData aReturn;
- auto pImplementation = comphelper::getUnoTunnelImplementation<OJoinExchObj>(_rxObject);
+ auto pImplementation = comphelper::getFromUnoTunnel<OJoinExchObj>(_rxObject);
if (pImplementation)
aReturn = pImplementation->m_jxdSourceDescription;
return aReturn;
@@ -71,7 +71,7 @@ namespace dbaui
sal_Int64 SAL_CALL OJoinExchObj::getSomething( const Sequence< sal_Int8 >& _rIdentifier )
{
- if (isUnoTunnelId<OJoinExchObj>(_rIdentifier))
+ if (comphelper::isUnoTunnelId<OJoinExchObj>(_rIdentifier))
return reinterpret_cast<sal_Int64>(this);
return 0;
diff --git a/dbaccess/source/ui/uno/ColumnControl.cxx b/dbaccess/source/ui/uno/ColumnControl.cxx
index 19dddf59d8a4..51adc7d651fc 100644
--- a/dbaccess/source/ui/uno/ColumnControl.cxx
+++ b/dbaccess/source/ui/uno/ColumnControl.cxx
@@ -69,7 +69,7 @@ void SAL_CALL OColumnControl::createPeer(const Reference< XToolkit >& /*rToolkit
vcl::Window* pParentWin = nullptr;
if (rParentPeer.is())
{
- VCLXWindow* pParent = comphelper::getUnoTunnelImplementation<VCLXWindow>(rParentPeer);
+ VCLXWindow* pParent = comphelper::getFromUnoTunnel<VCLXWindow>(rParentPeer);
if (pParent)
pParentWin = pParent->GetWindow();
}