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

use unique_ptr for SwTableAutoFormat

Change-Id: Ib83be524b5c15e4639a834494726501ac7aa6755
Reviewed-on: https://gerrit.libreoffice.org/66314
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst e450351a
......@@ -120,7 +120,7 @@ protected:
public:
virtual void GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rCol,
SwInsertTableOptions& rInsTableFlags, OUString& rTableAutoFormatName,
SwTableAutoFormat *& prTAFormat ) = 0;
std::unique_ptr<SwTableAutoFormat>& prTAFormat ) = 0;
};
class AbstractJavaEditDialog : public VclAbstractDialog
......
......@@ -550,7 +550,7 @@ void AbstractInsFootNoteDlg_Impl::SetText( const OUString& rStr )
void AbstractInsTableDlg_Impl::GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rCol,
SwInsertTableOptions& rInsTableFlags, OUString& rTableAutoFormatName,
SwTableAutoFormat *& prTAFormat )
std::unique_ptr<SwTableAutoFormat>& prTAFormat )
{
m_xDlg->GetValues(rName, rRow, rCol, rInsTableFlags, rTableAutoFormatName, prTAFormat);
}
......
......@@ -444,9 +444,9 @@ public:
{
}
virtual short Execute() override;
virtual void GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rCol,
SwInsertTableOptions& rInsTableFlags, OUString& rTableAutoFormatName,
SwTableAutoFormat *& prTAFormat ) override;
virtual void GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rCol,
SwInsertTableOptions& rInsTableFlags, OUString& rTableAutoFormatName,
std::unique_ptr<SwTableAutoFormat>& prTAFormat ) override;
};
class SwJavaEditDialog;
......
......@@ -29,7 +29,7 @@
void SwInsTableDlg::GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rCol,
SwInsertTableOptions& rInsTableOpts, OUString& rAutoName,
SwTableAutoFormat *& prTAFormat )
std::unique_ptr<SwTableAutoFormat>& prTAFormat )
{
SwInsertTableFlags nInsMode = SwInsertTableFlags::NONE;
rName = m_xNameEdit->get_text();
......@@ -46,7 +46,7 @@ void SwInsTableDlg::GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rC
nInsMode |= SwInsertTableFlags::SplitLayout;
if( pTAutoFormat )
{
prTAFormat = new SwTableAutoFormat( *pTAutoFormat );
prTAFormat.reset(new SwTableAutoFormat( *pTAutoFormat ));
rAutoName = prTAFormat->GetName();
}
......
......@@ -82,7 +82,7 @@ public:
void GetValues( OUString& rName, sal_uInt16& rRow, sal_uInt16& rCol,
SwInsertTableOptions& rInsTableOpts, OUString& rTableAutoFormatName,
SwTableAutoFormat *& prTAFormat );
std::unique_ptr<SwTableAutoFormat>& prTAFormat );
};
#endif
......
......@@ -374,7 +374,7 @@ void SwHHCWrapper::ReplaceUnit(
OUString aOrigText( m_rWrtShell.GetSelText() );
OUString aNewText( rReplaceWith );
OSL_ENSURE( aOrigText == rOrigText, "!! text mismatch !!" );
SwFormatRuby *pRuby = nullptr;
std::unique_ptr<SwFormatRuby> pRuby;
bool bRubyBelow = false;
OUString aNewOrigText;
switch (eAction)
......@@ -393,24 +393,24 @@ void SwHHCWrapper::ReplaceUnit(
break;
case eReplacementAbove :
{
pRuby = new SwFormatRuby( rReplaceWith );
pRuby.reset(new SwFormatRuby( rReplaceWith ));
}
break;
case eOriginalAbove :
{
pRuby = new SwFormatRuby( aOrigText );
pRuby.reset(new SwFormatRuby( aOrigText ));
aNewOrigText = rReplaceWith;
}
break;
case eReplacementBelow :
{
pRuby = new SwFormatRuby( rReplaceWith );
pRuby.reset(new SwFormatRuby( rReplaceWith ));
bRubyBelow = true;
}
break;
case eOriginalBelow :
{
pRuby = new SwFormatRuby( aOrigText );
pRuby.reset(new SwFormatRuby( aOrigText ));
aNewOrigText = rReplaceWith;
bRubyBelow = true;
}
......@@ -445,7 +445,7 @@ void SwHHCWrapper::ReplaceUnit(
pRuby->SetAdjustment( RubyAdjust_CENTER );
m_rWrtShell.SetAttrItem(*pRuby);
delete pRuby;
pRuby.reset();
m_rWrtShell.EndUndo( SwUndoId::SETRUBYATTR );
}
else
......
......@@ -2616,7 +2616,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
SwInsertTableOptions aInsTableOpts( SwInsertTableFlags::All, 1 );
OUString aTableName;
OUString aAutoName;
SwTableAutoFormat* pTAFormat = nullptr;
std::unique_ptr<SwTableAutoFormat> pTAFormat;
if( pArgs && pArgs->Count() >= 2 )
{
......@@ -2643,7 +2643,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
{
if ( aTableTable[n].GetName() == aAutoName )
{
pTAFormat = new SwTableAutoFormat( aTableTable[n] );
pTAFormat.reset(new SwTableAutoFormat( aTableTable[n] ));
break;
}
}
......@@ -2689,7 +2689,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
if( rSh.HasSelection() )
rSh.DelRight();
rSh.InsertTable( aInsTableOpts, nRows, nCols, pTAFormat );
rSh.InsertTable( aInsTableOpts, nRows, nCols, pTAFormat.get() );
rSh.MoveTable( GotoPrevTable, fnTableStart );
if( !aTableName.isEmpty() && !rSh.GetTableStyle( aTableName ) )
......@@ -2701,7 +2701,6 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
rSh.EndAllAction();
rTempView.AutoCaption(TABLE_CAP);
}
delete pTAFormat;
}
if( bCallEndUndo )
......
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