From 6124ad4ca2c98e4c76cc7a32c4c8e538d9cd8b87 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 9 Apr 2015 09:08:55 +0200 Subject: DocxAttributeOutput::m_pPostponedGraphic: use std::unique_ptr<> Change-Id: I033cc6fce66203ad2967064211f9144b0edf8d1e --- sw/source/filter/ww8/docxattributeoutput.cxx | 20 +++++++++----------- sw/source/filter/ww8/docxattributeoutput.hxx | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 793f85c676d9..5328de1b82d0 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1596,8 +1596,8 @@ void DocxAttributeOutput::StartRunProperties() } InitCollectedRunProperties(); - OSL_ASSERT( m_postponedGraphic == NULL ); - m_postponedGraphic = new std::list< PostponedGraphic >; + OSL_ASSERT( !m_pPostponedGraphic ); + m_pPostponedGraphic.reset(new std::list()); OSL_ASSERT( m_postponedDiagram == NULL ); m_postponedDiagram = new std::list< PostponedDiagram >; @@ -1962,12 +1962,11 @@ void DocxAttributeOutput::GetSdtEndBefore(const SdrObject* pSdrObj) void DocxAttributeOutput::WritePostponedGraphic() { - for( std::list< PostponedGraphic >::const_iterator it = m_postponedGraphic->begin(); - it != m_postponedGraphic->end(); + for( std::list< PostponedGraphic >::const_iterator it = m_pPostponedGraphic->begin(); + it != m_pPostponedGraphic->end(); ++it ) FlyFrameGraphic( it->grfNode, it->size, it->mOLEFrmFmt, it->mOLENode, it->pSdrObj ); - delete m_postponedGraphic; - m_postponedGraphic = NULL; + m_pPostponedGraphic.reset(0); } void DocxAttributeOutput::WritePostponedDiagram() @@ -4211,11 +4210,11 @@ void DocxAttributeOutput::WriteOLE2Obj( const SdrObject* pSdrObj, SwOLENode& rOL if( PostponeOLE( pSdrObj, rOLENode, rSize, pFlyFrmFmt )) return; // Then we fall back to just export the object as a graphic. - if( m_postponedGraphic == NULL ) + if( !m_pPostponedGraphic ) FlyFrameGraphic( 0, rSize, pFlyFrmFmt, &rOLENode ); else // w:drawing should not be inside w:rPr, so write it out later - m_postponedGraphic->push_back( PostponedGraphic( 0, rSize, pFlyFrmFmt, &rOLENode, 0 ) ); + m_pPostponedGraphic->push_back(PostponedGraphic(0, rSize, pFlyFrmFmt, &rOLENode, 0)); } bool DocxAttributeOutput::WriteOLEChart( const SdrObject* pSdrObj, const Size& rSize ) @@ -4786,7 +4785,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po const SwGrfNode *pGrfNode = pNode ? pNode->GetGrfNode() : 0; if ( pGrfNode ) { - if( m_postponedGraphic == NULL ) + if (!m_pPostponedGraphic) { m_bPostponedProcessingFly = false ; FlyFrameGraphic( pGrfNode, rFrame.GetLayoutSize(), 0, 0, pSdrObj); @@ -4794,7 +4793,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po else // we are writing out attributes, but w:drawing should not be inside w:rPr, { // so write it out later m_bPostponedProcessingFly = true ; - m_postponedGraphic->push_back( PostponedGraphic( pGrfNode, rFrame.GetLayoutSize(), 0, 0, pSdrObj)); + m_pPostponedGraphic->push_back(PostponedGraphic(pGrfNode, rFrame.GetLayoutSize(), 0, 0, pSdrObj)); } } } @@ -8279,7 +8278,6 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri m_startedHyperlink( false ), m_nHyperLinkCount(0), m_nFieldsInHyperlink( 0 ), - m_postponedGraphic( NULL ), m_postponedDiagram( NULL ), m_postponedVMLDrawing(NULL), m_postponedDMLDrawing(NULL), diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index c63efd363f56..7e0cea603c5e 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -832,7 +832,7 @@ private: SwOLENode* mOLENode; const SdrObject* pSdrObj; }; - std::list< PostponedGraphic >* m_postponedGraphic; + std::unique_ptr< std::list > m_pPostponedGraphic; struct PostponedDiagram { PostponedDiagram( const SdrObject* o, const SwFrmFmt* frm ) : object( o ), frame( frm ) {}; -- cgit v1.2.3