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

loplugin:useuniqueptr in SdrTableObjImpl

Change-Id: Ic59384aef628ff2d34a735ce9b10d38a5e2a8b11
Reviewed-on: https://gerrit.libreoffice.org/53756Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst fef6c6cf
...@@ -191,7 +191,7 @@ public: ...@@ -191,7 +191,7 @@ public:
CellRef mxActiveCell; CellRef mxActiveCell;
TableModelRef mxTable; TableModelRef mxTable;
SdrTableObj* mpTableObj; SdrTableObj* mpTableObj;
TableLayouter* mpLayouter; std::unique_ptr<TableLayouter> mpLayouter;
CellPos maEditPos; CellPos maEditPos;
TableStyleSettings maTableStyle; TableStyleSettings maTableStyle;
Reference< XIndexAccess > mxTableStyle; Reference< XIndexAccess > mxTableStyle;
...@@ -277,7 +277,7 @@ void SdrTableObjImpl::init( SdrTableObj* pTable, sal_Int32 nColumns, sal_Int32 n ...@@ -277,7 +277,7 @@ void SdrTableObjImpl::init( SdrTableObj* pTable, sal_Int32 nColumns, sal_Int32 n
mxTable->init( nColumns, nRows ); mxTable->init( nColumns, nRows );
Reference< XModifyListener > xListener( static_cast< css::util::XModifyListener* >(this) ); Reference< XModifyListener > xListener( static_cast< css::util::XModifyListener* >(this) );
mxTable->addModifyListener( xListener ); mxTable->addModifyListener( xListener );
mpLayouter = new TableLayouter( mxTable ); mpLayouter.reset(new TableLayouter( mxTable ));
LayoutTable( mpTableObj->maRect, true, true ); LayoutTable( mpTableObj->maRect, true, true );
mpTableObj->maLogicRect = mpTableObj->maRect; mpTableObj->maLogicRect = mpTableObj->maRect;
} }
...@@ -289,11 +289,7 @@ SdrTableObjImpl& SdrTableObjImpl::operator=( const SdrTableObjImpl& rSource ) ...@@ -289,11 +289,7 @@ SdrTableObjImpl& SdrTableObjImpl::operator=( const SdrTableObjImpl& rSource )
{ {
disconnectTableStyle(); disconnectTableStyle();
if( mpLayouter ) mpLayouter.reset();
{
delete mpLayouter;
mpLayouter = nullptr;
}
if( mxTable.is() ) if( mxTable.is() )
{ {
...@@ -306,7 +302,7 @@ SdrTableObjImpl& SdrTableObjImpl::operator=( const SdrTableObjImpl& rSource ) ...@@ -306,7 +302,7 @@ SdrTableObjImpl& SdrTableObjImpl::operator=( const SdrTableObjImpl& rSource )
maTableStyle = rSource.maTableStyle; maTableStyle = rSource.maTableStyle;
mxTable = new TableModel( mpTableObj, rSource.mxTable ); mxTable = new TableModel( mpTableObj, rSource.mxTable );
mpLayouter = new TableLayouter( mxTable ); mpLayouter.reset(new TableLayouter( mxTable ));
Reference< XModifyListener > xListener( static_cast< css::util::XModifyListener* >(this) ); Reference< XModifyListener > xListener( static_cast< css::util::XModifyListener* >(this) );
mxTable->addModifyListener( xListener ); mxTable->addModifyListener( xListener );
mxTableStyle = rSource.mxTableStyle; mxTableStyle = rSource.mxTableStyle;
...@@ -456,11 +452,7 @@ void SdrTableObjImpl::dispose() ...@@ -456,11 +452,7 @@ void SdrTableObjImpl::dispose()
disconnectTableStyle(); disconnectTableStyle();
mxTableStyle.clear(); mxTableStyle.clear();
if( mpLayouter ) mpLayouter.reset();
{
delete mpLayouter;
mpLayouter = nullptr;
}
if( mxTable.is() ) if( mxTable.is() )
{ {
...@@ -638,11 +630,7 @@ void SAL_CALL SdrTableObjImpl::disposing( const css::lang::EventObject& /*Source ...@@ -638,11 +630,7 @@ void SAL_CALL SdrTableObjImpl::disposing( const css::lang::EventObject& /*Source
{ {
mxActiveCell.clear(); mxActiveCell.clear();
mxTable.clear(); mxTable.clear();
if( mpLayouter ) mpLayouter.reset();
{
delete mpLayouter;
mpLayouter = nullptr;
}
mpTableObj = nullptr; mpTableObj = nullptr;
} }
......
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