From bd66648fc2d361a9a18e62522c244cd245abf198 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sat, 13 Feb 2016 19:00:13 +0200 Subject: sequence->vector in filter Change-Id: I2b18a4affed75dfc36d44ba485b2ac44d0e082cb Reviewed-on: https://gerrit.libreoffice.org/23690 Tested-by: Jenkins Reviewed-by: Noel Grandin --- filter/source/svg/svgexport.cxx | 22 +++++++++++----------- filter/source/svg/svgfilter.cxx | 14 +++++++------- filter/source/svg/svgfilter.hxx | 5 ++--- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 8e068451e829..17a88281d3d5 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -554,7 +554,7 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) if( xOStm.is() ) { - if( mSelectedPages.hasElements() && !mMasterPageTargets.empty() ) + if( !mSelectedPages.empty() && !mMasterPageTargets.empty() ) { Reference< XDocumentHandler > xDocHandler( implCreateExportDocumentHandler( xOStm ), UNO_QUERY ); @@ -571,8 +571,8 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) Reference< XInterface > xSVGExport = static_cast< css::document::XFilter* >( mpSVGExport ); // create an id for each draw page - for( sal_Int32 i = 0; i < mSelectedPages.getLength(); ++i ) - implRegisterInterface( mSelectedPages[i] ); + for( auto& rPage : mSelectedPages ) + implRegisterInterface( rPage ); // create an id for each master page for( size_t i = 0; i < mMasterPageTargets.size(); ++i ) @@ -658,7 +658,7 @@ Reference< XWriter > SVGFilter::implCreateExportDocumentHandler( const Reference bool SVGFilter::implLookForFirstVisiblePage() { - sal_Int32 nCurPage = 0, nLastPage = mSelectedPages.getLength() - 1; + sal_Int32 nCurPage = 0, nLastPage = mSelectedPages.size() - 1; while( ( nCurPage <= nLastPage ) && ( -1 == mnVisiblePage ) ) { @@ -692,7 +692,7 @@ bool SVGFilter::implExportDocument() sal_Int32 nDocX = 0, nDocY = 0; // #i124608# sal_Int32 nDocWidth = 0, nDocHeight = 0; bool bRet = false; - sal_Int32 nLastPage = mSelectedPages.getLength() - 1; + sal_Int32 nLastPage = mSelectedPages.size() - 1; mbSinglePage = (nLastPage == 0); mnVisiblePage = -1; @@ -933,7 +933,7 @@ OUString implGenerateFieldId( std::vector< TextField* > & aFieldSet, void SVGFilter::implGenerateMetaData() { - sal_Int32 nCount = mSelectedPages.getLength(); + sal_Int32 nCount = mSelectedPages.size(); if( nCount != 0 ) { // we wrap all meta presentation info into a svg:defs element @@ -1160,7 +1160,7 @@ void SVGFilter::implExportAnimations() mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", "presentation-animations" ); SvXMLElementExport aDefsContainerElem( *mpSVGExport, XML_NAMESPACE_NONE, "defs", true, true ); - for( sal_Int32 i = 0; i < mSelectedPages.getLength(); ++i ) + for( size_t i = 0; i < mSelectedPages.size(); ++i ) { Reference< XPropertySet > xProps( mSelectedPages[i], UNO_QUERY ); @@ -1220,7 +1220,7 @@ void SVGFilter::implExportTextShapeIndex() mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", "TextShapeIndex" ); SvXMLElementExport aDefsContainerElem( *mpSVGExport, XML_NAMESPACE_NONE, "defs", true, true ); - sal_Int32 nCount = mSelectedPages.getLength(); + sal_Int32 nCount = mSelectedPages.size(); for( sal_Int32 i = 0; i < nCount; ++i ) { const Reference< XDrawPage > & xDrawPage = mSelectedPages[i]; @@ -1490,7 +1490,7 @@ bool SVGFilter::implExportMasterPages( const std::vector< Reference< XDrawPage > } -void SVGFilter::implExportDrawPages( const SVGFilter::XDrawPageSequence & rxPages, +void SVGFilter::implExportDrawPages( const std::vector< Reference< XDrawPage > > & rxPages, sal_Int32 nFirstPage, sal_Int32 nLastPage ) { DBG_ASSERT( nFirstPage <= nLastPage, @@ -1881,7 +1881,7 @@ bool SVGFilter::implCreateObjects() if (mbExportShapeSelection) { // #i124608# export a given object selection - if (mSelectedPages.getLength() && mSelectedPages[0].is()) + if (!mSelectedPages.empty() && mSelectedPages[0].is()) { implCreateObjectsFromShapes(mSelectedPages[0], maShapeSelection); return true; @@ -1905,7 +1905,7 @@ bool SVGFilter::implCreateObjects() } } - for( i = 0, nCount = mSelectedPages.getLength(); i < nCount; ++i ) + for( i = 0, nCount = mSelectedPages.size(); i < nCount; ++i ) { const Reference< XDrawPage > & xDrawPage = mSelectedPages[i]; diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx index f993900f7a3c..503510a92a5c 100644 --- a/filter/source/svg/svgfilter.cxx +++ b/filter/source/svg/svgfilter.cxx @@ -168,8 +168,8 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto { ObjectSequence aSelectedPageSequence; aSelection >>= aSelectedPageSequence; - mSelectedPages.realloc( aSelectedPageSequence.getLength() ); - for( sal_Int32 j=0; j xDrawPage( aSelectedPageSequence[j], uno::UNO_QUERY ); @@ -183,10 +183,10 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto } } - if( !mSelectedPages.hasElements() ) + if( mSelectedPages.empty() ) { // apparently failed to clean selection - fallback to current page - mSelectedPages.realloc( 1 ); + mSelectedPages.resize( 1 ); mSelectedPages[0] = xDrawView->getCurrentPage(); } } @@ -194,7 +194,7 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto /* * Export all slides, or requested "PagePos" */ - if( !mSelectedPages.hasElements() ) + if( mSelectedPages.empty() ) { uno::Reference< drawing::XMasterPagesSupplier > xMasterPagesSupplier( mxSrcDoc, uno::UNO_QUERY ); uno::Reference< drawing::XDrawPagesSupplier > xDrawPagesSupplier( mxSrcDoc, uno::UNO_QUERY ); @@ -208,7 +208,7 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto { sal_Int32 nDPCount = xDrawPages->getCount(); - mSelectedPages.realloc( nPageToExport != -1 ? 1 : nDPCount ); + mSelectedPages.resize( nPageToExport != -1 ? 1 : nDPCount ); sal_Int32 i; for( i = 0; i < nDPCount; ++i ) { @@ -258,7 +258,7 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto * The master page are put in an unordered set. */ ObjectSet aMasterPageTargetSet; - for( sal_Int32 i = 0; i < mSelectedPages.getLength(); ++i ) + for( size_t i = 0; i < mSelectedPages.size(); ++i ) { uno::Reference< drawing::XMasterPageTarget > xMasterPageTarget( mSelectedPages[i], uno::UNO_QUERY ); if( xMasterPageTarget.is() ) diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx index 0d1921d155df..fd65969e49e6 100644 --- a/filter/source/svg/svgfilter.hxx +++ b/filter/source/svg/svgfilter.hxx @@ -201,7 +201,6 @@ public: typedef std::unordered_map< Reference< XInterface >, ObjectRepresentation, HashReferenceXInterface > ObjectMap; typedef std::unordered_set< Reference< XInterface >, HashReferenceXInterface > ObjectSet; typedef Sequence< Reference< XInterface > > ObjectSequence; - typedef Sequence< Reference< XDrawPage > > XDrawPageSequence; typedef std::unordered_set< sal_Unicode, HashUChar > UCharSet; typedef std::unordered_map< OUString, UCharSet, OUStringHash > UCharSetMap; @@ -240,7 +239,7 @@ private: // #i124608# explicit ShapeSelection for export when export of the selection is wanted Reference< XShapes > maShapeSelection; bool mbExportShapeSelection; - XDrawPageSequence mSelectedPages; + std::vector< Reference< XDrawPage > > mSelectedPages; std::vector< Reference< XDrawPage > > mMasterPageTargets; Link maOldFieldHdl; @@ -264,7 +263,7 @@ private: bool implExportMasterPages( const std::vector< Reference< XDrawPage > >& rxPages, sal_Int32 nFirstPage, sal_Int32 nLastPage ); - void implExportDrawPages( const XDrawPageSequence& rxPages, + void implExportDrawPages( const std::vector< Reference< XDrawPage > >& rxPages, sal_Int32 nFirstPage, sal_Int32 nLastPage ); bool implExportPage( const OUString & sPageId, const Reference< XDrawPage > & rxPage, -- cgit