compilerplugins/clang/fieldcast.results          |    6 -
 forms/source/xforms/binding.cxx                  |   76 ++++++++++-------------
 forms/source/xforms/binding.hxx                  |   11 +--
 forms/source/xforms/model_helper.hxx             |    4 -
 framework/inc/services/layoutmanager.hxx         |    5 -
 framework/source/layoutmanager/layoutmanager.cxx |   68 ++++++++------------
 6 files changed, 72 insertions(+), 98 deletions(-)

New commits:
commit 89945d719282ba83d6a06be899a1320c40daee12
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Wed Nov 22 22:03:34 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Nov 23 08:14:02 2023 +0100

    loplugin:fieldcast in LayoutManager
    
    Change-Id: Ib0b56703cd6782d850ab5960a7fa53d15eb443a8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159840
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/compilerplugins/clang/fieldcast.results 
b/compilerplugins/clang/fieldcast.results
index e803723cd774..aa36df627b34 100644
--- a/compilerplugins/clang/fieldcast.results
+++ b/compilerplugins/clang/fieldcast.results
@@ -88,9 +88,6 @@ editeng/source/editeng/impedit.hxx:506
 extensions/source/update/check/updatecheck.hxx:164
     UpdateCheck m_pThread WorkerThread *
     (anonymous namespace)::UpdateCheckThread
-framework/inc/services/layoutmanager.hxx:253
-    framework::LayoutManager m_xMenuBar 
css::uno::Reference<css::ui::XUIElement>
-    framework::MenuBarWrapper
 framework/inc/services/layoutmanager.hxx:256
     framework::LayoutManager m_xProgressBarBackup 
css::uno::Reference<css::ui::XUIElement>
     framework::ProgressBarWrapper
diff --git a/framework/inc/services/layoutmanager.hxx 
b/framework/inc/services/layoutmanager.hxx
index 28f78d5bdc0f..6675737d4b15 100644
--- a/framework/inc/services/layoutmanager.hxx
+++ b/framework/inc/services/layoutmanager.hxx
@@ -42,9 +42,10 @@
 #include <vcl/timer.hxx>
 
 class MenuBar;
