loplugin:useuniqueptr in XFStyleManager

Change-Id: I6fccaef0778ce02fc6d6daaa2fdb31af9ea1c19f
Reviewed-on: https://gerrit.libreoffice.org/56334
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2018-06-22 13:40:49 +02:00
parent f2ab7b0ddb
commit 879c455e49
2 changed files with 4 additions and 9 deletions

View File

@@ -133,7 +133,7 @@ private:
XFStyleContainer s_aTableCellStyles;
XFStyleContainer s_aTableRowStyles;
XFStyleContainer s_aTableColStyles;
IXFStyle *s_pOutlineStyle;
std::unique_ptr<IXFStyle> s_pOutlineStyle;
XFStyleContainer s_aRubyStyles;
};

View File

@@ -80,11 +80,7 @@ XFStyleManager::~XFStyleManager()
void XFStyleManager::Reset()
{
if( s_pOutlineStyle )
{
delete s_pOutlineStyle;
s_pOutlineStyle = nullptr;
}
s_pOutlineStyle.reset();
s_aStdTextStyles.Reset();
s_aStdParaStyles.Reset();
@@ -203,8 +199,7 @@ IXFStyleRet XFStyleManager::AddStyle(std::unique_ptr<IXFStyle> pStyle)
}
else if( pStyle->GetStyleFamily() == enumXFStyleOutline )
{
delete s_pOutlineStyle;
s_pOutlineStyle = pStyle.release();
s_pOutlineStyle = std::move(pStyle);
}
else if( pStyle->GetStyleFamily() == enumXFStyleStrokeDash )
{
@@ -265,7 +260,7 @@ IXFStyle* XFStyleManager::FindStyle(const OUString& name)
if( pStyle )
return pStyle;
if(s_pOutlineStyle && s_pOutlineStyle->GetStyleName() == name )
return s_pOutlineStyle;
return s_pOutlineStyle.get();
pStyle = s_aStdStrokeDashStyles.FindStyle(name);
if( pStyle )
return pStyle;