oox/source/drawingml/effectproperties.cxx | 15 ++++-- oox/source/drawingml/effectproperties.hxx | 13 ++++- oox/source/drawingml/effectpropertiescontext.cxx | 32 +++++++------ oox/source/drawingml/shape.cxx | 7 +- toolkit/source/awt/vclxtoolkit.cxx | 2 ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx | 53 +++++++++++----------- 6 files changed, 69 insertions(+), 53 deletions(-)
New commits: commit d29e614ff9cd91c4e4a1bada6a21884e33323f8d Author: Michael Stahl <mst...@redhat.com> Date: Thu Oct 22 21:21:15 2015 +0200 oox: replace boost::ptr_vector with std::vector<std::unique_ptr> Change-Id: I105535a2a250e682a5d6976e0c7f74374b1f31ac diff --git a/oox/source/drawingml/effectproperties.cxx b/oox/source/drawingml/effectproperties.cxx index 3fd3882..631f2fc 100644 --- a/oox/source/drawingml/effectproperties.cxx +++ b/oox/source/drawingml/effectproperties.cxx @@ -14,6 +14,7 @@ #include "oox/token/tokens.hxx" #include <basegfx/numeric/ftools.hxx> +#include <o3tl/make_unique.hxx> namespace oox { namespace drawingml { @@ -28,14 +29,21 @@ void EffectShadowProperties::assignUsed(const EffectShadowProperties& rSourcePro void EffectProperties::assignUsed( const EffectProperties& rSourceProps ) { maShadow.assignUsed(rSourceProps.maShadow); - if( rSourceProps.maEffects.size() > 0 ) - maEffects = rSourceProps.maEffects; + if (!rSourceProps.m_Effects.empty()) + { + m_Effects.reserve(rSourceProps.m_Effects.size()); + for (auto const& it : rSourceProps.m_Effects) + { + m_Effects.push_back(o3tl::make_unique<Effect>(*it)); + } + } } void EffectProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelper& rGraphicHelper ) const { - for( boost::ptr_vector< Effect >::const_iterator it = maEffects.begin(); it != maEffects.end(); ++it ) + for (auto const& it : m_Effects) + { if( it->msName == "outerShdw" ) { sal_Int32 nAttrDir = 0, nAttrDist = 0; @@ -59,6 +67,7 @@ void EffectProperties::pushToPropMap( PropertyMap& rPropMap, rPropMap.setProperty( PROP_ShadowColor, it->moColor.getColor(rGraphicHelper ) ); rPropMap.setProperty( PROP_ShadowTransparence, it->moColor.getTransparency()); } + } } css::beans::PropertyValue Effect::getEffect() diff --git a/oox/source/drawingml/effectproperties.hxx b/oox/source/drawingml/effectproperties.hxx index 4256b8d..9089e1d 100644 --- a/oox/source/drawingml/effectproperties.hxx +++ b/oox/source/drawingml/effectproperties.hxx @@ -10,11 +10,12 @@ #ifndef INCLUDED_OOX_DRAWINGML_EFFECTPROPERTIES_HXX #define INCLUDED_OOX_DRAWINGML_EFFECTPROPERTIES_HXX -#include <map> #include <oox/drawingml/color.hxx> #include <oox/helper/propertymap.hxx> -#include <boost/ptr_container/ptr_vector.hpp> +#include <memory> +#include <vector> +#include <map> namespace oox { namespace drawingml { @@ -44,7 +45,13 @@ struct EffectProperties EffectShadowProperties maShadow; /** Stores all effect properties, including those not supported by core yet */ - boost::ptr_vector< Effect > maEffects; + std::vector<std::unique_ptr<Effect>> m_Effects; + + EffectProperties() {} + EffectProperties(EffectProperties const& rOther) + { + assignUsed(rOther); + } /** Overwrites all members that are explicitly set in rSourceProps. */ void assignUsed( const EffectProperties& rSourceProps ); diff --git a/oox/source/drawingml/effectpropertiescontext.cxx b/oox/source/drawingml/effectpropertiescontext.cxx index d1d0cd9..3f79cb7 100644 --- a/oox/source/drawingml/effectpropertiescontext.cxx +++ b/oox/source/drawingml/effectpropertiescontext.cxx @@ -13,6 +13,8 @@ #include "drawingml/fillpropertiesgroupcontext.hxx" #include "oox/helper/attributelist.hxx" +#include <o3tl/make_unique.hxx> + using namespace ::oox::core; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::xml::sax; @@ -70,28 +72,28 @@ void EffectPropertiesContext::saveUnsupportedAttribs( Effect& rEffect, const Att ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { - sal_Int32 nPos = mrEffectProperties.maEffects.size(); - mrEffectProperties.maEffects.push_back( new Effect() ); + sal_Int32 nPos = mrEffectProperties.m_Effects.size(); + mrEffectProperties.m_Effects.push_back(o3tl::make_unique<Effect>()); switch( nElement ) { case A_TOKEN( outerShdw ): { - mrEffectProperties.maEffects[nPos].msName = "outerShdw"; - saveUnsupportedAttribs( mrEffectProperties.maEffects[nPos], rAttribs ); + mrEffectProperties.m_Effects[nPos]->msName = "outerShdw"; + saveUnsupportedAttribs(*mrEffectProperties.m_Effects[nPos], rAttribs); mrEffectProperties.maShadow.moShadowDist = rAttribs.getInteger( XML_dist, 0 ); mrEffectProperties.maShadow.moShadowDir = rAttribs.getInteger( XML_dir, 0 ); - return new ColorContext( *this, mrEffectProperties.maEffects[nPos].moColor ); + return new ColorContext(*this, mrEffectProperties.m_Effects[nPos]->moColor); } break; case A_TOKEN( innerShdw ): { - mrEffectProperties.maEffects[nPos].msName = "innerShdw"; - saveUnsupportedAttribs( mrEffectProperties.maEffects[nPos], rAttribs ); + mrEffectProperties.m_Effects[nPos]->msName = "innerShdw"; + saveUnsupportedAttribs(*mrEffectProperties.m_Effects[nPos], rAttribs); mrEffectProperties.maShadow.moShadowDist = rAttribs.getInteger( XML_dist, 0 ); mrEffectProperties.maShadow.moShadowDir = rAttribs.getInteger( XML_dir, 0 ); - return new ColorContext( *this, mrEffectProperties.maEffects[nPos].moColor ); + return new ColorContext(*this, mrEffectProperties.m_Effects[nPos]->moColor); } break; case A_TOKEN( glow ): @@ -100,20 +102,20 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement, case A_TOKEN( blur ): { if( nElement == A_TOKEN( glow ) ) - mrEffectProperties.maEffects[nPos].msName = "glow"; + mrEffectProperties.m_Effects[nPos]->msName = "glow"; else if( nElement == A_TOKEN( softEdge ) ) - mrEffectProperties.maEffects[nPos].msName = "softEdge"; + mrEffectProperties.m_Effects[nPos]->msName = "softEdge"; else if( nElement == A_TOKEN( reflection ) ) - mrEffectProperties.maEffects[nPos].msName = "reflection"; + mrEffectProperties.m_Effects[nPos]->msName = "reflection"; else if( nElement == A_TOKEN( blur ) ) - mrEffectProperties.maEffects[nPos].msName = "blur"; - saveUnsupportedAttribs( mrEffectProperties.maEffects[nPos], rAttribs ); - return new ColorContext( *this, mrEffectProperties.maEffects[nPos].moColor ); + mrEffectProperties.m_Effects[nPos]->msName = "blur"; + saveUnsupportedAttribs(*mrEffectProperties.m_Effects[nPos], rAttribs); + return new ColorContext(*this, mrEffectProperties.m_Effects[nPos]->moColor); } break; } - mrEffectProperties.maEffects.pop_back(); + mrEffectProperties.m_Effects.pop_back(); return 0; } diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 085c7b5..748f313 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -953,12 +953,11 @@ Reference< XShape > Shape::createAndInsert( } // store unsupported effect attributes in the grab bag - if( aEffectProperties.maEffects.size() > 0 ) + if (!aEffectProperties.m_Effects.empty()) { - Sequence< PropertyValue > aEffects( aEffectProperties.maEffects.size() ); + Sequence<PropertyValue> aEffects(aEffectProperties.m_Effects.size()); sal_uInt32 i = 0; - for( boost::ptr_vector< Effect >::iterator it = aEffectProperties.maEffects.begin(); - it != aEffectProperties.maEffects.end(); ++it ) + for (auto const& it : aEffectProperties.m_Effects) { PropertyValue aEffect = it->getEffect(); if( !aEffect.Name.isEmpty() ) commit fc90cf2af58dc8d551c39ba37d3a44597aa11e44 Author: Michael Stahl <mst...@redhat.com> Date: Thu Oct 22 20:50:23 2015 +0200 ucb: replace boost::ptr_vector with std::vector<std::unique_ptr> Change-Id: I05c64aaed4aaea813b369dccc721f9d10167f161 diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index df62e80..e31e5c3 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -17,8 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <boost/ptr_container/ptr_vector.hpp> - #include <stdio.h> #ifdef WNT #include <prewin.h> diff --git a/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx b/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx index 16f3969..dc86ddb 100644 --- a/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx +++ b/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx @@ -32,12 +32,14 @@ ************************************************************************** *************************************************************************/ -#include <boost/ptr_container/ptr_vector.hpp> + #include <osl/diagnose.h> +#include <o3tl/make_unique.hxx> #include <com/sun/star/ucb/OpenMode.hpp> #include <ucbhelper/contentidentifier.hxx> #include <ucbhelper/providerhelper.hxx> #include <memory> +#include <vector> #include "webdavdatasupplier.hxx" #include "webdavcontent.hxx" #include "ContentProperties.hxx" @@ -75,7 +77,7 @@ struct ResultListEntry -typedef boost::ptr_vector<ResultListEntry> ResultList; +typedef std::vector<std::unique_ptr<ResultListEntry>> ResultList; @@ -86,7 +88,7 @@ typedef boost::ptr_vector<ResultListEntry> ResultList; struct DataSupplier_Impl { osl::Mutex m_aMutex; - ResultList m_aResults; + ResultList m_Results; rtl::Reference< Content > m_xContent; uno::Reference< uno::XComponentContext > m_xContext; sal_Int32 m_nOpenMode; @@ -131,9 +133,9 @@ OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex ) { osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); - if ( nIndex < m_pImpl->m_aResults.size() ) + if (nIndex < m_pImpl->m_Results.size()) { - OUString aId = m_pImpl->m_aResults[ nIndex ].aId; + OUString aId = m_pImpl->m_Results[ nIndex ]->aId; if ( !aId.isEmpty() ) { // Already cached. @@ -145,8 +147,7 @@ OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex ) { OUString aId = m_pImpl->m_xContent->getResourceAccess().getURL(); - const ContentProperties& props - = *( m_pImpl->m_aResults[ nIndex ].pData ); + const ContentProperties& props(*(m_pImpl->m_Results[ nIndex ]->pData)); if ( ( aId.lastIndexOf( '/' ) + 1 ) != aId.getLength() ) aId += "/"; @@ -156,7 +157,7 @@ OUString DataSupplier::queryContentIdentifierString( sal_uInt32 nIndex ) if ( props.isTrailingSlash() ) aId += "/"; - m_pImpl->m_aResults[ nIndex ].aId = aId; + m_pImpl->m_Results[ nIndex ]->aId = aId; return aId; } return OUString(); @@ -169,10 +170,10 @@ DataSupplier::queryContentIdentifier( sal_uInt32 nIndex ) { osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); - if ( nIndex < m_pImpl->m_aResults.size() ) + if (nIndex < m_pImpl->m_Results.size()) { uno::Reference< ucb::XContentIdentifier > xId - = m_pImpl->m_aResults[ nIndex ].xId; + = m_pImpl->m_Results[ nIndex ]->xId; if ( xId.is() ) { // Already cached. @@ -185,7 +186,7 @@ DataSupplier::queryContentIdentifier( sal_uInt32 nIndex ) { uno::Reference< ucb::XContentIdentifier > xId = new ::ucbhelper::ContentIdentifier( aId ); - m_pImpl->m_aResults[ nIndex ].xId = xId; + m_pImpl->m_Results[ nIndex ]->xId = xId; return xId; } return uno::Reference< ucb::XContentIdentifier >(); @@ -198,10 +199,10 @@ DataSupplier::queryContent( sal_uInt32 nIndex ) { osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); - if ( nIndex < m_pImpl->m_aResults.size() ) + if (nIndex < m_pImpl->m_Results.size()) { uno::Reference< ucb::XContent > xContent - = m_pImpl->m_aResults[ nIndex ].xContent; + = m_pImpl->m_Results[ nIndex ]->xContent; if ( xContent.is() ) { // Already cached. @@ -217,7 +218,7 @@ DataSupplier::queryContent( sal_uInt32 nIndex ) { uno::Reference< ucb::XContent > xContent = m_pImpl->m_xContent->getProvider()->queryContent( xId ); - m_pImpl->m_aResults[ nIndex ].xContent = xContent; + m_pImpl->m_Results[ nIndex ]->xContent = xContent; return xContent; } @@ -234,7 +235,7 @@ bool DataSupplier::getResult( sal_uInt32 nIndex ) { osl::ClearableGuard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); - if ( m_pImpl->m_aResults.size() > nIndex ) + if (nIndex < m_pImpl->m_Results.size()) { // Result already present. return true; @@ -243,7 +244,7 @@ bool DataSupplier::getResult( sal_uInt32 nIndex ) // Obtain values... if ( getData() ) { - if ( m_pImpl->m_aResults.size() > nIndex ) + if (nIndex < m_pImpl->m_Results.size()) { // Result already present. return true; @@ -260,14 +261,14 @@ sal_uInt32 DataSupplier::totalCount() // Obtain values... getData(); - return m_pImpl->m_aResults.size(); + return m_pImpl->m_Results.size(); } // virtual sal_uInt32 DataSupplier::currentCount() { - return m_pImpl->m_aResults.size(); + return m_pImpl->m_Results.size(); } @@ -284,9 +285,9 @@ uno::Reference< sdbc::XRow > DataSupplier::queryPropertyValues( { osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); - if ( nIndex < m_pImpl->m_aResults.size() ) + if (nIndex < m_pImpl->m_Results.size()) { - uno::Reference< sdbc::XRow > xRow = m_pImpl->m_aResults[ nIndex ].xRow; + uno::Reference< sdbc::XRow > xRow = m_pImpl->m_Results[ nIndex ]->xRow; if ( xRow.is() ) { // Already cached. @@ -300,11 +301,11 @@ uno::Reference< sdbc::XRow > DataSupplier::queryPropertyValues( = Content::getPropertyValues( m_pImpl->m_xContext, getResultSet()->getProperties(), - *(m_pImpl->m_aResults[ nIndex ].pData), + *(m_pImpl->m_Results[ nIndex ]->pData), rtl::Reference< ::ucbhelper::ContentProviderImplHelper >( m_pImpl->m_xContent->getProvider().get() ), queryContentIdentifierString( nIndex ) ); - m_pImpl->m_aResults[ nIndex ].xRow = xRow; + m_pImpl->m_Results[ nIndex ]->xRow = xRow; return xRow; } @@ -317,8 +318,8 @@ void DataSupplier::releasePropertyValues( sal_uInt32 nIndex ) { osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex ); - if ( nIndex < m_pImpl->m_aResults.size() ) - m_pImpl->m_aResults[ nIndex ].xRow = uno::Reference< sdbc::XRow >(); + if (nIndex < m_pImpl->m_Results.size()) + m_pImpl->m_Results[ nIndex ]->xRow = uno::Reference< sdbc::XRow >(); } @@ -470,8 +471,8 @@ bool DataSupplier::getData() break; } - m_pImpl->m_aResults.push_back( - new ResultListEntry( pContentProperties ) ); + m_pImpl->m_Results.push_back( + o3tl::make_unique<ResultListEntry>(pContentProperties)); } } catch ( DAVException const & ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits