[Libreoffice-commits] core.git: forms/source

Arkadiy Illarionov (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 20 06:05:53 UTC 2019


 forms/source/xforms/binding.cxx    |    2 +-
 forms/source/xforms/model.cxx      |   18 ++----------------
 forms/source/xforms/model.hxx      |    5 +----
 forms/source/xforms/submission.cxx |    8 ++++----
 4 files changed, 8 insertions(+), 25 deletions(-)

New commits:
commit 9950aab9f02ab6aff71feca820575ed5a4e215d5
Author:     Arkadiy Illarionov <qarkai at gmail.com>
AuthorDate: Wed Jun 19 23:37:31 2019 +0300
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Jun 20 08:04:47 2019 +0200

    tdf#39593 Remove xforms::Model::getModel
    
    Replace with comphelper::getUnoTunnelImplementation.
    
    Change-Id: I52f780059be7626a03bf79044cfc580bb33f3fd3
    Reviewed-on: https://gerrit.libreoffice.org/74383
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/forms/source/xforms/binding.cxx b/forms/source/xforms/binding.cxx
index 378cd39a71fd..0601babdf72e 100644
--- a/forms/source/xforms/binding.cxx
+++ b/forms/source/xforms/binding.cxx
@@ -462,7 +462,7 @@ Model* Binding::getModelImpl( const css::uno::Reference<css::xforms::XModel>& xM
     Reference<XUnoTunnel> xTunnel( xModel, UNO_QUERY );
     Model* pModel = xTunnel.is()
         ? reinterpret_cast<Model*>(
-            xTunnel->getSomething( Model::getUnoTunnelID() ) )
+            xTunnel->getSomething( Model::getUnoTunnelId() ) )
         : nullptr;
     return pModel;
 }
diff --git a/forms/source/xforms/model.cxx b/forms/source/xforms/model.cxx
index 7fc703a74f1c..2bddfea5db30 100644
--- a/forms/source/xforms/model.cxx
+++ b/forms/source/xforms/model.cxx
@@ -108,20 +108,6 @@ Model::~Model() throw()
 {
 }
 
-static Model* lcl_getModel( const Reference<XUnoTunnel>& xTunnel )
-{
-    Model* pModel = nullptr;
-    if( xTunnel.is() )
-        pModel = reinterpret_cast<Model*>(
-            xTunnel->getSomething( Model::getUnoTunnelID() ) );
-    return pModel;
-}
-
-Model* Model::getModel( const Reference<XModel>& xModel )
-{
-    return lcl_getModel( Reference<XUnoTunnel>( xModel, UNO_QUERY ) );
-}
-
 EvaluationContext Model::getEvaluationContext()
 {
     // the default context is the top-level element node. A default
@@ -144,7 +130,7 @@ EvaluationContext Model::getEvaluationContext()
 }
 
 
-css::uno::Sequence<sal_Int8> Model::getUnoTunnelID()
+css::uno::Sequence<sal_Int8> Model::getUnoTunnelId()
 {
     static cppu::OImplementationId aImplementationId;
     return aImplementationId.getImplementationId();
@@ -604,7 +590,7 @@ void Model::update()
 
 sal_Int64 Model::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 );
 }
 
 Sequence<sal_Int8> Model::getImplementationId()
diff --git a/forms/source/xforms/model.hxx b/forms/source/xforms/model.hxx
index 6d956576778c..a56554c0888f 100644
--- a/forms/source/xforms/model.hxx
+++ b/forms/source/xforms/model.hxx
@@ -113,13 +113,10 @@ public:
     Model();
     virtual ~Model() throw() override;
 
-    // get Model implementation from API object
-    static Model* getModel( const css::uno::Reference<css::xforms::XModel>& );
-
     xforms::EvaluationContext getEvaluationContext();
 
 
-    static css::uno::Sequence<sal_Int8> getUnoTunnelID();
+    static css::uno::Sequence<sal_Int8> getUnoTunnelId();
 
 
     // get/set that part of the schema, that we can't interpret as data types
diff --git a/forms/source/xforms/submission.cxx b/forms/source/xforms/submission.cxx
index 32066cdf5507..c4d786877674 100644
--- a/forms/source/xforms/submission.cxx
+++ b/forms/source/xforms/submission.cxx
@@ -216,12 +216,12 @@ bool Submission::doSubmit( const Reference< XInteractionHandler >& xHandler )
     else if( !maRef.getExpression().isEmpty() )
     {
         aExpression.setExpression( maRef.getExpression() );
-        aEvalContext = Model::getModel( mxModel )->getEvaluationContext();
+        aEvalContext = comphelper::getUnoTunnelImplementation<Model>( mxModel )->getEvaluationContext();
     }
     else
     {
         aExpression.setExpression( "/" );
-        aEvalContext = Model::getModel( mxModel )->getEvaluationContext();
+        aEvalContext = comphelper::getUnoTunnelImplementation<Model>( mxModel )->getEvaluationContext();
     }
     aExpression.evaluate( aEvalContext );
     Reference<XXPathObject> xResult = aExpression.getXPath();
@@ -283,7 +283,7 @@ Model* Submission::getModelImpl() const
 {
     Model* pModel = nullptr;
     if( mxModel.is() )
-        pModel = Model::getModel( mxModel );
+        pModel = comphelper::getUnoTunnelImplementation<Model>( mxModel );
     return pModel;
 }
 
@@ -401,7 +401,7 @@ void SAL_CALL Submission::submitWithInteraction(
                 *this
               );
 
-    Model* pModel = Model::getModel( xModel );
+    Model* pModel = comphelper::getUnoTunnelImplementation<Model>( xModel );
     OSL_ENSURE( pModel != nullptr, "illegal model?" );
 
     // #i36765# #i47248# warning on submission of illegal data


More information about the Libreoffice-commits mailing list