diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-09-14 08:19:47 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-09-15 06:07:36 +0200 |
commit | 05bc93db2de56000f65764d7e394d03747cac23d (patch) | |
tree | 975de9ae83572aac8a5c3ea8db281e1017ee5be0 /xmloff | |
parent | 8cbb414ed737f9ffc76e1258e6671769bf63fc6c (diff) |
Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 1
The header got some changes:
1. Move UnoTunnelIdInit and isUnoTunnelId into 'comphelper' namespace
2. Rename UnoTunnelIdInit to UnoIdInit, as a precondition to replace
of uses of OImplementationId with it, including in XTypeProvider
3. Introduce convenience functions 'getSomething_cast' to cast between
sal_Int64 and object pointers uniformly.
4. Rename getUnoTunnelImplementation to getFromUnoTunnel, both to make
it a bit shorter, and to reflect its function better. Templatize it
to take also css::uno::Any for convenience.
5. Introduce getSomethingImpl, inspired by sw::UnoTunnelImpl; allow it
handle cases both with and without fallback to parent.
6. Adjust UNO3_GETIMPLEMENTATION_* macros
TODO (in separate commits):
- Drop sw::UnoTunnelImpl and sw::UnoTunnelGetImplementation
- Replace all uses of OImplementationId in core with UnoIdInit
- Deprecate OImplementationId in <cppuhelper/typeprovider.hxx>
- Change implementations of getSomething to use getSomethingImpl
- Revise uses of getSomething to use getFromUnoTunnel
Change-Id: If4a3cb024130f1f552f988f0479589da1cd066e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122022
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/attrlist.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/core/unoatrcn.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/core/xmlimp.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/style/xmlnumfe.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/style/xmlnumfi.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/transform/MutableAttrList.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/transform/OOo2Oasis.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/transform/Oasis2OOo.cxx | 4 |
8 files changed, 16 insertions, 16 deletions
diff --git a/xmloff/source/core/attrlist.cxx b/xmloff/source/core/attrlist.cxx index 0a1956db8775..3f9fbb6a8634 100644 --- a/xmloff/source/core/attrlist.cxx +++ b/xmloff/source/core/attrlist.cxx @@ -46,7 +46,7 @@ SvXMLAttributeList::SvXMLAttributeList( const SvXMLAttributeList &r ) : SvXMLAttributeList::SvXMLAttributeList( const uno::Reference< xml::sax::XAttributeList> & rAttrList ) { SvXMLAttributeList* pImpl = - comphelper::getUnoTunnelImplementation<SvXMLAttributeList>( rAttrList ); + comphelper::getFromUnoTunnel<SvXMLAttributeList>( rAttrList ); if( pImpl ) vecAttribute = pImpl->vecAttribute; diff --git a/xmloff/source/core/unoatrcn.cxx b/xmloff/source/core/unoatrcn.cxx index 001033b711c3..1745e73f4bf0 100644 --- a/xmloff/source/core/unoatrcn.cxx +++ b/xmloff/source/core/unoatrcn.cxx @@ -88,13 +88,13 @@ sal_uInt16 SvUnoAttributeContainer::getIndexByName(const OUString& aName ) const const css::uno::Sequence< sal_Int8 > & SvUnoAttributeContainer::getUnoTunnelId() noexcept { - static const UnoTunnelIdInit theSvUnoAttributeContainerUnoTunnelId; + static const comphelper::UnoIdInit theSvUnoAttributeContainerUnoTunnelId; return theSvUnoAttributeContainerUnoTunnelId.getSeq(); } sal_Int64 SAL_CALL SvUnoAttributeContainer::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { - if( isUnoTunnelId<SvUnoAttributeContainer>(rId) ) + if( comphelper::isUnoTunnelId<SvUnoAttributeContainer>(rId) ) { return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); } diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index ea5e88b47603..4957fad331f8 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -467,14 +467,14 @@ bool SvXMLImport::addEmbeddedFont(const css::uno::Reference< css::io::XInputStre const css::uno::Sequence<sal_Int8>& SvXMLImport::getUnoTunnelId() noexcept { - static const UnoTunnelIdInit theSvXMLImportUnoTunnelId; + static const comphelper::UnoIdInit theSvXMLImportUnoTunnelId; return theSvXMLImportUnoTunnelId.getSeq(); } // XUnoTunnel sal_Int64 SAL_CALL SvXMLImport::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( isUnoTunnelId<SvXMLImport>(rId) ) + if( comphelper::isUnoTunnelId<SvXMLImport>(rId) ) { return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); } @@ -988,7 +988,7 @@ void SAL_CALL SvXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen uno::Any aAny = mxImportInfo->getPropertyValue(sPropName); aAny >>= xIfc; - StyleMap *pSMap = comphelper::getUnoTunnelImplementation<StyleMap>( xIfc ); + StyleMap *pSMap = comphelper::getFromUnoTunnel<StyleMap>( xIfc ); if( pSMap ) { mpStyleMap = pSMap; diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index caba160252f3..990cf15461a7 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -215,7 +215,7 @@ SvXMLNumFmtExport::SvXMLNumFmtExport( { // supplier must be SvNumberFormatsSupplierObj SvNumberFormatsSupplierObj* pObj = - comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>( rSupp ); + comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>( rSupp ); if (pObj) pFormatter = pObj->GetNumberFormatter(); @@ -248,7 +248,7 @@ SvXMLNumFmtExport::SvXMLNumFmtExport( { // supplier must be SvNumberFormatsSupplierObj SvNumberFormatsSupplierObj* pObj = - comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>( rSupp ); + comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>( rSupp ); if (pObj) pFormatter = pObj->GetNumberFormatter(); diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index af65c302054b..4563efa9173d 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -1448,7 +1448,7 @@ sal_Int32 SvXMLNumFormatContext::CreateAndInsert( css::uno::Reference< css::util { SvNumberFormatter* pFormatter = nullptr; SvNumberFormatsSupplierObj* pObj = - comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>( xFormatsSupplier ); + comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>( xFormatsSupplier ); if (pObj) pFormatter = pObj->GetNumberFormatter(); @@ -2150,7 +2150,7 @@ SvXMLNumFmtHelper::SvXMLNumFmtHelper( SvNumberFormatter* pFormatter = nullptr; SvNumberFormatsSupplierObj* pObj = - comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>( rSupp ); + comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>( rSupp ); if (pObj) pFormatter = pObj->GetNumberFormatter(); diff --git a/xmloff/source/transform/MutableAttrList.cxx b/xmloff/source/transform/MutableAttrList.cxx index fc11fb964716..9373055ab1df 100644 --- a/xmloff/source/transform/MutableAttrList.cxx +++ b/xmloff/source/transform/MutableAttrList.cxx @@ -59,7 +59,7 @@ XMLMutableAttributeList::~XMLMutableAttributeList() const css::uno::Sequence<sal_Int8>& XMLMutableAttributeList::getUnoTunnelId() noexcept { - static const UnoTunnelIdInit theXMLMutableAttributeListUnoTunnelId; + static const comphelper::UnoIdInit theXMLMutableAttributeListUnoTunnelId; return theXMLMutableAttributeListUnoTunnelId.getSeq(); } @@ -67,7 +67,7 @@ const css::uno::Sequence<sal_Int8>& XMLMutableAttributeList::getUnoTunnelId() no sal_Int64 SAL_CALL XMLMutableAttributeList::getSomething( const Sequence< sal_Int8 >& rId ) { - if( isUnoTunnelId<XMLMutableAttributeList>(rId) ) + if( comphelper::isUnoTunnelId<XMLMutableAttributeList>(rId) ) { return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); } diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx index 5495864bf120..243fd6b708db 100644 --- a/xmloff/source/transform/OOo2Oasis.cxx +++ b/xmloff/source/transform/OOo2Oasis.cxx @@ -1946,14 +1946,14 @@ void OOo2OasisTransformer::Initialize( const css::uno::Sequence<sal_Int8>& OOo2OasisTransformer::getUnoTunnelId() noexcept { - static const UnoTunnelIdInit theOOo2OasisTransformerUnoTunnelId; + static const comphelper::UnoIdInit theOOo2OasisTransformerUnoTunnelId; return theOOo2OasisTransformerUnoTunnelId.getSeq(); } // XUnoTunnel sal_Int64 SAL_CALL OOo2OasisTransformer::getSomething( const Sequence< sal_Int8 >& rId ) { - if( isUnoTunnelId<OOo2OasisTransformer>(rId) ) + if( comphelper::isUnoTunnelId<OOo2OasisTransformer>(rId) ) { return reinterpret_cast< sal_Int64 >( this ); } diff --git a/xmloff/source/transform/Oasis2OOo.cxx b/xmloff/source/transform/Oasis2OOo.cxx index ceb5daeffcfd..5c9cd31a9372 100644 --- a/xmloff/source/transform/Oasis2OOo.cxx +++ b/xmloff/source/transform/Oasis2OOo.cxx @@ -1945,14 +1945,14 @@ Oasis2OOoTransformer::~Oasis2OOoTransformer() noexcept const css::uno::Sequence<sal_Int8>& Oasis2OOoTransformer::getUnoTunnelId() noexcept { - static const class UnoTunnelIdInit theOasis2OOoTransformerUnoTunnelId; + static const class comphelper::UnoIdInit theOasis2OOoTransformerUnoTunnelId; return theOasis2OOoTransformerUnoTunnelId.getSeq(); } // XUnoTunnel sal_Int64 SAL_CALL Oasis2OOoTransformer::getSomething( const Sequence< sal_Int8 >& rId ) { - if( isUnoTunnelId<Oasis2OOoTransformer>(rId) ) + if( comphelper::isUnoTunnelId<Oasis2OOoTransformer>(rId) ) { return reinterpret_cast< sal_Int64 >( this ); } |