+
 namespace framework
 {
-
+    class MenuBarWrapper;
     class ToolbarLayoutManager;
     class GlobalSettings;
     namespace detail
@@ -250,7 +251,7 @@ namespace framework
             css::awt::Rectangle                                            
m_aDockingArea;
             css::uno::Reference< css::ui::XDockingAreaAcceptor >           
m_xDockingAreaAcceptor;
             rtl::Reference< MenuBarManager >                               
m_xInplaceMenuBar;
-            css::uno::Reference< css::ui::XUIElement >                     
m_xMenuBar;
+            rtl::Reference< MenuBarWrapper >                               
m_xMenuBar;
             UIElement                                                      
m_aStatusBarElement;
             UIElement                                                      
m_aProgressBarElement;
             css::uno::Reference< css::ui::XUIElement >                     
m_xProgressBarBackup;
diff --git a/framework/source/layoutmanager/layoutmanager.cxx 
b/framework/source/layoutmanager/layoutmanager.cxx
index d4d30416ad26..3b5a0af3017c 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -154,7 +154,7 @@ void LayoutManager::implts_createMenuBar(const OUString& 
rMenuBarName)
     if (m_bInplaceMenuSet || m_xMenuBar.is())
         return;
 
-    m_xMenuBar = implts_createElement( rMenuBarName );
+    m_xMenuBar.set( static_cast< MenuBarWrapper* >(implts_createElement( 
rMenuBarName ).get()) );
     if ( !m_xMenuBar.is() )
         return;
 
@@ -164,19 +164,15 @@ void LayoutManager::implts_createMenuBar(const OUString& 
rMenuBarName)
 
     Reference< awt::XMenuBar > xMenuBar;
 
-    Reference< XPropertySet > xPropSet( m_xMenuBar, UNO_QUERY );
-    if ( xPropSet.is() )
+    try
+    {
+        m_xMenuBar->getPropertyValue("XMenuBar") >>= xMenuBar;
+    }
+    catch (const beans::UnknownPropertyException&)
+    {
+    }
+    catch (const lang::WrappedTargetException&)
     {
-        try
-        {
-            xPropSet->getPropertyValue("XMenuBar") >>= xMenuBar;
-        }
-        catch (const beans::UnknownPropertyException&)
-        {
-        }
-        catch (const lang::WrappedTargetException&)
-        {
-        }
     }
 
     if ( !xMenuBar.is() )
@@ -215,12 +211,11 @@ void LayoutManager::impl_clearUpMenuBar()
             {
                 Reference< awt::XMenuBar > xMenuBar;
 
-                Reference< XPropertySet > xPropSet( m_xMenuBar, UNO_QUERY );
-                if ( xPropSet.is() )
+                if ( m_xMenuBar.is() )
                 {
                     try
                     {
-                        xPropSet->getPropertyValue("XMenuBar") >>= xMenuBar;
+                        m_xMenuBar->getPropertyValue("XMenuBar") >>= xMenuBar;
                     }
                     catch (const beans::UnknownPropertyException&)
                     {
@@ -252,10 +247,11 @@ void LayoutManager::impl_clearUpMenuBar()
     pMenuBar.disposeAndClear();
     m_bInplaceMenuSet = false;
 
-    Reference< XComponent > xComp( m_xMenuBar, UNO_QUERY );
-    if ( xComp.is() )
-        xComp->dispose();
-    m_xMenuBar.clear();
+    if ( m_xMenuBar.is() )
+    {
+        m_xMenuBar->dispose();
+        m_xMenuBar.clear();
+    }
     implts_unlock();
 }
 
@@ -763,7 +759,7 @@ void LayoutManager::implts_updateUIElementsVisibleState( 
bool bSetVisible )
         implts_notifyListeners( frame::LayoutManagerEvents::INVISIBLE, a );
 
     SolarMutexResettableGuard aWriteLock;
-    Reference< XUIElement >   xMenuBar = m_xMenuBar;
+    rtl::Reference< MenuBarWrapper > xMenuBar = m_xMenuBar;
     Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
     rtl::Reference< MenuBarManager > xInplaceMenuBar( m_xInplaceMenuBar );
     aWriteLock.clear();
@@ -777,8 +773,7 @@ void LayoutManager::implts_updateUIElementsVisibleState( 
bool bSetVisible )
             pMenuBar = static_cast<MenuBar *>(xInplaceMenuBar->GetMenuBar());
         else
         {
-            MenuBarWrapper* pMenuBarWrapper = static_cast< MenuBarWrapper* 
>(xMenuBar.get());
-            pMenuBar = static_cast<MenuBar 
*>(pMenuBarWrapper->GetMenuBarManager()->GetMenuBar());
+            pMenuBar = static_cast<MenuBar 
*>(xMenuBar->GetMenuBarManager()->GetMenuBar());
         }
 
         SystemWindow* pSysWindow = getTopSystemWindow( xContainerWindow );
@@ -1188,12 +1183,11 @@ void LayoutManager::implts_resetInplaceMenuBar()
     if ( m_xContainerWindow.is() )
     {
         SolarMutexGuard aGuard;
-        MenuBarWrapper* pMenuBarWrapper = static_cast< MenuBarWrapper* 
>(m_xMenuBar.get());
         SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow );
         if ( pSysWindow )
         {
-            if ( pMenuBarWrapper )
-                pSysWindow->SetMenuBar(static_cast<MenuBar 
*>(pMenuBarWrapper->GetMenuBarManager()->GetMenuBar()));
+            if ( m_xMenuBar )
+                pSysWindow->SetMenuBar(static_cast<MenuBar 
*>(m_xMenuBar->GetMenuBarManager()->GetMenuBar()));
             else
                 pSysWindow->SetMenuBar(nullptr);
         }
@@ -1650,7 +1644,7 @@ Reference< XUIElement > SAL_CALL 
LayoutManager::getElement( const OUString& aNam
 Sequence< Reference< ui::XUIElement > > SAL_CALL LayoutManager::getElements()
 {
     SolarMutexClearableGuard aReadLock;
-    uno::Reference< ui::XUIElement >  xMenuBar( m_xMenuBar );
+    rtl::Reference< MenuBarWrapper >  xMenuBar( m_xMenuBar );
     uno::Reference< ui::XUIElement >  xStatusBar( 
m_aStatusBarElement.m_xUIElement );
     ToolbarLayoutManager*             pToolbarManager( m_xToolbarManager.get() 
);
     aReadLock.clear();
@@ -2465,12 +2459,8 @@ bool LayoutManager::implts_resetMenuBar()
     MenuBar* pSetMenuBar = nullptr;
     if ( m_xInplaceMenuBar.is() )
         pSetMenuBar = static_cast<MenuBar *>(m_xInplaceMenuBar->GetMenuBar());
-    else
-    {
-        MenuBarWrapper* pMenuBarWrapper = static_cast< MenuBarWrapper* >( 
m_xMenuBar.get() );
-        if ( pMenuBarWrapper )
-            pSetMenuBar = 
static_cast<MenuBar*>(pMenuBarWrapper->GetMenuBarManager()->GetMenuBar());
-    }
+    else if ( m_xMenuBar )
+        pSetMenuBar = 
static_cast<MenuBar*>(m_xMenuBar->GetMenuBarManager()->GetMenuBar());
 
     SystemWindow* pSysWindow = getTopSystemWindow( xContainerWindow );
     if ( pSysWindow && bMenuVisible && pSetMenuBar )
@@ -2488,9 +2478,8 @@ void LayoutManager::implts_createMSCompatibleMenuBar( 
const OUString& aName )
     SolarMutexGuard aWriteLock;
 
     // Find Form menu in the original menubar
-    m_xMenuBar = implts_createElement( aName );
-    uno::Reference< XUIElementSettings > xMenuBarSettings(m_xMenuBar, 
UNO_QUERY);
-    uno::Reference< container::XIndexReplace > 
xMenuIndex(xMenuBarSettings->getSettings(true), UNO_QUERY);
+    m_xMenuBar.set( static_cast< MenuBarWrapper* >(implts_createElement( aName 
).get()) );
+    uno::Reference< container::XIndexReplace > 
xMenuIndex(m_xMenuBar->getSettings(true), UNO_QUERY);
 
     sal_Int32 nFormsMenu = -1;
     for (sal_Int32 nIndex = 0; nIndex < xMenuIndex->getCount(); ++nIndex)
@@ -2870,7 +2859,7 @@ void SAL_CALL LayoutManager::elementRemoved( const 
ui::ConfigurationEvent& Event
     Reference< frame::XFrame >                xFrame( m_xFrame );
     rtl::Reference< ToolbarLayoutManager >    xToolbarManager( 
m_xToolbarManager );
     Reference< awt::XWindow >                 xContainerWindow( 
m_xContainerWindow );
-    Reference< ui::XUIElement >               xMenuBar( m_xMenuBar );
+    rtl::Reference< MenuBarWrapper >          xMenuBar( m_xMenuBar );
     Reference< ui::XUIConfigurationManager >  xModuleCfgMgr( m_xModuleCfgMgr );
     Reference< ui::XUIConfigurationManager >  xDocCfgMgr( m_xDocCfgMgr );
     aReadLock.clear();
@@ -2936,9 +2925,8 @@ void SAL_CALL LayoutManager::elementRemoved( const 
ui::ConfigurationEvent& Event
                     if ( pSysWindow && !m_bInplaceMenuSet )
                         pSysWindow->SetMenuBar( nullptr );
 
-                    Reference< XComponent > xComp( xMenuBar, UNO_QUERY );
-                    if ( xComp.is() )
-                        xComp->dispose();
+                    if ( xMenuBar.is() )
+                        xMenuBar->dispose();
 
                     SolarMutexGuard g;
                     m_xMenuBar.clear();
commit 0cea768b529a26c58fb736f762aeb0b99884debb
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Wed Nov 22 21:53:29 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Nov 23 08:13:53 2023 +0100

    loplugin:fieldcast in Binding
    
    Change-Id: Ia4bb341dba0c853b53c42a36fcb472e5948f1708
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159839
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/compilerplugins/clang/fieldcast.results 
b/compilerplugins/clang/fieldcast.results
index 0bdabb345340..e803723cd774 100644
--- a/compilerplugins/clang/fieldcast.results
+++ b/compilerplugins/clang/fieldcast.results
@@ -88,9 +88,6 @@ editeng/source/editeng/impedit.hxx:506
 extensions/source/update/check/updatecheck.hxx:164
     UpdateCheck m_pThread WorkerThread *
     (anonymous namespace)::UpdateCheckThread
-forms/source/xforms/binding.hxx:97
-    xforms::Binding mxModel css::uno::Reference<css::xforms::XModel>
-    xforms::Model
 framework/inc/services/layoutmanager.hxx:253
     framework::LayoutManager m_xMenuBar 
css::uno::Reference<css::ui::XUIElement>
     framework::MenuBarWrapper
diff --git a/forms/source/xforms/binding.cxx b/forms/source/xforms/binding.cxx
index 93952e033ac1..c739126642c4 100644
--- a/forms/source/xforms/binding.cxx
+++ b/forms/source/xforms/binding.cxx
@@ -121,7 +121,7 @@ Binding::~Binding()
     _setModel(nullptr);
 }
 
-void Binding::_setModel( const css::uno::Reference<css::xforms::XModel>& 
xModel )
+void Binding::_setModel( const rtl::Reference<Model>& xModel )
 {
     PropertyChangeNotifier aNotifyModelChange( *this, HANDLE_Model );
     PropertyChangeNotifier aNotifyModelIDChange( *this, HANDLE_ModelID );
@@ -142,8 +142,7 @@ void Binding::_setModel( const 
css::uno::Reference<css::xforms::XModel>& xModel
 
 OUString Binding::getModelID() const
 {
-    Model* pModel = getModelImpl();
-    return ( pModel == nullptr ) ? OUString() : pModel->getID();
+    return ( mxModel == nullptr ) ? OUString() : mxModel->getID();
 }
 
 
@@ -231,7 +230,7 @@ bool Binding::isUseful() const
     // 3) we are bound to some control
     //    (this can be assumed if some listeners are set)
     bool bUseful =
-        getModelImpl() == nullptr
+        mxModel == nullptr
 //        || msBindingID.getLength() > 0
         || ! msTypeName.isEmpty()
         || ! maReadonly.isEmptyExpression()
@@ -285,15 +284,15 @@ OUString Binding::explainInvalid()
 
 EvaluationContext Binding::getEvaluationContext() const
 {
-    OSL_ENSURE( getModelImpl() != nullptr, "need model impl" );
-    EvaluationContext aContext = getModelImpl()->getEvaluationContext();
+    OSL_ENSURE( mxModel != nullptr, "need model impl" );
+    EvaluationContext aContext = mxModel->getEvaluationContext();
     aContext.mxNamespaces = getBindingNamespaces();
     return aContext;
 }
 
 ::std::vector<EvaluationContext> Binding::getMIPEvaluationContexts()
 {
-    OSL_ENSURE( getModelImpl() != nullptr, "need model impl" );
+    OSL_ENSURE( mxModel != nullptr, "need model impl" );
 
     // bind (in case we were not bound before)
     bind();
@@ -425,9 +424,8 @@ bool Binding::getExternalData() const
 
     try
     {
-        Reference< XPropertySet > xModelProps( mxModel, UNO_QUERY_THROW );
         OSL_VERIFY(
-            xModelProps->getPropertyValue( "ExternalData" ) >>= bExternalData 
);
+            mxModel->getPropertyValue( "ExternalData" ) >>= bExternalData );
     }
     catch( const Exception& )
     {
@@ -445,14 +443,9 @@ void Binding::checkLive()
 
 bool Binding::isLive() const
 {
-    const Model* pModel = getModelImpl();
-    return pModel && pModel->isInitialized();
+    return mxModel && mxModel->isInitialized();
 }
 
-Model* Binding::getModelImpl() const
-{
-    return dynamic_cast<Model*>( mxModel.get() );
-}
 
 static void lcl_addListenerToNode( const Reference<XNode>& xNode,
                                    const Reference<XEventListener>& xListener )
@@ -494,7 +487,7 @@ static void lcl_removeListenerFromNode( const 
Reference<XNode>& xNode,
 
 ::std::vector<EvaluationContext> Binding::_getMIPEvaluationContexts() const
 {
-    OSL_ENSURE( getModelImpl() != nullptr, "need model impl" );
+    OSL_ENSURE( mxModel != nullptr, "need model impl" );
 
     // iterate over nodes of bind expression and create
     // EvaluationContext for each
@@ -505,7 +498,7 @@ static void lcl_removeListenerFromNode( const 
Reference<XNode>& xNode,
         OSL_ENSURE( node.is(), "no node?" );
 
         // create proper evaluation context for this MIP
-        aVector.emplace_back( node, getModel(), getBindingNamespaces() );
+        aVector.emplace_back( node, mxModel, getBindingNamespaces() );
     }
     return aVector;
 }
@@ -562,9 +555,8 @@ void Binding::bind( bool bForceRebind )
     }
 
     // 3) remove old MIPs defined by this binding
-    Model* pModel = getModelImpl();
-    OSL_ENSURE( pModel != nullptr, "need model" );
-    pModel->removeMIPs( this );
+    OSL_ENSURE( mxModel != nullptr, "need model" );
+    mxModel->removeMIPs( this );
 
     // 4) calculate all MIPs
     ::std::vector<EvaluationContext> aMIPContexts = 
_getMIPEvaluationContexts();
@@ -580,7 +572,7 @@ void Binding::bind( bool bForceRebind )
             {
                 mbInCalculate = true;
                 maCalculate.evaluate( rContext );
-                pModel->setSimpleContent( rContext.mxContextNode,
+                mxModel->setSimpleContent( rContext.mxContextNode,
                                           maCalculate.getString() );
                 mbInCalculate = false;
             }
@@ -594,7 +586,7 @@ void Binding::bind( bool bForceRebind )
         // type is static; does not need updating
 
         // evaluate the locally defined MIPs, and push them to the model
-        pModel->addMIP( this, rContext.mxContextNode, getLocalMIP() );
+        mxModel->addMIP( this, rContext.mxContextNode, getLocalMIP() );
     }
 }
 
@@ -637,7 +629,7 @@ void Binding::valueModified()
 
     // query MIP used by our first node (also note validity)
     Reference<XNode> xNode = maBindingExpression.getNode();
-    maMIP = getModelImpl()->queryMIP( xNode );
+    maMIP = mxModel->queryMIP( xNode );
 
     // distribute MIPs _used_ by this binding
     if( xNode.is() )
@@ -738,11 +730,11 @@ MIP Binding::getLocalMIP() const
 
 css::uno::Reference<css::xsd::XDataType> Binding::getDataType() const
 {
-    OSL_ENSURE( getModel().is(), "need model" );
-    OSL_ENSURE( getModel()->getDataTypeRepository().is(), "need types" );
+    OSL_ENSURE( mxModel.is(), "need model" );
+    OSL_ENSURE( mxModel->getDataTypeRepository().is(), "need types" );
 
     Reference<XDataTypeRepository> xRepository =
-        getModel()->getDataTypeRepository();
+        mxModel->getDataTypeRepository();
     OUString sTypeName = maMIP.getTypeName();
 
     return ( xRepository.is() && xRepository->hasByName( sTypeName ) )
@@ -768,9 +760,8 @@ OUString Binding::explainInvalid_DataType()
 void Binding::clear()
 {
     // remove MIPs contributed by this binding
-    Model* pModel = getModelImpl();
-    if( pModel != nullptr )
-        pModel->removeMIPs( this );
+    if( mxModel != nullptr )
+        mxModel->removeMIPs( this );
 
     // remove all references
     for (auto const& eventNode : maEventNodes)
@@ -859,9 +850,8 @@ css::uno::Reference<css::container::XNameContainer> 
Binding::_getNamespaces() co
     lcl_copyNamespaces( mxNamespaces, xNamespaces, true );
 
     // merge model's with binding's own namespaces
-    Model* pModel = getModelImpl();
-    if( pModel != nullptr )
-        lcl_copyNamespaces( pModel->getNamespaces(), xNamespaces, false );
+    if( mxModel != nullptr )
+        lcl_copyNamespaces( mxModel->getNamespaces(), xNamespaces, false );
 
     return xNamespaces;
 }
@@ -871,11 +861,10 @@ css::uno::Reference<css::container::XNameContainer> 
Binding::_getNamespaces() co
 void Binding::_setNamespaces( const 
css::uno::Reference<css::container::XNameContainer>& rNamespaces,
                               bool bBinding )
 {
-    Model* pModel = getModelImpl();
-    css::uno::Reference<css::container::XNameContainer> xModelNamespaces = ( 
pModel != nullptr )
-                                            ? pModel->getNamespaces()
+    css::uno::Reference<css::container::XNameContainer> xModelNamespaces = ( 
mxModel != nullptr )
+                                            ? mxModel->getNamespaces()
                                             : nullptr;
-    OSL_ENSURE( ( pModel != nullptr ) == xModelNamespaces.is(), "no model 
nmsp?");
+    OSL_ENSURE( ( mxModel != nullptr ) == xModelNamespaces.is(), "no model 
nmsp?");
 
     // remove deleted namespaces
     lcl_removeOtherNamespaces( rNamespaces, mxNamespaces );
@@ -924,10 +913,10 @@ void Binding::_setNamespaces( const 
css::uno::Reference<css::container::XNameCon
 
 void Binding::_checkBindingID()
 {
-    if( !getModel().is() )
+    if( !mxModel.is() )
         return;
 
-    Reference<XNameAccess> xBindings( getModel()->getBindings(), 
UNO_QUERY_THROW );
+    Reference<XNameAccess> xBindings( mxModel->getBindings(), UNO_QUERY_THROW 
);
     if( !msBindingID.isEmpty() )
         return;
 
@@ -995,7 +984,7 @@ void Binding::setValue( const css::uno::Any& aValue )
         throw InvalidBindingStateException("no suitable node found", 
static_cast<XValueBinding*>(this));
 
     OUString sValue = Convert::get().toXSD( aValue );
-    bool bSuccess = getModelImpl()->setSimpleContent( xNode, sValue );
+    bool bSuccess = mxModel->setSimpleContent( xNode, sValue );
     if( ! bSuccess )
         throw InvalidBindingStateException("can't set value", 
static_cast<XValueBinding*>(this));
 
@@ -1178,9 +1167,8 @@ css::uno::Reference<css::util::XCloneable> SAL_CALL 
Binding::createClone()
 {
     Reference< XPropertySet > xClone;
 
-    Model* pModel = getModelImpl();
-    if ( pModel )
-        xClone = pModel->cloneBinding( this );
+    if ( mxModel )
+        xClone = mxModel->cloneBinding( this );
     else
     {
         xClone = new Binding;
@@ -1189,6 +1177,10 @@ css::uno::Reference<css::util::XCloneable> SAL_CALL 
Binding::createClone()
     return css::uno::Reference<css::util::XCloneable>( xClone, UNO_QUERY );
 }
 
+css::uno::Reference<css::xforms::XModel> Binding::getModel() const
+{
+    return mxModel;
+}
 
 // property set implementations
 
diff --git a/forms/source/xforms/binding.hxx b/forms/source/xforms/binding.hxx
index d7201a5b5246..76b478b944a4 100644
--- a/forms/source/xforms/binding.hxx
+++ b/forms/source/xforms/binding.hxx
@@ -35,6 +35,7 @@
 #include "boolexpression.hxx"
 #include "mip.hxx"
 #include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
 #include <vector>
 
 // forward declaractions
@@ -94,7 +95,7 @@ public:
 private:
 
     /// the Model to which this Binding belongs; may be NULL
-    css::uno::Reference<css::xforms::XModel> mxModel;
+    rtl::Reference<Model> mxModel;
 
     /// binding-ID. A document-wide unique ID for this binding element.
     OUString msBindingID;
@@ -162,8 +163,9 @@ public:
     // property methods: get/set value
 
 
-    css::uno::Reference<css::xforms::XModel> getModel() const { return 
mxModel;}   /// get XForms model
-    void _setModel( const css::uno::Reference<css::xforms::XModel>& ); /// set 
XForms model (only called by Model)
+    /// get the model implementation
+    css::uno::Reference<css::xforms::XModel> getModel() const;   /// get 
XForms model
+    void _setModel( const rtl::Reference<Model>& ); /// set XForms model (only 
called by Model)
 
 
     OUString getModelID() const;   /// get ID of XForms model
@@ -270,9 +272,6 @@ private:
     /// live: has model, and model has been initialized
     bool isLive() const;
 
-    /// get the model implementation
-    xforms::Model* getModelImpl() const;
-
     /// get MIP evaluation contexts
     /// (only valid if control has already been bound)
     std::vector<xforms::EvaluationContext> _getMIPEvaluationContexts() const;
diff --git a/forms/source/xforms/model_helper.hxx 
b/forms/source/xforms/model_helper.hxx
index ae8d78da7c0d..08d7f013992d 100644
--- a/forms/source/xforms/model_helper.hxx
+++ b/forms/source/xforms/model_helper.hxx
@@ -64,14 +64,14 @@ protected:
     {
         auto pBinding = comphelper::getFromUnoTunnel<Binding>( t );
         OSL_ENSURE( pBinding != nullptr, "invalid item?" );
-        pBinding->_setModel( css::uno::Reference<css::xforms::XModel>( mpModel 
) );
+        pBinding->_setModel( mpModel );
     }
 
     virtual void _remove( const T& t ) override
     {
         auto pBinding = comphelper::getFromUnoTunnel<Binding>( t );
         OSL_ENSURE( pBinding != nullptr, "invalid item?" );
-        pBinding->_setModel( css::uno::Reference<css::xforms::XModel>() );
+        pBinding->_setModel( nullptr );
     }
 };
 

Reply via email to