summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx12
-rw-r--r--chart2/source/controller/drawinglayer/DrawViewWrapper.cxx5
-rw-r--r--chart2/source/view/diagram/VDiagram.cxx5
-rw-r--r--chart2/source/view/main/ChartView.cxx17
-rw-r--r--connectivity/source/drivers/dbase/DDatabaseMetaData.cxx13
-rw-r--r--connectivity/source/drivers/dbase/DIndexes.cxx12
-rw-r--r--connectivity/source/drivers/dbase/DResultSet.cxx27
-rw-r--r--connectivity/source/drivers/dbase/DTables.cxx35
-rw-r--r--connectivity/source/drivers/file/FDatabaseMetaData.cxx37
-rw-r--r--connectivity/source/drivers/hsqldb/HDriver.cxx11
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YDriver.cxx45
-rw-r--r--dbaccess/source/core/api/RowSet.cxx20
-rw-r--r--dbaccess/source/ui/misc/DExport.cxx3
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx3
-rw-r--r--dbaccess/source/ui/querydesign/JoinExchange.cxx10
-rw-r--r--reportdesign/source/core/api/ReportDefinition.cxx9
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx3
-rw-r--r--sc/source/ui/unoobj/textuno.cxx6
-rw-r--r--sd/source/core/sdpage.cxx10
-rw-r--r--sd/source/ui/framework/factories/PresentationFactory.cxx16
-rw-r--r--sd/source/ui/framework/module/CenterViewFocusModule.cxx18
-rw-r--r--sd/source/ui/framework/module/ShellStackGuard.cxx12
-rw-r--r--sd/source/ui/framework/module/ToolBarModule.cxx12
-rw-r--r--sd/source/ui/sidebar/PanelFactory.cxx12
-rw-r--r--sfx2/source/control/thumbnailviewacc.cxx9
-rw-r--r--starmath/source/mathmlexport.cxx21
-rw-r--r--starmath/source/mathmlimport.cxx17
-rw-r--r--starmath/source/view.cxx13
-rw-r--r--svl/source/items/style.cxx6
-rw-r--r--svtools/source/control/valueacc.cxx12
-rw-r--r--sw/source/core/layout/atrfrm.cxx9
-rw-r--r--sw/source/core/layout/dumpfilter.cxx3
-rw-r--r--sw/source/core/unocore/unochart.cxx39
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx10
-rw-r--r--sw/source/core/unocore/unodraw.cxx34
-rw-r--r--sw/source/core/unocore/unoframe.cxx5
-rw-r--r--sw/source/core/unocore/unoobj.cxx8
-rw-r--r--sw/source/core/unocore/unoobj2.cxx4
-rw-r--r--sw/source/core/unocore/unorefmk.cxx3
-rw-r--r--sw/source/core/unocore/unostyle.cxx12
-rw-r--r--sw/source/core/unocore/unotext.cxx23
-rw-r--r--sw/source/filter/html/htmlform.cxx12
-rw-r--r--sw/source/filter/xml/xmlimp.cxx10
-rw-r--r--sw/source/ui/dbui/mmlayoutpage.cxx3
-rw-r--r--sw/source/ui/index/cntex.cxx3
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx13
-rw-r--r--sw/source/uibase/misc/glosdoc.cxx23
-rw-r--r--sw/source/uibase/shells/basesh.cxx3
-rw-r--r--sw/source/uibase/uiview/uivwimp.cxx24
-rw-r--r--sw/source/uibase/uno/SwXFilterOptions.cxx10
-rw-r--r--sw/source/uibase/uno/unomailmerge.cxx9
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx6
-rw-r--r--sw/source/uibase/utlui/uiitems.cxx4
-rw-r--r--sw/source/uibase/utlui/unotools.cxx18
-rw-r--r--vcl/source/gdi/graph.cxx6
55 files changed, 221 insertions, 504 deletions
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index 046f8bd87ea4..406df92db13a 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -47,6 +47,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
+#include <comphelper/servicehelper.hxx>
#include <vcl/settings.hxx>
#include <com/sun/star/drawing/ShapeCollection.hpp>
@@ -1026,15 +1027,10 @@ namespace {
uno::Reference< lang::XMultiServiceFactory > getShapeFactory(const uno::Reference<uno::XInterface>& xChartView)
{
- Reference< lang::XUnoTunnel> xUnoTunnel(xChartView,uno::UNO_QUERY);
- if(xUnoTunnel.is())
- {
- ExplicitValueProvider* pProvider = reinterpret_cast<ExplicitValueProvider*>(xUnoTunnel->getSomething(
- ExplicitValueProvider::getUnoTunnelId() ));
- if( pProvider )
- return pProvider->getDrawModelWrapper()->getShapeFactory();
+ auto pProvider = comphelper::getUnoTunnelImplementation<ExplicitValueProvider>(xChartView);
+ if( pProvider )
+ return pProvider->getDrawModelWrapper()->getShapeFactory();
- }
return uno::Reference< lang::XMultiServiceFactory >();
}
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
index f09f4035c70a..2141c4f76bce 100644
--- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
+++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
@@ -371,11 +371,10 @@ SdrObject* DrawViewWrapper::getSdrObject( const uno::Reference<
drawing::XShape >& xShape )
{
SdrObject* pRet = nullptr;
- uno::Reference< lang::XUnoTunnel > xUnoTunnel( xShape, uno::UNO_QUERY );
uno::Reference< lang::XTypeProvider > xTypeProvider( xShape, uno::UNO_QUERY );
- if(xUnoTunnel.is()&&xTypeProvider.is())
+ if(xTypeProvider.is())
{
- SvxShape* pSvxShape = reinterpret_cast<SvxShape*>(xUnoTunnel->getSomething( SvxShape::getUnoTunnelId() ));
+ SvxShape* pSvxShape = comphelper::getUnoTunnelImplementation<SvxShape>(xShape);
if(pSvxShape)
pRet = pSvxShape->GetSdrObject();
}
diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx
index ffce05afa0ad..fec07e83f0a3 100644
--- a/chart2/source/view/diagram/VDiagram.cxx
+++ b/chart2/source/view/diagram/VDiagram.cxx
@@ -204,11 +204,10 @@ void VDiagram::createShapes_2d()
static E3dScene* lcl_getE3dScene( const uno::Reference< drawing::XShape >& xShape )
{
E3dScene* pRet=nullptr;
- uno::Reference< lang::XUnoTunnel > xUnoTunnel( xShape, uno::UNO_QUERY );
uno::Reference< lang::XTypeProvider > xTypeProvider( xShape, uno::UNO_QUERY );
- if(xUnoTunnel.is()&&xTypeProvider.is())
+ if(xTypeProvider.is())
{
- SvxShape* pSvxShape = reinterpret_cast<SvxShape*>(xUnoTunnel->getSomething( SvxShape::getUnoTunnelId() ));
+ SvxShape* pSvxShape = comphelper::getUnoTunnelImplementation<SvxShape>(xShape);
if(pSvxShape)
{
SdrObject* pObj = pSvxShape->GetSdrObject();
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index ab3b10d7c8cf..200b4b4e9823 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1747,18 +1747,11 @@ bool ChartView::getExplicitValuesForAxis(
SdrPage* ChartView::getSdrPage()
{
- SdrPage* pPage=nullptr;
- Reference< lang::XUnoTunnel> xUnoTunnel(m_xDrawPage,uno::UNO_QUERY);
- if(xUnoTunnel.is())
- {
- SvxDrawPage* pSvxDrawPage = reinterpret_cast<SvxDrawPage*>(xUnoTunnel->getSomething(
- SvxDrawPage::getUnoTunnelId() ));
- if(pSvxDrawPage)
- {
- pPage = pSvxDrawPage->GetSdrPage();
- }
- }
- return pPage;
+ auto pSvxDrawPage = comphelper::getUnoTunnelImplementation<SvxDrawPage>(m_xDrawPage);
+ if(pSvxDrawPage)
+ return pSvxDrawPage->GetSdrPage();
+
+ return nullptr;
}
uno::Reference< drawing::XShape > ChartView::getShapeForCID( const OUString& rObjectCID )
diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
index 1db65083b06a..cc5f12b6e7ac 100644
--- a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
@@ -31,6 +31,7 @@
#include <dbase/DIndex.hxx>
#include <connectivity/FValue.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
#include <ucbhelper/content.hxx>
@@ -296,15 +297,11 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo(
aRow[4] = new ORowSetValueDecorator(getBOOL(xIndex->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE))));
aRow[6] = new ORowSetValueDecorator(*pBegin);
- Reference< XUnoTunnel> xTunnel(xIndex,UNO_QUERY);
- if(xTunnel.is())
+ auto pIndex = comphelper::getUnoTunnelImplementation<ODbaseIndex>(xIndex);
+ if(pIndex)
{
- ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelId()) );
- if(pIndex)
- {
- aRow[11] = new ORowSetValueDecorator(static_cast<sal_Int32>(pIndex->getHeader().db_maxkeys));
- aRow[12] = new ORowSetValueDecorator(static_cast<sal_Int32>(pIndex->getHeader().db_pagecount));
- }
+ aRow[11] = new ORowSetValueDecorator(static_cast<sal_Int32>(pIndex->getHeader().db_maxkeys));
+ aRow[12] = new ORowSetValueDecorator(static_cast<sal_Int32>(pIndex->getHeader().db_pagecount));
}
Reference<XColumnsSupplier> xColumnsSup(xIndex,UNO_QUERY);
diff --git a/connectivity/source/drivers/dbase/DIndexes.cxx b/connectivity/source/drivers/dbase/DIndexes.cxx
index 3758330b9f3c..1ebce2612098 100644
--- a/connectivity/source/drivers/dbase/DIndexes.cxx
+++ b/connectivity/source/drivers/dbase/DIndexes.cxx
@@ -19,6 +19,7 @@
#include <dbase/DIndexes.hxx>
#include <dbase/DIndex.hxx>
+#include <comphelper/servicehelper.hxx>
#include <connectivity/dbexception.hxx>
#include <unotools/ucbhelper.hxx>
#include <strings.hrc>
@@ -106,14 +107,9 @@ sdbcx::ObjectType ODbaseIndexes::appendObject( const OUString& _rForName, const
// XDrop
void ODbaseIndexes::dropObject(sal_Int32 _nPos, const OUString& /*_sElementName*/)
{
- Reference< XUnoTunnel> xTunnel(getObject(_nPos),UNO_QUERY);
- if ( xTunnel.is() )
- {
- ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelId()) );
- if ( pIndex )
- pIndex->DropImpl();
- }
-
+ auto pIndex = comphelper::getUnoTunnelImplementation<ODbaseIndex>(getObject(_nPos));
+ if ( pIndex )
+ pIndex->DropImpl();
}
diff --git a/connectivity/source/drivers/dbase/DResultSet.cxx b/connectivity/source/drivers/dbase/DResultSet.cxx
index 260e009611fc..22826ec2fd0f 100644
--- a/connectivity/source/drivers/dbase/DResultSet.cxx
+++ b/connectivity/source/drivers/dbase/DResultSet.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <comphelper/sequence.hxx>
+#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <dbase/DIndex.hxx>
#include <dbase/DIndexIter.hxx>
@@ -155,25 +156,21 @@ Sequence< sal_Int32 > SAL_CALL ODbaseResultSet::deleteRows( const Sequence< An
bool ODbaseResultSet::fillIndexValues(const Reference< XColumnsSupplier> &_xIndex)
{
- Reference<XUnoTunnel> xTunnel(_xIndex,UNO_QUERY);
- if(xTunnel.is())
+ auto pIndex = comphelper::getUnoTunnelImplementation<dbase::ODbaseIndex>(_xIndex);
+ if(pIndex)
{
- dbase::ODbaseIndex* pIndex = reinterpret_cast< dbase::ODbaseIndex* >( xTunnel->getSomething(dbase::ODbaseIndex::getUnoTunnelId()) );
- if(pIndex)
- {
- std::unique_ptr<dbase::OIndexIterator> pIter = pIndex->createIterator();
+ std::unique_ptr<dbase::OIndexIterator> pIter = pIndex->createIterator();
- if (pIter)
+ if (pIter)
+ {
+ sal_uInt32 nRec = pIter->First();
+ while (nRec != NODE_NOTFOUND)
{
- sal_uInt32 nRec = pIter->First();
- while (nRec != NODE_NOTFOUND)
- {
- m_pFileSet->get().push_back(nRec);
- nRec = pIter->Next();
- }
- m_pFileSet->setFrozen();
- return true;
+ m_pFileSet->get().push_back(nRec);
+ nRec = pIter->Next();
}
+ m_pFileSet->setFrozen();
+ return true;
}
}
return false;
diff --git a/connectivity/source/drivers/dbase/DTables.cxx b/connectivity/source/drivers/dbase/DTables.cxx
index d72061b4538f..0054f3fcecc1 100644
--- a/connectivity/source/drivers/dbase/DTables.cxx
+++ b/connectivity/source/drivers/dbase/DTables.cxx
@@ -31,6 +31,7 @@
#include <file/FConnection.hxx>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <dbase/DCatalog.hxx>
+#include <comphelper/servicehelper.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <strings.hrc>
#include <connectivity/dbexception.hxx>
@@ -69,27 +70,23 @@ Reference< XPropertySet > ODbaseTables::createDescriptor()
// XAppend
sdbcx::ObjectType ODbaseTables::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
{
- Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY);
- if(xTunnel.is())
+ auto pTable = comphelper::getUnoTunnelImplementation<ODbaseTable>(descriptor);
+ if(pTable)
{
- ODbaseTable* pTable = reinterpret_cast< ODbaseTable* >( xTunnel->getSomething(ODbaseTable::getUnoTunnelId()) );
- if(pTable)
+ pTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(_rForName));
+ try
+ {
+ if(!pTable->CreateImpl())
+ throw SQLException();
+ }
+ catch(SQLException&)
+ {
+ throw;
+ }
+ catch(Exception& ex)
{
- pTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(_rForName));
- try
- {
- if(!pTable->CreateImpl())
- throw SQLException();
- }
- catch(SQLException&)
- {
- throw;
- }
- catch(Exception& ex)
- {
- css::uno::Any anyEx = cppu::getCaughtException();
- throw SQLException( ex.Message, nullptr, "", 0, anyEx );
- }
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw SQLException( ex.Message, nullptr, "", 0, anyEx );
}
}
return createObject( _rForName );
diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
index c5fdadbbf5d0..44404f98267a 100644
--- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
@@ -32,6 +32,7 @@
#include <file/FDriver.hxx>
#include <file/FTable.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/servicehelper.hxx>
#include <tools/diagnose_ex.h>
#include <ucbhelper/content.hxx>
@@ -401,30 +402,26 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
xNames->getByName(*pBegin), css::uno::UNO_QUERY);
if(xTable.is())
{
- Reference<XUnoTunnel> xTunnel(xTable,UNO_QUERY);
- if(xTunnel.is())
+ auto pTable = comphelper::getUnoTunnelImplementation<OFileTable>(xTable);
+ if(pTable && !pTable->isReadOnly())
{
- OFileTable* pTable = reinterpret_cast< OFileTable* >( xTunnel->getSomething(OFileTable::getUnoTunnelId()) );
- if(pTable && !pTable->isReadOnly())
+ aRow[6] = ODatabaseMetaDataResultSet::getInsertValue();
+ aRows.push_back(aRow);
+ if(!m_pConnection->showDeleted())
{
- aRow[6] = ODatabaseMetaDataResultSet::getInsertValue();
- aRows.push_back(aRow);
- if(!m_pConnection->showDeleted())
- {
- aRow[6] = ODatabaseMetaDataResultSet::getDeleteValue();
- aRows.push_back(aRow);
- }
- aRow[6] = ODatabaseMetaDataResultSet::getUpdateValue();
- aRows.push_back(aRow);
- aRow[6] = ODatabaseMetaDataResultSet::getCreateValue();
- aRows.push_back(aRow);
- aRow[6] = ODatabaseMetaDataResultSet::getReadValue();
- aRows.push_back(aRow);
- aRow[6] = ODatabaseMetaDataResultSet::getAlterValue();
- aRows.push_back(aRow);
- aRow[6] = ODatabaseMetaDataResultSet::getDropValue();
+ aRow[6] = ODatabaseMetaDataResultSet::getDeleteValue();
aRows.push_back(aRow);
}
+ aRow[6] = ODatabaseMetaDataResultSet::getUpdateValue();
+ aRows.push_back(aRow);
+ aRow[6] = ODatabaseMetaDataResultSet::getCreateValue();
+ aRows.push_back(aRow);
+ aRow[6] = ODatabaseMetaDataResultSet::getReadValue();
+ aRows.push_back(aRow);
+ aRow[6] = ODatabaseMetaDataResultSet::getAlterValue();
+ aRows.push_back(aRow);
+ aRow[6] = ODatabaseMetaDataResultSet::getDropValue();
+ aRows.push_back(aRow);
}
}
}
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx
index 5ab48b138a1e..1a03f16707d3 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -47,6 +47,7 @@
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/propertysequence.hxx>
+#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/types.hxx>
#include <unotools/confignode.hxx>
@@ -342,13 +343,9 @@ namespace connectivity
if ( xOrig.is() )
{
// now we have to set the URL to get the correct answer for metadata()->getURL()
- Reference< XUnoTunnel> xTunnel(xOrig,UNO_QUERY);
- if ( xTunnel.is() )
- {
- OMetaConnection* pMetaConnection = reinterpret_cast<OMetaConnection*>(xTunnel->getSomething( OMetaConnection::getUnoTunnelId() ));
- if ( pMetaConnection )
- pMetaConnection->setURL(url);
- }
+ auto pMetaConnection = comphelper::getUnoTunnelImplementation<OMetaConnection>(xOrig);
+ if ( pMetaConnection )
+ pMetaConnection->setURL(url);
Reference<XComponent> xComp(xOrig,UNO_QUERY);
if ( xComp.is() )
diff --git a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
index 06631edda7f1..727a8f2b350b 100644
--- a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
@@ -21,6 +21,7 @@
#include <mysql/YCatalog.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <connectivity/dbexception.hxx>
@@ -265,16 +266,11 @@ Reference<XConnection> SAL_CALL ODriverDelegator::connect(const OUString& url,
xConnection = xDriver->connect(sCuttedUrl, aConvertedProperties);
if (xConnection.is())
{
- OMetaConnection* pMetaConnection = nullptr;
// now we have to set the URL to get the correct answer for metadata()->getURL()
- Reference<XUnoTunnel> xTunnel(xConnection, UNO_QUERY);
- if (xTunnel.is())
- {
- pMetaConnection = reinterpret_cast<OMetaConnection*>(
- xTunnel->getSomething(OMetaConnection::getUnoTunnelId()));
- if (pMetaConnection)
- pMetaConnection->setURL(url);
- }
+ auto pMetaConnection
+ = comphelper::getUnoTunnelImplementation<OMetaConnection>(xConnection);
+ if (pMetaConnection)
+ pMetaConnection->setURL(url);
m_aConnections.push_back(
TWeakPair(WeakReferenceHelper(xConnection),
TWeakConnectionPair(WeakReferenceHelper(), pMetaConnection)));
@@ -340,29 +336,24 @@ ODriverDelegator::getDataDefinitionByConnection(const Reference<XConnection>& co
checkDisposed(ODriverDelegator_BASE::rBHelper.bDisposed);
Reference<XTablesSupplier> xTab;
- Reference<XUnoTunnel> xTunnel(connection, UNO_QUERY);
- if (xTunnel.is())
+ auto pConnection = comphelper::getUnoTunnelImplementation<OMetaConnection>(connection);
+ if (pConnection)
{
- OMetaConnection* pConnection = reinterpret_cast<OMetaConnection*>(
- xTunnel->getSomething(OMetaConnection::getUnoTunnelId()));
- if (pConnection)
+ TWeakPairVector::iterator i
+ = std::find_if(m_aConnections.begin(), m_aConnections.end(),
+ [&pConnection](const TWeakPairVector::value_type& rConnection) {
+ return rConnection.second.second == pConnection;
+ });
+ if (i != m_aConnections.end())
{
- TWeakPairVector::iterator i
- = std::find_if(m_aConnections.begin(), m_aConnections.end(),
- [&pConnection](const TWeakPairVector::value_type& rConnection) {
- return rConnection.second.second == pConnection;
- });
- if (i != m_aConnections.end())
+ xTab.set(i->second.first.get(), UNO_QUERY);
+ if (!xTab.is())
{
- xTab.set(i->second.first.get(), UNO_QUERY);
- if (!xTab.is())
- {
- xTab = new OMySQLCatalog(connection);
- i->second.first = WeakReferenceHelper(xTab);
- }
+ xTab = new OMySQLCatalog(connection);
+ i->second.first = WeakReferenceHelper(xTab);
}
}
- } // if ( xTunnel.is() )
+ } // if (pConnection)
if (!xTab.is())
{
TWeakPairVector::iterator i
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<ORowSetClone*>(xTunnel->getSomething(ORowSetClone::getUnoTunnelId()));
- if(pClone)
- pClone->onDeleteRow( _rBookmark );
- }
+ auto pClone = comphelper::getUnoTunnelImplementation<ORowSetClone>(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<ORowSetClone*>(xTunnel->getSomething(ORowSetClone::getUnoTunnelId()));
- if(pClone)
- pClone->onDeletedRow( _rBookmark, _nPos );
- }
+ auto pClone = comphelper::getUnoTunnelImplementation<ORowSetClone>(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<SvNumberFormatsSupplierObj*>(xTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId()));
+ auto pSupplierImpl = comphelper::getUnoTunnelImplementation<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/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<SvNumberFormatsSupplierObj*>(xTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId()));
+ auto pSupplierImpl = comphelper::getUnoTunnelImplementation<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 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<OJoinExchObj*>(xTunnel->getSomething(getUnoTunnelId()));
- if (pImplementation)
- aReturn = pImplementation->m_jxdSourceDescription;
- }
+ auto pImplementation = comphelper::getUnoTunnelImplementation<OJoinExchObj>(_rxObject);
+ if (pImplementation)
+ aReturn = pImplementation->m_jxdSourceDescription;
return aReturn;
}
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index e3ef88ae80dc..166e58eea05f 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -1979,12 +1979,9 @@ uno::Reference< uno::XComponentContext > OReportDefinition::getContext()
std::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel(const uno::Reference< report::XReportDefinition >& _xReportDefinition)
{
std::shared_ptr<rptui::OReportModel> pReportModel;
- uno::Reference< lang::XUnoTunnel > xUT( _xReportDefinition, uno::UNO_QUERY );
- if( xUT.is() )
- pReportModel = reinterpret_cast<OReportDefinition*>(
- sal::static_int_cast<sal_uIntPtr>(
- xUT->getSomething( OReportDefinition::getUnoTunnelId()))
- )->m_pImpl->m_pReportModel;
+ auto pReportDefinition = comphelper::getUnoTunnelImplementation<OReportDefinition>(_xReportDefinition);
+ if (pReportDefinition)
+ pReportModel = pReportDefinition->m_pImpl->m_pReportModel;
return pReportModel;
}
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index fa2a8fc9c961..f0e2be876858 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -5244,8 +5244,7 @@ ErrCode ScXMLExport::exportDoc( enum XMLTokenEnum eClass )
uno::Reference< frame::XModel > xModel = GetModel();
if ( xModel.is() )
{
- uno::Reference< lang::XUnoTunnel > xObjShellTunnel( xModel, uno::UNO_QUERY );
- SfxObjectShell* pFoundShell = reinterpret_cast<SfxObjectShell*>( xObjShellTunnel.is() ? xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId()) : 0 );
+ auto pFoundShell = comphelper::getUnoTunnelImplementation<SfxObjectShell>(xModel);
if ( pFoundShell && ooo::vba::isAlienExcelDoc( *pFoundShell ) )
{
xRowStylesPropertySetMapper = new XMLPropertySetMapper(aXMLScFromXLSRowStylesProperties, xScPropHdlFactory, true);
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 59f1b724442f..914a398d82f2 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -157,11 +157,7 @@ const uno::Sequence<sal_Int8>& ScHeaderFooterContentObj::getUnoTunnelId()
rtl::Reference<ScHeaderFooterContentObj> ScHeaderFooterContentObj::getImplementation(
const uno::Reference<sheet::XHeaderFooterContent>& rObj)
{
- rtl::Reference<ScHeaderFooterContentObj> pRet;
- uno::Reference<lang::XUnoTunnel> xUT(rObj, uno::UNO_QUERY);
- if (xUT.is())
- pRet = reinterpret_cast<ScHeaderFooterContentObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
- return pRet;
+ return comphelper::getUnoTunnelImplementation<ScHeaderFooterContentObj>(rObj);
}
void ScHeaderFooterContentObj::Init( const EditTextObject* pLeft,
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 0ffc10889adc..667fb7ed57d7 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -2675,13 +2675,9 @@ SdPage* SdPage::getImplementation( const css::uno::Reference< css::drawing::XDra
{
try
{
- css::uno::Reference< css::lang::XUnoTunnel > xUnoTunnel( xPage, css::uno::UNO_QUERY );
- if( xUnoTunnel.is() )
- {
- SvxDrawPage* pUnoPage = reinterpret_cast<SvxDrawPage*>(sal::static_int_cast<sal_uIntPtr>(xUnoTunnel->getSomething( SvxDrawPage::getUnoTunnelId()) ) );
- if( pUnoPage )
- return static_cast< SdPage* >( pUnoPage->GetSdrPage() );
- }
+ auto pUnoPage = comphelper::getUnoTunnelImplementation<SvxDrawPage>(xPage);
+ if( pUnoPage )
+ return static_cast< SdPage* >( pUnoPage->GetSdrPage() );
}
catch( css::uno::Exception& )
{
diff --git a/sd/source/ui/framework/factories/PresentationFactory.cxx b/sd/source/ui/framework/factories/PresentationFactory.cxx
index 42df2c979b6a..7647a35e47f9 100644
--- a/sd/source/ui/framework/factories/PresentationFactory.cxx
+++ b/sd/source/ui/framework/factories/PresentationFactory.cxx
@@ -22,6 +22,7 @@
#include <DrawController.hxx>
#include <com/sun/star/drawing/framework/XControllerManager.hpp>
#include <com/sun/star/drawing/framework/XView.hpp>
+#include <comphelper/servicehelper.hxx>
#include <cppuhelper/compbase.hxx>
#include <tools/diagnose_ex.h>
#include <slideshow.hxx>
@@ -121,17 +122,12 @@ void SAL_CALL PresentationFactory::releaseResource (
{
ThrowIfDisposed();
- Reference<lang::XUnoTunnel> xTunnel (mxController, UNO_QUERY);
- if (xTunnel.is())
+ auto pController = comphelper::getUnoTunnelImplementation<sd::DrawController>(mxController);
+ if (pController != nullptr)
{
- ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
- xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
- if (pController != nullptr)
- {
- ViewShellBase* pBase = pController->GetViewShellBase();
- if (pBase != nullptr)
- SlideShow::Stop( *pBase );
- }
+ ViewShellBase* pBase = pController->GetViewShellBase();
+ if (pBase != nullptr)
+ SlideShow::Stop( *pBase );
}
}
diff --git a/sd/source/ui/framework/module/CenterViewFocusModule.cxx b/sd/source/ui/framework/module/CenterViewFocusModule.cxx
index d462489339a7..3db156d62ff8 100644
--- a/sd/source/ui/framework/module/CenterViewFocusModule.cxx
+++ b/sd/source/ui/framework/module/CenterViewFocusModule.cxx
@@ -27,6 +27,7 @@
#include <ViewShellManager.hxx>
#include <com/sun/star/drawing/framework/XControllerManager.hpp>
#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <comphelper/servicehelper.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -51,14 +52,9 @@ CenterViewFocusModule::CenterViewFocusModule (Reference<frame::XController> cons
mxConfigurationController = xControllerManager->getConfigurationController();
// Tunnel through the controller to obtain a ViewShellBase.
- Reference<lang::XUnoTunnel> xTunnel (rxController, UNO_QUERY);
- if (xTunnel.is())
- {
- ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
- xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
- if (pController != nullptr)
- mpBase = pController->GetViewShellBase();
- }
+ auto pController = comphelper::getUnoTunnelImplementation<sd::DrawController>(rxController);
+ if (pController != nullptr)
+ mpBase = pController->GetViewShellBase();
// Check, if all required objects do exist.
if (mxConfigurationController.is() && mpBase!=nullptr)
@@ -128,11 +124,9 @@ void CenterViewFocusModule::HandleNewView (
Reference<XView> xView;
if (xViewIds.hasElements())
xView.set( mxConfigurationController->getResource(xViewIds[0]),UNO_QUERY);
- Reference<lang::XUnoTunnel> xTunnel (xView, UNO_QUERY);
- if (xTunnel.is() && mpBase!=nullptr)
+ if (mpBase!=nullptr)
{
- ViewShellWrapper* pViewShellWrapper = reinterpret_cast<ViewShellWrapper*>(
- xTunnel->getSomething(ViewShellWrapper::getUnoTunnelId()));
+ auto pViewShellWrapper = comphelper::getUnoTunnelImplementation<ViewShellWrapper>(xView);
if (pViewShellWrapper != nullptr)
{
std::shared_ptr<ViewShell> pViewShell = pViewShellWrapper->GetViewShell();
diff --git a/sd/source/ui/framework/module/ShellStackGuard.cxx b/sd/source/ui/framework/module/ShellStackGuard.cxx
index 877a66f1a5de..0340b850f263 100644
--- a/sd/source/ui/framework/module/ShellStackGuard.cxx
+++ b/sd/source/ui/framework/module/ShellStackGuard.cxx
@@ -27,6 +27,7 @@
#include <sfx2/printer.hxx>
#include <com/sun/star/drawing/framework/XControllerManager.hpp>
#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <comphelper/servicehelper.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -51,14 +52,9 @@ ShellStackGuard::ShellStackGuard (Reference<frame::XController> const & rxContro
mxConfigurationController = xControllerManager->getConfigurationController();
// Tunnel through the controller to obtain a ViewShellBase.
- Reference<lang::XUnoTunnel> xTunnel (rxController, UNO_QUERY);
- if (xTunnel.is())
- {
- ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
- xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
- if (pController != nullptr)
- mpBase = pController->GetViewShellBase();
- }
+ auto pController = comphelper::getUnoTunnelImplementation<sd::DrawController>(rxController);
+ if (pController != nullptr)
+ mpBase = pController->GetViewShellBase();
}
if (mxConfigurationController.is())
diff --git a/sd/source/ui/framework/module/ToolBarModule.cxx b/sd/source/ui/framework/module/ToolBarModule.cxx
index d4f3932a2f9c..a14bac5206a5 100644
--- a/sd/source/ui/framework/module/ToolBarModule.cxx
+++ b/sd/source/ui/framework/module/ToolBarModule.cxx
@@ -20,6 +20,7 @@
#include "ToolBarModule.hxx"
#include <ViewShellBase.hxx>
#include <DrawController.hxx>
+#include <comphelper/servicehelper.hxx>
#include <framework/FrameworkHelper.hxx>
using namespace ::com::sun::star;
@@ -48,14 +49,9 @@ ToolBarModule::ToolBarModule (
mbMainViewSwitchUpdatePending(false)
{
// Tunnel through the controller to obtain a ViewShellBase.
- Reference<lang::XUnoTunnel> xTunnel (rxController, UNO_QUERY);
- if (xTunnel.is())
- {
- ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
- xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
- if (pController != nullptr)
- mpBase = pController->GetViewShellBase();
- }
+ auto pController = comphelper::getUnoTunnelImplementation<sd::DrawController>(rxController);
+ if (pController != nullptr)
+ mpBase = pController->GetViewShellBase();
Reference<XControllerManager> xControllerManager (rxController, UNO_QUERY);
if (!xControllerManager.is())
diff --git a/sd/source/ui/sidebar/PanelFactory.cxx b/sd/source/ui/sidebar/PanelFactory.cxx
index 226e820d15e5..e3489acb97b4 100644
--- a/sd/source/ui/sidebar/PanelFactory.cxx
+++ b/sd/source/ui/sidebar/PanelFactory.cxx
@@ -33,6 +33,7 @@
#include <sfx2/sidebar/SidebarPanelBase.hxx>
#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/servicehelper.hxx>
#include <vcl/window.hxx>
#include <toolkit/helper/vclunohelper.hxx>
@@ -82,14 +83,9 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
// Tunnel through the controller to obtain a ViewShellBase.
ViewShellBase* pBase = nullptr;
- Reference<lang::XUnoTunnel> xTunnel (xFrame->getController(), UNO_QUERY);
- if (xTunnel.is())
- {
- ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
- xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
- if (pController != nullptr)
- pBase = pController->GetViewShellBase();
- }
+ auto pController = comphelper::getUnoTunnelImplementation<sd::DrawController>(xFrame->getController());
+ if (pController != nullptr)
+ pBase = pController->GetViewShellBase();
if (pBase == nullptr)
throw RuntimeException("can not get ViewShellBase for frame");
diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx
index afb49746f496..bc1b3b711592 100644
--- a/sfx2/source/control/thumbnailviewacc.cxx
+++ b/sfx2/source/control/thumbnailviewacc.cxx
@@ -86,8 +86,7 @@ ThumbnailViewAcc* ThumbnailViewAcc::getImplementation( const uno::Reference< uno
{
try
{
- uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY );
- return( xUnoTunnel.is() ? reinterpret_cast<ThumbnailViewAcc*>(sal::static_int_cast<sal_IntPtr>(xUnoTunnel->getSomething( ThumbnailViewAcc::getUnoTunnelId() ))) : nullptr );
+ return comphelper::getUnoTunnelImplementation<ThumbnailViewAcc>(rxData);
}
catch(const css::uno::Exception&)
{
@@ -1041,11 +1040,7 @@ ThumbnailViewItemAcc* ThumbnailViewItemAcc::getImplementation( const uno::Refere
{
try
{
- uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY );
- return( xUnoTunnel.is() ?
- reinterpret_cast<ThumbnailViewItemAcc*>(sal::static_int_cast<sal_IntPtr>(
- xUnoTunnel->getSomething( ThumbnailViewItemAcc::getUnoTunnelId() ))) :
- nullptr );
+ return comphelper::getUnoTunnelImplementation<ThumbnailViewItemAcc>(rxData);
}
catch(const css::uno::Exception&)
{
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 3c0d3ff891c4..bfeab01c6284 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -98,9 +98,7 @@ bool SmXMLExportWrapper::Export(SfxMedium &rMedium)
uno::Reference< lang::XComponent > xModelComp = xModel;
bool bEmbedded = false;
- uno::Reference <lang::XUnoTunnel> xTunnel(xModel,uno::UNO_QUERY);
- SmModel *pModel = reinterpret_cast<SmModel *>
- (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+ SmModel *pModel = comphelper::getUnoTunnelImplementation<SmModel>(xModel);
SmDocShell *pDocShell = pModel ?
static_cast<SmDocShell*>(pModel->GetObjectShell()) : nullptr;
@@ -285,10 +283,7 @@ bool SmXMLExportWrapper::WriteThroughComponent(
uno::Sequence< PropertyValue > aProps(0);
xFilter->filter( aProps );
- uno::Reference<lang::XUnoTunnel> xFilterTunnel( xFilter, uno::UNO_QUERY );
- SmXMLExport *pFilter = reinterpret_cast< SmXMLExport * >(
- sal::static_int_cast< sal_uIntPtr >(
- xFilterTunnel->getSomething( SmXMLExport::getUnoTunnelId() )));
+ auto pFilter = comphelper::getUnoTunnelImplementation<SmXMLExport>(xFilter);
return pFilter == nullptr || pFilter->GetSuccess();
}
@@ -413,9 +408,7 @@ ErrCode SmXMLExport::exportDoc(enum XMLTokenEnum eClass)
else
{
uno::Reference <frame::XModel> xModel = GetModel();
- uno::Reference <lang::XUnoTunnel> xTunnel(xModel,uno::UNO_QUERY);
- SmModel *pModel = reinterpret_cast<SmModel *>
- (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+ SmModel *pModel = comphelper::getUnoTunnelImplementation<SmModel>(xModel);
if (pModel)
{
@@ -451,9 +444,7 @@ ErrCode SmXMLExport::exportDoc(enum XMLTokenEnum eClass)
void SmXMLExport::ExportContent_()
{
uno::Reference <frame::XModel> xModel = GetModel();
- uno::Reference <lang::XUnoTunnel> xTunnel(xModel,uno::UNO_QUERY);
- SmModel *pModel = reinterpret_cast<SmModel *>
- (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+ SmModel *pModel = comphelper::getUnoTunnelImplementation<SmModel>(xModel);
SmDocShell *pDocShell = pModel ?
static_cast<SmDocShell*>(pModel->GetObjectShell()) : nullptr;
OSL_ENSURE( pDocShell, "doc shell missing" );
@@ -504,9 +495,7 @@ void SmXMLExport::GetViewSettings( Sequence < PropertyValue >& aProps)
if ( !xModel.is() )
return;
- uno::Reference <lang::XUnoTunnel> xTunnel(xModel,uno::UNO_QUERY);
- SmModel *pModel = reinterpret_cast<SmModel *>
- (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+ SmModel *pModel = comphelper::getUnoTunnelImplementation<SmModel>(xModel);
if ( !pModel )
return;
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index 946c8e240a7c..808a235b96b8 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -107,9 +107,7 @@ ErrCode SmXMLImportWrapper::Import(SfxMedium &rMedium)
uno::Reference<task::XStatusIndicator> xStatusIndicator;
bool bEmbedded = false;
- uno::Reference <lang::XUnoTunnel> xTunnel(xModel,uno::UNO_QUERY);
- SmModel *pModel = reinterpret_cast<SmModel *>
- (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+ SmModel *pModel = comphelper::getUnoTunnelImplementation<SmModel>(xModel);
SmDocShell *pDocShell = pModel ?
static_cast<SmDocShell*>(pModel->GetObjectShell()) : nullptr;
@@ -298,10 +296,7 @@ ErrCode SmXMLImportWrapper::ReadThroughComponent(
else
xParser->parseStream( aParserInput );
- uno::Reference<lang::XUnoTunnel> xFilterTunnel( xFilter, uno::UNO_QUERY );
- SmXMLImport *pFilter = reinterpret_cast< SmXMLImport * >(
- sal::static_int_cast< sal_uIntPtr >(
- xFilterTunnel->getSomething( SmXMLImport::getUnoTunnelId() )));
+ auto pFilter = comphelper::getUnoTunnelImplementation<SmXMLImport>(xFilter);
if ( pFilter && pFilter->GetSuccess() )
nError = ERRCODE_NONE;
}
@@ -471,9 +466,7 @@ void SmXMLImport::endDocument()
if (pTree && pTree->GetType() == SmNodeType::Table)
{
uno::Reference <frame::XModel> xModel = GetModel();
- uno::Reference <lang::XUnoTunnel> xTunnel(xModel,uno::UNO_QUERY);
- SmModel *pModel = reinterpret_cast<SmModel *>
- (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+ SmModel *pModel = comphelper::getUnoTunnelImplementation<SmModel>(xModel);
if (pModel)
{
@@ -3063,9 +3056,7 @@ void SmXMLImport::SetViewSettings(const Sequence<PropertyValue>& aViewProps)
if ( !xModel.is() )
return;
- uno::Reference <lang::XUnoTunnel> xTunnel(xModel,uno::UNO_QUERY);
- SmModel *pModel = reinterpret_cast<SmModel *>
- (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+ SmModel *pModel = comphelper::getUnoTunnelImplementation<SmModel>(xModel);
if ( !pModel )
return;
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 3a513cd87aad..68a4368d1e04 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/container/XChild.hpp>
#include <comphelper/processfactory.hxx>
+#include <comphelper/servicehelper.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/string.hxx>
#include <i18nutil/unicode.hxx>
@@ -1446,15 +1447,9 @@ void SmViewShell::Execute(SfxRequest& rReq)
Reference< datatransfer::XTransferable > xTrans( GetDoc()->GetModel(), uno::UNO_QUERY );
if( xTrans.is() )
{
- Reference< lang::XUnoTunnel> xTnnl( xTrans, uno::UNO_QUERY);
- if( xTnnl.is() )
- {
- TransferableHelper* pTrans = reinterpret_cast< TransferableHelper * >(
- sal::static_int_cast< sal_uIntPtr >(
- xTnnl->getSomething( TransferableHelper::getUnoTunnelId() )));
- if( pTrans )
- pTrans->CopyToClipboard(GetEditWindow());
- }
+ auto pTrans = comphelper::getUnoTunnelImplementation<TransferableHelper>(xTrans);
+ if( pTrans )
+ pTrans->CopyToClipboard(GetEditWindow());
}
}
break;
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 5651b8bb780c..6a8b25576fb6 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -914,11 +914,7 @@ SfxUnoStyleSheet* SfxUnoStyleSheet::getUnoStyleSheet( const css::uno::Reference<
{
SfxUnoStyleSheet* pRet = dynamic_cast< SfxUnoStyleSheet* >( xStyle.get() );
if( !pRet )
- {
- css::uno::Reference< css::lang::XUnoTunnel > xUT( xStyle, css::uno::UNO_QUERY );
- if( xUT.is() )
- pRet = reinterpret_cast<SfxUnoStyleSheet*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( SfxUnoStyleSheet::getUnoTunnelId())));
- }
+ pRet = comphelper::getUnoTunnelImplementation<SfxUnoStyleSheet>(xStyle);
return pRet;
}
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index 08838f343d1a..869dc818061c 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -144,8 +144,7 @@ ValueSetAcc* ValueSetAcc::getImplementation( const uno::Reference< uno::XInterfa
{
try
{
- uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY );
- return( xUnoTunnel.is() ? reinterpret_cast<ValueSetAcc*>(sal::static_int_cast<sal_IntPtr>(xUnoTunnel->getSomething( ValueSetAcc::getUnoTunnelId() ))) : nullptr );
+ return comphelper::getUnoTunnelImplementation<ValueSetAcc>(rxData);
}
catch(const css::uno::Exception&)
{
@@ -747,8 +746,7 @@ ValueItemAcc* ValueItemAcc::getImplementation( const uno::Reference< uno::XInter
{
try
{
- uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY );
- return( xUnoTunnel.is() ? reinterpret_cast<ValueItemAcc*>(sal::static_int_cast<sal_IntPtr>(xUnoTunnel->getSomething( ValueItemAcc::getUnoTunnelId() ))) : nullptr );
+ return comphelper::getUnoTunnelImplementation<ValueItemAcc>(rxData);
}
catch(const css::uno::Exception&)
{
@@ -1096,8 +1094,7 @@ SvtValueItemAcc* SvtValueItemAcc::getImplementation( const uno::Reference< uno::
{
try
{
- uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY );
- return( xUnoTunnel.is() ? reinterpret_cast<SvtValueItemAcc*>(sal::static_int_cast<sal_IntPtr>(xUnoTunnel->getSomething( SvtValueItemAcc::getUnoTunnelId() ))) : nullptr );
+ return comphelper::getUnoTunnelImplementation<SvtValueItemAcc>(rxData);
}
catch(const css::uno::Exception&)
{
@@ -1486,8 +1483,7 @@ SvtValueSetAcc* SvtValueSetAcc::getImplementation( const uno::Reference< uno::XI
{
try
{
- uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY );
- return( xUnoTunnel.is() ? reinterpret_cast<SvtValueSetAcc*>(sal::static_int_cast<sal_IntPtr>(xUnoTunnel->getSomething( SvtValueSetAcc::getUnoTunnelId() ))) : nullptr );
+ return comphelper::getUnoTunnelImplementation<SvtValueSetAcc>(rxData);
}
catch(const css::uno::Exception&)
{
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 41a4e79655ec..b03a2a03b8f7 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -1102,14 +1102,7 @@ bool SwFormatCol::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
m_nWidth = nWidthSum;
m_bOrtho = false;
- uno::Reference<lang::XUnoTunnel> xNumTunnel(xCols, uno::UNO_QUERY);
- SwXTextColumns* pSwColums = nullptr;
- if(xNumTunnel.is())
- {
- pSwColums = reinterpret_cast< SwXTextColumns * >(
- sal::static_int_cast< sal_IntPtr >(
- xNumTunnel->getSomething( SwXTextColumns::getUnoTunnelId() )));
- }
+ auto pSwColums = comphelper::getUnoTunnelImplementation<SwXTextColumns>(xCols);
if(pSwColums)
{
m_bOrtho = pSwColums->IsAutomaticWidth();
diff --git a/sw/source/core/layout/dumpfilter.cxx b/sw/source/core/layout/dumpfilter.cxx
index 4078784fef11..7e26bceb4397 100644
--- a/sw/source/core/layout/dumpfilter.cxx
+++ b/sw/source/core/layout/dumpfilter.cxx
@@ -87,8 +87,7 @@ namespace sw
uno::Reference< io::XOutputStream >() );
// Actually get the SwRootFrame to call dumpAsXml
- uno::Reference< lang::XUnoTunnel > xDocTunnel( m_xSrcDoc, uno::UNO_QUERY );
- SwXTextDocument* pXDoc = UnoTunnelGetImplementation< SwXTextDocument >( xDocTunnel );
+ auto pXDoc = comphelper::getUnoTunnelImplementation<SwXTextDocument>(m_xSrcDoc);
if ( pXDoc )
{
SwRootFrame* pLayout = pXDoc->GetDocShell()->GetWrtShell()->GetLayout();
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 895cf5b7e5c3..11efa6a692ec 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -1602,37 +1602,30 @@ void SwChartDataProvider::AddRowCols(
const sal_Int32 nLen = xRef->getTextualData().getLength();
if (nLen > 1) // value data-sequence ?
{
- uno::Reference< lang::XUnoTunnel > xTunnel( xRef, uno::UNO_QUERY );
- if(xTunnel.is())
+ auto pDataSeq = comphelper::getUnoTunnelImplementation<SwChartDataSequence>(xRef);
+ if (pDataSeq)
{
- SwChartDataSequence *pDataSeq = reinterpret_cast< SwChartDataSequence * >(
- sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( SwChartDataSequence::getUnoTunnelId() )));
+ SwRangeDescriptor aDesc;
+ pDataSeq->FillRangeDesc( aDesc );
- if (pDataSeq)
+ chart::ChartDataRowSource eDRSource = chart::ChartDataRowSource_COLUMNS;
+ if (aDesc.nTop == aDesc.nBottom && aDesc.nLeft != aDesc.nRight)
+ eDRSource = chart::ChartDataRowSource_ROWS;
+
+ if (!bAddCols && eDRSource == chart::ChartDataRowSource_COLUMNS)
+ {
+ // add rows: extend affected columns by newly added row cells
+ pDataSeq->ExtendTo( true, nFirstNewRow, nLines );
+ }
+ else if (bAddCols && eDRSource == chart::ChartDataRowSource_ROWS)
{
- SwRangeDescriptor aDesc;
- pDataSeq->FillRangeDesc( aDesc );
-
- chart::ChartDataRowSource eDRSource = chart::ChartDataRowSource_COLUMNS;
- if (aDesc.nTop == aDesc.nBottom && aDesc.nLeft != aDesc.nRight)
- eDRSource = chart::ChartDataRowSource_ROWS;
-
- if (!bAddCols && eDRSource == chart::ChartDataRowSource_COLUMNS)
- {
- // add rows: extend affected columns by newly added row cells
- pDataSeq->ExtendTo( true, nFirstNewRow, nLines );
- }
- else if (bAddCols && eDRSource == chart::ChartDataRowSource_ROWS)
- {
- // add cols: extend affected rows by newly added column cells
- pDataSeq->ExtendTo( false, nFirstNewCol, nLines );
- }
+ // add cols: extend affected rows by newly added column cells
+ pDataSeq->ExtendTo( false, nFirstNewCol, nLines );
}
}
}
}
}
-
}
}
}
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 5ac8ff1a5a45..0b0555b94c11 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -772,15 +772,7 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
uno::Reference<XIndexReplace> xIndexReplace;
if(rValue >>= xIndexReplace)
{
- SwXNumberingRules* pSwNum = nullptr;
-
- uno::Reference<XUnoTunnel> xNumTunnel(xIndexReplace, UNO_QUERY);
- if(xNumTunnel.is())
- {
- pSwNum = reinterpret_cast< SwXNumberingRules * >(
- sal::static_int_cast< sal_IntPtr >( xNumTunnel->getSomething( SwXNumberingRules::getUnoTunnelId() )));
- }
-
+ auto pSwNum = comphelper::getUnoTunnelImplementation<SwXNumberingRules>(xIndexReplace);
if(pSwNum)
{
SwDoc* pDoc = rPam.GetDoc();
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index be29668a6b40..35d35b635ee0 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -898,11 +898,7 @@ SwXShape::SwXShape(
xShapeAgg->setDelegator( static_cast<cppu::OWeakObject*>(this) );
osl_atomic_decrement(&m_refCount);
- uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShapeAgg, uno::UNO_QUERY);
- SvxShape* pShape = nullptr;
- if(xShapeTunnel.is())
- pShape = reinterpret_cast< SvxShape * >(
- sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
+ SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>(xShapeAgg);
SdrObject* pObj = pShape ? pShape->GetSdrObject() : nullptr;
if(pObj)
@@ -927,11 +923,7 @@ void SwXShape::AddExistingShapeToFormat( SdrObject const & _rObj )
if ( !pCurrent )
continue;
- SwXShape* pSwShape = nullptr;
- uno::Reference< lang::XUnoTunnel > xShapeTunnel( pCurrent->getWeakUnoShape(), uno::UNO_QUERY );
- if ( xShapeTunnel.is() )
- pSwShape = reinterpret_cast< SwXShape * >(
- sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething( SwXShape::getUnoTunnelId() ) ) );
+ auto pSwShape = comphelper::getUnoTunnelImplementation<SwXShape>(pCurrent->getWeakUnoShape());
if ( pSwShape )
{
if ( pSwShape->m_bDescriptor )
@@ -1051,11 +1043,7 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
uno::Reference<text::XTextFrame> xFrame;
if(aValue >>= xFrame)
{
- uno::Reference<lang::XUnoTunnel> xTunnel(xFrame, uno::UNO_QUERY);
- SwXFrame* pFrame = xTunnel.is() ?
- reinterpret_cast< SwXFrame * >(
- sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SwXFrame::getUnoTunnelId()) ))
- : nullptr;
+ SwXFrame* pFrame = comphelper::getUnoTunnelImplementation<SwXFrame>(xFrame);
if(pFrame && pFrame->GetFrameFormat() &&
pFrame->GetFrameFormat()->GetDoc() == pDoc)
{
@@ -2165,15 +2153,9 @@ uno::Sequence< OUString > SwXShape::getSupportedServiceNames()
SvxShape* SwXShape::GetSvxShape()
{
- SvxShape* pSvxShape = nullptr;
if(xShapeAgg.is())
- {
- uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShapeAgg, uno::UNO_QUERY);
- if(xShapeTunnel.is())
- pSvxShape = reinterpret_cast< SvxShape * >(
- sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
- }
- return pSvxShape;
+ return comphelper::getUnoTunnelImplementation<SvxShape>(xShapeAgg);
+ return nullptr;
}
// #i31698#
@@ -2288,11 +2270,7 @@ void SAL_CALL SwXShape::setPosition( const awt::Point& aPosition )
// #i34750#
// use method <SvxShape->getPosition()> to get the correct
// 'Drawing layer' position of the top group shape.
- uno::Reference< lang::XUnoTunnel > xGrpShapeTunnel(
- pTopGroupObj->getUnoShape(),
- uno::UNO_QUERY );
- SvxShape* pSvxGroupShape = reinterpret_cast< SvxShape * >(
- sal::static_int_cast< sal_IntPtr >( xGrpShapeTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
+ auto pSvxGroupShape = comphelper::getUnoTunnelImplementation<SvxShape>(pTopGroupObj->getUnoShape());
const awt::Point aGroupPos = pSvxGroupShape->getPosition();
aNewPos.X = o3tl::saturating_add(aNewPos.X, aGroupPos.X);
aNewPos.Y = o3tl::saturating_add(aNewPos.Y, aGroupPos.Y);
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 77eeb295e189..81906e1c4c60 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1729,10 +1729,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
uno::Reference<text::XTextFrame> xFrame;
if(aValue >>= xFrame)
{
- uno::Reference<lang::XUnoTunnel> xTunnel(xFrame, uno::UNO_QUERY);
- SwXFrame* pFrame = xTunnel.is() ?
- reinterpret_cast< SwXFrame * >( sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething(SwXFrame::getUnoTunnelId()) ))
- : nullptr;
+ SwXFrame* pFrame = comphelper::getUnoTunnelImplementation<SwXFrame>(xFrame);
if(pFrame && this != pFrame && pFrame->GetFrameFormat() && pFrame->GetFrameFormat()->GetDoc() == pDoc)
{
SfxItemSet aSet( pDoc->GetAttrPool(),
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 2c5766ecebf9..dc47a6d5dac2 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -2921,13 +2921,7 @@ SwXTextCursor::createEnumeration()
SwUnoCursor & rUnoCursor( m_pImpl->GetCursorOrThrow() );
- const uno::Reference<lang::XUnoTunnel> xTunnel(
- m_pImpl->m_xParentText, uno::UNO_QUERY);
- SwXText* pParentText = nullptr;
- if (xTunnel.is())
- {
- pParentText = ::sw::UnoTunnelGetImplementation<SwXText>(xTunnel);
- }
+ SwXText* pParentText = comphelper::getUnoTunnelImplementation<SwXText>(m_pImpl->m_xParentText);
OSL_ENSURE(pParentText, "parent is not a SwXText");
if (!pParentText)
{
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 2230e40d014c..004de650992d 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1035,10 +1035,8 @@ bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill,
{
xTextCursor.set( pText->CreateCursor() );
xTextCursor->gotoEnd(true);
- const uno::Reference<lang::XUnoTunnel> xCursorTunnel(
- xTextCursor, uno::UNO_QUERY);
pCursor =
- ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xCursorTunnel);
+ comphelper::getUnoTunnelImplementation<OTextCursorHelper>(xTextCursor);
}
if(pRange && &pRange->GetDoc() == rToFill.GetDoc())
{
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 24cb9c5213bc..d69f7ab1ad10 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -710,9 +710,8 @@ SwXMeta::CreateXMeta(::sw::Meta & rMeta,
{
if (pPortions) // set cache in the XMeta to the given portions
{
- const uno::Reference<lang::XUnoTunnel> xUT(xMeta, uno::UNO_QUERY);
SwXMeta *const pXMeta(
- ::sw::UnoTunnelGetImplementation<SwXMeta>(xUT));
+ comphelper::getUnoTunnelImplementation<SwXMeta>(xMeta));
assert(pXMeta);
// NB: the meta must always be created with the complete content
// if SwXTextPortionEnumeration is created for a selection,
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 34060acf60e1..02c07eac0b1e 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1025,13 +1025,9 @@ void XStyleFamily::replaceByName(const OUString& rName, const uno::Any& rElement
uno::Reference<style::XStyle> xStyle = FindStyle(pBase->GetName());
if(xStyle.is())
{
- uno::Reference<lang::XUnoTunnel> xTunnel( xStyle, uno::UNO_QUERY);
- if(xTunnel.is())
- {
- SwXStyle* pStyle = reinterpret_cast< SwXStyle * >(
- sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( SwXStyle::getUnoTunnelId()) ));
+ SwXStyle* pStyle = comphelper::getUnoTunnelImplementation<SwXStyle>(xStyle);
+ if(pStyle)
pStyle->Invalidate();
- }
}
m_pBasePool->Remove(pBase);
insertByName(rName, rElement);
@@ -1195,9 +1191,7 @@ const uno::Sequence<sal_Int8>& SwXStyle::getUnoTunnelId()
sal_Int64 SAL_CALL SwXStyle::getSomething(const uno::Sequence<sal_Int8>& rId)
{
- if(rId.getLength() != 16)
- return 0;
- if(0 == memcmp(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16))
+ if(isUnoTunnelId<SwXStyle>(rId))
{
return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
}
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 65ca22480557..e012e630198f 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -634,10 +634,8 @@ SwXText::insertTextContentBefore(
throw aRuntime;
}
- const uno::Reference<lang::XUnoTunnel> xParaTunnel(xNewContent,
- uno::UNO_QUERY);
SwXParagraph *const pPara =
- ::sw::UnoTunnelGetImplementation<SwXParagraph>(xParaTunnel);
+ comphelper::getUnoTunnelImplementation<SwXParagraph>(xNewContent);
if (!pPara || !pPara->IsDescriptor() || !xSuccessor.is())
{
throw lang::IllegalArgumentException();
@@ -692,10 +690,8 @@ SwXText::insertTextContentAfter(
throw uno::RuntimeException();
}
- const uno::Reference<lang::XUnoTunnel> xParaTunnel(xNewContent,
- uno::UNO_QUERY);
SwXParagraph *const pPara =
- ::sw::UnoTunnelGetImplementation<SwXParagraph>(xParaTunnel);
+ comphelper::getUnoTunnelImplementation<SwXParagraph>(xNewContent);
if(!pPara || !pPara->IsDescriptor() || !xPredecessor.is())
{
throw lang::IllegalArgumentException();
@@ -986,9 +982,8 @@ bool SwXText::Impl::CheckForOwnMember(
{
const uno::Reference<text::XTextCursor> xOwnCursor(m_rThis.CreateCursor());
- const uno::Reference<lang::XUnoTunnel> xTunnel(xOwnCursor, uno::UNO_QUERY);
OTextCursorHelper *const pOwnCursor =
- ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xTunnel);
+ comphelper::getUnoTunnelImplementation<OTextCursorHelper>(xOwnCursor);
OSL_ENSURE(pOwnCursor, "OTextCursorHelper::getUnoTunnelId() ??? ");
const SwStartNode* pOwnStartNode =
pOwnCursor->GetPaM()->GetNode().StartOfSectionNode();
@@ -1522,14 +1517,10 @@ SwXText::convertToTextFrame(
throw lang::IllegalArgumentException();
}
- const uno::Reference<lang::XUnoTunnel> xStartRangeTunnel(xStart,
- uno::UNO_QUERY);
SwXTextRange *const pStartRange =
- ::sw::UnoTunnelGetImplementation<SwXTextRange>(xStartRangeTunnel);
- const uno::Reference<lang::XUnoTunnel> xEndRangeTunnel(xEnd,
- uno::UNO_QUERY);
+ comphelper::getUnoTunnelImplementation<SwXTextRange>(xStart);
SwXTextRange *const pEndRange =
- ::sw::UnoTunnelGetImplementation<SwXTextRange>(xEndRangeTunnel);
+ comphelper::getUnoTunnelImplementation<SwXTextRange>(xEnd);
// bookmarks have to be removed before the referenced text node
// is deleted in DelFullPara
if (pStartRange)
@@ -1735,10 +1726,8 @@ SwXText::convertToTextFrame(
{
const uno::Reference<text::XTextCursor> xFrameTextCursor =
rNewFrame.createTextCursor();
- const uno::Reference<XUnoTunnel> xTunnel(xFrameTextCursor,
- uno::UNO_QUERY);
SwXTextCursor *const pFrameCursor =
- ::sw::UnoTunnelGetImplementation<SwXTextCursor>(xTunnel);
+ comphelper::getUnoTunnelImplementation<SwXTextCursor>(xFrameTextCursor);
if (bParaBeforeInserted)
{
// todo: remove paragraph before frame
diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx
index 74ae9f78b1a9..9e83aae9cd13 100644
--- a/sw/source/filter/html/htmlform.cxx
+++ b/sw/source/filter/html/htmlform.cxx
@@ -496,11 +496,7 @@ void SwHTMLImageWatcher::init( sal_Int32 Width, sal_Int32 Height )
// To get to the SwXShape* we need an interface that is implemented by SwXShape
uno::Reference< beans::XPropertySet > xPropSet( xShape, UNO_QUERY );
- uno::Reference< XUnoTunnel> xTunnel( xPropSet, UNO_QUERY );
- SwXShape *pSwShape = xTunnel.is() ?
- reinterpret_cast< SwXShape * >( sal::static_int_cast< sal_IntPtr>(
- xTunnel->getSomething(SwXShape::getUnoTunnelId()) ))
- : nullptr;
+ SwXShape *pSwShape = comphelper::getUnoTunnelImplementation<SwXShape>(xPropSet);
OSL_ENSURE( pSwShape, "Where is SW-Shape?" );
if( pSwShape )
@@ -650,11 +646,7 @@ void SwHTMLParser::SetControlSize( const uno::Reference< drawing::XShape >& rSha
}
}
- uno::Reference< XUnoTunnel> xTunnel( xPropSet, UNO_QUERY );
- SwXShape *pSwShape = xTunnel.is() ?
- reinterpret_cast< SwXShape *>( sal::static_int_cast< sal_IntPtr >(
- xTunnel->getSomething(SwXShape::getUnoTunnelId()) ))
- : nullptr;
+ SwXShape *pSwShape = comphelper::getUnoTunnelImplementation<SwXShape>(xPropSet);
OSL_ENSURE( pSwShape, "Where is SW-Shape?" );
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 1c633585c8d1..f940c8eb3ff1 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1710,9 +1710,7 @@ void SwXMLImport::initialize(
SwDoc* SwImport::GetDocFromXMLImport( SvXMLImport const & rImport )
{
- uno::Reference<lang::XUnoTunnel> xModelTunnel( rImport.GetModel(), uno::UNO_QUERY );
- SwXTextDocument *pTextDoc = reinterpret_cast< SwXTextDocument *>(
- sal::static_int_cast< sal_IntPtr >( xModelTunnel->getSomething(SwXTextDocument::getUnoTunnelId() )));
+ auto pTextDoc = comphelper::getUnoTunnelImplementation<SwXTextDocument>(rImport.GetModel());
assert( pTextDoc );
assert( pTextDoc->GetDocShell() );
SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
@@ -1723,11 +1721,7 @@ SwDoc* SwImport::GetDocFromXMLImport( SvXMLImport const & rImport )
void SwXMLImport::initXForms()
{
// obtain SwDoc
- Reference<XUnoTunnel> xDocTunnel( GetModel(), UNO_QUERY );
- if( ! xDocTunnel.is() )
- return;
- SwXTextDocument* pXTextDocument = reinterpret_cast<SwXTextDocument*>(
- xDocTunnel->getSomething( SwXTextDocument::getUnoTunnelId() ) );
+ auto pXTextDocument = comphelper::getUnoTunnelImplementation<SwXTextDocument>(GetModel());
if( pXTextDocument == nullptr )
return;
diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx
index 83e4f1f0868d..2738f470821c 100644
--- a/sw/source/ui/dbui/mmlayoutpage.cxx
+++ b/sw/source/ui/dbui/mmlayoutpage.cxx
@@ -610,8 +610,7 @@ IMPL_LINK_NOARG(SwMailMergeLayoutPage, PreviewLoadedHdl_Impl, SwOneExampleFrame&
//now the ViewOptions should be set properly
Reference< XViewSettingsSupplier > xSettings(xModel->getCurrentController(), UNO_QUERY);
m_xViewProperties = xSettings->getViewSettings();
- Reference< XUnoTunnel > xDocTunnel(xModel, UNO_QUERY);
- SwXTextDocument* pXDoc = reinterpret_cast<SwXTextDocument*>(xDocTunnel->getSomething(SwXTextDocument::getUnoTunnelId()));
+ auto pXDoc = comphelper::getUnoTunnelImplementation<SwXTextDocument>(xModel);
SwDocShell* pDocShell = pXDoc->GetDocShell();
m_pExampleWrtShell = pDocShell->GetWrtShell();
OSL_ENSURE(m_pExampleWrtShell, "No SwWrtShell found!");
diff --git a/sw/source/ui/index/cntex.cxx b/sw/source/ui/index/cntex.cxx
index 1401f8a6b1fd..12f8ad5abd1f 100644
--- a/sw/source/ui/index/cntex.cxx
+++ b/sw/source/ui/index/cntex.cxx
@@ -99,8 +99,7 @@ IMPL_LINK_NOARG(SwMultiTOXTabDialog, CreateExample_Hdl, SwOneExampleFrame&, void
try
{
uno::Reference< frame::XModel > & xModel = m_xExampleFrame->GetModel();
- uno::Reference< lang::XUnoTunnel > xDocTunnel(xModel, uno::UNO_QUERY);
- SwXTextDocument* pDoc = reinterpret_cast<SwXTextDocument*>(xDocTunnel->getSomething(SwXTextDocument::getUnoTunnelId()));
+ auto pDoc = comphelper::getUnoTunnelImplementation<SwXTextDocument>(xModel);
if( pDoc )
pDoc->GetDocShell()->LoadStyles_( *m_rWrtShell.GetView().GetDocShell(), true );
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index c8cc0ea74d9d..6e787fc8a323 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -3908,18 +3908,7 @@ sal_Int64 SwTransferable::getSomething( const Sequence< sal_Int8 >& rId )
SwTransferable* SwTransferable::GetSwTransferable( const TransferableDataHelper& rData )
{
- SwTransferable* pSwTransferable = nullptr;
-
- uno::Reference<XUnoTunnel> xTunnel( rData.GetTransferable(), UNO_QUERY );
- if ( xTunnel.is() )
- {
- sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() );
- if ( nHandle )
- pSwTransferable = reinterpret_cast<SwTransferable*>( static_cast<sal_IntPtr>(nHandle) );
- }
-
- return pSwTransferable;
-
+ return comphelper::getUnoTunnelImplementation<SwTransferable>(rData.GetTransferable());
}
SwTransferDdeLink::SwTransferDdeLink( SwTransferable& rTrans, SwWrtShell& rSh )
diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx
index fcaf11b7e126..d64a39456d45 100644
--- a/sw/source/uibase/misc/glosdoc.cxx
+++ b/sw/source/uibase/misc/glosdoc.cxx
@@ -20,6 +20,7 @@
#include <algorithm>
#include <com/sun/star/container/XNamed.hpp>
+#include <comphelper/servicehelper.hxx>
#include <unotools/transliterationwrapper.hxx>
@@ -457,13 +458,7 @@ void SwGlossaries::RemoveFileFromList( const OUString& rGroup )
aLoop != m_aGlossaryEntries.end();
)
{
- Reference< lang::XUnoTunnel > xEntryTunnel( aLoop->get(), UNO_QUERY );
-
- SwXAutoTextEntry* pEntry = nullptr;
- if ( xEntryTunnel.is() )
- pEntry = reinterpret_cast< SwXAutoTextEntry* >(
- xEntryTunnel->getSomething( SwXAutoTextEntry::getUnoTunnelId() ) );
-
+ auto pEntry = comphelper::getUnoTunnelImplementation<SwXAutoTextEntry>(aLoop->get());
if ( pEntry && ( pEntry->GetGroupName() == rGroup ) )
{
pEntry->Invalidate();
@@ -518,12 +513,7 @@ void SwGlossaries::InvalidateUNOOjects()
// invalidate all the AutoTextEntry-objects
for (const auto& rEntry : m_aGlossaryEntries)
{
- Reference< lang::XUnoTunnel > xEntryTunnel( rEntry.get(), UNO_QUERY );
- SwXAutoTextEntry* pEntry = nullptr;
- if ( xEntryTunnel.is() )
- pEntry = reinterpret_cast< SwXAutoTextEntry* >(
- xEntryTunnel->getSomething( SwXAutoTextEntry::getUnoTunnelId() ) );
-
+ auto pEntry = comphelper::getUnoTunnelImplementation<SwXAutoTextEntry>(rEntry.get());
if ( pEntry )
pEntry->Invalidate();
}
@@ -543,12 +533,7 @@ Reference< text::XAutoTextGroup > SwGlossaries::GetAutoTextGroup( const OUString
UnoAutoTextGroups::iterator aSearch = m_aGlossaryGroups.begin();
for ( ; aSearch != m_aGlossaryGroups.end(); )
{
- Reference< lang::XUnoTunnel > xGroupTunnel( aSearch->get(), UNO_QUERY );
-
- SwXAutoTextGroup* pSwGroup = nullptr;
- if ( xGroupTunnel.is() )
- pSwGroup = reinterpret_cast< SwXAutoTextGroup* >( xGroupTunnel->getSomething( SwXAutoTextGroup::getUnoTunnelId() ) );
-
+ auto pSwGroup = comphelper::getUnoTunnelImplementation<SwXAutoTextGroup>(aSearch->get());
if ( !pSwGroup )
{
// the object is dead in the meantime -> remove from cache
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index cf1b2296ca80..8aeba7910d5c 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -674,8 +674,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
case FN_REPAGINATE:
{
Reference < XModel > xModel = GetView().GetDocShell()->GetModel();
- Reference < XUnoTunnel > xDocTunnel ( xModel, UNO_QUERY );
- SwXTextDocument *pDoc = reinterpret_cast < SwXTextDocument * > ( xDocTunnel->getSomething ( SwXTextDocument::getUnoTunnelId() ) );
+ auto pDoc = comphelper::getUnoTunnelImplementation<SwXTextDocument>(xModel);
pDoc->NotifyRefreshListeners();
rSh.CalcLayout();
}
diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx
index 7b2130939798..6f0a0db5f938 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/scanner/XScannerManager2.hpp>
#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
#include <comphelper/propertysequence.hxx>
+#include <comphelper/servicehelper.hxx>
#include <vcl/weld.hxx>
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
@@ -66,15 +67,9 @@ SwView_Impl::SwView_Impl(SwView* pShell)
SwView_Impl::~SwView_Impl()
{
- Reference<XUnoTunnel> xDispTunnel(xDisProvInterceptor, UNO_QUERY);
- SwXDispatchProviderInterceptor* pInterceptor = nullptr;
- if(xDispTunnel.is() &&
- nullptr != (pInterceptor = reinterpret_cast< SwXDispatchProviderInterceptor * >(
- sal::static_int_cast< sal_IntPtr >(
- xDispTunnel->getSomething(SwXDispatchProviderInterceptor::getUnoTunnelId())))))
- {
+ auto pInterceptor = comphelper::getUnoTunnelImplementation<SwXDispatchProviderInterceptor>(xDisProvInterceptor);
+ if(pInterceptor)
pInterceptor->Invalidate();
- }
view::XSelectionSupplier* pTextView = mxXTextView.get();
static_cast<SwXTextView*>(pTextView)->Invalidate();
mxXTextView.clear();
@@ -223,16 +218,9 @@ void SwView_Impl::Invalidate()
GetUNOObject_Impl()->Invalidate();
for (const auto& xTransferable: mxTransferables)
{
- Reference< XUnoTunnel > xTunnel(xTransferable.get(), UNO_QUERY);
- if(xTunnel.is())
-
- {
- SwTransferable* pTransferable = reinterpret_cast< SwTransferable * >(
- sal::static_int_cast< sal_IntPtr >(
- xTunnel->getSomething(SwTransferable::getUnoTunnelId())));
- if(pTransferable)
- pTransferable->Invalidate();
- }
+ auto pTransferable = comphelper::getUnoTunnelImplementation<SwTransferable>(xTransferable.get());
+ if(pTransferable)
+ pTransferable->Invalidate();
}
}
diff --git a/sw/source/uibase/uno/SwXFilterOptions.cxx b/sw/source/uibase/uno/SwXFilterOptions.cxx
index 1d7f2d403acb..2e53ca270d03 100644
--- a/sw/source/uibase/uno/SwXFilterOptions.cxx
+++ b/sw/source/uibase/uno/SwXFilterOptions.cxx
@@ -80,14 +80,10 @@ sal_Int16 SwXFilterOptions::execute()
if ( xInputStream.is() )
pInStream = utl::UcbStreamHelper::CreateStream( xInputStream );
- uno::Reference< XUnoTunnel > xTunnel(xModel, uno::UNO_QUERY);
SwDocShell* pDocShell = nullptr;
- if(xTunnel.is())
- {
- SwXTextDocument* pXDoc = reinterpret_cast< SwXTextDocument * >(
- sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(SwXTextDocument::getUnoTunnelId())));
- pDocShell = pXDoc ? pXDoc->GetDocShell() : nullptr;
- }
+ if (auto pXDoc = comphelper::getUnoTunnelImplementation<SwXTextDocument>(xModel); pXDoc)
+ pDocShell = pXDoc->GetDocShell();
+
if(pDocShell)
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx
index d5231fa826ce..8ea1a82934d6 100644
--- a/sw/source/uibase/uno/unomailmerge.cxx
+++ b/sw/source/uibase/uno/unomailmerge.cxx
@@ -151,13 +151,8 @@ static bool LoadFromURL_impl(
// try to get the DocShell
SwDocShell *pTmpDocShell = nullptr;
- Reference < XUnoTunnel > xTunnel( xTmpModel, UNO_QUERY );
- if (xTunnel.is())
- {
- SwXTextDocument* pTextDoc = reinterpret_cast<SwXTextDocument *>(
- xTunnel->getSomething( SwXTextDocument::getUnoTunnelId() ));
- pTmpDocShell = pTextDoc ? pTextDoc->GetDocShell() : nullptr;
- }
+ if (auto pTextDoc = comphelper::getUnoTunnelImplementation<SwXTextDocument>(xTmpModel); pTextDoc)
+ pTmpDocShell = pTextDoc->GetDocShell();
bool bRes = false;
if (xTmpModel.is() && pTmpDocShell) // everything available?
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 2759922dd303..dad23f90c389 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -820,13 +820,11 @@ SwUnoCursor* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor >
sal_Int32& nResult,
Reference< XInterface > const & xLastResult)
{
- Reference< XUnoTunnel > xDescTunnel(xDesc, UNO_QUERY);
- if(!IsValid() || !xDescTunnel.is() || !xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId()))
+ const auto pSearch = comphelper::getUnoTunnelImplementation<SwXTextSearch>(xDesc);
+ if(!IsValid() || !pSearch)
return nullptr;
auto pUnoCursor(CreateCursorForSearch(xCursor));
- const SwXTextSearch* pSearch = reinterpret_cast<const SwXTextSearch*>(
- xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId()));
bool bParentInExtra = false;
if(xLastResult.is())
diff --git a/sw/source/uibase/utlui/uiitems.cxx b/sw/source/uibase/utlui/uiitems.cxx
index dd96cea07bcc..89390a6735a4 100644
--- a/sw/source/uibase/utlui/uiitems.cxx
+++ b/sw/source/uibase/utlui/uiitems.cxx
@@ -248,9 +248,7 @@ bool SwUINumRuleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
uno::Reference< container::XIndexReplace> xRulesRef;
if(rVal >>= xRulesRef)
{
- uno::Reference< lang::XUnoTunnel > xTunnel(xRulesRef, uno::UNO_QUERY);
- SwXNumberingRules* pSwXRules = xTunnel.is() ? reinterpret_cast<SwXNumberingRules*>(
- xTunnel->getSomething(SwXNumberingRules::getUnoTunnelId())) : nullptr;
+ auto pSwXRules = comphelper::getUnoTunnelImplementation<SwXNumberingRules>(xRulesRef);
if(pSwXRules)
{
*pRule = *pSwXRules->GetNumRule();
diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx
index 0e529d0b8bb1..4023a4bb1847 100644
--- a/sw/source/uibase/utlui/unotools.cxx
+++ b/sw/source/uibase/utlui/unotools.cxx
@@ -46,6 +46,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/propertysequence.hxx>
+#include <comphelper/servicehelper.hxx>
#include <sfx2/dispatch.hxx>
#include <svl/stritem.hxx>
#include <shellio.hxx>
@@ -153,14 +154,7 @@ void SwOneExampleFrame::Paint(vcl::RenderContext& rRenderContext, const tools::R
Color aBgColor = SW_MOD()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor;
m_xVirDev->DrawWallpaper(tools::Rectangle(Point(), aSize), aBgColor);
- OTextCursorHelper* pCursor = nullptr;
- uno::Reference<lang::XUnoTunnel> xTunnel(m_xCursor, uno::UNO_QUERY);
- if (xTunnel.is())
- {
- pCursor = reinterpret_cast<OTextCursorHelper*>(xTunnel->getSomething(
- OTextCursorHelper::getUnoTunnelId()));
- }
-
+ auto pCursor = comphelper::getUnoTunnelImplementation<OTextCursorHelper>(m_xCursor);
if (pCursor)
{
uno::Reference<view::XViewSettingsSupplier> xSettings(m_xController, uno::UNO_QUERY);
@@ -307,13 +301,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer, void )
//From here, a cursor is defined, which goes through the template,
//and overwrites the template words where it is necessary.
- OTextCursorHelper* pCursor = nullptr;
- uno::Reference< lang::XUnoTunnel> xTunnel( m_xCursor, uno::UNO_QUERY);
- if (xTunnel.is())
- {
- pCursor = reinterpret_cast<OTextCursorHelper*>(xTunnel->getSomething(
- OTextCursorHelper::getUnoTunnelId()));
- }
+ auto pCursor = comphelper::getUnoTunnelImplementation<OTextCursorHelper>(m_xCursor);
SwDoc *pDoc = pCursor ? pCursor->GetDoc() : nullptr;
if (pDoc)
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index 45a562d26d77..e8b377cb222e 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -24,6 +24,7 @@
#include <impgraph.hxx>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
+#include <comphelper/servicehelper.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <graphic/UnoGraphic.hxx>
#include <vcl/GraphicExternalLink.hxx>
@@ -228,10 +229,7 @@ Graphic::Graphic(const GDIMetaFile& rMtf)
Graphic::Graphic( const css::uno::Reference< css::graphic::XGraphic >& rxGraphic )
{
- uno::Reference< lang::XUnoTunnel > xTunnel( rxGraphic, uno::UNO_QUERY );
- const ::Graphic* pGraphic = ( xTunnel.is() ?
- reinterpret_cast< ::Graphic* >( xTunnel->getSomething( getUnoTunnelId() ) ) :
- nullptr );
+ const ::Graphic* pGraphic = comphelper::getUnoTunnelImplementation<::Graphic>(rxGraphic);
if( pGraphic )
{