diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-06-19 23:20:46 +0300 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-06-20 08:03:59 +0200 |
commit | 9e1fa327b161c24c3d588563d6a91aced50b85dd (patch) | |
tree | 8f6e0c3f53f716d98d04cf345ae41d397eecebc8 /forms | |
parent | d6a45af91bf1df9ab8aac3d8e83dba7474e15a95 (diff) |
tdf#39593 Remove xforms::Binding::getBinding
Replace with comphelper::getUnoTunnelImplementation.
Change-Id: Ic569783ae01f731f54b54775b8e0eba162cc4b78
Reviewed-on: https://gerrit.libreoffice.org/74381
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/xforms/binding.cxx | 12 | ||||
-rw-r--r-- | forms/source/xforms/binding.hxx | 3 | ||||
-rw-r--r-- | forms/source/xforms/model.cxx | 6 | ||||
-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 | 3 |
6 files changed, 19 insertions, 25 deletions
diff --git a/forms/source/xforms/binding.cxx b/forms/source/xforms/binding.cxx index f4f6c64d07a7..378cd39a71fd 100644 --- a/forms/source/xforms/binding.cxx +++ b/forms/source/xforms/binding.cxx @@ -304,20 +304,12 @@ EvaluationContext Binding::getEvaluationContext() const } -css::uno::Sequence<sal_Int8> Binding::getUnoTunnelID() +css::uno::Sequence<sal_Int8> Binding::getUnoTunnelId() { static cppu::OImplementationId aImplementationId; return aImplementationId.getImplementationId(); } -Binding* Binding::getBinding( const Reference<XPropertySet>& xPropertySet ) -{ - Reference<XUnoTunnel> xTunnel( xPropertySet, UNO_QUERY ); - return xTunnel.is() - ? reinterpret_cast<Binding*>( xTunnel->getSomething(getUnoTunnelID())) - : nullptr; -} - void Binding::setBindingID( const OUString& sBindingID ) { @@ -1194,7 +1186,7 @@ void Binding::handleEvent( const css::uno::Reference<css::xml::dom::events::XEve sal_Int64 Binding::getSomething( const css::uno::Sequence<sal_Int8>& xId ) { - return reinterpret_cast<sal_Int64>( ( xId == getUnoTunnelID() ) ? this : nullptr ); + return reinterpret_cast<sal_Int64>( ( xId == getUnoTunnelId() ) ? this : nullptr ); } diff --git a/forms/source/xforms/binding.hxx b/forms/source/xforms/binding.hxx index b75f66bfde6e..ba65c9bd7c18 100644 --- a/forms/source/xforms/binding.hxx +++ b/forms/source/xforms/binding.hxx @@ -257,8 +257,7 @@ public: // the ID for XUnoTunnel calls - static css::uno::Sequence<sal_Int8> getUnoTunnelID(); - static Binding* getBinding( const css::uno::Reference<css::beans::XPropertySet>& ); + static css::uno::Sequence<sal_Int8> getUnoTunnelId(); private: diff --git a/forms/source/xforms/model.cxx b/forms/source/xforms/model.cxx index c41358199ae8..7fc703a74f1c 100644 --- a/forms/source/xforms/model.cxx +++ b/forms/source/xforms/model.cxx @@ -245,7 +245,7 @@ void Model::rebind() sal_Int32 nCount = mxBindings->countItems(); for( sal_Int32 i = 0; i < nCount; i++ ) { - Binding* pBind = Binding::getBinding( mxBindings->Collection<XPropertySet_t>::getItem( i ) ); + Binding* pBind = comphelper::getUnoTunnelImplementation<Binding>( mxBindings->Collection<XPropertySet_t>::getItem( i ) ); OSL_ENSURE( pBind != nullptr, "binding?" ); pBind->update(); } @@ -258,7 +258,7 @@ void Model::deferNotifications( bool bDefer ) sal_Int32 nCount = mxBindings->countItems(); for( sal_Int32 i = 0; i < nCount; i++ ) { - Binding* pBind = Binding::getBinding( mxBindings->Collection<XPropertySet_t>::getItem( i ) ); + Binding* pBind = comphelper::getUnoTunnelImplementation<Binding>( mxBindings->Collection<XPropertySet_t>::getItem( i ) ); OSL_ENSURE( pBind != nullptr, "binding?" ); pBind->deferNotifications( bDefer ); } @@ -381,7 +381,7 @@ bool Model::isValid() const sal_Int32 nCount = mxBindings->countItems(); for( sal_Int32 i = 0; bValid && i < nCount; i++ ) { - Binding* pBind = Binding::getBinding( mxBindings->Collection<XPropertySet_t>::getItem( i ) ); + Binding* pBind = comphelper::getUnoTunnelImplementation<Binding>( mxBindings->Collection<XPropertySet_t>::getItem( i ) ); OSL_ENSURE( pBind != nullptr, "binding?" ); bValid = pBind->isValid(); } diff --git a/forms/source/xforms/model_helper.hxx b/forms/source/xforms/model_helper.hxx index f0a6c46d58a4..592649f839de 100644 --- a/forms/source/xforms/model_helper.hxx +++ b/forms/source/xforms/model_helper.hxx @@ -57,20 +57,22 @@ public: virtual bool isValid( const T& t ) const override { - return Binding::getBinding( t ) != nullptr; + return comphelper::getUnoTunnelImplementation<Binding>( t ) != nullptr; } protected: virtual void _insert( const T& t ) override { - OSL_ENSURE( Binding::getBinding( t ) != nullptr, "invalid item?" ); - Binding::getBinding( t )->_setModel( css::uno::Reference<css::xforms::XModel>( mpModel ) ); + auto pBinding = comphelper::getUnoTunnelImplementation<Binding>( t ); + OSL_ENSURE( pBinding != nullptr, "invalid item?" ); + pBinding->_setModel( css::uno::Reference<css::xforms::XModel>( mpModel ) ); } virtual void _remove( const T& t ) override { - OSL_ENSURE( Binding::getBinding( t ) != nullptr, "invalid item?" ); - Binding::getBinding( t )->_setModel( css::uno::Reference<css::xforms::XModel>() ); + auto pBinding = comphelper::getUnoTunnelImplementation<Binding>( t ); + OSL_ENSURE( pBinding != nullptr, "invalid item?" ); + pBinding->_setModel( css::uno::Reference<css::xforms::XModel>() ); } }; diff --git a/forms/source/xforms/model_ui.cxx b/forms/source/xforms/model_ui.cxx index 521f710fbc50..e37dfa3d490b 100644 --- a/forms/source/xforms/model_ui.cxx +++ b/forms/source/xforms/model_ui.cxx @@ -379,7 +379,7 @@ css::uno::Reference< ::css::beans::XPropertySet > Model::cloneBindingAsGhost( co void Model::removeBindingIfUseless( const css::uno::Reference< ::css::beans::XPropertySet >& xBinding ) { - Binding* pBinding = Binding::getBinding( xBinding ); + Binding* pBinding = comphelper::getUnoTunnelImplementation<Binding>( xBinding ); if( pBinding != nullptr ) { if( ! pBinding->isUseful() ) @@ -651,7 +651,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 = Binding::getBinding( + Binding* pBinding = comphelper::getUnoTunnelImplementation<Binding>( mxBindings->Collection<XPropertySet_t>::getItem( n ) ); if( pBinding->getBindingExpression() @@ -678,7 +678,7 @@ css::uno::Reference< ::css::beans::XPropertySet > Model::getBindingForNode( cons for( sal_Int32 n = 0; n < mxBindings->countItems(); n++ ) { - Binding* pBinding = Binding::getBinding( + Binding* pBinding = comphelper::getUnoTunnelImplementation<Binding>( mxBindings->Collection<XPropertySet_t>::getItem( n ) ); OSL_ENSURE( pBinding != nullptr, "no binding?" ); @@ -861,7 +861,7 @@ OUString Model::getResultForExpression( sal_Bool bIsBindingExpression, const OUString& sExpression ) { - Binding* pBinding = Binding::getBinding( xBinding ); + Binding* pBinding = comphelper::getUnoTunnelImplementation<Binding>( xBinding ); if( pBinding == nullptr ) throw RuntimeException(); diff --git a/forms/source/xforms/submission.cxx b/forms/source/xforms/submission.cxx index 9c7a0fb72abe..32066cdf5507 100644 --- a/forms/source/xforms/submission.cxx +++ b/forms/source/xforms/submission.cxx @@ -50,6 +50,7 @@ #include <comphelper/propertysetinfo.hxx> #include <comphelper/interaction.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> #include <memory> using com::sun::star::util::VetoException; @@ -204,7 +205,7 @@ bool Submission::doSubmit( const Reference< XInteractionHandler >& xHandler ) ComputedExpression aExpression; if( !msBind.isEmpty() ) { - Binding* pBinding = Binding::getBinding( mxModel->getBinding(msBind) ); + Binding* pBinding = comphelper::getUnoTunnelImplementation<Binding>( mxModel->getBinding(msBind) ); if( pBinding != nullptr ) { aExpression.setExpression( pBinding->getBindingExpression() ); |