Kaydet (Commit) 7d7a5666 authored tarafından Noel Grandin's avatar Noel Grandin

use rtl::Reference in FormControlContainer

instead of manual acquire/release

Change-Id: Ie0fed7db217adea68aaa09cf9de699d488bf84dd
üst 46a0ce80
...@@ -35,7 +35,6 @@ namespace bib ...@@ -35,7 +35,6 @@ namespace bib
FormControlContainer::FormControlContainer( ) FormControlContainer::FormControlContainer( )
:OLoadListener( m_aMutex ) :OLoadListener( m_aMutex )
,m_pFormAdapter( nullptr )
{ {
} }
...@@ -52,9 +51,8 @@ namespace bib ...@@ -52,9 +51,8 @@ namespace bib
SAL_WARN_IF( !isFormConnected(), "extensions.biblio", "FormControlContainer::connectForm: not connected!" ); SAL_WARN_IF( !isFormConnected(), "extensions.biblio", "FormControlContainer::connectForm: not connected!" );
if ( isFormConnected() ) if ( isFormConnected() )
{ {
m_pFormAdapter->dispose(); m_xFormAdapter->dispose();
m_pFormAdapter->release(); m_xFormAdapter.clear();
m_pFormAdapter = nullptr;
} }
} }
...@@ -65,9 +63,8 @@ namespace bib ...@@ -65,9 +63,8 @@ namespace bib
SAL_WARN_IF( !_rxForm.is(), "extensions.biblio", "FormControlContainer::connectForm: invalid form!" ); SAL_WARN_IF( !_rxForm.is(), "extensions.biblio", "FormControlContainer::connectForm: invalid form!" );
if ( !isFormConnected() && _rxForm.is() ) if ( !isFormConnected() && _rxForm.is() )
{ {
m_pFormAdapter = new OLoadListenerAdapter( _rxForm ); m_xFormAdapter = new OLoadListenerAdapter( _rxForm );
m_pFormAdapter->acquire(); m_xFormAdapter->Init( this );
m_pFormAdapter->Init( this );
implSetDesignMode( !m_xForm.is() || !m_xForm->isLoaded() ); implSetDesignMode( !m_xForm.is() || !m_xForm->isLoaded() );
} }
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <cppuhelper/basemutex.hxx> #include <cppuhelper/basemutex.hxx>
#include "loadlisteneradapter.hxx" #include "loadlisteneradapter.hxx"
#include <com/sun/star/awt/XControlContainer.hpp> #include <com/sun/star/awt/XControlContainer.hpp>
#include <rtl/ref.hxx>
namespace bib namespace bib
...@@ -33,7 +34,7 @@ namespace bib ...@@ -33,7 +34,7 @@ namespace bib
,public ::bib::OLoadListener ,public ::bib::OLoadListener
{ {
private: private:
OLoadListenerAdapter* m_pFormAdapter; rtl::Reference<OLoadListenerAdapter> m_xFormAdapter;
css::uno::Reference< css::form::XLoadable > m_xForm; css::uno::Reference< css::form::XLoadable > m_xForm;
private: private:
void implSetDesignMode( bool _bDesign ); void implSetDesignMode( bool _bDesign );
...@@ -42,7 +43,7 @@ namespace bib ...@@ -42,7 +43,7 @@ namespace bib
FormControlContainer( ); FormControlContainer( );
virtual ~FormControlContainer( ) override; virtual ~FormControlContainer( ) override;
bool isFormConnected() const { return nullptr != m_pFormAdapter; } bool isFormConnected() const { return m_xFormAdapter.is(); }
void connectForm( const css::uno::Reference< css::form::XLoadable >& _rxForm ); void connectForm( const css::uno::Reference< css::form::XLoadable >& _rxForm );
void disconnectForm(); void disconnectForm();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment