diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-23 08:48:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-23 09:42:01 +0200 |
commit | 10d0c60947da520779040af25b0c558564b71aff (patch) | |
tree | 31dac0566d3d85ae55b92f5c0a8dbab0f5f2b232 /svx | |
parent | e5f5d9022150242a8a1222ccc657f7769d881594 (diff) |
use rtl::Reference in FmFormModelImplData
instead of manual acquire/release
Change-Id: I925b45bcc2f09e09330ae8c79f3f40b81ae120ed
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/form/fmmodel.cxx | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/svx/source/form/fmmodel.cxx b/svx/source/form/fmmodel.cxx index 3c7b1b463cab..22c9e206ed4b 100644 --- a/svx/source/form/fmmodel.cxx +++ b/svx/source/form/fmmodel.cxx @@ -37,15 +37,14 @@ using namespace svxform; struct FmFormModelImplData { - FmXUndoEnvironment* pUndoEnv; + rtl::Reference<FmXUndoEnvironment> mxUndoEnv; bool bOpenInDesignIsDefaulted; bool bMovingPage; ::boost::optional< sal_Bool > aControlsUseRefDevice; FmFormModelImplData() - :pUndoEnv( nullptr ) - ,bOpenInDesignIsDefaulted( true ) + :bOpenInDesignIsDefaulted( true ) ,bMovingPage( false ) ,aControlsUseRefDevice() { @@ -60,8 +59,7 @@ FmFormModel::FmFormModel(SfxItemPool* pPool, SfxObjectShell* pPers) , m_bAutoControlFocus(false) { m_pImpl.reset( new FmFormModelImplData ); - m_pImpl->pUndoEnv = new FmXUndoEnvironment(*this); - m_pImpl->pUndoEnv->acquire(); + m_pImpl->mxUndoEnv = new FmXUndoEnvironment(*this); } FmFormModel::FmFormModel(const OUString& rPath, SfxItemPool* pPool, SfxObjectShell* pPers) @@ -72,8 +70,7 @@ FmFormModel::FmFormModel(const OUString& rPath, SfxItemPool* pPool, SfxObjectShe , m_bAutoControlFocus(false) { m_pImpl.reset( new FmFormModelImplData ); - m_pImpl->pUndoEnv = new FmXUndoEnvironment(*this); - m_pImpl->pUndoEnv->acquire(); + m_pImpl->mxUndoEnv = new FmXUndoEnvironment(*this); } FmFormModel::FmFormModel(const OUString& rPath, SfxItemPool* pPool, SfxObjectShell* pPers, @@ -85,20 +82,17 @@ FmFormModel::FmFormModel(const OUString& rPath, SfxItemPool* pPool, SfxObjectShe , m_bAutoControlFocus(false) { m_pImpl.reset( new FmFormModelImplData ); - m_pImpl->pUndoEnv = new FmXUndoEnvironment(*this); - m_pImpl->pUndoEnv->acquire(); + m_pImpl->mxUndoEnv = new FmXUndoEnvironment(*this); } FmFormModel::~FmFormModel() { - if (m_pObjShell && m_pImpl->pUndoEnv->IsListening(*m_pObjShell)) + if (m_pObjShell && m_pImpl->mxUndoEnv->IsListening(*m_pObjShell)) SetObjectShell(nullptr); ClearUndoBuffer(); // minimale grenze fuer undos SetMaxUndoActionCount(1); - - m_pImpl->pUndoEnv->release(); } SdrPage* FmFormModel::AllocPage(bool bMasterPage) @@ -109,7 +103,7 @@ SdrPage* FmFormModel::AllocPage(bool bMasterPage) void FmFormModel::InsertPage(SdrPage* pPage, sal_uInt16 nPos) { // hack solange Methode intern - if (m_pObjShell && !m_pImpl->pUndoEnv->IsListening( *m_pObjShell )) + if (m_pObjShell && !m_pImpl->mxUndoEnv->IsListening( *m_pObjShell )) SetObjectShell(m_pObjShell); SdrModel::InsertPage( pPage, nPos ); @@ -134,7 +128,7 @@ SdrPage* FmFormModel::RemovePage(sal_uInt16 nPgNum) { Reference< XNameContainer > xForms( pToBeRemovedPage->GetForms( false ), css::uno::UNO_QUERY ); if ( xForms.is() ) - m_pImpl->pUndoEnv->RemoveForms( xForms ); + m_pImpl->mxUndoEnv->RemoveForms( xForms ); } FmFormPage* pRemovedPage = static_cast<FmFormPage*>(SdrModel::RemovePage(nPgNum)); @@ -145,7 +139,7 @@ SdrPage* FmFormModel::RemovePage(sal_uInt16 nPgNum) void FmFormModel::InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos) { // hack solange Methode intern - if (m_pObjShell && !m_pImpl->pUndoEnv->IsListening( *m_pObjShell )) + if (m_pObjShell && !m_pImpl->mxUndoEnv->IsListening( *m_pObjShell )) SetObjectShell(m_pObjShell); SdrModel::InsertMasterPage(pPage, nPos); @@ -159,7 +153,7 @@ SdrPage* FmFormModel::RemoveMasterPage(sal_uInt16 nPgNum) { Reference< XNameContainer > xForms( pPage->GetForms( false ), css::uno::UNO_QUERY ); if ( xForms.is() ) - m_pImpl->pUndoEnv->RemoveForms( xForms ); + m_pImpl->mxUndoEnv->RemoveForms( xForms ); } return pPage; @@ -222,27 +216,27 @@ void FmFormModel::SetObjectShell( SfxObjectShell* pShell ) if (m_pObjShell) { - m_pImpl->pUndoEnv->EndListening( *this ); - m_pImpl->pUndoEnv->EndListening( *m_pObjShell ); + m_pImpl->mxUndoEnv->EndListening( *this ); + m_pImpl->mxUndoEnv->EndListening( *m_pObjShell ); } m_pObjShell = pShell; if (m_pObjShell) { - m_pImpl->pUndoEnv->SetReadOnly( m_pObjShell->IsReadOnly() || m_pObjShell->IsReadOnlyUI(), FmXUndoEnvironment::Accessor() ); + m_pImpl->mxUndoEnv->SetReadOnly( m_pObjShell->IsReadOnly() || m_pObjShell->IsReadOnlyUI(), FmXUndoEnvironment::Accessor() ); - if (!m_pImpl->pUndoEnv->IsReadOnly()) - m_pImpl->pUndoEnv->StartListening(*this); + if (!m_pImpl->mxUndoEnv->IsReadOnly()) + m_pImpl->mxUndoEnv->StartListening(*this); - m_pImpl->pUndoEnv->StartListening( *m_pObjShell ); + m_pImpl->mxUndoEnv->StartListening( *m_pObjShell ); } } FmXUndoEnvironment& FmFormModel::GetUndoEnv() { - return *m_pImpl->pUndoEnv; + return *m_pImpl->mxUndoEnv; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |