diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx index 1cb392f718f8..a9f60c47039f 100644 --- a/compilerplugins/clang/useuniqueptr.cxx +++ b/compilerplugins/clang/useuniqueptr.cxx @@ -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()); } diff --git a/sw/source/filter/html/htmlnumwriter.cxx b/sw/source/filter/html/htmlnumwriter.cxx index dc21f1cbb0f2..bd0d2dadab8b 100644 --- a/sw/source/filter/html/htmlnumwriter.cxx +++ b/sw/source/filter/html/htmlnumwriter.cxx @@ -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 pNxt ) +{ + m_pNextNumRuleInfo = std::move(pNxt); } Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt, diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index c0347613752e..b2f90146fa7c 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -171,6 +171,11 @@ SwHTMLWriter::~SwHTMLWriter() { } +std::unique_ptr 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 { diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index 1aff873f8fc8..27ae06bd7bef 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -259,7 +259,7 @@ class SW_DLLPUBLIC SwHTMLWriter : public Writer { SwHTMLPosFlyFrames *m_pHTMLPosFlyFrames; std::unique_ptr m_pNumRuleInfo;// current numbering - SwHTMLNumRuleInfo *m_pNextNumRuleInfo; + std::unique_ptr 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 ReleaseNextNumInfo(); // Set the numbering information of next paragraph. - void SetNextNumInfo( SwHTMLNumRuleInfo *pNxt ) { m_pNextNumRuleInfo=pNxt; } + void SetNextNumInfo( std::unique_ptr 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 pOldNextNumRuleInfo; sal_uInt16 nOldDefListLvl; SvxFrameDirection nOldDirection; bool bOldWriteAll : 1;