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 /forms | |
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 'forms')
-rw-r--r-- | forms/source/component/Columns.cxx | 4 | ||||
-rw-r--r-- | forms/source/component/Grid.cxx | 6 | ||||
-rw-r--r-- | forms/source/richtext/richtextcontrol.cxx | 2 | ||||
-rw-r--r-- | forms/source/richtext/richtextmodel.cxx | 2 | ||||
-rw-r--r-- | forms/source/solar/component/navbarcontrol.cxx | 2 | ||||
-rw-r--r-- | forms/source/xforms/binding.cxx | 2 | ||||
-rw-r--r-- | forms/source/xforms/model.cxx | 8 | ||||
-rw-r--r-- | forms/source/xforms/model_helper.hxx | 12 | ||||
-rw-r--r-- | forms/source/xforms/model_ui.cxx | 8 | ||||
-rw-r--r-- | forms/source/xforms/submission.cxx | 10 |
10 files changed, 28 insertions, 28 deletions
diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx index 8b3748e99ecc..0dbe216cc506 100644 --- a/forms/source/component/Columns.cxx +++ b/forms/source/component/Columns.cxx @@ -108,7 +108,7 @@ sal_Int32 getColumnTypeByModelName(const OUString& aModelName) const Sequence<sal_Int8>& OGridColumn::getUnoTunnelId() { - static const UnoTunnelIdInit theOGridColumnImplementationId; + static const comphelper::UnoIdInit theOGridColumnImplementationId; return theOGridColumnImplementationId.getSeq(); } @@ -117,7 +117,7 @@ sal_Int64 SAL_CALL OGridColumn::getSomething( const Sequence<sal_Int8>& _rIdenti { sal_Int64 nReturn(0); - if ( isUnoTunnelId<OGridColumn>(_rIdentifier) ) + if ( comphelper::isUnoTunnelId<OGridColumn>(_rIdentifier) ) { nReturn = reinterpret_cast<sal_Int64>(this); } diff --git a/forms/source/component/Grid.cxx b/forms/source/component/Grid.cxx index 041fd89c77d0..b92f763d578e 100644 --- a/forms/source/component/Grid.cxx +++ b/forms/source/component/Grid.cxx @@ -739,7 +739,7 @@ ElementDescription* OGridControlModel::createElementMetaData( ) void OGridControlModel::approveNewElement( const Reference< XPropertySet >& _rxObject, ElementDescription* _pElement ) { - OGridColumn* pCol = comphelper::getUnoTunnelImplementation<OGridColumn>( _rxObject ); + OGridColumn* pCol = comphelper::getFromUnoTunnel<OGridColumn>( _rxObject ); if ( !pCol ) throw IllegalArgumentException(); OInterfaceContainer::approveNewElement( _rxObject, _pElement ); @@ -763,7 +763,7 @@ void OGridControlModel::write(const Reference<XObjectOutputStream>& _rxOutStream for (sal_Int32 i = 0; i < nLen; i++) { // first the service name for the underlying model - OGridColumn* pCol = comphelper::getUnoTunnelImplementation<OGridColumn>(m_aItems[i]); + OGridColumn* pCol = comphelper::getFromUnoTunnel<OGridColumn>(m_aItems[i]); DBG_ASSERT(pCol != nullptr, "OGridControlModel::write : such items should never reach it into my container !"); _rxOutStream << pCol->getModelName(); // then the object itself @@ -867,7 +867,7 @@ void OGridControlModel::read(const Reference<XObjectInputStream>& _rxInStream) sal_Int32 nMark = xMark->createMark(); if (xCol.is()) { - OGridColumn* pCol = comphelper::getUnoTunnelImplementation<OGridColumn>(xCol); + OGridColumn* pCol = comphelper::getFromUnoTunnel<OGridColumn>(xCol); pCol->read(_rxInStream); } xMark->jumpToMark(nMark); diff --git a/forms/source/richtext/richtextcontrol.cxx b/forms/source/richtext/richtextcontrol.cxx index e6416ca2d0da..bc3dbfe6002b 100644 --- a/forms/source/richtext/richtextcontrol.cxx +++ b/forms/source/richtext/richtextcontrol.cxx @@ -176,7 +176,7 @@ namespace frm vcl::Window* pParentWin = nullptr; if ( _rParentPeer.is() ) { - VCLXWindow* pParentXWin = comphelper::getUnoTunnelImplementation<VCLXWindow>( _rParentPeer ); + VCLXWindow* pParentXWin = comphelper::getFromUnoTunnel<VCLXWindow>( _rParentPeer ); if ( pParentXWin ) pParentWin = pParentXWin->GetWindow(); DBG_ASSERT( pParentWin, "ORichTextControl::createPeer: could not obtain the VCL-level parent window!" ); diff --git a/forms/source/richtext/richtextmodel.cxx b/forms/source/richtext/richtextmodel.cxx index 4c5f0c6af706..3e2930d1bfeb 100644 --- a/forms/source/richtext/richtextmodel.cxx +++ b/forms/source/richtext/richtextmodel.cxx @@ -548,7 +548,7 @@ namespace frm sal_Int64 SAL_CALL ORichTextModel::getSomething( const Sequence< sal_Int8 >& _rId ) { - if (isUnoTunnelId<ORichTextModel>(_rId)) + if (comphelper::isUnoTunnelId<ORichTextModel>(_rId)) return reinterpret_cast< sal_Int64 >( m_pEngine.get() ); Reference< XUnoTunnel > xAggTunnel; diff --git a/forms/source/solar/component/navbarcontrol.cxx b/forms/source/solar/component/navbarcontrol.cxx index 92d7ac4635cc..af8c6d561d55 100644 --- a/forms/source/solar/component/navbarcontrol.cxx +++ b/forms/source/solar/component/navbarcontrol.cxx @@ -123,7 +123,7 @@ namespace frm vcl::Window* pParentWin = nullptr; if ( _rParentPeer.is() ) { - VCLXWindow* pParentXWin = comphelper::getUnoTunnelImplementation<VCLXWindow>( _rParentPeer ); + VCLXWindow* pParentXWin = comphelper::getFromUnoTunnel<VCLXWindow>( _rParentPeer ); if ( pParentXWin ) pParentWin = pParentXWin->GetWindow(); DBG_ASSERT( pParentWin, "ONavigationBarControl::createPeer: could not obtain the VCL-level parent window!" ); diff --git a/forms/source/xforms/binding.cxx b/forms/source/xforms/binding.cxx index adb66aba283c..6b29e26685b7 100644 --- a/forms/source/xforms/binding.cxx +++ b/forms/source/xforms/binding.cxx @@ -449,7 +449,7 @@ bool Binding::isLive() const Model* Binding::getModelImpl() const { - return comphelper::getUnoTunnelImplementation<Model>( mxModel ); + return comphelper::getFromUnoTunnel<Model>( mxModel ); } static void lcl_addListenerToNode( const Reference<XNode>& xNode, diff --git a/forms/source/xforms/model.cxx b/forms/source/xforms/model.cxx index 6320ff732229..f3bad8a5f323 100644 --- a/forms/source/xforms/model.cxx +++ b/forms/source/xforms/model.cxx @@ -230,7 +230,7 @@ void Model::rebind() sal_Int32 nCount = mxBindings->countItems(); for( sal_Int32 i = 0; i < nCount; i++ ) { - Binding* pBind = comphelper::getUnoTunnelImplementation<Binding>( mxBindings->Collection<XPropertySet_t>::getItem( i ) ); + Binding* pBind = comphelper::getFromUnoTunnel<Binding>( mxBindings->Collection<XPropertySet_t>::getItem( i ) ); OSL_ENSURE( pBind != nullptr, "binding?" ); pBind->update(); } @@ -243,7 +243,7 @@ void Model::deferNotifications( bool bDefer ) sal_Int32 nCount = mxBindings->countItems(); for( sal_Int32 i = 0; i < nCount; i++ ) { - Binding* pBind = comphelper::getUnoTunnelImplementation<Binding>( mxBindings->Collection<XPropertySet_t>::getItem( i ) ); + Binding* pBind = comphelper::getFromUnoTunnel<Binding>( mxBindings->Collection<XPropertySet_t>::getItem( i ) ); OSL_ENSURE( pBind != nullptr, "binding?" ); pBind->deferNotifications( bDefer ); } @@ -366,7 +366,7 @@ bool Model::isValid() const sal_Int32 nCount = mxBindings->countItems(); for( sal_Int32 i = 0; bValid && i < nCount; i++ ) { - Binding* pBind = comphelper::getUnoTunnelImplementation<Binding>( mxBindings->Collection<XPropertySet_t>::getItem( i ) ); + Binding* pBind = comphelper::getFromUnoTunnel<Binding>( mxBindings->Collection<XPropertySet_t>::getItem( i ) ); OSL_ENSURE( pBind != nullptr, "binding?" ); bValid = pBind->isValid(); } @@ -434,7 +434,7 @@ void SAL_CALL Model::submitWithInteraction( if( mxSubmissions->hasItem( sID ) ) { Submission* pSubmission = - comphelper::getUnoTunnelImplementation<Submission>( mxSubmissions->getItem( sID ) ); + comphelper::getFromUnoTunnel<Submission>( mxSubmissions->getItem( sID ) ); OSL_ENSURE( pSubmission != nullptr, "no submission?" ); OSL_ENSURE( pSubmission->getModel() == Reference<XModel>( this ), "wrong model" ); diff --git a/forms/source/xforms/model_helper.hxx b/forms/source/xforms/model_helper.hxx index 6e0c90a07fd8..d8e98c98ec26 100644 --- a/forms/source/xforms/model_helper.hxx +++ b/forms/source/xforms/model_helper.hxx @@ -56,20 +56,20 @@ public: virtual bool isValid( const T& t ) const override { - return comphelper::getUnoTunnelImplementation<Binding>( t ) != nullptr; + return comphelper::getFromUnoTunnel<Binding>( t ) != nullptr; } protected: virtual void _insert( const T& t ) override { - auto pBinding = comphelper::getUnoTunnelImplementation<Binding>( t ); + auto pBinding = comphelper::getFromUnoTunnel<Binding>( t ); OSL_ENSURE( pBinding != nullptr, "invalid item?" ); pBinding->_setModel( css::uno::Reference<css::xforms::XModel>( mpModel ) ); } virtual void _remove( const T& t ) override { - auto pBinding = comphelper::getUnoTunnelImplementation<Binding>( t ); + auto pBinding = comphelper::getFromUnoTunnel<Binding>( t ); OSL_ENSURE( pBinding != nullptr, "invalid item?" ); pBinding->_setModel( css::uno::Reference<css::xforms::XModel>() ); } @@ -84,20 +84,20 @@ public: virtual bool isValid( const T& t ) const override { - return comphelper::getUnoTunnelImplementation<Submission>( t ) != nullptr; + return comphelper::getFromUnoTunnel<Submission>( t ) != nullptr; } protected: virtual void _insert( const T& t ) override { - auto pSubmission = comphelper::getUnoTunnelImplementation<Submission>( t ); + auto pSubmission = comphelper::getFromUnoTunnel<Submission>( t ); OSL_ENSURE( pSubmission != nullptr, "invalid item?" ); pSubmission->setModel( css::uno::Reference<css::xforms::XModel>( mpModel ) ); } virtual void _remove( const T& t ) override { - auto pSubmission = comphelper::getUnoTunnelImplementation<Submission>( t ); + auto pSubmission = comphelper::getFromUnoTunnel<Submission>( t ); OSL_ENSURE( pSubmission != nullptr, "invalid item?" ); pSubmission->setModel( css::uno::Reference<css::xforms::XModel>( ) ); } diff --git a/forms/source/xforms/model_ui.cxx b/forms/source/xforms/model_ui.cxx index 7f39a9f6ed99..890e18ea73ae 100644 --- a/forms/source/xforms/model_ui.cxx +++ b/forms/source/xforms/model_ui.cxx @@ -380,7 +380,7 @@ css::uno::Reference< ::css::beans::XPropertySet > Model::cloneBindingAsGhost( co void Model::removeBindingIfUseless( const css::uno::Reference< ::css::beans::XPropertySet >& xBinding ) { - Binding* pBinding = comphelper::getUnoTunnelImplementation<Binding>( xBinding ); + Binding* pBinding = comphelper::getFromUnoTunnel<Binding>( xBinding ); if( pBinding != nullptr ) { if( ! pBinding->isUseful() ) @@ -652,7 +652,7 @@ css::uno::Reference<css::xml::dom::XNode> Model::renameNode( const css::uno::Ref getDefaultBindingExpressionForNode( xNew ); for( sal_Int32 n = 0; n < mxBindings->countItems(); n++ ) { - Binding* pBinding = comphelper::getUnoTunnelImplementation<Binding>( + Binding* pBinding = comphelper::getFromUnoTunnel<Binding>( mxBindings->Collection<XPropertySet_t>::getItem( n ) ); if( pBinding->getBindingExpression() @@ -679,7 +679,7 @@ css::uno::Reference< ::css::beans::XPropertySet > Model::getBindingForNode( cons for( sal_Int32 n = 0; n < mxBindings->countItems(); n++ ) { - Binding* pBinding = comphelper::getUnoTunnelImplementation<Binding>( + Binding* pBinding = comphelper::getFromUnoTunnel<Binding>( mxBindings->Collection<XPropertySet_t>::getItem( n ) ); OSL_ENSURE( pBinding != nullptr, "no binding?" ); @@ -862,7 +862,7 @@ OUString Model::getResultForExpression( sal_Bool bIsBindingExpression, const OUString& sExpression ) { - Binding* pBinding = comphelper::getUnoTunnelImplementation<Binding>( xBinding ); + Binding* pBinding = comphelper::getFromUnoTunnel<Binding>( xBinding ); if( pBinding == nullptr ) throw RuntimeException(); diff --git a/forms/source/xforms/submission.cxx b/forms/source/xforms/submission.cxx index c8b28fc0c135..64d2e59524e9 100644 --- a/forms/source/xforms/submission.cxx +++ b/forms/source/xforms/submission.cxx @@ -192,7 +192,7 @@ bool Submission::doSubmit( const Reference< XInteractionHandler >& xHandler ) ComputedExpression aExpression; if( !msBind.isEmpty() ) { - Binding* pBinding = comphelper::getUnoTunnelImplementation<Binding>( mxModel->getBinding(msBind) ); + Binding* pBinding = comphelper::getFromUnoTunnel<Binding>( mxModel->getBinding(msBind) ); if( pBinding != nullptr ) { aExpression.setExpression( pBinding->getBindingExpression() ); @@ -203,12 +203,12 @@ bool Submission::doSubmit( const Reference< XInteractionHandler >& xHandler ) else if( !maRef.getExpression().isEmpty() ) { aExpression.setExpression( maRef.getExpression() ); - aEvalContext = comphelper::getUnoTunnelImplementation<Model>( mxModel )->getEvaluationContext(); + aEvalContext = comphelper::getFromUnoTunnel<Model>( mxModel )->getEvaluationContext(); } else { aExpression.setExpression( "/" ); - aEvalContext = comphelper::getUnoTunnelImplementation<Model>( mxModel )->getEvaluationContext(); + aEvalContext = comphelper::getFromUnoTunnel<Model>( mxModel )->getEvaluationContext(); } aExpression.evaluate( aEvalContext ); Reference<XXPathObject> xResult = aExpression.getXPath(); @@ -273,7 +273,7 @@ Model* Submission::getModelImpl() const { Model* pModel = nullptr; if( mxModel.is() ) - pModel = comphelper::getUnoTunnelImplementation<Model>( mxModel ); + pModel = comphelper::getFromUnoTunnel<Model>( mxModel ); return pModel; } @@ -391,7 +391,7 @@ void SAL_CALL Submission::submitWithInteraction( *this ); - Model* pModel = comphelper::getUnoTunnelImplementation<Model>( xModel ); + Model* pModel = comphelper::getFromUnoTunnel<Model>( xModel ); OSL_ENSURE( pModel != nullptr, "illegal model?" ); // #i36765# #i47248# warning on submission of illegal data |