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>
diff --git a/forms/source/xforms/binding.cxx b/forms/source/xforms/binding.cxx
index f4f6c64..378cd39 100644
--- a/forms/source/xforms/binding.cxx
+++ b/forms/source/xforms/binding.cxx
@@ -304,20 +304,12 @@
}
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 @@
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 b75f66b..ba65c9b 100644
--- a/forms/source/xforms/binding.hxx
+++ b/forms/source/xforms/binding.hxx
@@ -257,8 +257,7 @@
// 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 c413581..7fc703a 100644
--- a/forms/source/xforms/model.cxx
+++ b/forms/source/xforms/model.cxx
@@ -245,7 +245,7 @@
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 @@
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 @@
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 f0a6c46..592649f 100644
--- a/forms/source/xforms/model_helper.hxx
+++ b/forms/source/xforms/model_helper.hxx
@@ -57,20 +57,22 @@
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 521f710..e37dfa3 100644
--- a/forms/source/xforms/model_ui.cxx
+++ b/forms/source/xforms/model_ui.cxx
@@ -379,7 +379,7 @@
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 @@
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 @@
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 @@
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 9c7a0fb..32066cd 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 @@
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() );