summaryrefslogtreecommitdiff
path: root/forms/source/xforms
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-09-14 08:19:47 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-09-15 06:07:36 +0200
commit05bc93db2de56000f65764d7e394d03747cac23d (patch)
tree975de9ae83572aac8a5c3ea8db281e1017ee5be0 /forms/source/xforms
parent8cbb414ed737f9ffc76e1258e6671769bf63fc6c (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/source/xforms')
-rw-r--r--forms/source/xforms/binding.cxx2
-rw-r--r--forms/source/xforms/model.cxx8
-rw-r--r--forms/source/xforms/model_helper.hxx12
-rw-r--r--forms/source/xforms/model_ui.cxx8
-rw-r--r--forms/source/xforms/submission.cxx10
5 files changed, 20 insertions, 20 deletions
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