diff options
71 files changed, 156 insertions, 168 deletions
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 3989f8d7e86a..ec0df4b1e789 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -1201,8 +1201,7 @@ Reference< util::XNumberFormatsSupplier > const & ChartModel::getNumberFormatsSu // ____ XUnoTunnel ___ ::sal_Int64 SAL_CALL ChartModel::getSomething( const Sequence< ::sal_Int8 >& aIdentifier ) { - if( aIdentifier.getLength() == 16 && memcmp( SvNumberFormatsSupplierObj::getUnoTunnelId().getConstArray(), - aIdentifier.getConstArray(), 16 ) == 0 ) + if( isUnoTunnelId<SvNumberFormatsSupplierObj>(aIdentifier) ) { Reference< lang::XUnoTunnel > xTunnel( getNumberFormatsSupplier(), uno::UNO_QUERY ); if( xTunnel.is() ) diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 876d47570878..ab3b10d7c8cf 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1233,8 +1233,7 @@ sal_Bool SAL_CALL ChartView::isDataFlavorSupported( const datatransfer::DataFlav // ____ XUnoTunnel ___ ::sal_Int64 SAL_CALL ChartView::getSomething( const uno::Sequence< ::sal_Int8 >& aIdentifier ) { - if( aIdentifier.getLength() == 16 && memcmp( ExplicitValueProvider::getUnoTunnelId().getConstArray(), - aIdentifier.getConstArray(), 16 ) == 0 ) + if( isUnoTunnelId<ExplicitValueProvider>(aIdentifier) ) { ExplicitValueProvider* pProvider = this; return reinterpret_cast<sal_Int64>(pProvider); diff --git a/connectivity/source/commontools/ConnectionWrapper.cxx b/connectivity/source/commontools/ConnectionWrapper.cxx index e5a10447316e..fba26d8937ae 100644 --- a/connectivity/source/commontools/ConnectionWrapper.cxx +++ b/connectivity/source/commontools/ConnectionWrapper.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <comphelper/uno3.hxx> #include <comphelper/sequence.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/hash.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> @@ -157,7 +158,7 @@ Sequence< Type > SAL_CALL OConnectionWrapper::getTypes( ) // css::lang::XUnoTunnel sal_Int64 SAL_CALL OConnectionWrapper::getSomething( const Sequence< sal_Int8 >& rId ) { - if (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + if (isUnoTunnelId<OConnectionWrapper>(rId)) return reinterpret_cast< sal_Int64 >( this ); if(m_xUnoTunnel.is()) @@ -166,7 +167,7 @@ sal_Int64 SAL_CALL OConnectionWrapper::getSomething( const Sequence< sal_Int8 >& } -Sequence< sal_Int8 > OConnectionWrapper::getUnoTunnelImplementationId() +Sequence< sal_Int8 > OConnectionWrapper::getUnoTunnelId() { static ::cppu::OImplementationId implId; diff --git a/connectivity/source/commontools/TConnection.cxx b/connectivity/source/commontools/TConnection.cxx index 779ea853520f..255776a3ceb4 100644 --- a/connectivity/source/commontools/TConnection.cxx +++ b/connectivity/source/commontools/TConnection.cxx @@ -20,6 +20,7 @@ #include <string.h> #include <TConnection.hxx> #include <cppuhelper/typeprovider.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/types.hxx> #include <connectivity/dbexception.hxx> @@ -57,12 +58,12 @@ void OMetaConnection::disposing() //XUnoTunnel sal_Int64 SAL_CALL OMetaConnection::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { - return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (isUnoTunnelId<OMetaConnection>(rId)) ? reinterpret_cast< sal_Int64 >( this ) : sal_Int64(0); } -Sequence< sal_Int8 > OMetaConnection::getUnoTunnelImplementationId() +Sequence< sal_Int8 > OMetaConnection::getUnoTunnelId() { static ::cppu::OImplementationId implId; diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx index ef9e0951670e..004b0af38232 100644 --- a/connectivity/source/drivers/calc/CTable.cxx +++ b/connectivity/source/drivers/calc/CTable.cxx @@ -46,6 +46,7 @@ #include <rtl/math.hxx> #include <connectivity/dbexception.hxx> #include <connectivity/dbconversion.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/types.hxx> #include <cppuhelper/typeprovider.hxx> @@ -617,7 +618,7 @@ void SAL_CALL OCalcTable::disposing() } -Sequence< sal_Int8 > OCalcTable::getUnoTunnelImplementationId() +Sequence< sal_Int8 > OCalcTable::getUnoTunnelId() { static ::cppu::OImplementationId implId; @@ -628,7 +629,7 @@ Sequence< sal_Int8 > OCalcTable::getUnoTunnelImplementationId() sal_Int64 OCalcTable::getSomething( const Sequence< sal_Int8 > & rId ) { - return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (isUnoTunnelId<OCalcTable>(rId)) ? reinterpret_cast< sal_Int64 >( this ) : OCalcTable_BASE::getSomething(rId); } diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx index 0f40fe79ca6e..1db65083b06a 100644 --- a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx +++ b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx @@ -299,7 +299,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo( Reference< XUnoTunnel> xTunnel(xIndex,UNO_QUERY); if(xTunnel.is()) { - ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) ); + ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelId()) ); if(pIndex) { aRow[11] = new ORowSetValueDecorator(static_cast<sal_Int32>(pIndex->getHeader().db_maxkeys)); diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx index 23a5d28f9fd9..ee77ea8b2e6f 100644 --- a/connectivity/source/drivers/dbase/DIndex.cxx +++ b/connectivity/source/drivers/dbase/DIndex.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/sdbcx/XRowLocate.hpp> #include <com/sun/star/sdbc/XRow.hpp> #include <unotools/ucbhelper.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/types.hxx> #include <cppuhelper/typeprovider.hxx> #include <connectivity/dbexception.hxx> @@ -104,7 +105,7 @@ void ODbaseIndex::refreshColumns() m_pColumns.reset(new ODbaseIndexColumns(this,m_aMutex,aVector)); } -Sequence< sal_Int8 > ODbaseIndex::getUnoTunnelImplementationId() +Sequence< sal_Int8 > ODbaseIndex::getUnoTunnelId() { static ::cppu::OImplementationId implId; @@ -115,7 +116,7 @@ Sequence< sal_Int8 > ODbaseIndex::getUnoTunnelImplementationId() sal_Int64 ODbaseIndex::getSomething( const Sequence< sal_Int8 > & rId ) { - return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (isUnoTunnelId<ODbaseIndex>(rId)) ? reinterpret_cast< sal_Int64 >( this ) : ODbaseIndex_BASE::getSomething(rId); } diff --git a/connectivity/source/drivers/dbase/DIndexes.cxx b/connectivity/source/drivers/dbase/DIndexes.cxx index 416e05eaa576..3758330b9f3c 100644 --- a/connectivity/source/drivers/dbase/DIndexes.cxx +++ b/connectivity/source/drivers/dbase/DIndexes.cxx @@ -94,7 +94,7 @@ sdbcx::ObjectType ODbaseIndexes::appendObject( const OUString& _rForName, const Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY); if(xTunnel.is()) { - ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) ); + ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelId()) ); if(!pIndex) throw SQLException(); pIndex->CreateImpl(); @@ -109,7 +109,7 @@ 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::getUnoTunnelImplementationId()) ); + ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelId()) ); if ( pIndex ) pIndex->DropImpl(); } diff --git a/connectivity/source/drivers/dbase/DResultSet.cxx b/connectivity/source/drivers/dbase/DResultSet.cxx index 572eaa27d69c..260e009611fc 100644 --- a/connectivity/source/drivers/dbase/DResultSet.cxx +++ b/connectivity/source/drivers/dbase/DResultSet.cxx @@ -158,7 +158,7 @@ bool ODbaseResultSet::fillIndexValues(const Reference< XColumnsSupplier> &_xInde Reference<XUnoTunnel> xTunnel(_xIndex,UNO_QUERY); if(xTunnel.is()) { - dbase::ODbaseIndex* pIndex = reinterpret_cast< dbase::ODbaseIndex* >( xTunnel->getSomething(dbase::ODbaseIndex::getUnoTunnelImplementationId()) ); + dbase::ODbaseIndex* pIndex = reinterpret_cast< dbase::ODbaseIndex* >( xTunnel->getSomething(dbase::ODbaseIndex::getUnoTunnelId()) ); if(pIndex) { std::unique_ptr<dbase::OIndexIterator> pIter = pIndex->createIterator(); diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 9cfee8f0b8af..3f91c546fb2d 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <comphelper/property.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/string.hxx> #include <unotools/tempfile.hxx> #include <unotools/ucbhelper.hxx> @@ -733,7 +734,7 @@ Any SAL_CALL ODbaseTable::queryInterface( const Type & rType ) } -Sequence< sal_Int8 > ODbaseTable::getUnoTunnelImplementationId() +Sequence< sal_Int8 > ODbaseTable::getUnoTunnelId() { static ::cppu::OImplementationId implId; @@ -744,7 +745,7 @@ Sequence< sal_Int8 > ODbaseTable::getUnoTunnelImplementationId() sal_Int64 ODbaseTable::getSomething( const Sequence< sal_Int8 > & rId ) { - return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (isUnoTunnelId<ODbaseTable>(rId)) ? reinterpret_cast< sal_Int64 >( this ) : ODbaseTable_BASE::getSomething(rId); } @@ -1567,7 +1568,7 @@ bool ODbaseTable::DeleteRow(const OSQLColumns& _rCols) Reference<XUnoTunnel> xTunnel(xIndex,UNO_QUERY); OSL_ENSURE(xTunnel.is(),"No TunnelImplementation!"); - ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) ); + ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelId()) ); OSL_ENSURE(pIndex,"ODbaseTable::DeleteRow: No Index returned!"); OSQLColumns::Vector::const_iterator aIter = std::find_if(_rCols.get().begin(), _rCols.get().end(), @@ -1673,7 +1674,7 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo { Reference<XUnoTunnel> xTunnel(xIndex,UNO_QUERY); OSL_ENSURE(xTunnel.is(),"No TunnelImplementation!"); - ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) ); + ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelId()) ); OSL_ENSURE(pIndex,"ODbaseTable::UpdateBuffer: No Index returned!"); if (pIndex->Find(0,*rRow.get()[nPos])) @@ -1781,7 +1782,7 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo { Reference<XUnoTunnel> xTunnel(aIndexedCols[i],UNO_QUERY); OSL_ENSURE(xTunnel.is(),"No TunnelImplementation!"); - ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) ); + ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelId()) ); OSL_ENSURE(pIndex,"ODbaseTable::UpdateBuffer: No Index returned!"); // Update !! if (pOrgRow.is() && !thisColIsNull) diff --git a/connectivity/source/drivers/dbase/DTables.cxx b/connectivity/source/drivers/dbase/DTables.cxx index 99c192dd2751..d72061b4538f 100644 --- a/connectivity/source/drivers/dbase/DTables.cxx +++ b/connectivity/source/drivers/dbase/DTables.cxx @@ -72,7 +72,7 @@ sdbcx::ObjectType ODbaseTables::appendObject( const OUString& _rForName, const R Reference<XUnoTunnel> xTunnel(descriptor,UNO_QUERY); if(xTunnel.is()) { - ODbaseTable* pTable = reinterpret_cast< ODbaseTable* >( xTunnel->getSomething(ODbaseTable::getUnoTunnelImplementationId()) ); + ODbaseTable* pTable = reinterpret_cast< ODbaseTable* >( xTunnel->getSomething(ODbaseTable::getUnoTunnelId()) ); if(pTable) { pTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(_rForName)); @@ -111,7 +111,7 @@ void ODbaseTables::dropObject(sal_Int32 _nPos, const OUString& _sElementName) if ( xTunnel.is() ) { - ODbaseTable* pTable = reinterpret_cast< ODbaseTable* >( xTunnel->getSomething(ODbaseTable::getUnoTunnelImplementationId()) ); + ODbaseTable* pTable = reinterpret_cast< ODbaseTable* >( xTunnel->getSomething(ODbaseTable::getUnoTunnelId()) ); if(pTable) pTable->DropImpl(); } diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx index afa6cc598668..3eeea6735f1e 100644 --- a/connectivity/source/drivers/file/FConnection.cxx +++ b/connectivity/source/drivers/file/FConnection.cxx @@ -20,6 +20,7 @@ #include <sal/config.h> #include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/typeprovider.hxx> #include <file/FConnection.hxx> #include <file/FDatabaseMetaData.hxx> @@ -405,12 +406,12 @@ Reference< XDynamicResultSet > OConnection::getDir() const sal_Int64 SAL_CALL OConnection::getSomething( const Sequence< sal_Int8 >& rId ) { - return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (isUnoTunnelId<OConnection>(rId)) ? reinterpret_cast< sal_Int64 >( this ) : sal_Int64(0); } -Sequence< sal_Int8 > OConnection::getUnoTunnelImplementationId() +Sequence< sal_Int8 > OConnection::getUnoTunnelId() { static ::cppu::OImplementationId implId; diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx index 25ccc578f959..367fd1f3416c 100644 --- a/connectivity/source/drivers/file/FDriver.cxx +++ b/connectivity/source/drivers/file/FDriver.cxx @@ -189,7 +189,7 @@ Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByConnection Reference< css::lang::XUnoTunnel> xTunnel(connection,UNO_QUERY); if(xTunnel.is()) { - OConnection* pSearchConnection = reinterpret_cast< OConnection* >( xTunnel->getSomething(OConnection::getUnoTunnelImplementationId()) ); + OConnection* pSearchConnection = reinterpret_cast< OConnection* >( xTunnel->getSomething(OConnection::getUnoTunnelId()) ); OConnection* pConnection = nullptr; for (auto const& elem : m_xConnections) { diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index b535c35ae627..bc978bcc3599 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -34,6 +34,7 @@ #include <cppuhelper/typeprovider.hxx> #include <comphelper/numbers.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/types.hxx> #include <flat/EDriver.hxx> #include <com/sun/star/util/NumberFormat.hpp> @@ -553,7 +554,7 @@ Any SAL_CALL OFlatTable::queryInterface( const Type & rType ) } -Sequence< sal_Int8 > OFlatTable::getUnoTunnelImplementationId() +Sequence< sal_Int8 > OFlatTable::getUnoTunnelId() { static ::cppu::OImplementationId implId; @@ -564,7 +565,7 @@ Sequence< sal_Int8 > OFlatTable::getUnoTunnelImplementationId() sal_Int64 OFlatTable::getSomething( const Sequence< sal_Int8 > & rId ) { - return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (isUnoTunnelId<OFlatTable>(rId)) ? reinterpret_cast< sal_Int64 >( this ) : OFlatTable_BASE::getSomething(rId); } diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index e7811fdac811..5ab48b138a1e 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -345,7 +345,7 @@ namespace connectivity Reference< XUnoTunnel> xTunnel(xOrig,UNO_QUERY); if ( xTunnel.is() ) { - OMetaConnection* pMetaConnection = reinterpret_cast<OMetaConnection*>(xTunnel->getSomething( OMetaConnection::getUnoTunnelImplementationId() )); + OMetaConnection* pMetaConnection = reinterpret_cast<OMetaConnection*>(xTunnel->getSomething( OMetaConnection::getUnoTunnelId() )); if ( pMetaConnection ) pMetaConnection->setURL(url); } diff --git a/connectivity/source/drivers/hsqldb/HTable.cxx b/connectivity/source/drivers/hsqldb/HTable.cxx index b7a841a76ff4..ab7d95812f40 100644 --- a/connectivity/source/drivers/hsqldb/HTable.cxx +++ b/connectivity/source/drivers/hsqldb/HTable.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/sdbc/ColumnValue.hpp> #include <com/sun/star/sdbcx/Privilege.hpp> #include <comphelper/property.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/types.hxx> #include <connectivity/dbtools.hxx> #include <connectivity/sdbcx/VColumn.hxx> @@ -126,7 +127,7 @@ sdbcx::OCollection* OHSQLTable::createIndexes(const ::std::vector< OUString>& _r return new OIndexesHelper(this,m_aMutex,_rNames); } -Sequence< sal_Int8 > OHSQLTable::getUnoTunnelImplementationId() +Sequence< sal_Int8 > OHSQLTable::getUnoTunnelId() { static ::cppu::OImplementationId implId; @@ -137,7 +138,7 @@ Sequence< sal_Int8 > OHSQLTable::getUnoTunnelImplementationId() sal_Int64 OHSQLTable::getSomething( const Sequence< sal_Int8 > & rId ) { - return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + return (isUnoTunnelId<OHSQLTable>(rId)) ? reinterpret_cast< sal_Int64 >( this ) : OTable_TYPEDEF::getSomething(rId); } diff --git a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx index d36f78fb3819..06631edda7f1 100644 --- a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx +++ b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx @@ -271,7 +271,7 @@ Reference<XConnection> SAL_CALL ODriverDelegator::connect(const OUString& url, if (xTunnel.is()) { pMetaConnection = reinterpret_cast<OMetaConnection*>( - xTunnel->getSomething(OMetaConnection::getUnoTunnelImplementationId())); + xTunnel->getSomething(OMetaConnection::getUnoTunnelId())); if (pMetaConnection) pMetaConnection->setURL(url); } @@ -344,7 +344,7 @@ ODriverDelegator::getDataDefinitionByConnection(const Reference<XConnection>& co if (xTunnel.is()) { OMetaConnection* pConnection = reinterpret_cast<OMetaConnection*>( - xTunnel->getSomething(OMetaConnection::getUnoTunnelImplementationId())); + xTunnel->getSomething(OMetaConnection::getUnoTunnelId())); if (pConnection) { TWeakPairVector::iterator i diff --git a/connectivity/source/drivers/mysql_jdbc/YTable.cxx b/connectivity/source/drivers/mysql_jdbc/YTable.cxx index a3f303982839..f62779499d58 100644 --- a/connectivity/source/drivers/mysql_jdbc/YTable.cxx +++ b/connectivity/source/drivers/mysql_jdbc/YTable.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/sdbc/ColumnValue.hpp> #include <com/sun/star/sdbcx/Privilege.hpp> #include <comphelper/property.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/types.hxx> #include <connectivity/dbtools.hxx> #include <connectivity/sdbcx/VColumn.hxx> @@ -125,7 +126,7 @@ sdbcx::OCollection* OMySQLTable::createIndexes(const ::std::vector<OUString>& _r return new OIndexesHelper(this, m_aMutex, _rNames); } -Sequence<sal_Int8> OMySQLTable::getUnoTunnelImplementationId() +Sequence<sal_Int8> OMySQLTable::getUnoTunnelId() { static ::cppu::OImplementationId implId; @@ -136,10 +137,8 @@ Sequence<sal_Int8> OMySQLTable::getUnoTunnelImplementationId() sal_Int64 OMySQLTable::getSomething(const Sequence<sal_Int8>& rId) { - return (rId.getLength() == 16 - && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16)) - ? reinterpret_cast<sal_Int64>(this) - : OTable_TYPEDEF::getSomething(rId); + return (isUnoTunnelId<OMySQLTable>(rId)) ? reinterpret_cast<sal_Int64>(this) + : OTable_TYPEDEF::getSomething(rId); } // XAlterTable diff --git a/connectivity/source/drivers/writer/WTable.cxx b/connectivity/source/drivers/writer/WTable.cxx index 82aea711a4a9..cf9ca7850fd5 100644 --- a/connectivity/source/drivers/writer/WTable.cxx +++ b/connectivity/source/drivers/writer/WTable.cxx @@ -28,6 +28,7 @@ #include <writer/WConnection.hxx> #include <connectivity/sdbcx/VColumn.hxx> #include <sal/log.hxx> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/typeprovider.hxx> namespace com @@ -222,7 +223,7 @@ void SAL_CALL OWriterTable::disposing() m_pWriterConnection = nullptr; } -uno::Sequence<sal_Int8> OWriterTable::getUnoTunnelImplementationId() +uno::Sequence<sal_Int8> OWriterTable::getUnoTunnelId() { static ::cppu::OImplementationId implId; @@ -231,10 +232,8 @@ uno::Sequence<sal_Int8> OWriterTable::getUnoTunnelImplementationId() sal_Int64 OWriterTable::getSomething(const uno::Sequence<sal_Int8>& rId) { - return (rId.getLength() == 16 - && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16)) - ? reinterpret_cast<sal_Int64>(this) - : OWriterTable_BASE::getSomething(rId); + return (isUnoTunnelId<OWriterTable>(rId)) ? reinterpret_cast<sal_Int64>(this) + : OWriterTable_BASE::getSomething(rId); } bool OWriterTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) diff --git a/connectivity/source/inc/TConnection.hxx b/connectivity/source/inc/TConnection.hxx index 8737da6dddbc..af528c894a34 100644 --- a/connectivity/source/inc/TConnection.hxx +++ b/connectivity/source/inc/TConnection.hxx @@ -75,7 +75,7 @@ namespace connectivity //XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); }; } #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_TCONNECTION_HXX diff --git a/connectivity/source/inc/calc/CTable.hxx b/connectivity/source/inc/calc/CTable.hxx index 00e91ee7f095..570a6bc87134 100644 --- a/connectivity/source/inc/calc/CTable.hxx +++ b/connectivity/source/inc/calc/CTable.hxx @@ -69,7 +69,7 @@ namespace connectivity // css::lang::XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); void construct() override; }; diff --git a/connectivity/source/inc/dbase/DIndex.hxx b/connectivity/source/inc/dbase/DIndex.hxx index d4a9d7dbfafd..ce2a3c594998 100644 --- a/connectivity/source/inc/dbase/DIndex.hxx +++ b/connectivity/source/inc/dbase/DIndex.hxx @@ -97,7 +97,7 @@ namespace connectivity // css::lang::XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); const ODbaseTable* getTable() const { return m_pTable; } const NDXHeader& getHeader() const { return m_aHeader; } diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx index ace8f3c54959..7551dd01b527 100644 --- a/connectivity/source/inc/dbase/DTable.hxx +++ b/connectivity/source/inc/dbase/DTable.hxx @@ -167,7 +167,7 @@ namespace connectivity // css::lang::XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); // XAlterTable virtual void SAL_CALL alterColumnByName( const OUString& colName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; diff --git a/connectivity/source/inc/file/FConnection.hxx b/connectivity/source/inc/file/FConnection.hxx index ddb3dbc63264..4041e060816f 100644 --- a/connectivity/source/inc/file/FConnection.hxx +++ b/connectivity/source/inc/file/FConnection.hxx @@ -107,7 +107,7 @@ namespace connectivity virtual void SAL_CALL clearWarnings( ) override; //XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); // no interface methods css::uno::Reference< css::ucb::XDynamicResultSet > getDir() const; diff --git a/connectivity/source/inc/flat/ETable.hxx b/connectivity/source/inc/flat/ETable.hxx index 7dbc56de195b..b36111c9637a 100644 --- a/connectivity/source/inc/flat/ETable.hxx +++ b/connectivity/source/inc/flat/ETable.hxx @@ -98,7 +98,7 @@ namespace connectivity // css::lang::XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); OUString getEntry() const; }; diff --git a/connectivity/source/inc/hsqldb/HTable.hxx b/connectivity/source/inc/hsqldb/HTable.hxx index 9f3bbe42f18c..efae11c1a145 100644 --- a/connectivity/source/inc/hsqldb/HTable.hxx +++ b/connectivity/source/inc/hsqldb/HTable.hxx @@ -87,7 +87,7 @@ namespace connectivity virtual void construct() override; // css::lang::XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; //XTypeProvider diff --git a/connectivity/source/inc/mysql/YTable.hxx b/connectivity/source/inc/mysql/YTable.hxx index 5c5f5e48ec7b..9e7ea59a6607 100644 --- a/connectivity/source/inc/mysql/YTable.hxx +++ b/connectivity/source/inc/mysql/YTable.hxx @@ -94,7 +94,7 @@ namespace connectivity virtual void construct() override; // css::lang::XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); // XAlterTable virtual void SAL_CALL alterColumnByName( const OUString& colName, const css::uno::Reference< css::beans::XPropertySet >& descriptor ) override; diff --git a/connectivity/source/inc/writer/WTable.hxx b/connectivity/source/inc/writer/WTable.hxx index 6e2c3e89e88a..fa533e1e34da 100644 --- a/connectivity/source/inc/writer/WTable.hxx +++ b/connectivity/source/inc/writer/WTable.hxx @@ -78,7 +78,7 @@ public: // css::lang::XUnoTunnel sal_Int64 SAL_CALL getSomething(const css::uno::Sequence<sal_Int8>& rId) override; - static css::uno::Sequence<sal_Int8> getUnoTunnelImplementationId(); + static css::uno::Sequence<sal_Int8> getUnoTunnelId(); void construct() override; }; diff --git a/connectivity/source/sdbcx/VDescriptor.cxx b/connectivity/source/sdbcx/VDescriptor.cxx index cde97530a186..7b56d400c878 100644 --- a/connectivity/source/sdbcx/VDescriptor.cxx +++ b/connectivity/source/sdbcx/VDescriptor.cxx @@ -49,7 +49,7 @@ namespace connectivity // css::lang::XUnoTunnel sal_Int64 SAL_CALL ODescriptor::getSomething( const Sequence< sal_Int8 >& rId ) { - return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) + return (isUnoTunnelId<ODescriptor>(rId)) ? reinterpret_cast< sal_Int64 >( this ) : 0; } diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index c2cf6e568ac4..334afad81836 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -59,6 +59,7 @@ #include <comphelper/property.hxx> #include <comphelper/seqstream.hxx> #include <comphelper/sequence.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/types.hxx> #include <comphelper/uno3.hxx> #include <connectivity/BlobHelper.hxx> @@ -443,13 +444,13 @@ void SAL_CALL ORowSet::release() throw() // css::XUnoTunnel sal_Int64 SAL_CALL ORowSet::getSomething( const Sequence< sal_Int8 >& rId ) { - if (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + if (isUnoTunnelId<ORowSet>(rId)) return reinterpret_cast<sal_Int64>(this); return 0; } -Sequence< sal_Int8 > ORowSet::getUnoTunnelImplementationId() +Sequence< sal_Int8 > ORowSet::getUnoTunnelId() { static ::cppu::OImplementationId s_Id; @@ -2146,7 +2147,7 @@ void ORowSet::notifyRowSetAndClonesRowDelete( const Any& _rBookmark ) Reference< XUnoTunnel > xTunnel(elem.get(),UNO_QUERY); if(xTunnel.is()) { - ORowSetClone* pClone = reinterpret_cast<ORowSetClone*>(xTunnel->getSomething(ORowSetClone::getUnoTunnelImplementationId())); + ORowSetClone* pClone = reinterpret_cast<ORowSetClone*>(xTunnel->getSomething(ORowSetClone::getUnoTunnelId())); if(pClone) pClone->onDeleteRow( _rBookmark ); } @@ -2163,7 +2164,7 @@ void ORowSet::notifyRowSetAndClonesRowDeleted( const Any& _rBookmark, sal_Int32 Reference< XUnoTunnel > xTunnel(clone.get(),UNO_QUERY); if(xTunnel.is()) { - ORowSetClone* pClone = reinterpret_cast<ORowSetClone*>(xTunnel->getSomething(ORowSetClone::getUnoTunnelImplementationId())); + ORowSetClone* pClone = reinterpret_cast<ORowSetClone*>(xTunnel->getSomething(ORowSetClone::getUnoTunnelId())); if(pClone) pClone->onDeletedRow( _rBookmark, _nPos ); } @@ -2909,7 +2910,7 @@ void ORowSetClone::close() return *::comphelper::OPropertyArrayUsageHelper<ORowSetClone>::getArrayHelper(); } -Sequence< sal_Int8 > ORowSetClone::getUnoTunnelImplementationId() +Sequence< sal_Int8 > ORowSetClone::getUnoTunnelId() { static ::cppu::OImplementationId implId; @@ -2919,7 +2920,7 @@ Sequence< sal_Int8 > ORowSetClone::getUnoTunnelImplementationId() // css::XUnoTunnel sal_Int64 SAL_CALL ORowSetClone::getSomething( const Sequence< sal_Int8 >& rId ) { - if (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + if (isUnoTunnelId<ORowSetClone>(rId)) return reinterpret_cast<sal_Int64>(this); return 0; diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx index 74d54cd409f9..a0c7b6fca6d5 100644 --- a/dbaccess/source/core/api/RowSet.hxx +++ b/dbaccess/source/core/api/RowSet.hxx @@ -259,7 +259,7 @@ namespace dbaccess // css::lang::XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); // css::uno::XAggregation virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override; @@ -491,7 +491,7 @@ namespace dbaccess // css::lang::XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); // OComponentHelper virtual void SAL_CALL disposing() override; diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx index 6b632e135e12..c2c99f269e91 100644 --- a/dbaccess/source/core/api/TableDeco.cxx +++ b/dbaccess/source/core/api/TableDeco.cxx @@ -29,6 +29,7 @@ #include <cppuhelper/typeprovider.hxx> #include <comphelper/property.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/types.hxx> #include <com/sun/star/util/XRefreshListener.hpp> #include <com/sun/star/sdbc/SQLException.hpp> @@ -452,7 +453,7 @@ OUString SAL_CALL ODBTableDecorator::getName() sal_Int64 SAL_CALL ODBTableDecorator::getSomething( const Sequence< sal_Int8 >& rId ) { - if (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + if (isUnoTunnelId<ODBTableDecorator>(rId)) return reinterpret_cast<sal_Int64>(this); sal_Int64 nRet = 0; @@ -462,7 +463,7 @@ sal_Int64 SAL_CALL ODBTableDecorator::getSomething( const Sequence< sal_Int8 >& return nRet; } -Sequence< sal_Int8 > ODBTableDecorator::getUnoTunnelImplementationId() +Sequence< sal_Int8 > ODBTableDecorator::getUnoTunnelId() { static ::cppu::OImplementationId implId; diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx index ea0055404d64..3007b03c9fc1 100644 --- a/dbaccess/source/core/api/table.cxx +++ b/dbaccess/source/core/api/table.cxx @@ -28,6 +28,7 @@ #include <osl/diagnose.h> #include <cppuhelper/typeprovider.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/types.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/util/XRefreshListener.hpp> @@ -306,7 +307,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 (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + if (isUnoTunnelId<ODBTable>(rId)) nRet = reinterpret_cast<sal_Int64>(this); else nRet = OTable_Base::getSomething(rId); @@ -314,7 +315,7 @@ sal_Int64 SAL_CALL ODBTable::getSomething( const Sequence< sal_Int8 >& rId ) return nRet; } -Sequence< sal_Int8 > ODBTable::getUnoTunnelImplementationId() +Sequence< sal_Int8 > ODBTable::getUnoTunnelId() { static ::cppu::OImplementationId s_Id; diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx index b8e7502247f6..7737ac0b2825 100644 --- a/dbaccess/source/core/dataaccess/ContentHelper.cxx +++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx @@ -32,6 +32,7 @@ #include <ucbhelper/contentidentifier.hxx> #include "myucp_resultset.hxx" #include <com/sun/star/container/XNameContainer.hpp> +#include <comphelper/servicehelper.hxx> #include <sdbcoretools.hxx> #include <stringconstants.hxx> @@ -541,7 +542,7 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent // css::lang::XUnoTunnel sal_Int64 OContentHelper::getSomething( const Sequence< sal_Int8 > & rId ) { - if (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) + if (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 6e9a38da6552..c37994d7c0ba 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.cxx +++ b/dbaccess/source/core/dataaccess/databasecontext.cxx @@ -54,6 +54,7 @@ #include <comphelper/enumhelper.hxx> #include <comphelper/namedvaluecollection.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> @@ -731,13 +732,13 @@ void ODatabaseContext::databaseDocumentURLChange( const OUString& _rOldURL, cons sal_Int64 SAL_CALL ODatabaseContext::getSomething( const Sequence< sal_Int8 >& rId ) { - if (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + if (isUnoTunnelId<ODatabaseContext>(rId)) return reinterpret_cast<sal_Int64>(this); return 0; } -Sequence< sal_Int8 > ODatabaseContext::getUnoTunnelImplementationId() +Sequence< sal_Int8 > ODatabaseContext::getUnoTunnelId() { static ::cppu::OImplementationId implId; diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index f1f5b8a1b881..30ffe0cfadda 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -2205,7 +2205,7 @@ com_sun_star_comp_dba_ODatabaseDocument(css::uno::XComponentContext* context, Reference<XUnoTunnel> xDBContextTunnel(DatabaseContext::create(context), UNO_QUERY_THROW); dbaccess::ODatabaseContext* pContext = reinterpret_cast<dbaccess::ODatabaseContext*>( xDBContextTunnel->getSomething( - dbaccess::ODatabaseContext::getUnoTunnelImplementationId())); + dbaccess::ODatabaseContext::getUnoTunnelId())); rtl::Reference pImpl( new dbaccess::ODatabaseModelImpl(context, *pContext)); diff --git a/dbaccess/source/core/inc/TableDeco.hxx b/dbaccess/source/core/inc/TableDeco.hxx index 52d6fb05e0bb..cd1bb3161c20 100644 --- a/dbaccess/source/core/inc/TableDeco.hxx +++ b/dbaccess/source/core/inc/TableDeco.hxx @@ -147,7 +147,7 @@ namespace dbaccess virtual void SAL_CALL setName( const OUString& aName ) override; // css::lang::XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); // XColumnsSupplier virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getColumns( ) override; diff --git a/dbaccess/source/core/inc/databasecontext.hxx b/dbaccess/source/core/inc/databasecontext.hxx index c69c35084e47..19c59a953f9d 100644 --- a/dbaccess/source/core/inc/databasecontext.hxx +++ b/dbaccess/source/core/inc/databasecontext.hxx @@ -167,7 +167,7 @@ public: // css::lang::XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); void registerDatabaseDocument( ODatabaseModelImpl& _rModelImpl); void revokeDatabaseDocument( const ODatabaseModelImpl& _rModelImpl); diff --git a/dbaccess/source/core/inc/table.hxx b/dbaccess/source/core/inc/table.hxx index 0b4b284558df..883849c90156 100644 --- a/dbaccess/source/core/inc/table.hxx +++ b/dbaccess/source/core/inc/table.hxx @@ -124,7 +124,7 @@ namespace dbaccess //XTypeProvider virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); // css::lang::XServiceInfo DECLARE_SERVICE_INFO(); diff --git a/dbaccess/source/ui/inc/JoinExchange.hxx b/dbaccess/source/ui/inc/JoinExchange.hxx index 0d750a444e81..72aa0d1de73e 100644 --- a/dbaccess/source/ui/inc/JoinExchange.hxx +++ b/dbaccess/source/ui/inc/JoinExchange.hxx @@ -50,6 +50,7 @@ namespace dbaui virtual void SAL_CALL release( ) throw() override; // XUnoTunnel + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& _rIdentifier ) override; void StartDrag( vcl::Window* pWindow, sal_Int8 nDragSourceActions, IDragTransferableListener* _pListener ); @@ -62,8 +63,6 @@ namespace dbaui virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; virtual void DragFinished( sal_Int8 nDropAction ) override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); - using TransferableHelper::StartDrag; }; } diff --git a/dbaccess/source/ui/querydesign/JoinExchange.cxx b/dbaccess/source/ui/querydesign/JoinExchange.cxx index 036943fac4df..3ee2e4d34b1f 100644 --- a/dbaccess/source/ui/querydesign/JoinExchange.cxx +++ b/dbaccess/source/ui/querydesign/JoinExchange.cxx @@ -19,6 +19,7 @@ #include <JoinExchange.hxx> #include <sot/formats.hxx> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/typeprovider.hxx> namespace dbaui @@ -70,14 +71,14 @@ namespace dbaui Reference< XUnoTunnel > xTunnel(_rxObject, UNO_QUERY); if (xTunnel.is()) { - OJoinExchObj* pImplementation = reinterpret_cast<OJoinExchObj*>(xTunnel->getSomething(getUnoTunnelImplementationId())); + OJoinExchObj* pImplementation = reinterpret_cast<OJoinExchObj*>(xTunnel->getSomething(getUnoTunnelId())); if (pImplementation) aReturn = pImplementation->m_jxdSourceDescription; } return aReturn; } - Sequence< sal_Int8 > OJoinExchObj::getUnoTunnelImplementationId() + Sequence< sal_Int8 > OJoinExchObj::getUnoTunnelId() { static ::cppu::OImplementationId implId; @@ -86,7 +87,7 @@ namespace dbaui sal_Int64 SAL_CALL OJoinExchObj::getSomething( const Sequence< sal_Int8 >& _rIdentifier ) { - if (_rIdentifier.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), _rIdentifier.getConstArray(), 16 ) ) + if (isUnoTunnelId<OJoinExchObj>(_rIdentifier)) return reinterpret_cast<sal_Int64>(this); return 0; diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx index 5fd625f3191c..8ed4217b1c75 100644 --- a/forms/source/component/Columns.cxx +++ b/forms/source/component/Columns.cxx @@ -125,9 +125,7 @@ sal_Int64 SAL_CALL OGridColumn::getSomething( const Sequence<sal_Int8>& _rIdenti { sal_Int64 nReturn(0); - if ( (_rIdentifier.getLength() == 16) - && (0 == memcmp( getUnoTunnelId().getConstArray(), _rIdentifier.getConstArray(), 16 )) - ) + if ( isUnoTunnelId<OGridColumn>(_rIdentifier) ) { nReturn = reinterpret_cast<sal_Int64>(this); } diff --git a/framework/source/fwi/uielement/constitemcontainer.cxx b/framework/source/fwi/uielement/constitemcontainer.cxx index f33a4085a06e..397218a26f85 100644 --- a/framework/source/fwi/uielement/constitemcontainer.cxx +++ b/framework/source/fwi/uielement/constitemcontainer.cxx @@ -165,7 +165,7 @@ Reference< XIndexAccess > ConstItemContainer::deepCopyContainer( const Reference // XUnoTunnel sal_Int64 ConstItemContainer::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) { - if( ( rIdentifier.getLength() == 16 ) && ( 0 == memcmp( ConstItemContainer::getUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 ) ) ) + if( isUnoTunnelId<ConstItemContainer>(rIdentifier) ) { return reinterpret_cast< sal_Int64 >( this ); } diff --git a/include/connectivity/ConnectionWrapper.hxx b/include/connectivity/ConnectionWrapper.hxx index 0d6132ae02b9..b621cd041b51 100644 --- a/include/connectivity/ConnectionWrapper.hxx +++ b/include/connectivity/ConnectionWrapper.hxx @@ -67,7 +67,7 @@ namespace connectivity // css::lang::XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); /** method to create unique ids @param _rURL The URL. diff --git a/include/svl/style.hxx b/include/svl/style.hxx index 23a35f09c751..7a695948d6c5 100644 --- a/include/svl/style.hxx +++ b/include/svl/style.hxx @@ -356,10 +356,8 @@ public: static SfxUnoStyleSheet* getUnoStyleSheet( const css::uno::Reference< css::style::XStyle >& xStyle ); // XUnoTunnel + static const css::uno::Sequence< ::sal_Int8 >& getUnoTunnelId(); virtual ::sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< ::sal_Int8 >& aIdentifier ) override; - -private: - static const css::uno::Sequence< ::sal_Int8 >& getIdentifier(); }; #endif diff --git a/package/inc/ZipPackage.hxx b/package/inc/ZipPackage.hxx index ff76226896f5..d1f956068327 100644 --- a/package/inc/ZipPackage.hxx +++ b/package/inc/ZipPackage.hxx @@ -147,7 +147,7 @@ public: // XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; /// @throws css::uno::RuntimeException - static css::uno::Sequence < sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence < sal_Int8 > getUnoTunnelId(); // XPropertySet virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; diff --git a/package/inc/ZipPackageFolder.hxx b/package/inc/ZipPackageFolder.hxx index 1f65b2ca297e..c99f8f2a6b27 100644 --- a/package/inc/ZipPackageFolder.hxx +++ b/package/inc/ZipPackageFolder.hxx @@ -64,7 +64,7 @@ public: ZipContentInfo& doGetByName( const OUString& aName ); - static css::uno::Sequence < sal_Int8 > static_getImplementationId(); + static css::uno::Sequence < sal_Int8 > getUnoTunnelId(); void setPackageFormat_Impl( sal_Int32 nFormat ) { m_nFormat = nFormat; } void setRemoveOnInsertMode_Impl( bool bRemove ) { mbAllowRemoveOnInsert = bRemove; } diff --git a/package/inc/ZipPackageStream.hxx b/package/inc/ZipPackageStream.hxx index ffd791c8aca0..7f704ca59232 100644 --- a/package/inc/ZipPackageStream.hxx +++ b/package/inc/ZipPackageStream.hxx @@ -138,7 +138,7 @@ public: void setZipEntryOnLoading( const ZipEntry &rInEntry); void successfullyWritten( ZipEntry const *pEntry ); - static css::uno::Sequence < sal_Int8 > static_getImplementationId(); + static css::uno::Sequence < sal_Int8 > getUnoTunnelId(); // XActiveDataSink virtual void SAL_CALL setInputStream( const css::uno::Reference< css::io::XInputStream >& aStream ) override; diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index a7bb9e818e10..3f3858070a0c 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -80,6 +80,7 @@ #include <comphelper/sequenceashashmap.hxx> #include <cppuhelper/supportsservice.hxx> #include <comphelper/sequence.hxx> +#include <comphelper/servicehelper.hxx> using namespace std; using namespace osl; @@ -245,7 +246,7 @@ void ZipPackage::parseManifest() uno::Reference < XUnoTunnel > xUnoTunnel; aAny >>= xUnoTunnel; sal_Int64 nTest=0; - if ( (nTest = xUnoTunnel->getSomething( ZipPackageFolder::static_getImplementationId() )) != 0 ) + if ( (nTest = xUnoTunnel->getSomething( ZipPackageFolder::getUnoTunnelId() )) != 0 ) { pFolder = reinterpret_cast < ZipPackageFolder* > ( nTest ); pFolder->SetMediaType ( sMediaType ); @@ -253,7 +254,7 @@ void ZipPackage::parseManifest() } else { - pStream = reinterpret_cast < ZipPackageStream* > ( xUnoTunnel->getSomething( ZipPackageStream::static_getImplementationId() )); + pStream = reinterpret_cast < ZipPackageStream* > ( xUnoTunnel->getSomething( ZipPackageStream::getUnoTunnelId() )); pStream->SetMediaType ( sMediaType ); pStream->SetFromManifest( true ); @@ -491,7 +492,7 @@ void ZipPackage::parseContentType() uno::Any aIterAny = getByHierarchicalName( aPath ); uno::Reference < lang::XUnoTunnel > xIterTunnel; aIterAny >>= xIterTunnel; - sal_Int64 nTest = xIterTunnel->getSomething( ZipPackageStream::static_getImplementationId() ); + sal_Int64 nTest = xIterTunnel->getSomething( ZipPackageStream::getUnoTunnelId() ); if ( nTest != 0 ) { // this is a package stream, in OFOPXML format only streams can have mediatype @@ -1706,7 +1707,7 @@ uno::Reference < XSingleServiceFactory > ZipPackage::createServiceFactory( uno:: static_getSupportedServiceNames() ); } -Sequence< sal_Int8 > ZipPackage::getUnoTunnelImplementationId() +Sequence< sal_Int8 > ZipPackage::getUnoTunnelId() { static ::cppu::OImplementationId implId; @@ -1715,7 +1716,7 @@ Sequence< sal_Int8 > ZipPackage::getUnoTunnelImplementationId() sal_Int64 SAL_CALL ZipPackage::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) { - if ( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelImplementationId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) + if ( isUnoTunnelId<ZipPackage>(aIdentifier) ) return reinterpret_cast < sal_Int64 > ( this ); return 0; } diff --git a/package/source/zippackage/ZipPackageEntry.cxx b/package/source/zippackage/ZipPackageEntry.cxx index 118630eef80b..35789653b35d 100644 --- a/package/source/zippackage/ZipPackageEntry.cxx +++ b/package/source/zippackage/ZipPackageEntry.cxx @@ -94,7 +94,7 @@ void SAL_CALL ZipPackageEntry::setParent( const uno::Reference< XInterface >& xN { sal_Int64 nTest(0); uno::Reference < XUnoTunnel > xTunnel ( xNewParent, UNO_QUERY ); - if ( !xNewParent.is() || ( nTest = xTunnel->getSomething ( ZipPackageFolder::static_getImplementationId () ) ) == 0 ) + if ( !xNewParent.is() || ( nTest = xTunnel->getSomething ( ZipPackageFolder::getUnoTunnelId () ) ) == 0 ) throw NoSupportException(THROW_WHERE ); ZipPackageFolder *pNewParent = reinterpret_cast < ZipPackageFolder * > ( nTest ); diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index 0b5ae3623a62..2dfbb72dc567 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/packages/zip/ZipConstants.hpp> #include <com/sun/star/embed/StorageFormats.hpp> #include <comphelper/sequence.hxx> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> #include <osl/diagnose.h> @@ -155,7 +156,7 @@ void ZipPackageFolder::setChildStreamsTypeByExtension( const beans::StringPair& } } -css::uno::Sequence < sal_Int8 > ZipPackageFolder::static_getImplementationId() +css::uno::Sequence < sal_Int8 > ZipPackageFolder::getUnoTunnelId() { return lcl_CachedImplId::get().getImplementationId(); } @@ -173,12 +174,12 @@ void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const uno:: sal_Int64 nTest; ZipPackageEntry *pEntry; - if ( ( nTest = xRef->getSomething ( ZipPackageFolder::static_getImplementationId() ) ) != 0 ) + if ( ( nTest = xRef->getSomething ( ZipPackageFolder::getUnoTunnelId() ) ) != 0 ) { ZipPackageFolder *pFolder = reinterpret_cast < ZipPackageFolder * > ( nTest ); pEntry = static_cast < ZipPackageEntry * > ( pFolder ); } - else if ( ( nTest = xRef->getSomething ( ZipPackageStream::static_getImplementationId() ) ) != 0 ) + else if ( ( nTest = xRef->getSomething ( ZipPackageStream::getUnoTunnelId() ) ) != 0 ) { ZipPackageStream *pStream = reinterpret_cast < ZipPackageStream * > ( nTest ); pEntry = static_cast < ZipPackageEntry * > ( pStream ); @@ -357,8 +358,7 @@ void ZipPackageFolder::saveContents( sal_Int64 SAL_CALL ZipPackageFolder::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) { sal_Int64 nMe = 0; - if ( aIdentifier.getLength() == 16 && - 0 == memcmp(static_getImplementationId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) + if ( isUnoTunnelId<ZipPackageFolder>(aIdentifier) ) nMe = reinterpret_cast < sal_Int64 > ( this ); return nMe; } diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index 25c705036a6d..f685f891c649 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -46,6 +46,7 @@ #include "wrapstreamforshare.hxx" #include <comphelper/seekableinput.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/storagehelper.hxx> #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/supportsservice.hxx> @@ -76,7 +77,7 @@ using namespace cppu; namespace { struct lcl_CachedImplId : public rtl::Static< cppu::OImplementationId, lcl_CachedImplId > {}; } -css::uno::Sequence < sal_Int8 > ZipPackageStream::static_getImplementationId() +css::uno::Sequence < sal_Int8 > ZipPackageStream::getUnoTunnelId() { return lcl_CachedImplId::get().getImplementationId(); } @@ -1119,8 +1120,7 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getPlainRawStream( sal_Int64 SAL_CALL ZipPackageStream::getSomething( const Sequence< sal_Int8 >& aIdentifier ) { sal_Int64 nMe = 0; - if ( aIdentifier.getLength() == 16 && - 0 == memcmp( static_getImplementationId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) + if ( isUnoTunnelId<ZipPackageStream>(aIdentifier) ) nMe = reinterpret_cast < sal_Int64 > ( this ); return nMe; } diff --git a/reportdesign/inc/ReportDefinition.hxx b/reportdesign/inc/ReportDefinition.hxx index bdcaeb8f2552..436550c9aa3f 100644 --- a/reportdesign/inc/ReportDefinition.hxx +++ b/reportdesign/inc/ReportDefinition.hxx @@ -192,6 +192,7 @@ namespace reportdesign public: //TTTT Needed? Or same as above? + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); static std::shared_ptr<rptui::OReportModel> getSdrModel(const css::uno::Reference< css::report::XReportDefinition >& _xReportDefinition); private: @@ -354,7 +355,6 @@ namespace reportdesign // css::lang::XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); // SvxUnoDrawMSFactory virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier ) override; diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 7ac5e6e09d20..e3ef88ae80dc 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -96,6 +96,7 @@ #include <comphelper/propertystatecontainer.hxx> #include <comphelper/seqstream.hxx> #include <comphelper/sequence.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/storagehelper.hxx> #include <comphelper/uno3.hxx> #include <connectivity/CommonTools.hxx> @@ -1937,7 +1938,7 @@ uno::Sequence< OUString > SAL_CALL OReportDefinition::getAvailableMimeTypes( ) sal_Int64 SAL_CALL OReportDefinition::getSomething( const uno::Sequence< sal_Int8 >& rId ) { sal_Int64 nRet = 0; - if (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) + if (isUnoTunnelId<OReportDefinition>(rId) ) nRet = reinterpret_cast<sal_Int64>(this); else { @@ -1961,7 +1962,7 @@ uno::Sequence< sal_Int8 > SAL_CALL OReportDefinition::getImplementationId( ) return css::uno::Sequence<sal_Int8>(); } -uno::Sequence< sal_Int8 > OReportDefinition::getUnoTunnelImplementationId() +uno::Sequence< sal_Int8 > OReportDefinition::getUnoTunnelId() { static ::cppu::OImplementationId implId; @@ -1982,7 +1983,7 @@ std::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel(const uno::R if( xUT.is() ) pReportModel = reinterpret_cast<OReportDefinition*>( sal::static_int_cast<sal_uIntPtr>( - xUT->getSomething( OReportDefinition::getUnoTunnelImplementationId())) + xUT->getSomething( OReportDefinition::getUnoTunnelId())) )->m_pImpl->m_pReportModel; return pReportModel; } diff --git a/reportdesign/source/core/api/Section.cxx b/reportdesign/source/core/api/Section.cxx index 1ad60a62e38e..6aa10a6acaa2 100644 --- a/reportdesign/source/core/api/Section.cxx +++ b/reportdesign/source/core/api/Section.cxx @@ -571,7 +571,7 @@ sal_Bool SAL_CALL OSection::hasForms() sal_Int64 OSection::getSomething( const uno::Sequence< sal_Int8 > & rId ) { - if (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) + if (isUnoTunnelId<OSection>(rId) ) return reinterpret_cast<sal_Int64>(this); return (m_xDrawPage_Tunnel.is()) ? m_xDrawPage_Tunnel->getSomething(rId) : 0; } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index bbca0b5b6de0..ab464f2cde3d 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -2860,9 +2860,7 @@ sal_Int64 SAL_CALL ScModelObj::getSomething( return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); } - if ( rId.getLength() == 16 && - 0 == memcmp( SfxObjectShell::getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if ( isUnoTunnelId<SfxObjectShell>(rId) ) { return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(pDocShell )); } diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx index edfa6bfa3e7d..7665a226ef9b 100644 --- a/sc/source/ui/vba/vbaworkbook.cxx +++ b/sc/source/ui/vba/vbaworkbook.cxx @@ -410,8 +410,7 @@ ScVbaWorkbook::getCodeName() sal_Int64 ScVbaWorkbook::getSomething(const uno::Sequence<sal_Int8 >& rId ) { - if (rId.getLength() == 16 && - 0 == memcmp( ScVbaWorksheet::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 )) + if (isUnoTunnelId<ScVbaWorksheet>(rId)) { return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); } diff --git a/sd/source/ui/inc/ViewTabBar.hxx b/sd/source/ui/inc/ViewTabBar.hxx index 3401966657a5..4d205fb88dc0 100644 --- a/sd/source/ui/inc/ViewTabBar.hxx +++ b/sd/source/ui/inc/ViewTabBar.hxx @@ -110,6 +110,8 @@ public: //----- XUnoTunnel -------------------------------------------------------- + static const css::uno::Sequence<sal_Int8>& getUnoTunnelId(); + virtual sal_Int64 SAL_CALL getSomething (const css::uno::Sequence<sal_Int8>& rId) override; /** The returned value is calculated as the difference between the @@ -159,7 +161,6 @@ private: static vcl::Window* GetAnchorWindow( const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewTabBarId, const css::uno::Reference<css::frame::XController>& rxController); - static const css::uno::Sequence<sal_Int8>& getUnoTunnelId(); }; } // end of namespace sd diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 20bdfbd110e4..c3c54fd2ef59 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -350,13 +350,13 @@ const css::uno::Sequence< sal_Int8 > & SdXImpressDocument::getUnoTunnelId() thro sal_Int64 SAL_CALL SdXImpressDocument::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) { - if( rIdentifier.getLength() == 16 ) - { - if( 0 == memcmp( SdXImpressDocument::getUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 ) ) - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); + if( isUnoTunnelId<SdXImpressDocument>(rIdentifier) ) + return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); - if( 0 == memcmp( SdrModel::getUnoTunnelImplementationId().getConstArray(), rIdentifier.getConstArray(), 16 ) ) - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(mpDoc)); + if( (rIdentifier.getLength() == 16) && + (0 == memcmp( SdrModel::getUnoTunnelImplementationId().getConstArray(), rIdentifier.getConstArray(), 16 ))) + { + return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(mpDoc)); } return SfxBaseModel::getSomething( rIdentifier ); diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx index 969a59aa689d..9c9abdabb2c1 100644 --- a/sd/source/ui/view/ViewTabBar.cxx +++ b/sd/source/ui/view/ViewTabBar.cxx @@ -314,8 +314,7 @@ sal_Int64 SAL_CALL ViewTabBar::getSomething (const Sequence<sal_Int8>& rId) { sal_Int64 nResult = 0; - if (rId.getLength() == 16 - && memcmp(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0) + if (isUnoTunnelId<ViewTabBar>(rId)) { nResult = reinterpret_cast<sal_Int64>(this); } diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx index 91b31ebc8a92..afb49746f496 100644 --- a/sfx2/source/control/thumbnailviewacc.cxx +++ b/sfx2/source/control/thumbnailviewacc.cxx @@ -486,7 +486,7 @@ sal_Int64 SAL_CALL ThumbnailViewAcc::getSomething( const uno::Sequence< sal_Int8 { sal_Int64 nRet; - if( ( rId.getLength() == 16 ) && ( 0 == memcmp( ThumbnailViewAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) + if( isUnoTunnelId<ThumbnailViewAcc>(rId) ) nRet = reinterpret_cast< sal_Int64 >( this ); else nRet = 0; @@ -946,7 +946,7 @@ sal_Int64 SAL_CALL SfxThumbnailViewAcc::getSomething( const uno::Sequence< sal_I { sal_Int64 nRet; - if( ( rId.getLength() == 16 ) && ( 0 == memcmp( SfxThumbnailViewAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) + if( isUnoTunnelId<SfxThumbnailViewAcc>(rId) ) nRet = reinterpret_cast< sal_Int64 >( this ); else nRet = 0; @@ -1354,7 +1354,7 @@ sal_Int64 SAL_CALL ThumbnailViewItemAcc::getSomething( const uno::Sequence< sal_ { sal_Int64 nRet; - if( ( rId.getLength() == 16 ) && ( 0 == memcmp( ThumbnailViewItemAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) + if( isUnoTunnelId<ThumbnailViewItemAcc>(rId) ) nRet = reinterpret_cast< sal_Int64 >( this ); else nRet = 0; diff --git a/sfx2/source/control/thumbnailviewacc.hxx b/sfx2/source/control/thumbnailviewacc.hxx index 5eab7ffd9255..4d3f0d7ef181 100644 --- a/sfx2/source/control/thumbnailviewacc.hxx +++ b/sfx2/source/control/thumbnailviewacc.hxx @@ -118,6 +118,7 @@ public: virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) override; // XUnoTunnel + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override; private: @@ -127,8 +128,6 @@ private: /// The current FOCUSED state. bool mbIsFocused; - static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); - /** Tell all listeners that the object is dying. This callback is usually called from the WeakComponentImplHelper class. */ @@ -210,6 +209,7 @@ public: virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) override; // XUnoTunnel + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override; private: @@ -217,8 +217,6 @@ private: css::accessibility::XAccessibleEventListener > > mxEventListeners; SfxThumbnailView* mpParent; - static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); - /** Tell all listeners that the object is dying. This callback is usually called from the WeakComponentImplHelper class. */ @@ -264,8 +262,6 @@ private: ThumbnailViewItem* mpParent; bool const mbIsTransientChildrenDisabled; - static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); - public: ThumbnailViewItemAcc( ThumbnailViewItem* pParent, bool bIsTransientChildrenDisabled ); @@ -308,6 +304,7 @@ public: virtual sal_Int32 SAL_CALL getBackground( ) override; // XUnoTunnel + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override; }; diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index d206c17ba6bd..beeaa5610432 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -917,7 +917,7 @@ SfxUnoStyleSheet* SfxUnoStyleSheet::getUnoStyleSheet( const css::uno::Reference< { 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::getIdentifier()))); + pRet = reinterpret_cast<SfxUnoStyleSheet*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( SfxUnoStyleSheet::getUnoTunnelId()))); } return pRet; } @@ -927,14 +927,12 @@ SfxUnoStyleSheet* SfxUnoStyleSheet::getUnoStyleSheet( const css::uno::Reference< */ ::sal_Int64 SAL_CALL SfxUnoStyleSheet::getSomething( const css::uno::Sequence< ::sal_Int8 >& rId ) { - if( rId.getLength() == 16 && 0 == memcmp( getIdentifier().getConstArray(), rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SfxUnoStyleSheet>(rId) ) { return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); } - else - { - return 0; - } + + return 0; } void @@ -948,7 +946,7 @@ namespace class theSfxUnoStyleSheetIdentifier : public rtl::Static< UnoTunnelIdInit, theSfxUnoStyleSheetIdentifier > {}; } -const css::uno::Sequence< ::sal_Int8 >& SfxUnoStyleSheet::getIdentifier() +const css::uno::Sequence< ::sal_Int8 >& SfxUnoStyleSheet::getUnoTunnelId() { return theSfxUnoStyleSheetIdentifier::get().getSeq(); } diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 50ae750f068b..08838f343d1a 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -602,7 +602,7 @@ sal_Int64 SAL_CALL ValueSetAcc::getSomething( const uno::Sequence< sal_Int8 >& r { sal_Int64 nRet; - if( ( rId.getLength() == 16 ) && ( 0 == memcmp( ValueSetAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) + if( isUnoTunnelId<ValueSetAcc>(rId) ) nRet = reinterpret_cast< sal_Int64 >( this ); else nRet = 0; @@ -1056,7 +1056,7 @@ sal_Int64 SAL_CALL ValueItemAcc::getSomething( const uno::Sequence< sal_Int8 >& { sal_Int64 nRet; - if( ( rId.getLength() == 16 ) && ( 0 == memcmp( ValueItemAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) + if( isUnoTunnelId<ValueItemAcc>(rId) ) nRet = reinterpret_cast< sal_Int64 >( this ); else nRet = 0; @@ -1405,7 +1405,7 @@ sal_Int64 SAL_CALL SvtValueItemAcc::getSomething( const uno::Sequence< sal_Int8 { sal_Int64 nRet; - if( ( rId.getLength() == 16 ) && ( 0 == memcmp( SvtValueItemAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) + if( isUnoTunnelId<SvtValueItemAcc>(rId) ) nRet = reinterpret_cast< sal_Int64 >( this ); else nRet = 0; @@ -1929,7 +1929,7 @@ sal_Int64 SAL_CALL SvtValueSetAcc::getSomething( const uno::Sequence< sal_Int8 > { sal_Int64 nRet; - if( ( rId.getLength() == 16 ) && ( 0 == memcmp( SvtValueSetAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) + if( isUnoTunnelId<SvtValueSetAcc>(rId) ) nRet = reinterpret_cast< sal_Int64 >( this ); else nRet = 0; diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx index 635a7d0da624..840d92fda434 100644 --- a/svtools/source/control/valueimp.hxx +++ b/svtools/source/control/valueimp.hxx @@ -165,6 +165,7 @@ public: virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) override; // XUnoTunnel + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override; private: @@ -174,8 +175,6 @@ private: /// The current FOCUSED state. bool mbIsFocused; - static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); - /** Tell all listeners that the object is dying. This callback is usually called from the WeakComponentImplHelper class. */ @@ -279,6 +278,7 @@ public: virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) override; // XUnoTunnel + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override; private: @@ -288,8 +288,6 @@ private: /// The current FOCUSED state. bool mbIsFocused; - static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); - /** Tell all listeners that the object is dying. This callback is usually called from the WeakComponentImplHelper class. */ @@ -342,8 +340,6 @@ private: ValueSetItem* mpParent; bool const mbIsTransientChildrenDisabled; - static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); - public: ValueItemAcc( ValueSetItem* pParent, bool bIsTransientChildrenDisabled ); @@ -388,6 +384,7 @@ public: virtual sal_Int32 SAL_CALL getBackground( ) override; // XUnoTunnel + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override; }; @@ -405,8 +402,6 @@ private: SvtValueSetItem* mpParent; bool const mbIsTransientChildrenDisabled; - static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); - public: SvtValueItemAcc(SvtValueSetItem* pParent, bool bIsTransientChildrenDisabled); @@ -451,6 +446,7 @@ public: virtual sal_Int32 SAL_CALL getBackground( ) override; // XUnoTunnel + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override; }; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 6dd0738d85d1..5b0239d177af 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -302,9 +302,7 @@ sal_Int64 SAL_CALL SwXTextDocument::getSomething( const Sequence< sal_Int8 >& rI { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); } - if( rId.getLength() == 16 - && 0 == memcmp( SfxObjectShell::getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SfxObjectShell>(rId) ) { return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(pDocShell )); } diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx index bf18360abc16..485c7701be6d 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx @@ -107,7 +107,7 @@ SAL_CALL XMLSignature_MSCryptImpl::generate( } Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY_THROW ) ; - XMLElementWrapper_XmlSecImpl* pElement = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>(xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() )); + XMLElementWrapper_XmlSecImpl* pElement = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>(xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelId() )); if( pElement == nullptr ) { throw RuntimeException() ; } @@ -195,7 +195,7 @@ SAL_CALL XMLSignature_MSCryptImpl::validate( throw RuntimeException() ; Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY_THROW ) ; - XMLElementWrapper_XmlSecImpl* pElement = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>(xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() )); + XMLElementWrapper_XmlSecImpl* pElement = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>(xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelId() )); if( pElement == nullptr ) throw RuntimeException() ; diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx index f3a76c76e099..c39f6cc72f76 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx @@ -105,7 +105,7 @@ SAL_CALL XMLSignature_NssImpl::generate( XMLElementWrapper_XmlSecImpl* pElement = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>( sal::static_int_cast<sal_uIntPtr>( - xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ))); + xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelId() ))); if( pElement == nullptr ) { throw RuntimeException() ; } @@ -193,7 +193,7 @@ SAL_CALL XMLSignature_NssImpl::validate( XMLElementWrapper_XmlSecImpl* pElement = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>( sal::static_int_cast<sal_uIntPtr>( - xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ))); + xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelId() ))); if( pElement == nullptr ) throw RuntimeException() ; diff --git a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx index a2ebb134d1e5..5d57ff0709e6 100644 --- a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx +++ b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx @@ -380,7 +380,7 @@ xmlNodePtr XMLDocumentWrapper_XmlSecImpl::checkElement( const uno::Reference< cs = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>( sal::static_int_cast<sal_uIntPtr>( xNodTunnel->getSomething( - XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ))) ; + XMLElementWrapper_XmlSecImpl::getUnoTunnelId() ))) ; if( pElement == nullptr ) { throw uno::RuntimeException() ; diff --git a/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx index 31085431b453..01f8df70230c 100644 --- a/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx +++ b/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx @@ -20,6 +20,7 @@ #include <string.h> #include "xmlelementwrapper_xmlsecimpl.hxx" +#include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> @@ -33,7 +34,7 @@ XMLElementWrapper_XmlSecImpl::XMLElementWrapper_XmlSecImpl(const xmlNodePtr pNod } /* XUnoTunnel */ -uno::Sequence< sal_Int8 > XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() +uno::Sequence< sal_Int8 > XMLElementWrapper_XmlSecImpl::getUnoTunnelId() { static ::cppu::OImplementationId implId; @@ -42,18 +43,12 @@ uno::Sequence< sal_Int8 > XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementati sal_Int64 SAL_CALL XMLElementWrapper_XmlSecImpl::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) { - if (aIdentifier.getLength() == 16 && - 0 == memcmp( - getUnoTunnelImplementationId().getConstArray(), - aIdentifier.getConstArray(), - 16 )) + if (isUnoTunnelId<XMLElementWrapper_XmlSecImpl>(aIdentifier)) { return reinterpret_cast < sal_Int64 > ( this ); } - else - { - return 0; - } + + return 0; } /* XServiceInfo */ diff --git a/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.hxx b/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.hxx index 35c584203b63..43815a224ff8 100644 --- a/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.hxx +++ b/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.hxx @@ -56,7 +56,7 @@ public: /* css::lang::XUnoTunnel */ virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; /// @throws css::uno::RuntimeException - static css::uno::Sequence < sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence < sal_Int8 > getUnoTunnelId(); /* css::lang::XServiceInfo */ virtual OUString SAL_CALL getImplementationName( ) override; |