loplugin:useuniqueptr in SwHTMLWriter

Change-Id: I4802e6502addce96bff4831598e852e4fe673af4
Reviewed-on: https://gerrit.libreoffice.org/57521
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2018-07-16 14:40:20 +02:00
parent 5c6bce38a0
commit 011c6c719f
4 changed files with 23 additions and 11 deletions

View File

@ -79,6 +79,9 @@ public:
// SwLineLayout::m_pNext
if (fn == SRCDIR "/sw/source/core/text/porlay.cxx")
return;
// ODatabaseExport::m_aDestColumns
if (fn == SRCDIR "/dbaccess/source/ui/misc/DExport.cxx")
return;
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
}

View File

@ -56,7 +56,7 @@ void SwHTMLWriter::FillNextNumInfo()
const SwNode* pNd = m_pDoc->GetNodes()[nPos];
if( pNd->IsTextNode() )
{
m_pNextNumRuleInfo = new SwHTMLNumRuleInfo( *pNd->GetTextNode() );
m_pNextNumRuleInfo.reset( new SwHTMLNumRuleInfo( *pNd->GetTextNode() ) );
// Before a table we keep the old level if the same numbering is
// continued after the table and no new numbering is started.
@ -78,7 +78,7 @@ void SwHTMLWriter::FillNextNumInfo()
else
{
// In all other case the numbering is over.
m_pNextNumRuleInfo = new SwHTMLNumRuleInfo;
m_pNextNumRuleInfo.reset(new SwHTMLNumRuleInfo);
}
}
while( !m_pNextNumRuleInfo );
@ -86,8 +86,12 @@ void SwHTMLWriter::FillNextNumInfo()
void SwHTMLWriter::ClearNextNumInfo()
{
delete m_pNextNumRuleInfo;
m_pNextNumRuleInfo = nullptr;
m_pNextNumRuleInfo.reset();
}
void SwHTMLWriter::SetNextNumInfo( std::unique_ptr<SwHTMLNumRuleInfo> pNxt )
{
m_pNextNumRuleInfo = std::move(pNxt);
}
Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt,

View File

@ -171,6 +171,11 @@ SwHTMLWriter::~SwHTMLWriter()
{
}
std::unique_ptr<SwHTMLNumRuleInfo> SwHTMLWriter::ReleaseNextNumInfo()
{
return std::move(m_pNextNumRuleInfo);
}
void SwHTMLWriter::SetupFilterOptions(SfxMedium& rMedium)
{
const SfxItemSet* pSet = rMedium.GetItemSet();
@ -1519,8 +1524,7 @@ HTMLSaveData::HTMLSaveData(SwHTMLWriter& rWriter, sal_uLong nStt,
if( bSaveNum )
{
pOldNumRuleInfo = new SwHTMLNumRuleInfo( rWrt.GetNumInfo() );
pOldNextNumRuleInfo = rWrt.GetNextNumInfo();
rWrt.SetNextNumInfo( nullptr );
pOldNextNumRuleInfo = rWrt.ReleaseNextNumInfo();
}
else
{
@ -1555,7 +1559,7 @@ HTMLSaveData::~HTMLSaveData()
{
rWrt.GetNumInfo().Set( *pOldNumRuleInfo );
delete pOldNumRuleInfo;
rWrt.SetNextNumInfo( pOldNextNumRuleInfo );
rWrt.SetNextNumInfo( std::move(pOldNextNumRuleInfo) );
}
else
{

View File

@ -259,7 +259,7 @@ class SW_DLLPUBLIC SwHTMLWriter : public Writer
{
SwHTMLPosFlyFrames *m_pHTMLPosFlyFrames;
std::unique_ptr<SwHTMLNumRuleInfo> m_pNumRuleInfo;// current numbering
SwHTMLNumRuleInfo *m_pNextNumRuleInfo;
std::unique_ptr<SwHTMLNumRuleInfo> m_pNextNumRuleInfo;
sal_uInt32 m_nHTMLMode; // description of export configuration
FieldUnit m_eCSS1Unit;
@ -521,10 +521,11 @@ public:
// Fetch current numbering information of next paragraph. They
// don't have to exist yet!
SwHTMLNumRuleInfo *GetNextNumInfo() { return m_pNextNumRuleInfo; }
SwHTMLNumRuleInfo *GetNextNumInfo() { return m_pNextNumRuleInfo.get(); }
std::unique_ptr<SwHTMLNumRuleInfo> ReleaseNextNumInfo();
// Set the numbering information of next paragraph.
void SetNextNumInfo( SwHTMLNumRuleInfo *pNxt ) { m_pNextNumRuleInfo=pNxt; }
void SetNextNumInfo( std::unique_ptr<SwHTMLNumRuleInfo> pNxt );
// Fill the numbering information of next paragraph.
void FillNextNumInfo();
@ -621,7 +622,7 @@ struct HTMLSaveData
SwHTMLWriter& rWrt;
SwPaM* pOldPam, *pOldEnd;
SwHTMLNumRuleInfo *pOldNumRuleInfo; // Owner = this
SwHTMLNumRuleInfo *pOldNextNumRuleInfo; // Owner = HTML-Writer
std::unique_ptr<SwHTMLNumRuleInfo> pOldNextNumRuleInfo;
sal_uInt16 nOldDefListLvl;
SvxFrameDirection nOldDirection;
bool bOldWriteAll : 1;