From 1d398fb983d8f8b53a78e7c47b588fc1f1e7f748 Mon Sep 17 00:00:00 2001 From: Arkadiy Illarionov Date: Sun, 22 Sep 2019 18:20:39 +0300 Subject: tdf#39593 use getUnoTunnelImplementation Change-Id: I78eb67913a568c610e38e5002f914773c4906dfd Reviewed-on: https://gerrit.libreoffice.org/79350 Tested-by: Jenkins Reviewed-by: Arkadiy Illarionov --- dbaccess/source/core/api/RowSet.cxx | 20 ++++++-------------- dbaccess/source/ui/misc/DExport.cxx | 3 +-- dbaccess/source/ui/misc/UITools.cxx | 3 +-- dbaccess/source/ui/querydesign/JoinExchange.cxx | 10 +++------- 4 files changed, 11 insertions(+), 25 deletions(-) (limited to 'dbaccess/source') diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 99c6e56edc0c..2130d6b4acf4 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -2144,13 +2144,9 @@ void ORowSet::notifyRowSetAndClonesRowDelete( const Any& _rBookmark ) // notify the clones for (auto const& elem : m_aClones) { - Reference< XUnoTunnel > xTunnel(elem.get(),UNO_QUERY); - if(xTunnel.is()) - { - ORowSetClone* pClone = reinterpret_cast(xTunnel->getSomething(ORowSetClone::getUnoTunnelId())); - if(pClone) - pClone->onDeleteRow( _rBookmark ); - } + auto pClone = comphelper::getUnoTunnelImplementation(elem.get()); + if(pClone) + pClone->onDeleteRow( _rBookmark ); } } @@ -2161,13 +2157,9 @@ void ORowSet::notifyRowSetAndClonesRowDeleted( const Any& _rBookmark, sal_Int32 // notify the clones for (auto const& clone : m_aClones) { - Reference< XUnoTunnel > xTunnel(clone.get(),UNO_QUERY); - if(xTunnel.is()) - { - ORowSetClone* pClone = reinterpret_cast(xTunnel->getSomething(ORowSetClone::getUnoTunnelId())); - if(pClone) - pClone->onDeletedRow( _rBookmark, _nPos ); - } + auto pClone = comphelper::getUnoTunnelImplementation(clone.get()); + if(pClone) + pClone->onDeletedRow( _rBookmark, _nPos ); } } diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index 78117ef9f348..e64ab80b8293 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -786,8 +786,7 @@ void ODatabaseExport::ensureFormatter() if ( !m_pFormatter ) { Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier(); - Reference< XUnoTunnel > xTunnel(xSupplier,UNO_QUERY); - SvNumberFormatsSupplierObj* pSupplierImpl = reinterpret_cast(xTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId())); + auto pSupplierImpl = comphelper::getUnoTunnelImplementation(xSupplier); m_pFormatter = pSupplierImpl ? pSupplierImpl->GetNumberFormatter() : nullptr; Reference xNumberFormatSettings = xSupplier->getNumberFormatSettings(); xNumberFormatSettings->getPropertyValue("NullDate") >>= m_aNullDate; diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 31decd181fe3..417b42eb7aa1 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -1080,8 +1080,7 @@ void setEvalDateFormatForFormatter(Reference< css::util::XNumberFormatter > cons { Reference< css::util::XNumberFormatsSupplier > xSupplier = _rxFormatter->getNumberFormatsSupplier(); - Reference< XUnoTunnel > xTunnel(xSupplier,UNO_QUERY); - SvNumberFormatsSupplierObj* pSupplierImpl = reinterpret_cast(xTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId())); + auto pSupplierImpl = comphelper::getUnoTunnelImplementation(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 a22ec381f6ab..9681fdf03710 100644 --- a/dbaccess/source/ui/querydesign/JoinExchange.cxx +++ b/dbaccess/source/ui/querydesign/JoinExchange.cxx @@ -68,13 +68,9 @@ namespace dbaui OJoinExchangeData OJoinExchObj::GetSourceDescription(const Reference< XTransferable >& _rxObject) { OJoinExchangeData aReturn; - Reference< XUnoTunnel > xTunnel(_rxObject, UNO_QUERY); - if (xTunnel.is()) - { - OJoinExchObj* pImplementation = reinterpret_cast(xTunnel->getSomething(getUnoTunnelId())); - if (pImplementation) - aReturn = pImplementation->m_jxdSourceDescription; - } + auto pImplementation = comphelper::getUnoTunnelImplementation(_rxObject); + if (pImplementation) + aReturn = pImplementation->m_jxdSourceDescription; return aReturn; } -- cgit