loplugin:useuniqueptr in XclObj

Change-Id: I2995dfe5fb39ae2e7f3c37992cb3e2147381784e
Reviewed-on: https://gerrit.libreoffice.org/57753
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2018-07-19 12:11:06 +02:00
parent 8c63897b83
commit 82a2a8f29e
4 changed files with 14 additions and 12 deletions

View File

@@ -88,6 +88,10 @@ public:
// SwHTMLParser::m_pPendStack // SwHTMLParser::m_pPendStack
if (fn == SRCDIR "/sw/source/filter/html/htmlcss1.cxx") if (fn == SRCDIR "/sw/source/filter/html/htmlcss1.cxx")
return; return;
// Visual Studio 2017 has trouble with these
if (fn == SRCDIR "/comphelper/source/property/MasterPropertySet.cxx"
|| fn == SRCDIR "/comphelper/source/property/MasterPropertySetInfo.cxx")
return;
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());

View File

@@ -743,7 +743,7 @@ XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rRoot, Reference<
/* Be sure to construct the MSODRAWING record containing the /* Be sure to construct the MSODRAWING record containing the
ClientTextbox atom after the base OBJ's MSODRAWING record data is ClientTextbox atom after the base OBJ's MSODRAWING record data is
completed. */ completed. */
pClientTextbox = new XclExpMsoDrawing( mrEscherEx ); pClientTextbox.reset( new XclExpMsoDrawing( mrEscherEx ) );
mrEscherEx.AddAtom( 0, ESCHER_ClientTextbox ); // TXO record mrEscherEx.AddAtom( 0, ESCHER_ClientTextbox ); // TXO record
mrEscherEx.UpdateDffFragmentEnd(); mrEscherEx.UpdateDffFragmentEnd();
@@ -756,7 +756,7 @@ XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rRoot, Reference<
nXclFont = GetFontBuffer().Insert( aFontData, EXC_COLOR_CTRLTEXT ); nXclFont = GetFontBuffer().Insert( aFontData, EXC_COLOR_CTRLTEXT );
} }
pTxo = new XclTxo( aString, nXclFont ); pTxo.reset( new XclTxo( aString, nXclFont ) );
pTxo->SetHorAlign( (mnObjType == EXC_OBJTYPE_BUTTON) ? EXC_OBJ_HOR_CENTER : EXC_OBJ_HOR_LEFT ); pTxo->SetHorAlign( (mnObjType == EXC_OBJTYPE_BUTTON) ? EXC_OBJ_HOR_CENTER : EXC_OBJ_HOR_LEFT );
pTxo->SetVerAlign( EXC_OBJ_VER_CENTER ); pTxo->SetVerAlign( EXC_OBJ_VER_CENTER );
} }

View File

@@ -87,8 +87,8 @@ class XclObj : public XclExpRecord
protected: protected:
XclEscherEx& mrEscherEx; XclEscherEx& mrEscherEx;
XclExpMsoDrawing* pMsodrawing; XclExpMsoDrawing* pMsodrawing;
XclExpMsoDrawing* pClientTextbox; std::unique_ptr<XclExpMsoDrawing> pClientTextbox;
XclTxo* pTxo; std::unique_ptr<XclTxo> pTxo;
sal_uInt16 mnObjType; sal_uInt16 mnObjType;
sal_uInt16 nObjId; sal_uInt16 nObjId;
sal_uInt16 nGrbit; sal_uInt16 nGrbit;

View File

@@ -338,8 +338,6 @@ void XclExpObjList::ResetCounters()
XclObj::XclObj( XclExpObjectManager& rObjMgr, sal_uInt16 nObjType, bool bOwnEscher ) : XclObj::XclObj( XclExpObjectManager& rObjMgr, sal_uInt16 nObjType, bool bOwnEscher ) :
XclExpRecord( EXC_ID_OBJ, 26 ), XclExpRecord( EXC_ID_OBJ, 26 ),
mrEscherEx( rObjMgr.GetEscherEx() ), mrEscherEx( rObjMgr.GetEscherEx() ),
pClientTextbox( nullptr ),
pTxo( nullptr ),
mnObjType( nObjType ), mnObjType( nObjType ),
nObjId(0), nObjId(0),
nGrbit( 0x6011 ), // AutoLine, AutoFill, Printable, Locked nGrbit( 0x6011 ), // AutoLine, AutoFill, Printable, Locked
@@ -358,8 +356,8 @@ XclObj::~XclObj()
{ {
if ( !bFirstOnSheet ) if ( !bFirstOnSheet )
delete pMsodrawing; delete pMsodrawing;
delete pClientTextbox; pClientTextbox.reset();
delete pTxo; pTxo.reset();
} }
void XclObj::ImplWriteAnchor( const SdrObject* pSdrObj, const tools::Rectangle* pChildAnchor ) void XclObj::ImplWriteAnchor( const SdrObject* pSdrObj, const tools::Rectangle* pChildAnchor )
@@ -410,10 +408,10 @@ void XclObj::SetText( const XclExpRoot& rRoot, const SdrTextObj& rObj )
if ( !pClientTextbox ) if ( !pClientTextbox )
{ {
mrEscherEx.UpdateDffFragmentEnd(); mrEscherEx.UpdateDffFragmentEnd();
pClientTextbox = new XclExpMsoDrawing( mrEscherEx ); pClientTextbox.reset( new XclExpMsoDrawing( mrEscherEx ) );
mrEscherEx.AddAtom( 0, ESCHER_ClientTextbox ); // TXO record mrEscherEx.AddAtom( 0, ESCHER_ClientTextbox ); // TXO record
mrEscherEx.UpdateDffFragmentEnd(); mrEscherEx.UpdateDffFragmentEnd();
pTxo = new XclTxo( rRoot, rObj ); pTxo.reset( new XclTxo( rRoot, rObj ) );
} }
} }
@@ -514,7 +512,7 @@ XclObjComment::XclObjComment( XclExpObjectManager& rObjMgr, const tools::Rectang
{ {
ProcessEscherObj( rObjMgr.GetRoot(), rRect, pCaption, bVisible); ProcessEscherObj( rObjMgr.GetRoot(), rRect, pCaption, bVisible);
// TXO // TXO
pTxo = new XclTxo( rObjMgr.GetRoot(), rEditObj, pCaption ); pTxo .reset(new XclTxo( rObjMgr.GetRoot(), rEditObj, pCaption ));
} }
static void lcl_FillProps( EscherPropertyContainer& rPropOpt, SdrObject* pCaption, bool bVisible ) static void lcl_FillProps( EscherPropertyContainer& rPropOpt, SdrObject* pCaption, bool bVisible )
@@ -584,7 +582,7 @@ void XclObjComment::ProcessEscherObj( const XclExpRoot& rRoot, const tools::Rect
//! Be sure to construct the MSODRAWING ClientTextbox record _after_ the //! Be sure to construct the MSODRAWING ClientTextbox record _after_ the
//! base OBJ's MSODRAWING record Escher data is completed. //! base OBJ's MSODRAWING record Escher data is completed.
pClientTextbox = new XclExpMsoDrawing( mrEscherEx ); pClientTextbox.reset( new XclExpMsoDrawing( mrEscherEx ) );
mrEscherEx.AddAtom( 0, ESCHER_ClientTextbox ); // TXO record mrEscherEx.AddAtom( 0, ESCHER_ClientTextbox ); // TXO record
mrEscherEx.UpdateDffFragmentEnd(); mrEscherEx.UpdateDffFragmentEnd();
mrEscherEx.CloseContainer(); // ESCHER_SpContainer mrEscherEx.CloseContainer(); // ESCHER_SpContainer