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

loplugin:useuniqueptr in SwHTMLWriter

Change-Id: I67f3dd615e798f8ac865b57332f6153530d81929
Reviewed-on: https://gerrit.libreoffice.org/57863
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 0b7fe7b2
......@@ -104,6 +104,9 @@ public:
// SaveLine::pBox, pNext
if (fn == SRCDIR "/sw/source/core/undo/untbl.cxx")
return;
// RedlineInfo::pNextRedline
if (fn == SRCDIR "/sw/source/filter/xml/XMLRedlineImportHelper.cxx")
return;
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
}
......
......@@ -1079,7 +1079,7 @@ class HTMLEndPosLst
SwDoc *pDoc; // the current document
SwDoc* pTemplate; // the HTML template (or 0)
const Color* pDfltColor;// the default foreground colors
boost::optional<Color> xDfltColor;// the default foreground colors
std::set<OUString>& rScriptTextStyles;
sal_uLong nHTMLMode;
......@@ -1123,7 +1123,7 @@ class HTMLEndPosLst
public:
HTMLEndPosLst( SwDoc *pDoc, SwDoc* pTemplate, const Color* pDfltColor,
HTMLEndPosLst( SwDoc *pDoc, SwDoc* pTemplate, boost::optional<Color> xDfltColor,
bool bOutStyles, sal_uLong nHTMLMode,
const OUString& rText, std::set<OUString>& rStyles );
~HTMLEndPosLst();
......@@ -1570,12 +1570,12 @@ const SwHTMLFormatInfo *HTMLEndPosLst::GetFormatInfo( const SwFormat& rFormat,
}
HTMLEndPosLst::HTMLEndPosLst( SwDoc *pD, SwDoc* pTempl,
const Color* pDfltCol, bool bStyles,
boost::optional<Color> xDfltCol, bool bStyles,
sal_uLong nMode, const OUString& rText,
std::set<OUString>& rStyles ):
pDoc( pD ),
pTemplate( pTempl ),
pDfltColor( pDfltCol ),
xDfltColor( xDfltCol ),
rScriptTextStyles( rStyles ),
nHTMLMode( nMode ),
bOutStyles( bStyles )
......@@ -1681,8 +1681,8 @@ void HTMLEndPosLst::InsertNoScript( const SfxPoolItem& rItem,
Color aColor( static_cast<const SvxColorItem&>(rItem).GetValue() );
if( COL_AUTO == aColor )
aColor = COL_BLACK;
bSet = !bParaAttrs || !pDfltColor ||
!pDfltColor->IsRGBEqual( aColor );
bSet = !bParaAttrs || !xDfltColor ||
!xDfltColor->IsRGBEqual( aColor );
}
break;
......@@ -2259,7 +2259,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode )
// are there any hard attributes that must be written as tags?
aFullText += rStr;
HTMLEndPosLst aEndPosLst( rWrt.m_pDoc, rHTMLWrt.m_xTemplate.get(),
rHTMLWrt.m_pDfltColor, rHTMLWrt.m_bCfgOutStyles,
rHTMLWrt.m_xDfltColor, rHTMLWrt.m_bCfgOutStyles,
rHTMLWrt.GetHTMLMode(), aFullText,
rHTMLWrt.m_aScriptTextStyles );
if( aFormatInfo.pItemSet )
......
......@@ -345,7 +345,7 @@ void SwHTMLWriter::CollectFlyFrames()
}
if( !m_pHTMLPosFlyFrames )
m_pHTMLPosFlyFrames = new SwHTMLPosFlyFrames;
m_pHTMLPosFlyFrames.reset(new SwHTMLPosFlyFrames);
SwHTMLPosFlyFrame *pNew = new SwHTMLPosFlyFrame(**aIter, pSdrObj, nMode);
m_pHTMLPosFlyFrames->insert( pNew );
......@@ -385,8 +385,7 @@ bool SwHTMLWriter::OutFlyFrame( sal_uLong nNdIdx, sal_Int32 nContentIdx, HtmlPos
i--;
if( m_pHTMLPosFlyFrames->empty() )
{
delete m_pHTMLPosFlyFrames;
m_pHTMLPosFlyFrames = nullptr;
m_pHTMLPosFlyFrames.reset();
bRestart = true; // not really, only exit the loop
}
......
......@@ -97,7 +97,6 @@ SwHTMLWriter::SwHTMLWriter( const OUString& rBaseURL )
, m_eCSS1Unit(FUNIT_NONE)
, m_pFootEndNotes(nullptr)
, mxFormComps()
, m_pDfltColor(nullptr)
, m_pStartNdIdx(nullptr)
, m_pCurrPageDesc(nullptr)
, m_pFormatFootnote(nullptr)
......@@ -324,7 +323,7 @@ ErrCode SwHTMLWriter::WriteStream()
::StartProgress( STR_STATSTR_W4WWRITE, 0, m_pDoc->GetNodes().Count(),
m_pDoc->GetDocShell());
m_pDfltColor = nullptr;
m_xDfltColor.reset();
m_pFootEndNotes = nullptr;
m_pFormatFootnote = nullptr;
m_bOutTable = m_bOutHeader = m_bOutFooter = m_bOutFlyFrame = false;
......@@ -487,8 +486,7 @@ ErrCode SwHTMLWriter::WriteStream()
if( m_pHTMLPosFlyFrames )
{
m_pHTMLPosFlyFrames->DeleteAndDestroyAll();
delete m_pHTMLPosFlyFrames;
m_pHTMLPosFlyFrames = nullptr;
m_pHTMLPosFlyFrames.reset();
}
m_aHTMLControls.DeleteAndDestroyAll();
......@@ -513,8 +511,7 @@ ErrCode SwHTMLWriter::WriteStream()
m_aScriptParaStyles.clear();
m_aScriptTextStyles.clear();
delete m_pDfltColor;
m_pDfltColor = nullptr;
m_xDfltColor.reset();
delete m_pStartNdIdx;
m_pStartNdIdx = nullptr;
......@@ -928,7 +925,7 @@ static void OutBodyColor( const sal_Char* pTag, const SwFormat *pFormat,
aColor = COL_BLACK;
HTMLOutFuncs::Out_Color( rHWrt.Strm(), aColor );
if( RES_POOLCOLL_STANDARD==pFormat->GetPoolFormatId() )
rHWrt.m_pDfltColor = new Color( aColor );
rHWrt.m_xDfltColor = aColor;
}
}
......@@ -1523,7 +1520,7 @@ HTMLSaveData::HTMLSaveData(SwHTMLWriter& rWriter, sal_uLong nStt,
// Only then also the numbering information of the next paragraph will be valid.
if( bSaveNum )
{
pOldNumRuleInfo = new SwHTMLNumRuleInfo( rWrt.GetNumInfo() );
pOldNumRuleInfo.reset( new SwHTMLNumRuleInfo( rWrt.GetNumInfo() ) );
pOldNextNumRuleInfo = rWrt.ReleaseNextNumInfo();
}
else
......@@ -1558,7 +1555,7 @@ HTMLSaveData::~HTMLSaveData()
if( pOldNumRuleInfo )
{
rWrt.GetNumInfo().Set( *pOldNumRuleInfo );
delete pOldNumRuleInfo;
pOldNumRuleInfo.reset();
rWrt.SetNextNumInfo( std::move(pOldNextNumRuleInfo) );
}
else
......
......@@ -257,7 +257,7 @@ class IDocumentStylePoolAccess;
class SW_DLLPUBLIC SwHTMLWriter : public Writer
{
SwHTMLPosFlyFrames *m_pHTMLPosFlyFrames;
std::unique_ptr<SwHTMLPosFlyFrames> m_pHTMLPosFlyFrames;
std::unique_ptr<SwHTMLNumRuleInfo> m_pNumRuleInfo;// current numbering
std::unique_ptr<SwHTMLNumRuleInfo> m_pNextNumRuleInfo;
sal_uInt32 m_nHTMLMode; // description of export configuration
......@@ -296,7 +296,7 @@ public:
css::uno::Reference<css::container::XIndexContainer> mxFormComps; // current form
rtl::Reference<SwDoc> m_xTemplate; // HTML template
Color *m_pDfltColor; // default colour
boost::optional<Color> m_xDfltColor; // default colour
SwNodeIndex *m_pStartNdIdx; // index of first paragraph
const SwPageDesc *m_pCurrPageDesc;// current page style
const SwFormatFootnote *m_pFormatFootnote;
......@@ -621,7 +621,7 @@ struct HTMLSaveData
{
SwHTMLWriter& rWrt;
SwPaM* pOldPam, *pOldEnd;
SwHTMLNumRuleInfo *pOldNumRuleInfo; // Owner = this
std::unique_ptr<SwHTMLNumRuleInfo> pOldNumRuleInfo; // Owner = this
std::unique_ptr<SwHTMLNumRuleInfo> pOldNextNumRuleInfo;
sal_uInt16 nOldDefListLvl;
SvxFrameDirection nOldDirection;
......
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