diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-17 13:09:11 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-18 06:58:44 +0000 |
commit | d96c114171dada05caffd9a50f870809ebd0c450 (patch) | |
tree | 2ef1572fce732c39557b3f2f944aef86f17aa703 /oox | |
parent | 70aa5799336de6cbd1d964e2e9a176b44d438db2 (diff) |
clang-tidy modernize-make-shared
Change-Id: I3fa866bfb3093fc876474a9d9db29fe05dc2af3a
Reviewed-on: https://gerrit.libreoffice.org/25056
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/core/fragmenthandler.cxx | 4 | ||||
-rw-r--r-- | oox/source/core/xmlfilterbase.cxx | 5 | ||||
-rw-r--r-- | oox/source/drawingml/chart/plotareaconverter.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/chart/typegroupconverter.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 12 | ||||
-rw-r--r-- | oox/source/drawingml/shapecontext.cxx | 4 | ||||
-rw-r--r-- | oox/source/drawingml/shapegroupcontext.cxx | 8 | ||||
-rw-r--r-- | oox/source/drawingml/textliststyle.cxx | 10 | ||||
-rw-r--r-- | oox/source/drawingml/themeelementscontext.cxx | 6 | ||||
-rw-r--r-- | oox/source/export/vmlexport.cxx | 2 | ||||
-rw-r--r-- | oox/source/ppt/pptimport.cxx | 2 | ||||
-rw-r--r-- | oox/source/ppt/presentationfragmenthandler.cxx | 4 | ||||
-rw-r--r-- | oox/source/ppt/slidefragmenthandler.cxx | 4 | ||||
-rw-r--r-- | oox/source/shape/WpgContext.cxx | 4 |
14 files changed, 34 insertions, 35 deletions
diff --git a/oox/source/core/fragmenthandler.cxx b/oox/source/core/fragmenthandler.cxx index 653b2719445f..a4e4d23f6993 100644 --- a/oox/source/core/fragmenthandler.cxx +++ b/oox/source/core/fragmenthandler.cxx @@ -36,12 +36,12 @@ FragmentBaseData::FragmentBaseData( XmlFilterBase& rFilter, const OUString& rFra } FragmentHandler::FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath ) : - FragmentHandler_BASE( FragmentBaseDataRef( new FragmentBaseData( rFilter, rFragmentPath, rFilter.importRelations( rFragmentPath ) ) ) ) + FragmentHandler_BASE( std::make_shared<FragmentBaseData>( rFilter, rFragmentPath, rFilter.importRelations( rFragmentPath ) ) ) { } FragmentHandler::FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, RelationsRef xRelations ) : - FragmentHandler_BASE( FragmentBaseDataRef( new FragmentBaseData( rFilter, rFragmentPath, xRelations ) ) ) + FragmentHandler_BASE( std::make_shared<FragmentBaseData>( rFilter, rFragmentPath, xRelations ) ) { } diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index fe6a1aaef3a2..2019f31e26ee 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -452,9 +452,8 @@ Reference< XOutputStream > XmlFilterBase::openFragmentStream( const OUString& rS FSHelperPtr XmlFilterBase::openFragmentStreamWithSerializer( const OUString& rStreamName, const OUString& rMediaType ) { - bool bWriteHeader - = rMediaType.indexOf( "vml" ) < 0 || rMediaType.indexOf( "+xml" ) >= 0; - return FSHelperPtr( new FastSerializerHelper( openFragmentStream( rStreamName, rMediaType ), bWriteHeader ) ); + bool bWriteHeader = rMediaType.indexOf( "vml" ) < 0 || rMediaType.indexOf( "+xml" ) >= 0; + return std::make_shared<FastSerializerHelper>( openFragmentStream( rStreamName, rMediaType ), bWriteHeader ); } TextFieldStack& XmlFilterBase::getTextFieldStack() const diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx b/oox/source/drawingml/chart/plotareaconverter.cxx index 2e967156cfc7..b7796db7445a 100644 --- a/oox/source/drawingml/chart/plotareaconverter.cxx +++ b/oox/source/drawingml/chart/plotareaconverter.cxx @@ -118,7 +118,7 @@ void AxesSetConverter::convertFromModel( const Reference< XDiagram >& rxDiagram, typedef RefVector< TypeGroupConverter > TypeGroupConvVector; TypeGroupConvVector aTypeGroups; for( AxesSetModel::TypeGroupVector::iterator aIt = mrModel.maTypeGroups.begin(), aEnd = mrModel.maTypeGroups.end(); aIt != aEnd; ++aIt ) - aTypeGroups.push_back( TypeGroupConvVector::value_type( new TypeGroupConverter( *this, **aIt ) ) ); + aTypeGroups.push_back( std::make_shared<TypeGroupConverter>( *this, **aIt ) ); OSL_ENSURE( !aTypeGroups.empty(), "AxesSetConverter::convertFromModel - no type groups in axes set" ); if( !aTypeGroups.empty() ) try diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx index d0369b2532c3..e39fba78686e 100644 --- a/oox/source/drawingml/chart/typegroupconverter.cxx +++ b/oox/source/drawingml/chart/typegroupconverter.cxx @@ -345,7 +345,7 @@ void TypeGroupConverter::convertFromModel( const Reference< XDiagram >& rxDiagra typedef RefVector< SeriesConverter > SeriesConvVector; SeriesConvVector aSeries; for( TypeGroupModel::SeriesVector::iterator aIt = mrModel.maSeries.begin(), aEnd = mrModel.maSeries.end(); aIt != aEnd; ++aIt ) - aSeries.push_back( SeriesConvVector::value_type( new SeriesConverter( *this, **aIt ) ) ); + aSeries.push_back( std::make_shared<SeriesConverter>( *this, **aIt ) ); // reverse series order for some unstacked 2D chart types if( isReverseSeries() ) diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 537ca03c4a66..a3ab4677f983 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -298,16 +298,16 @@ void Shape::applyShapeReference( const Shape& rReferencedShape, bool bUseText ) SAL_INFO("oox", OSL_THIS_FUNC << "apply shape reference: " << rReferencedShape.msId << " to shape id: " << msId); if ( rReferencedShape.mpTextBody.get() && bUseText ) - mpTextBody = TextBodyPtr( new TextBody( *rReferencedShape.mpTextBody.get() ) ); + mpTextBody = std::make_shared<TextBody>( *rReferencedShape.mpTextBody.get() ); else mpTextBody.reset(); maShapeProperties = rReferencedShape.maShapeProperties; - mpShapeRefLinePropPtr = LinePropertiesPtr( new LineProperties( *rReferencedShape.mpLinePropertiesPtr.get() ) ); - mpShapeRefFillPropPtr = FillPropertiesPtr( new FillProperties( *rReferencedShape.mpFillPropertiesPtr.get() ) ); - mpCustomShapePropertiesPtr = CustomShapePropertiesPtr( new CustomShapeProperties( *rReferencedShape.mpCustomShapePropertiesPtr.get() ) ); + mpShapeRefLinePropPtr = std::make_shared<LineProperties>( *rReferencedShape.mpLinePropertiesPtr.get() ); + mpShapeRefFillPropPtr = std::make_shared<FillProperties>( *rReferencedShape.mpFillPropertiesPtr.get() ); + mpCustomShapePropertiesPtr = std::make_shared<CustomShapeProperties>( *rReferencedShape.mpCustomShapePropertiesPtr.get() ); mpTablePropertiesPtr = table::TablePropertiesPtr( rReferencedShape.mpTablePropertiesPtr.get() ? new table::TableProperties( *rReferencedShape.mpTablePropertiesPtr.get() ) : nullptr ); - mpShapeRefEffectPropPtr = EffectPropertiesPtr( new EffectProperties( *rReferencedShape.mpEffectPropertiesPtr.get() ) ); - mpMasterTextListStyle = TextListStylePtr( new TextListStyle( *rReferencedShape.mpMasterTextListStyle.get() ) ); + mpShapeRefEffectPropPtr = std::make_shared<EffectProperties>( *rReferencedShape.mpEffectPropertiesPtr.get() ); + mpMasterTextListStyle = std::make_shared<TextListStyle>( *rReferencedShape.mpMasterTextListStyle.get() ); maSize = rReferencedShape.maSize; maPosition = rReferencedShape.maPosition; mnRotation = rReferencedShape.mnRotation; diff --git a/oox/source/drawingml/shapecontext.cxx b/oox/source/drawingml/shapecontext.cxx index 9b097fc05881..fe011c94f944 100644 --- a/oox/source/drawingml/shapecontext.cxx +++ b/oox/source/drawingml/shapecontext.cxx @@ -95,7 +95,7 @@ ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 aElementToken, const case XML_txbxContent: { if (!mpShapePtr->getTextBody()) - mpShapePtr->setTextBody( TextBodyPtr(new TextBody) ); + mpShapePtr->setTextBody( std::make_shared<TextBody>() ); return new TextBodyContext( *this, *mpShapePtr->getTextBody() ); } case XML_txXfrm: @@ -109,7 +109,7 @@ ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 aElementToken, const break; case XML_bodyPr: if (!mpShapePtr->getTextBody()) - mpShapePtr->setTextBody( TextBodyPtr(new TextBody) ); + mpShapePtr->setTextBody( std::make_shared<TextBody>() ); return new TextBodyPropertiesContext( *this, rAttribs, mpShapePtr->getTextBody()->getTextProperties() ); break; case XML_txbx: diff --git a/oox/source/drawingml/shapegroupcontext.cxx b/oox/source/drawingml/shapegroupcontext.cxx index 2dbd69424ed5..1cb33adb3e65 100644 --- a/oox/source/drawingml/shapegroupcontext.cxx +++ b/oox/source/drawingml/shapegroupcontext.cxx @@ -93,17 +93,17 @@ ContextHandlerRef ShapeGroupContext::onCreateContext( sal_Int32 aElementToken, c return new ConnectorShapeContext( *this, mpGroupShapePtr, pShape ); } case XML_grpSp: // group shape - return new ShapeGroupContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.GroupShape" ) ) ); + return new ShapeGroupContext( *this, mpGroupShapePtr, std::make_shared<Shape>( "com.sun.star.drawing.GroupShape" ) ); case XML_sp: // shape case XML_wsp: // Don't set default character height for WPS shapes, Writer has its // own way to set the default, and if we don't set it here, editing // properly inherits it. - return new ShapeContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.CustomShape", getBaseToken(aElementToken) == XML_sp ) ) ); + return new ShapeContext( *this, mpGroupShapePtr, std::make_shared<Shape>( "com.sun.star.drawing.CustomShape", getBaseToken(aElementToken) == XML_sp ) ); case XML_pic: // CT_Picture - return new GraphicShapeContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.GraphicObjectShape" ) ) ); + return new GraphicShapeContext( *this, mpGroupShapePtr, std::make_shared<Shape>( "com.sun.star.drawing.GraphicObjectShape" ) ); case XML_graphicFrame: // CT_GraphicalObjectFrame - return new GraphicalObjectFrameContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.GraphicObjectShape" ) ), true ); + return new GraphicalObjectFrameContext( *this, mpGroupShapePtr, std::make_shared<Shape>( "com.sun.star.drawing.GraphicObjectShape" ), true ); case XML_cNvGrpSpPr: break; case XML_grpSpLocks: diff --git a/oox/source/drawingml/textliststyle.cxx b/oox/source/drawingml/textliststyle.cxx index 44b0f4121324..141c963e6a4c 100644 --- a/oox/source/drawingml/textliststyle.cxx +++ b/oox/source/drawingml/textliststyle.cxx @@ -26,8 +26,8 @@ TextListStyle::TextListStyle() { for ( int i = 0; i < 9; i++ ) { - maListStyle.push_back( TextParagraphPropertiesPtr( new TextParagraphProperties() ) ); - maAggregationListStyle.push_back( TextParagraphPropertiesPtr( new TextParagraphProperties() ) ); + maListStyle.push_back( std::make_shared<TextParagraphProperties>( ) ); + maAggregationListStyle.push_back( std::make_shared<TextParagraphProperties>( ) ); } } @@ -41,8 +41,8 @@ TextListStyle::TextListStyle(const TextListStyle& rStyle) assert(rStyle.maAggregationListStyle.size() == 9); for ( size_t i = 0; i < 9; i++ ) { - maListStyle.push_back( TextParagraphPropertiesPtr( new TextParagraphProperties(*rStyle.maListStyle[i]) ) ); - maAggregationListStyle.push_back( TextParagraphPropertiesPtr( new TextParagraphProperties(*rStyle.maAggregationListStyle[i]) ) ); + maListStyle.push_back( std::make_shared<TextParagraphProperties>( *rStyle.maListStyle[i] ) ); + maAggregationListStyle.push_back( std::make_shared<TextParagraphProperties>( *rStyle.maAggregationListStyle[i] ) ); } } @@ -75,7 +75,7 @@ void applyStyleList( const TextParagraphPropertiesVector& rSourceListStyle, Text ++aDestListStyleIter; } else - rDestListStyle.push_back( TextParagraphPropertiesPtr( new TextParagraphProperties( **aSourceListStyleIter ) ) ); + rDestListStyle.push_back( std::make_shared<TextParagraphProperties>( **aSourceListStyleIter ) ); ++aSourceListStyleIter; } } diff --git a/oox/source/drawingml/themeelementscontext.cxx b/oox/source/drawingml/themeelementscontext.cxx index 1f2622f93a3f..7f757476abd3 100644 --- a/oox/source/drawingml/themeelementscontext.cxx +++ b/oox/source/drawingml/themeelementscontext.cxx @@ -64,7 +64,7 @@ ContextHandlerRef FillStyleListContext::onCreateContext( sal_Int32 nElement, con case A_TOKEN( blipFill ): case A_TOKEN( pattFill ): case A_TOKEN( grpFill ): - mrFillStyleList.push_back( FillPropertiesPtr( new FillProperties ) ); + mrFillStyleList.push_back( std::make_shared<FillProperties>( ) ); return FillPropertiesContext::createFillContext( *this, nElement, rAttribs, *mrFillStyleList.back() ); } return nullptr; @@ -91,7 +91,7 @@ ContextHandlerRef LineStyleListContext::onCreateContext( sal_Int32 nElement, con switch( nElement ) { case A_TOKEN( ln ): - mrLineStyleList.push_back( LinePropertiesPtr( new LineProperties ) ); + mrLineStyleList.push_back( std::make_shared<LineProperties>( ) ); return new LinePropertiesContext( *this, rAttribs, *mrLineStyleList.back() ); } return nullptr; @@ -118,7 +118,7 @@ ContextHandlerRef EffectStyleListContext::onCreateContext( sal_Int32 nElement, c switch( nElement ) { case A_TOKEN( effectStyle ): - mrEffectStyleList.push_back( EffectPropertiesPtr( new EffectProperties ) ); + mrEffectStyleList.push_back( std::make_shared<EffectProperties>( ) ); return this; case A_TOKEN( effectLst ): // CT_EffectList diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index a907f480cc16..8cad39ebfe0c 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -50,7 +50,7 @@ static const sal_Int32 Tag_Container = 44444; static const sal_Int32 Tag_Commit = 44445; VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr pSerializer, VMLTextExport* pTextExport ) - : EscherEx( EscherExGlobalRef(new EscherExGlobal(0)), nullptr, /*bOOXML=*/true ) + : EscherEx( std::make_shared<EscherExGlobal>(0), nullptr, /*bOOXML=*/true ) , m_pSerializer( pSerializer ) , m_pTextExport( pTextExport ) , m_eHOri( 0 ) diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx index 3e484065ddf2..9a606e6f1a9a 100644 --- a/oox/source/ppt/pptimport.cxx +++ b/oox/source/ppt/pptimport.cxx @@ -175,7 +175,7 @@ const oox::drawingml::table::TableStyleListPtr PowerPointImport::getTableStyles( { if ( !mpTableStyleList && !maTableStyleListPath.isEmpty() ) { - mpTableStyleList = oox::drawingml::table::TableStyleListPtr( new oox::drawingml::table::TableStyleList() ); + mpTableStyleList = std::make_shared<oox::drawingml::table::TableStyleList>( ); importFragment( new oox::drawingml::table::TableStyleListFragmentHandler( *this, maTableStyleListPath, *mpTableStyleList ) ); } diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index 5447114339c1..944f1349cee0 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -201,8 +201,8 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage else xMasterPage = xMasterPages->insertNewByIndex( xMasterPages->getCount() ); - pMasterPersistPtr = SlidePersistPtr( new SlidePersist( rFilter, true, false, xMasterPage, - ShapePtr( new PPTShape( Master, "com.sun.star.drawing.GroupShape" ) ), mpTextListStyle ) ); + pMasterPersistPtr = std::make_shared<SlidePersist>( rFilter, true, false, xMasterPage, + ShapePtr( new PPTShape( Master, "com.sun.star.drawing.GroupShape" ) ), mpTextListStyle ); pMasterPersistPtr->setLayoutPath( aLayoutFragmentPath ); rFilter.getMasterPages().push_back( pMasterPersistPtr ); rFilter.setActualSlidePersist( pMasterPersistPtr ); diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index 972480f87ac2..bd7b6f13f763 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -109,8 +109,8 @@ SlideFragmentHandler::~SlideFragmentHandler() if( aIter == rMasterPages.end() && !mpSlidePersistPtr->getMasterPersist() ) { TextListStylePtr pTextListStyle(new TextListStyle); - SlidePersistPtr pMasterPersistPtr = SlidePersistPtr( new SlidePersist( rFilter, true, true, mpSlidePersistPtr->getPage(), - ShapePtr( new PPTShape( Master, "com.sun.star.drawing.GroupShape" ) ), mpSlidePersistPtr->getNotesTextStyle() ) ); + SlidePersistPtr pMasterPersistPtr = std::make_shared<SlidePersist>( rFilter, true, true, mpSlidePersistPtr->getPage(), + ShapePtr( new PPTShape( Master, "com.sun.star.drawing.GroupShape" ) ), mpSlidePersistPtr->getNotesTextStyle() ); pMasterPersistPtr->setPath( aNotesFragmentPath ); rFilter.getMasterPages().push_back( pMasterPersistPtr ); FragmentHandlerRef xMasterFragmentHandler( new SlideFragmentHandler( rFilter, aNotesFragmentPath, pMasterPersistPtr, Master ) ); diff --git a/oox/source/shape/WpgContext.cxx b/oox/source/shape/WpgContext.cxx index bfdeb26e540c..b5fe45b53ed0 100644 --- a/oox/source/shape/WpgContext.cxx +++ b/oox/source/shape/WpgContext.cxx @@ -53,11 +53,11 @@ oox::core::ContextHandlerRef WpgContext::onCreateContext(sal_Int32 nElementToken } break; case XML_pic: - return new oox::drawingml::GraphicShapeContext(*this, mpShape, oox::drawingml::ShapePtr(new oox::drawingml::Shape("com.sun.star.drawing.GraphicObjectShape"))); + return new oox::drawingml::GraphicShapeContext(*this, mpShape, std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GraphicObjectShape")); break; case XML_grpSp: { - return new oox::drawingml::ShapeGroupContext(*this, mpShape, oox::drawingml::ShapePtr(new oox::drawingml::Shape("com.sun.star.drawing.GroupShape"))); + return new oox::drawingml::ShapeGroupContext(*this, mpShape, std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape")); } break; case XML_graphicFrame: |