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