summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-06-02 14:53:50 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-06-06 07:01:51 +0000
commit7d1b01070c330d45212cd69ea692b2263c23c2a6 (patch)
tree7ae6ecdd69cd3d8b6ce4431a39034186695497c0 /svx
parent9f138ffe9da2f448a455f4b51facab82e5e243d7 (diff)
remove some manual ref counting in svx and xmloff
Change-Id: Ica0b6ff8ff7fa9e65cd758160d6e3ea7110ebb46 Reviewed-on: https://gerrit.libreoffice.org/25824 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/accessibility/AccessibleControlShape.cxx4
-rw-r--r--svx/source/dialog/dlgctrl.cxx11
-rw-r--r--svx/source/dialog/graphctl.cxx10
-rw-r--r--svx/source/fmcomp/gridcell.cxx45
-rw-r--r--svx/source/fmcomp/gridctrl.cxx23
-rw-r--r--svx/source/form/filtnav.cxx7
-rw-r--r--svx/source/form/fmshell.cxx3
-rw-r--r--svx/source/form/fmsrcimp.cxx4
-rw-r--r--svx/source/form/fmtools.cxx15
-rw-r--r--svx/source/form/fmview.cxx8
-rw-r--r--svx/source/form/formcontroller.cxx40
-rw-r--r--svx/source/form/formcontrolling.cxx8
-rw-r--r--svx/source/form/navigatortreemodel.cxx16
-rw-r--r--svx/source/form/tabwin.cxx11
-rw-r--r--svx/source/inc/filtnav.hxx2
-rw-r--r--svx/source/inc/fmexpl.hxx2
-rw-r--r--svx/source/inc/formcontroller.hxx4
-rw-r--r--svx/source/inc/formcontrolling.hxx7
-rw-r--r--svx/source/inc/gridcell.hxx8
-rw-r--r--svx/source/inc/tabwin.hxx2
-rw-r--r--svx/source/svdraw/svdmodel.cxx11
-rw-r--r--svx/source/table/svdotable.cxx73
-rw-r--r--svx/source/unodraw/unoshtxt.cxx8
23 files changed, 122 insertions, 200 deletions
diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx
index 6891b3707b68..a71dfe66b787 100644
--- a/svx/source/accessibility/AccessibleControlShape.cxx
+++ b/svx/source/accessibility/AccessibleControlShape.cxx
@@ -117,7 +117,6 @@ AccessibleControlShape::AccessibleControlShape (
, m_bWaitingForControl( false )
{
m_pChildManager = new comphelper::OWrappedAccessibleChildrenManager( comphelper::getProcessComponentContext() );
- m_pChildManager->acquire();
osl_atomic_increment( &m_refCount );
{
@@ -128,8 +127,7 @@ AccessibleControlShape::AccessibleControlShape (
AccessibleControlShape::~AccessibleControlShape()
{
- m_pChildManager->release();
- m_pChildManager = nullptr;
+ m_pChildManager.clear();
if ( m_xControlContextProxy.is() )
m_xControlContextProxy->setDelegator( nullptr );
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index 786c4534ff34..9ac13bbf7e6d 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -70,7 +70,6 @@ Bitmap& SvxRectCtl::GetRectBitmap()
SvxRectCtl::SvxRectCtl(vcl::Window* pParent, RECT_POINT eRpt,
sal_uInt16 nBorder, sal_uInt16 nCircle)
: Control(pParent, WB_BORDER | WB_TABSTOP)
- , pAccContext(nullptr)
, nBorderWidth(nBorder)
, nRadius(nCircle)
, eDefRP(eRpt)
@@ -110,8 +109,7 @@ void SvxRectCtl::dispose()
{
delete pBitmap;
- if( pAccContext )
- pAccContext->release();
+ pAccContext.clear();
Control::dispose();
}
@@ -567,7 +565,7 @@ void SvxRectCtl::GetFocus()
// Send the accessible focused event
Control::GetFocus();
// Send accessibility event.
- if(pAccContext)
+ if(pAccContext.is())
{
pAccContext->FireChildFocus(GetActualRP());
}
@@ -652,7 +650,7 @@ void SvxRectCtl::SetActualRP( RECT_POINT eNewRP )
Invalidate( Rectangle( aPtNew - Point( nRadius, nRadius ), aPtNew + Point( nRadius, nRadius ) ) );
// notify accessibility object about change
- if( pAccContext )
+ if( pAccContext.is() )
pAccContext->selectChild( eNewRP /* MT, bFireFocus */ );
}
@@ -718,11 +716,10 @@ Reference< XAccessible > SvxRectCtl::CreateAccessible()
if( xAccParent.is() )
{
pAccContext = new SvxRectCtlAccessibleContext( xAccParent, *this );
- pAccContext->acquire();
SetActualRP( GetActualRP() );
- return pAccContext;
+ return pAccContext.get();
}
else
return Reference< XAccessible >();
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx
index fac0708ce3fe..05a687f88a63 100644
--- a/svx/source/dialog/graphctl.cxx
+++ b/svx/source/dialog/graphctl.cxx
@@ -64,7 +64,6 @@ GraphCtrl::GraphCtrl( vcl::Window* pParent, WinBits nStyle ) :
bEditMode ( false ),
bSdrMode ( false ),
bAnim ( false ),
- mpAccContext ( nullptr ),
pModel ( nullptr ),
pView ( nullptr )
{
@@ -93,10 +92,10 @@ void GraphCtrl::dispose()
{
aUpdateIdle.Stop();
- if( mpAccContext )
+ if( mpAccContext.is() )
{
mpAccContext->disposing();
- mpAccContext->release();
+ mpAccContext.clear();
}
delete pView;
pView = nullptr;
@@ -166,7 +165,7 @@ void GraphCtrl::InitSdrModel()
pView->SetBufferedOverlayAllowed(true);
// Tell the accessibility object about the changes.
- if (mpAccContext != nullptr)
+ if (mpAccContext.is())
mpAccContext->setModelAndView (pModel, pView);
}
@@ -769,12 +768,11 @@ css::uno::Reference< css::accessibility::XAccessible > GraphCtrl::CreateAccessib
xAccParent.is() )
{
mpAccContext = new SvxGraphCtrlAccessibleContext( xAccParent, *this );
- mpAccContext->acquire();
}
}
}
- return mpAccContext;
+ return mpAccContext.get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index b14cdd18e14a..d83fb06879e2 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -226,7 +226,6 @@ void DbGridColumn::CreateControl(sal_Int32 _nFieldPos, const Reference< css::bea
m_pCell = new FmXEditCell( this, *pCellControl );
}
}
- m_pCell->acquire();
m_pCell->init();
impl_toggleScriptManager_nothrow( true );
@@ -262,9 +261,9 @@ void DbGridColumn::impl_toggleScriptManager_nothrow( bool _bAttach )
void DbGridColumn::UpdateFromField(const DbGridRow* pRow, const Reference< XNumberFormatter >& xFormatter)
{
- if (FmXFilterCell* pCell = dynamic_cast<FmXFilterCell*>(m_pCell))
+ if (FmXFilterCell* pCell = dynamic_cast<FmXFilterCell*>(m_pCell.get()))
pCell->Update();
- else if (pRow && pRow->IsValid() && m_nFieldPos >= 0 && m_pCell && pRow->HasField(m_nFieldPos))
+ else if (pRow && pRow->IsValid() && m_nFieldPos >= 0 && m_pCell.is() && pRow->HasField(m_nFieldPos))
{
dynamic_cast<FmXDataCell&>(*m_pCell).UpdateFromField( pRow->GetField( m_nFieldPos ).getColumn(), xFormatter );
}
@@ -273,13 +272,13 @@ void DbGridColumn::UpdateFromField(const DbGridRow* pRow, const Reference< XNumb
bool DbGridColumn::Commit()
{
bool bResult = true;
- if (!m_bInSave && m_pCell)
+ if (!m_bInSave && m_pCell.is())
{
m_bInSave = true;
bResult = m_pCell->Commit();
// store the data into the model
- FmXDataCell* pDataCell = dynamic_cast<FmXDataCell*>( m_pCell );
+ FmXDataCell* pDataCell = dynamic_cast<FmXDataCell*>( m_pCell.get() );
if (bResult && pDataCell)
{
Reference< css::form::XBoundComponent > xComp(m_xModel, UNO_QUERY);
@@ -300,25 +299,24 @@ DbGridColumn::~DbGridColumn()
void DbGridColumn::setModel(const css::uno::Reference< css::beans::XPropertySet >& _xModel)
{
- if ( m_pCell )
+ if ( m_pCell.is() )
impl_toggleScriptManager_nothrow( false );
m_xModel = _xModel;
- if ( m_pCell )
+ if ( m_pCell.is() )
impl_toggleScriptManager_nothrow( true );
}
void DbGridColumn::Clear()
{
- if ( m_pCell )
+ if ( m_pCell.is() )
{
impl_toggleScriptManager_nothrow( false );
m_pCell->dispose();
- m_pCell->release();
- m_pCell = nullptr;
+ m_pCell.clear();
}
m_xController = nullptr;
@@ -370,7 +368,7 @@ sal_Int16 DbGridColumn::SetAlignment(sal_Int16 _nAlign)
}
m_nAlign = _nAlign;
- if (m_pCell && m_pCell->isAlignedController())
+ if (m_pCell.is() && m_pCell->isAlignedController())
m_pCell->AlignControl(m_nAlign);
return m_nAlign;
@@ -411,7 +409,7 @@ void DbGridColumn::setLock(bool _bLock)
OUString DbGridColumn::GetCellText(const DbGridRow* pRow, const Reference< XNumberFormatter >& xFormatter) const
{
OUString aText;
- if (m_pCell && dynamic_cast<const FmXFilterCell*>( m_pCell) != nullptr)
+ if (m_pCell.is() && dynamic_cast<const FmXFilterCell*>( m_pCell.get() ) != nullptr)
return aText;
if (!pRow || !pRow->IsValid())
@@ -429,7 +427,7 @@ OUString DbGridColumn::GetCellText(const Reference< css::sdb::XColumn >& xField,
OUString aText;
if (xField.is())
{
- FmXTextCell* pTextCell = dynamic_cast<FmXTextCell*>( m_pCell );
+ FmXTextCell* pTextCell = dynamic_cast<FmXTextCell*>( m_pCell.get() );
if (pTextCell)
aText = pTextCell->GetText(xField, xFormatter);
else if (m_bObject)
@@ -459,7 +457,7 @@ void DbGridColumn::Paint(OutputDevice& rDev,
bool bEnabled = ( rDev.GetOutDevType() != OUTDEV_WINDOW )
|| ( static_cast< vcl::Window& >( rDev ).IsEnabled() );
- FmXDataCell* pDataCell = dynamic_cast<FmXDataCell*>( m_pCell );
+ FmXDataCell* pDataCell = dynamic_cast<FmXDataCell*>( m_pCell.get() );
if (pDataCell)
{
if (!pRow || !pRow->IsValid())
@@ -495,7 +493,7 @@ void DbGridColumn::Paint(OutputDevice& rDev,
pDataCell->PaintFieldToCell(rDev, rRect, pRow->GetField( m_nFieldPos ).getColumn(), xFormatter);
}
}
- else if (!m_pCell)
+ else if (!m_pCell.is())
{
if (!pRow || !pRow->IsValid())
{
@@ -513,14 +511,14 @@ void DbGridColumn::Paint(OutputDevice& rDev,
rDev.DrawText(rRect, OUString(OBJECTTEXT), nStyle);
}
}
- else if ( dynamic_cast<const FmXFilterCell*>( m_pCell) != nullptr )
- static_cast< FmXFilterCell* >( m_pCell )->PaintCell( rDev, rRect );
+ else if ( dynamic_cast<const FmXFilterCell*>( m_pCell.get() ) != nullptr )
+ static_cast< FmXFilterCell* >( m_pCell.get() )->PaintCell( rDev, rRect );
}
void DbGridColumn::ImplInitWindow( vcl::Window& rParent, const InitWindowFacet _eInitWhat )
{
- if ( m_pCell )
+ if ( m_pCell.is() )
m_pCell->ImplInitWindow( rParent, _eInitWhat );
}
@@ -530,8 +528,6 @@ void DbGridColumn::ImplInitWindow( vcl::Window& rParent, const InitWindowFacet _
DbCellControl::DbCellControl( DbGridColumn& _rColumn )
:OPropertyChangeListener(m_aMutex)
- ,m_pModelChangeBroadcaster(nullptr)
- ,m_pFieldChangeBroadcaster(nullptr)
,m_bTransparent( false )
,m_bAlignedController( true )
,m_bAccessingValueProperty( false )
@@ -544,7 +540,6 @@ DbCellControl::DbCellControl( DbGridColumn& _rColumn )
{
// if our model's format key changes we want to propagate the new value to our windows
m_pModelChangeBroadcaster = new ::comphelper::OPropertyChangeMultiplexer(this, Reference< css::beans::XPropertySet > (_rColumn.getModel(), UNO_QUERY));
- m_pModelChangeBroadcaster->acquire();
// be listener for some common properties
implDoPropertyListening( FM_PROP_READONLY, false );
@@ -570,7 +565,6 @@ DbCellControl::DbCellControl( DbGridColumn& _rColumn )
if ( xField.is() )
{
m_pFieldChangeBroadcaster = new ::comphelper::OPropertyChangeMultiplexer(this, xField);
- m_pFieldChangeBroadcaster->acquire();
m_pFieldChangeBroadcaster->addProperty( FM_PROP_ISREADONLY );
}
}
@@ -613,13 +607,12 @@ void DbCellControl::doPropertyListening(const OUString& _rPropertyName)
implDoPropertyListening( _rPropertyName );
}
-static void lcl_clearBroadCaster(::comphelper::OPropertyChangeMultiplexer*& _pBroadcaster)
+static void lcl_clearBroadCaster(rtl::Reference<::comphelper::OPropertyChangeMultiplexer>& _pBroadcaster)
{
- if ( _pBroadcaster )
+ if ( _pBroadcaster.is() )
{
_pBroadcaster->dispose();
- _pBroadcaster->release();
- _pBroadcaster = nullptr;
+ _pBroadcaster.clear();
// no delete, this is done implicitly
}
}
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index c6d48778b1b0..a6043a6a91c6 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -129,7 +129,7 @@ class GridFieldValueListener : protected ::comphelper::OPropertyChangeListener
{
osl::Mutex m_aMutex;
DbGridControl& m_rParent;
- ::comphelper::OPropertyChangeMultiplexer* m_pRealListener;
+ rtl::Reference<::comphelper::OPropertyChangeMultiplexer> m_pRealListener;
sal_uInt16 m_nId;
sal_Int16 m_nSuspended;
bool m_bDisposed : 1;
@@ -149,7 +149,6 @@ public:
GridFieldValueListener::GridFieldValueListener(DbGridControl& _rParent, const Reference< XPropertySet >& _rField, sal_uInt16 _nId)
:OPropertyChangeListener(m_aMutex)
,m_rParent(_rParent)
- ,m_pRealListener(nullptr)
,m_nId(_nId)
,m_nSuspended(0)
,m_bDisposed(false)
@@ -158,7 +157,6 @@ GridFieldValueListener::GridFieldValueListener(DbGridControl& _rParent, const Re
{
m_pRealListener = new ::comphelper::OPropertyChangeMultiplexer(this, _rField);
m_pRealListener->addProperty(FM_PROP_VALUE);
- m_pRealListener->acquire();
}
}
@@ -178,15 +176,14 @@ void GridFieldValueListener::dispose()
{
if (m_bDisposed)
{
- DBG_ASSERT(m_pRealListener == nullptr, "GridFieldValueListener::dispose : inconsistent !");
+ DBG_ASSERT(m_pRealListener.get() == nullptr, "GridFieldValueListener::dispose : inconsistent !");
return;
}
- if (m_pRealListener)
+ if (m_pRealListener.is())
{
m_pRealListener->dispose();
- m_pRealListener->release();
- m_pRealListener = nullptr;
+ m_pRealListener.clear();
}
m_bDisposed = true;
@@ -947,7 +944,6 @@ DbGridControl::DbGridControl(
,m_xContext(_rxContext)
,m_aBar(VclPtr<DbGridControl::NavigationBar>::Create(this))
,m_nAsynAdjustEvent(nullptr)
- ,m_pDataSourcePropMultiplexer(nullptr)
,m_pDataSourcePropListener(nullptr)
,m_pFieldListeners(nullptr)
,m_pCursorDisposeListener(nullptr)
@@ -1031,12 +1027,11 @@ void DbGridControl::dispose()
if (m_nDeleteEvent)
Application::RemoveUserEvent(m_nDeleteEvent);
- if (m_pDataSourcePropMultiplexer)
+ if (m_pDataSourcePropMultiplexer.is())
{
m_pDataSourcePropMultiplexer->dispose();
- m_pDataSourcePropMultiplexer->release(); // this should delete the multiplexer
+ m_pDataSourcePropMultiplexer.clear(); // this should delete the multiplexer
delete m_pDataSourcePropListener;
- m_pDataSourcePropMultiplexer = nullptr;
m_pDataSourcePropListener = nullptr;
}
m_xRowSetListener.clear();
@@ -1426,12 +1421,11 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, sal_uInt
if (!_xCursor.is() && !m_pDataCursor)
return;
- if (m_pDataSourcePropMultiplexer)
+ if (m_pDataSourcePropMultiplexer.is())
{
m_pDataSourcePropMultiplexer->dispose();
- m_pDataSourcePropMultiplexer->release(); // this should delete the multiplexer
+ m_pDataSourcePropMultiplexer.clear(); // this should delete the multiplexer
delete m_pDataSourcePropListener;
- m_pDataSourcePropMultiplexer = nullptr;
m_pDataSourcePropListener = nullptr;
}
m_xRowSetListener.clear();
@@ -1508,7 +1502,6 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, sal_uInt
{
m_pDataSourcePropListener = new FmXGridSourcePropListener(this);
m_pDataSourcePropMultiplexer = new ::comphelper::OPropertyChangeMultiplexer(m_pDataSourcePropListener, m_pDataCursor->getPropertySet() );
- m_pDataSourcePropMultiplexer->acquire();
m_pDataSourcePropMultiplexer->addProperty(FM_PROP_ISMODIFIED);
m_pDataSourcePropMultiplexer->addProperty(FM_PROP_ISNEW);
}
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index d6f9d201f665..7c1f1ee9924d 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -490,7 +490,6 @@ void SAL_CALL FmFilterAdapter::disjunctiveTermAdded( const FilterEvent& Event )
FmFilterModel::FmFilterModel()
:FmParentData(nullptr, OUString())
,OSQLParserClient(comphelper::getProcessComponentContext())
- ,m_pAdapter(nullptr)
,m_pCurrentItems(nullptr)
{
}
@@ -509,11 +508,10 @@ void FmFilterModel::Clear()
Broadcast( aClearedHint );
// lose endings
- if (m_pAdapter)
+ if (m_pAdapter.is())
{
m_pAdapter->dispose();
- m_pAdapter->release();
- m_pAdapter= nullptr;
+ m_pAdapter.clear();
}
m_pCurrentItems = nullptr;
@@ -551,7 +549,6 @@ void FmFilterModel::Update(const Reference< XIndexAccess > & xControllers, const
// Listening for TextChanges
m_pAdapter = new FmFilterAdapter(this, xControllers);
- m_pAdapter->acquire();
SetCurrentController(xCurrent);
EnsureEmptyFilterRows( *this );
diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx
index 7eb32e2fd976..e710f0f931a0 100644
--- a/svx/source/form/fmshell.cxx
+++ b/svx/source/form/fmshell.cxx
@@ -211,7 +211,6 @@ FmFormShell::FmFormShell( SfxViewShell* _pParent, FmFormView* pView )
,m_bDesignMode( true )
,m_bHasForms(false)
{
- m_pImpl->acquire();
SetPool( &SfxGetpApp()->GetPool() );
SetName( "Form" );
@@ -225,8 +224,6 @@ FmFormShell::~FmFormShell()
SetView( nullptr );
m_pImpl->dispose();
- m_pImpl->release();
- m_pImpl = nullptr;
}
diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx
index 2e6ab8ed47a1..914872bf484a 100644
--- a/svx/source/form/fmsrcimp.cxx
+++ b/svx/source/form/fmsrcimp.cxx
@@ -217,14 +217,12 @@ bool FmSearchEngine::MoveCursor()
else
if (m_xSearchCursor.isFirst())
{
- FmRecordCountListener* prclListener = new FmRecordCountListener(m_xSearchCursor);
- prclListener->acquire();
+ rtl::Reference<FmRecordCountListener> prclListener = new FmRecordCountListener(m_xSearchCursor);
prclListener->SetPropChangeHandler(LINK(this, FmSearchEngine, OnNewRecordCount));
m_xSearchCursor.last();
prclListener->DisConnect();
- prclListener->release();
}
else
m_xSearchCursor.previous();
diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx
index bfd316e5a94e..4eb8d38fc2c7 100644
--- a/svx/source/form/fmtools.cxx
+++ b/svx/source/form/fmtools.cxx
@@ -283,19 +283,8 @@ FmXDisposeListener::~FmXDisposeListener()
void FmXDisposeListener::setAdapter(FmXDisposeMultiplexer* pAdapter)
{
- if (m_pAdapter)
- {
- ::osl::MutexGuard aGuard(m_rMutex);
- m_pAdapter->release();
- m_pAdapter = nullptr;
- }
-
- if (pAdapter)
- {
- ::osl::MutexGuard aGuard(m_rMutex);
- m_pAdapter = pAdapter;
- m_pAdapter->acquire();
- }
+ ::osl::MutexGuard aGuard(m_rMutex);
+ m_pAdapter = pAdapter;
}
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index 7762f8bed226..f40e773cda69 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -90,8 +90,6 @@ void FmFormView::Init()
{
pFormShell = nullptr;
pImpl = new FmXFormView(this);
- pImpl->acquire();
-
// Model setzen
SdrModel* pModel = GetModel();
@@ -138,8 +136,6 @@ FmFormView::~FmFormView()
pFormShell->SetView( nullptr );
pImpl->notifyViewDying();
- pImpl->release();
- pImpl = nullptr;
}
@@ -163,7 +159,7 @@ void FmFormView::MarkListHasChanged()
pImpl->m_pMarkedGrid = nullptr;
if ( pImpl->m_xWindow.is() )
{
- pImpl->m_xWindow->removeFocusListener(pImpl);
+ pImpl->m_xWindow->removeFocusListener(pImpl.get());
pImpl->m_xWindow = nullptr;
}
SetMoveOutside(false);
@@ -500,7 +496,7 @@ bool FmFormView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin)
pImpl->m_pMarkedGrid = pObj;
pImpl->m_xWindow = xWindow;
// add as listener to get notified when ESC will be pressed inside the grid
- pImpl->m_xWindow->addFocusListener(pImpl);
+ pImpl->m_xWindow->addFocusListener(pImpl.get());
SetMoveOutside(true);
//OLMRefreshAllIAOManagers();
xWindow->setFocus();
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index 20602fdcd128..1ace5b93fe11 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -4165,21 +4165,17 @@ Reference< XDispatchProviderInterceptor > FormController::createInterceptor(con
OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
#ifdef DBG_UTIL
// check if we already have a interceptor for the given object
- for ( Interceptors::const_iterator aIter = m_aControlDispatchInterceptors.begin();
- aIter != m_aControlDispatchInterceptors.end();
- ++aIter
- )
+ for ( const auto & it : m_aControlDispatchInterceptors )
{
- if ((*aIter)->getIntercepted() == _xInterception)
+ if (it->getIntercepted() == _xInterception)
OSL_FAIL("FormController::createInterceptor : we already do intercept this objects dispatches !");
}
#endif
- DispatchInterceptionMultiplexer* pInterceptor = new DispatchInterceptionMultiplexer( _xInterception, this );
- pInterceptor->acquire();
- m_aControlDispatchInterceptors.insert( m_aControlDispatchInterceptors.end(), pInterceptor );
+ rtl::Reference<DispatchInterceptionMultiplexer> pInterceptor(new DispatchInterceptionMultiplexer( _xInterception, this ));
+ m_aControlDispatchInterceptors.push_back( pInterceptor );
- return pInterceptor;
+ return pInterceptor.get();
}
@@ -4208,28 +4204,20 @@ void FormController::deleteInterceptor(const Reference< XDispatchProviderInterce
{
OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
// search the interceptor responsible for the given object
- Interceptors::const_iterator aEnd = m_aControlDispatchInterceptors.end();
- Interceptors::iterator aIter;
- for ( aIter = m_aControlDispatchInterceptors.begin();
+ const auto aEnd = m_aControlDispatchInterceptors.end();
+ for ( auto aIter = m_aControlDispatchInterceptors.begin();
aIter != aEnd;
++aIter
)
{
- if ((*aIter)->getIntercepted() == _xInterception)
- break;
- }
- if (aIter == aEnd)
- {
- return;
+ if ((*aIter)->getIntercepted() == _xInterception) {
+ // log off the interception from its interception object
+ (*aIter)->dispose();
+ // remove the interceptor from our array
+ m_aControlDispatchInterceptors.erase(aIter);
+ return;
+ }
}
-
- // log off the interception from its interception object
- DispatchInterceptionMultiplexer* pInterceptorImpl = *aIter;
- pInterceptorImpl->dispose();
- pInterceptorImpl->release();
-
- // remove the interceptor from our array
- m_aControlDispatchInterceptors.erase(aIter);
}
diff --git a/svx/source/form/formcontrolling.cxx b/svx/source/form/formcontrolling.cxx
index 8255ccc5dfd3..06172a19821e 100644
--- a/svx/source/form/formcontrolling.cxx
+++ b/svx/source/form/formcontrolling.cxx
@@ -190,14 +190,12 @@ namespace svx
ControllerFeatures::ControllerFeatures( IControllerFeatureInvalidation* _pInvalidationCallback )
:m_pInvalidationCallback( _pInvalidationCallback )
- ,m_pImpl( nullptr )
{
}
ControllerFeatures::ControllerFeatures( const Reference< XFormController >& _rxController, IControllerFeatureInvalidation* _pInvalidationCallback )
:m_pInvalidationCallback( _pInvalidationCallback )
- ,m_pImpl( nullptr )
{
assign( _rxController );
}
@@ -207,7 +205,6 @@ namespace svx
{
dispose();
m_pImpl = new FormControllerHelper( _rxController, m_pInvalidationCallback );
- m_pImpl->acquire();
}
@@ -219,11 +216,10 @@ namespace svx
void ControllerFeatures::dispose()
{
- if ( m_pImpl )
+ if ( m_pImpl.is() )
{
m_pImpl->dispose();
- m_pImpl->release();
- m_pImpl = nullptr;
+ m_pImpl.clear();
}
}
diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx
index ada3cf9a33f8..fbfbeb6bd8f4 100644
--- a/svx/source/form/navigatortreemodel.cxx
+++ b/svx/source/form/navigatortreemodel.cxx
@@ -193,7 +193,6 @@ namespace svxform
,m_aNormalImages( _rNormalImages )
{
m_pPropChangeList = new OFormComponentObserver(this);
- m_pPropChangeList->acquire();
m_pRootList = new FmEntryDataList();
}
@@ -215,7 +214,6 @@ namespace svxform
Clear();
delete m_pRootList;
m_pPropChangeList->ReleaseModel();
- m_pPropChangeList->release();
}
@@ -232,7 +230,7 @@ namespace svxform
{
Reference< css::form::XForms > xForms( GetForms());
if(xForms.is())
- xForms->removeContainerListener(static_cast<XContainerListener*>(m_pPropChangeList));
+ xForms->removeContainerListener(m_pPropChangeList.get());
// delete RootList
@@ -325,7 +323,7 @@ namespace svxform
// register as PropertyChangeListener
Reference< XPropertySet > xSet(xElement, UNO_QUERY);
if( xSet.is() )
- xSet->addPropertyChangeListener( FM_PROP_NAME, m_pPropChangeList );
+ xSet->addPropertyChangeListener( FM_PROP_NAME, m_pPropChangeList.get() );
// Remove data from model
@@ -333,7 +331,7 @@ namespace svxform
{
Reference< XContainer > xContainer(xElement, UNO_QUERY);
if (xContainer.is())
- xContainer->addContainerListener(static_cast<XContainerListener*>(m_pPropChangeList));
+ xContainer->addContainerListener(m_pPropChangeList.get());
}
if (pFolder)
@@ -466,11 +464,11 @@ namespace svxform
// unregister as PropertyChangeListener
Reference< XPropertySet > xSet( pFormData->GetPropertySet() );
if ( xSet.is() )
- xSet->removePropertyChangeListener( FM_PROP_NAME, m_pPropChangeList );
+ xSet->removePropertyChangeListener( FM_PROP_NAME, m_pPropChangeList.get() );
Reference< XContainer > xContainer( pFormData->GetContainer() );
if (xContainer.is())
- xContainer->removeContainerListener(static_cast<XContainerListener*>(m_pPropChangeList));
+ xContainer->removeContainerListener(m_pPropChangeList.get());
}
@@ -485,7 +483,7 @@ namespace svxform
// unregister as PropertyChangeListener
Reference< XPropertySet > xSet( pControlData->GetPropertySet() );
if (xSet.is())
- xSet->removePropertyChangeListener( FM_PROP_NAME, m_pPropChangeList);
+ xSet->removePropertyChangeListener( FM_PROP_NAME, m_pPropChangeList.get());
}
@@ -835,7 +833,7 @@ namespace svxform
Clear();
if (xForms.is())
{
- xForms->addContainerListener(static_cast<XContainerListener*>(m_pPropChangeList));
+ xForms->addContainerListener(m_pPropChangeList.get());
FillBranch(nullptr);
diff --git a/svx/source/form/tabwin.cxx b/svx/source/form/tabwin.cxx
index c9adc54a864c..e9b06b34a04c 100644
--- a/svx/source/form/tabwin.cxx
+++ b/svx/source/form/tabwin.cxx
@@ -172,7 +172,6 @@ FmFieldWin::FmFieldWin(SfxBindings* _pBindings, SfxChildWindow* _pMgr, vcl::Wind
,SfxControllerItem(SID_FM_FIELDS_CONTROL, *_pBindings)
,::comphelper::OPropertyChangeListener(m_aMutex)
,m_nObjectType(0)
- ,m_pChangeListener(nullptr)
{
SetHelpId( HID_FIELD_SEL_WIN );
@@ -191,11 +190,10 @@ FmFieldWin::~FmFieldWin()
void FmFieldWin::dispose()
{
- if (m_pChangeListener)
+ if (m_pChangeListener.is())
{
m_pChangeListener->dispose();
- m_pChangeListener->release();
- // delete m_pChangeListener;
+ m_pChangeListener.clear();
}
pListBox.disposeAndClear();
::SfxControllerItem::dispose();
@@ -358,13 +356,12 @@ void FmFieldWin::UpdateContent(const css::uno::Reference< css::form::XForm > & x
}
// listen for changes at ControlSource in PropertySet
- if (m_pChangeListener)
+ if (m_pChangeListener.is())
{
m_pChangeListener->dispose();
- m_pChangeListener->release();
+ m_pChangeListener.clear();
}
m_pChangeListener = new ::comphelper::OPropertyChangeMultiplexer(this, xSet);
- m_pChangeListener->acquire();
m_pChangeListener->addProperty(FM_PROP_DATASOURCE);
m_pChangeListener->addProperty(FM_PROP_COMMAND);
m_pChangeListener->addProperty(FM_PROP_COMMANDTYPE);
diff --git a/svx/source/inc/filtnav.hxx b/svx/source/inc/filtnav.hxx
index 66906efc0663..afc6f0b760d1 100644
--- a/svx/source/inc/filtnav.hxx
+++ b/svx/source/inc/filtnav.hxx
@@ -156,7 +156,7 @@ class FmFilterModel : public FmParentData
css::uno::Reference< css::container::XIndexAccess > m_xControllers;
css::uno::Reference< css::form::runtime::XFormController > m_xController;
- FmFilterAdapter* m_pAdapter;
+ rtl::Reference<FmFilterAdapter> m_pAdapter;
FmFilterItems* m_pCurrentItems;
public:
diff --git a/svx/source/inc/fmexpl.hxx b/svx/source/inc/fmexpl.hxx
index 1059b262b8b5..5b5486af54fe 100644
--- a/svx/source/inc/fmexpl.hxx
+++ b/svx/source/inc/fmexpl.hxx
@@ -334,7 +334,7 @@ namespace svxform
FmFormShell* m_pFormShell;
FmFormPage* m_pFormPage;
FmFormModel* m_pFormModel;
- OFormComponentObserver* m_pPropChangeList;
+ rtl::Reference<OFormComponentObserver> m_pPropChangeList;
ImageList m_aNormalImages;
diff --git a/svx/source/inc/formcontroller.hxx b/svx/source/inc/formcontroller.hxx
index 1e1e611a474d..64802ad16f7f 100644
--- a/svx/source/inc/formcontroller.hxx
+++ b/svx/source/inc/formcontroller.hxx
@@ -75,6 +75,7 @@
#include <comphelper/proparrhlp.hxx>
#include <cppuhelper/propshlp.hxx>
#include <comphelper/interfacecontainer2.hxx>
+#include <rtl/ref.hxx>
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
@@ -203,8 +204,7 @@ namespace svxform
// as we want to intercept dispatches of _all_ controls we're responsible for, and an object implementing
// the css::frame::XDispatchProviderInterceptor interface can intercept only _one_ objects dispatches, we need a helper class
- typedef std::vector<DispatchInterceptionMultiplexer*> Interceptors;
- Interceptors m_aControlDispatchInterceptors;
+ std::vector<rtl::Reference<DispatchInterceptionMultiplexer>> m_aControlDispatchInterceptors;
public:
FormController( const css::uno::Reference< css::uno::XComponentContext > & _rxORB );
diff --git a/svx/source/inc/formcontrolling.hxx b/svx/source/inc/formcontrolling.hxx
index a24aab1acfb2..8b0a824dc9c7 100644
--- a/svx/source/inc/formcontrolling.hxx
+++ b/svx/source/inc/formcontrolling.hxx
@@ -27,6 +27,7 @@
#include <com/sun/star/sdb/XSQLErrorListener.hpp>
#include <cppuhelper/implbase.hxx>
+#include <rtl/ref.hxx>
#include <vector>
@@ -72,7 +73,7 @@ namespace svx
{
protected:
IControllerFeatureInvalidation* m_pInvalidationCallback; // necessary as long as m_pImpl is not yet constructed
- FormControllerHelper* m_pImpl;
+ rtl::Reference<FormControllerHelper> m_pImpl;
public:
/** standard ctor
@@ -116,8 +117,8 @@ namespace svx
void dispose();
// access to the instance which implements the functionality. Not to be used when not assigned
- inline const FormControllerHelper* operator->() const { return m_pImpl; }
- inline FormControllerHelper* operator->() { return m_pImpl; }
+ inline const FormControllerHelper* operator->() const { return m_pImpl.get(); }
+ inline FormControllerHelper* operator->() { return m_pImpl.get(); }
};
diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx
index a9c0ae74af9f..26b632a5eeee 100644
--- a/svx/source/inc/gridcell.hxx
+++ b/svx/source/inc/gridcell.hxx
@@ -71,7 +71,7 @@ class DbGridColumn
::svt::CellControllerRef m_xController; // Struktur zum Verwalten der Controls fuer eine Spalte
// diese wird von der DbBrowseBox auf die jeweiligen Zellen
// einer Spalte positioniert
- FmXGridCell* m_pCell;
+ rtl::Reference<FmXGridCell> m_pCell;
protected:
DbGridControl& m_rParent;
@@ -134,7 +134,7 @@ public:
const ::svt::CellControllerRef& GetController() const {return m_bLocked ? s_xEmptyController : m_xController;}
const css::uno::Reference< css::beans::XPropertySet >& GetField() const {return m_xField;}
DbGridControl& GetParent() const {return m_rParent;}
- FmXGridCell* GetCell() const {return m_pCell;}
+ FmXGridCell* GetCell() const {return m_pCell.get();}
css::uno::Reference< css::sdb::XColumn > GetCurrentFieldValue() const;
@@ -200,8 +200,8 @@ class DbCellControl
,public ::comphelper::OPropertyChangeListener
{
private:
- ::comphelper::OPropertyChangeMultiplexer* m_pModelChangeBroadcaster;
- ::comphelper::OPropertyChangeMultiplexer* m_pFieldChangeBroadcaster;
+ rtl::Reference<::comphelper::OPropertyChangeMultiplexer> m_pModelChangeBroadcaster;
+ rtl::Reference<::comphelper::OPropertyChangeMultiplexer> m_pFieldChangeBroadcaster;
private:
bool m_bTransparent : 1;
diff --git a/svx/source/inc/tabwin.hxx b/svx/source/inc/tabwin.hxx
index e042fc746040..2774ccbc035b 100644
--- a/svx/source/inc/tabwin.hxx
+++ b/svx/source/inc/tabwin.hxx
@@ -74,7 +74,7 @@ class FmFieldWin :public SfxFloatingWindow
m_aObjectName;
sal_Int32 m_nObjectType;
- ::comphelper::OPropertyChangeMultiplexer* m_pChangeListener;
+ rtl::Reference<::comphelper::OPropertyChangeMultiplexer> m_pChangeListener;
public:
FmFieldWin(SfxBindings *pBindings,
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 8f0beef843f9..b654568ec920 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -311,8 +311,7 @@ SdrModel::~SdrModel()
SfxItemPool::Free(pOutlPool);
}
- if( mpForbiddenCharactersTable )
- mpForbiddenCharactersTable->release();
+ mpForbiddenCharactersTable.clear();
delete mpNumberFormatter;
@@ -1905,13 +1904,7 @@ void SdrModel::MigrateItemSet( const SfxItemSet* pSourceSet, SfxItemSet* pDestSe
void SdrModel::SetForbiddenCharsTable( const rtl::Reference<SvxForbiddenCharactersTable>& xForbiddenChars )
{
- if( mpForbiddenCharactersTable )
- mpForbiddenCharactersTable->release();
-
- mpForbiddenCharactersTable = xForbiddenChars.get();
-
- if( mpForbiddenCharactersTable )
- mpForbiddenCharactersTable->acquire();
+ mpForbiddenCharactersTable = xForbiddenChars;
ImpSetOutlinerDefaults( pDrawOutliner );
ImpSetOutlinerDefaults( pHitTestOutliner );
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index 2ea9c8abe954..8c707110e513 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -758,7 +758,6 @@ void SdrTableObj::init( sal_Int32 nColumns, sal_Int32 nRows )
bClosedObj = true;
mpImpl = new SdrTableObjImpl;
- mpImpl->acquire();
mpImpl->init( this, nColumns, nRows );
}
@@ -766,7 +765,6 @@ void SdrTableObj::init( sal_Int32 nColumns, sal_Int32 nRows )
SdrTableObj::~SdrTableObj()
{
mpImpl->dispose();
- mpImpl->release();
}
@@ -864,7 +862,7 @@ CellPos SdrTableObj::getDownCell( const CellPos& rPos, bool bEdgeTravel ) const
CellPos SdrTableObj::getPreviousCell( const CellPos& rPos, bool bEdgeTravel ) const
{
CellPos aPos( rPos );
- if( mpImpl )
+ if( mpImpl.is() )
{
CellRef xCell( mpImpl->getCell( aPos ) );
if( xCell.is() && xCell->isMerged() )
@@ -891,7 +889,7 @@ CellPos SdrTableObj::getPreviousCell( const CellPos& rPos, bool bEdgeTravel ) co
CellPos SdrTableObj::getNextCell( const CellPos& rPos, bool bEdgeTravel ) const
{
CellPos aPos( rPos );
- if( mpImpl )
+ if( mpImpl.is() )
{
CellRef xCell( mpImpl->getCell( aPos ) );
if( xCell.is() )
@@ -933,7 +931,7 @@ CellPos SdrTableObj::getNextCell( const CellPos& rPos, bool bEdgeTravel ) const
CellPos SdrTableObj::getPreviousRow( const CellPos& rPos, bool bEdgeTravel ) const
{
CellPos aPos( rPos );
- if( mpImpl )
+ if( mpImpl.is() )
{
CellRef xCell( mpImpl->getCell( aPos ) );
if( xCell.is() )
@@ -963,7 +961,7 @@ CellPos SdrTableObj::getNextRow( const CellPos& rPos, bool bEdgeTravel ) const
{
CellPos aPos( rPos );
- if( mpImpl )
+ if( mpImpl.is() )
{
CellRef xCell( mpImpl->getCell( rPos ) );
if( xCell.is() )
@@ -1004,7 +1002,7 @@ CellPos SdrTableObj::getNextRow( const CellPos& rPos, bool bEdgeTravel ) const
const TableStyleSettings& SdrTableObj::getTableStyleSettings() const
{
- if( mpImpl )
+ if( mpImpl.is())
{
return mpImpl->maTableStyle;
}
@@ -1018,7 +1016,7 @@ const TableStyleSettings& SdrTableObj::getTableStyleSettings() const
void SdrTableObj::setTableStyleSettings( const TableStyleSettings& rStyle )
{
- if( mpImpl )
+ if( mpImpl.is() )
{
mpImpl->maTableStyle = rStyle;
mpImpl->update();
@@ -1028,7 +1026,7 @@ void SdrTableObj::setTableStyleSettings( const TableStyleSettings& rStyle )
TableHitKind SdrTableObj::CheckTableHit( const Point& rPos, sal_Int32& rnX, sal_Int32& rnY ) const
{
- if( !mpImpl || !mpImpl->mxTable.is() )
+ if( !mpImpl.is() || !mpImpl->mxTable.is() )
return SDRTABLEHIT_NONE;
rnX = 0;
@@ -1155,7 +1153,7 @@ const SfxItemSet& SdrTableObj::GetActiveCellItemSet() const
void SdrTableObj::setTableStyle( const Reference< XIndexAccess >& xTableStyle )
{
- if( mpImpl && (mpImpl->mxTableStyle != xTableStyle) )
+ if( mpImpl.is() && (mpImpl->mxTableStyle != xTableStyle) )
{
mpImpl->disconnectTableStyle();
mpImpl->mxTableStyle = xTableStyle;
@@ -1167,7 +1165,7 @@ void SdrTableObj::setTableStyle( const Reference< XIndexAccess >& xTableStyle )
const Reference< XIndexAccess >& SdrTableObj::getTableStyle() const
{
- if( mpImpl )
+ if( mpImpl.is() )
{
return mpImpl->mxTableStyle;
}
@@ -1227,7 +1225,7 @@ sal_Int32 SdrTableObj::getTextCount() const
/** changes the current active text */
void SdrTableObj::setActiveText( sal_Int32 nIndex )
{
- if( mpImpl && mpImpl->mxTable.is() )
+ if( mpImpl.is() && mpImpl->mxTable.is() )
{
const sal_Int32 nColCount = mpImpl->mxTable->getColumnCount();
if( nColCount )
@@ -1243,7 +1241,7 @@ void SdrTableObj::setActiveText( sal_Int32 nIndex )
/** returns the index of the text that contains the given point or -1 */
sal_Int32 SdrTableObj::CheckTextHit(const Point& rPnt) const
{
- if( mpImpl && mpImpl->mxTable.is() )
+ if( mpImpl.is() && mpImpl->mxTable.is() )
{
CellPos aPos;
if( CheckTableHit( rPnt, aPos.mnCol, aPos.mnRow ) == SDRTABLEHIT_CELLTEXTAREA )
@@ -1255,7 +1253,7 @@ sal_Int32 SdrTableObj::CheckTextHit(const Point& rPnt) const
SdrOutliner* SdrTableObj::GetCellTextEditOutliner( const Cell& rCell ) const
{
- if( mpImpl && (mpImpl->getCell( mpImpl->maEditPos ).get() == &rCell) )
+ if( mpImpl.is() && (mpImpl->getCell( mpImpl->maEditPos ).get() == &rCell) )
return pEdtOutl;
else
return nullptr;
@@ -1263,7 +1261,7 @@ SdrOutliner* SdrTableObj::GetCellTextEditOutliner( const Cell& rCell ) const
const TableLayouter& SdrTableObj::getTableLayouter() const
{
- assert(mpImpl && mpImpl->mpLayouter && "getTableLayouter() error: no mpImpl or mpLayouter (!)");
+ assert(mpImpl.is() && mpImpl->mpLayouter && "getTableLayouter() error: no mpImpl or mpLayouter (!)");
return *(mpImpl->mpLayouter);
}
@@ -1284,13 +1282,13 @@ bool SdrTableObj::HasText() const
bool SdrTableObj::IsTextEditActive( const CellPos& rPos )
{
- return pEdtOutl && mpImpl && (rPos == mpImpl->maEditPos);
+ return pEdtOutl && mpImpl.is() && (rPos == mpImpl->maEditPos);
}
void SdrTableObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus )
{
- if( (pEditStatus->GetStatusWord() & EditStatusFlags::TEXTHEIGHTCHANGED) && mpImpl && mpImpl->mpLayouter )
+ if( (pEditStatus->GetStatusWord() & EditStatusFlags::TEXTHEIGHTCHANGED) && mpImpl.is() && mpImpl->mpLayouter )
{
Rectangle aRect0( maRect );
maRect = maLogicRect;
@@ -1349,7 +1347,7 @@ void SdrTableObj::SetModel(SdrModel* pNewModel)
{
SdrTextObj::SetModel(pNewModel);
- if( mpImpl )
+ if( mpImpl.is() )
{
mpImpl->SetModel( pOldModel, pNewModel );
@@ -1365,14 +1363,14 @@ void SdrTableObj::SetModel(SdrModel* pNewModel)
void SdrTableObj::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, bool bNoEditText, Rectangle* pAnchorRect, bool bLineWidth ) const
{
- if( mpImpl )
+ if( mpImpl.is() )
TakeTextRect( mpImpl->maEditPos, rOutliner, rTextRect, bNoEditText, pAnchorRect, bLineWidth );
}
void SdrTableObj::TakeTextRect( const CellPos& rPos, SdrOutliner& rOutliner, Rectangle& rTextRect, bool bNoEditText, Rectangle* pAnchorRect, bool /*bLineWidth*/ ) const
{
- if( !mpImpl )
+ if( !mpImpl.is())
return;
CellRef xCell( mpImpl->getCell( rPos ) );
@@ -1454,7 +1452,7 @@ void SdrTableObj::TakeTextRect( const CellPos& rPos, SdrOutliner& rOutliner, Rec
const CellRef& SdrTableObj::getActiveCell() const
{
- if( mpImpl )
+ if( mpImpl.is() )
{
if( !mpImpl->mxActiveCell.is() )
{
@@ -1473,13 +1471,13 @@ const CellRef& SdrTableObj::getActiveCell() const
sal_Int32 SdrTableObj::getColumnCount() const
{
- return mpImpl ? mpImpl->getColumnCount() : 0;
+ return mpImpl.is() ? mpImpl->getColumnCount() : 0;
}
void SdrTableObj::setActiveCell( const CellPos& rPos )
{
- if( mpImpl && mpImpl->mxTable.is() ) try
+ if( mpImpl.is() && mpImpl->mxTable.is() ) try
{
mpImpl->mxActiveCell.set( dynamic_cast< Cell* >( mpImpl->mxTable->getCellByPosition( rPos.mnCol, rPos.mnRow ).get() ) );
if( mpImpl->mxActiveCell.is() && mpImpl->mxActiveCell->isMerged() )
@@ -1509,7 +1507,7 @@ void SdrTableObj::getActiveCellPos( CellPos& rPos ) const
void SdrTableObj::getCellBounds( const CellPos& rPos, ::Rectangle& rCellRect )
{
- if( mpImpl )
+ if( mpImpl.is() )
{
CellRef xCell( mpImpl->getCell( rPos ) );
if( xCell.is() )
@@ -1520,7 +1518,7 @@ void SdrTableObj::getCellBounds( const CellPos& rPos, ::Rectangle& rCellRect )
void SdrTableObj::TakeTextAnchorRect(Rectangle& rAnchorRect) const
{
- if( mpImpl )
+ if( mpImpl.is() )
TakeTextAnchorRect( mpImpl->maEditPos, rAnchorRect );
}
@@ -1529,7 +1527,7 @@ void SdrTableObj::TakeTextAnchorRect( const CellPos& rPos, Rectangle& rAnchorRec
{
Rectangle aAnkRect(maRect);
- if( mpImpl )
+ if( mpImpl.is() )
{
CellRef xCell( mpImpl->getCell( rPos ) );
if( xCell.is() )
@@ -1543,7 +1541,7 @@ void SdrTableObj::TakeTextAnchorRect( const CellPos& rPos, Rectangle& rAnchorRec
void SdrTableObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const
{
- if( mpImpl )
+ if( mpImpl.is() )
TakeTextEditArea( mpImpl->maEditPos, pPaperMin, pPaperMax, pViewInit, pViewMin );
}
@@ -1671,7 +1669,7 @@ SdrTableObj& SdrTableObj::operator=(const SdrTableObj& rObj)
// call parent
SdrObject::operator=(rObj);
- TableModelNotifyGuard aGuard( mpImpl ? mpImpl->mxTable.get() : nullptr );
+ TableModelNotifyGuard aGuard( mpImpl.is() ? mpImpl->mxTable.get() : nullptr );
maLogicRect = rObj.maLogicRect;
maRect = rObj.maRect;
@@ -1685,8 +1683,7 @@ SdrTableObj& SdrTableObj::operator=(const SdrTableObj& rObj)
bNoMirror = rObj.bNoMirror;
bDisableAutoWidthOnDragging = rObj.bDisableAutoWidthOnDragging;
- if (mpImpl && rObj.mpImpl)
- *mpImpl = *rObj.mpImpl;
+ *mpImpl = *rObj.mpImpl;
return *this;
}
@@ -1891,7 +1888,7 @@ void SdrTableObj::NbcMove(const Size& rSiz)
{
MoveRect(maLogicRect,rSiz);
SdrTextObj::NbcMove( rSiz );
- if( mpImpl )
+ if( mpImpl.is() )
mpImpl->UpdateCells( maRect );
}
@@ -1928,7 +1925,7 @@ bool SdrTableObj::AdjustTextFrameWidthAndHeight()
bool SdrTableObj::AdjustTextFrameWidthAndHeight(Rectangle& rR, bool bHeight, bool bWidth) const
{
- if((pModel == nullptr) || rR.IsEmpty() || !mpImpl || !mpImpl->mxTable.is() )
+ if((pModel == nullptr) || rR.IsEmpty() || !mpImpl.is() || !mpImpl->mxTable.is() )
return false;
Rectangle aRectangle( rR );
@@ -2392,7 +2389,7 @@ void SdrTableObj::RestGeoData(const SdrObjGeoData& rGeo)
SdrTextObj::RestGeoData (rGeo);
- if( mpImpl )
+ if( mpImpl.is() )
mpImpl->LayoutTable(maRect, false, false);
ActionChanged();
}
@@ -2458,7 +2455,7 @@ SdrTableObj* SdrTableObj::CloneRange( const CellPos& rStart, const CellPos& rEnd
void SdrTableObj::DistributeColumns( sal_Int32 nFirstColumn, sal_Int32 nLastColumn )
{
- if( mpImpl && mpImpl->mpLayouter )
+ if( mpImpl.is() && mpImpl->mpLayouter )
{
TableModelNotifyGuard aGuard( mpImpl->mxTable.get() );
mpImpl->mpLayouter->DistributeColumns( maRect, nFirstColumn, nLastColumn );
@@ -2468,7 +2465,7 @@ void SdrTableObj::DistributeColumns( sal_Int32 nFirstColumn, sal_Int32 nLastColu
void SdrTableObj::DistributeRows( sal_Int32 nFirstRow, sal_Int32 nLastRow )
{
- if( mpImpl && mpImpl->mpLayouter )
+ if( mpImpl.is() && mpImpl->mpLayouter )
{
TableModelNotifyGuard aGuard( mpImpl->mxTable.get() );
mpImpl->mpLayouter->DistributeRows( maRect, nFirstRow, nLastRow );
@@ -2478,7 +2475,7 @@ void SdrTableObj::DistributeRows( sal_Int32 nFirstRow, sal_Int32 nLastRow )
void SdrTableObj::SetChanged()
{
- if( mpImpl )
+ if( mpImpl.is() )
{
mpImpl->LayoutTable( maRect, false, false );
}
@@ -2489,14 +2486,14 @@ void SdrTableObj::SetChanged()
void SdrTableObj::uno_lock()
{
- if( mpImpl && mpImpl->mxTable.is() )
+ if( mpImpl.is() && mpImpl->mxTable.is() )
mpImpl->mxTable->lockBroadcasts();
}
void SdrTableObj::uno_unlock()
{
- if( mpImpl && mpImpl->mxTable.is() )
+ if( mpImpl.is() && mpImpl->mxTable.is() )
mpImpl->mxTable->unlockBroadcasts();
}
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index a6ef500eaaca..8d1d38265d73 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -1006,35 +1006,31 @@ IMPL_LINK_TYPED(SvxTextEditSourceImpl, NotifyHdl, EENotify&, rNotify, void)
SvxTextEditSource::SvxTextEditSource( SdrObject* pObject, SdrText* pText )
{
mpImpl = new SvxTextEditSourceImpl( pObject, pText );
- mpImpl->acquire();
}
SvxTextEditSource::SvxTextEditSource( SdrObject& rObj, SdrText* pText, SdrView& rView, const vcl::Window& rWindow )
{
mpImpl = new SvxTextEditSourceImpl( rObj, pText, rView, rWindow );
- mpImpl->acquire();
}
SvxTextEditSource::SvxTextEditSource( SvxTextEditSourceImpl* pImpl )
{
mpImpl = pImpl;
- mpImpl->acquire();
}
SvxTextEditSource::~SvxTextEditSource()
{
::SolarMutexGuard aGuard;
-
- mpImpl->release();
+ mpImpl.clear();
}
SvxEditSource* SvxTextEditSource::Clone() const
{
- return new SvxTextEditSource( mpImpl );
+ return new SvxTextEditSource( mpImpl.get() );
}