summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-11-19 10:37:10 +0200
committerNoel Grandin <noel@peralex.com>2015-11-19 11:05:41 +0200
commit49c5b9a98c45cd082e7fa6b6e399c39cd664ed66 (patch)
treeb7d9a554c08554c6d7a3cfb776a2815e6e32b60e /xmloff
parentdb7959eeacf404b661c8ebb903c80e51438c4137 (diff)
use comphelper::containerToSequence
Change-Id: I223ff4af01ab2da92da0c26d32457204a5008c4a
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/draw/ximpcustomshape.cxx103
-rw-r--r--xmloff/source/draw/ximpshap.cxx8
-rw-r--r--xmloff/source/style/prstylei.cxx13
3 files changed, 18 insertions, 106 deletions
diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx
index 51aaca6cf328..21f0029f2033 100644
--- a/xmloff/source/draw/ximpcustomshape.cxx
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -45,6 +45,7 @@
#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
#include <com/sun/star/drawing/ProjectionMode.hpp>
#include <sax/tools/converter.hxx>
+#include <comphelper/sequence.hxx>
#include <unordered_map>
using namespace ::com::sun::star;
@@ -455,17 +456,9 @@ void GetDoubleSequence( std::vector< com::sun::star::beans::PropertyValue >& rDe
if ( !vDirection.empty() )
{
- uno::Sequence< double > aDirectionsSeq( vDirection.size() );
- std::vector< double >::const_iterator aIter = vDirection.begin();
- std::vector< double >::const_iterator aEnd = vDirection.end();
- double* pValues = aDirectionsSeq.getArray();
-
- while ( aIter != aEnd )
- *pValues++ = *aIter++;
-
beans::PropertyValue aProp;
aProp.Name = EASGet( eDestProp );
- aProp.Value <<= aDirectionsSeq;
+ aProp.Value <<= comphelper::containerToSequence(vDirection);
rDest.push_back( aProp );
}
}
@@ -550,17 +543,9 @@ sal_Int32 GetEnhancedParameterPairSequence( std::vector< com::sun::star::beans::
}
if ( !vParameter.empty() )
{
- uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aParameterSeq( vParameter.size() );
- std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aIter = vParameter.begin();
- std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aEnd = vParameter.end();
- com::sun::star::drawing::EnhancedCustomShapeParameterPair* pValues = aParameterSeq.getArray();
-
- while ( aIter != aEnd )
- *pValues++ = *aIter++;
-
beans::PropertyValue aProp;
aProp.Name = EASGet( eDestProp );
- aProp.Value <<= aParameterSeq;
+ aProp.Value <<= comphelper::containerToSequence(vParameter);
rDest.push_back( aProp );
}
return vParameter.size();
@@ -583,17 +568,9 @@ void GetEnhancedRectangleSequence( std::vector< com::sun::star::beans::PropertyV
}
if ( !vTextFrame.empty() )
{
- uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > aTextFrameSeq( vTextFrame.size() );
- std::vector< com::sun::star::drawing::EnhancedCustomShapeTextFrame >::const_iterator aIter = vTextFrame.begin();
- std::vector< com::sun::star::drawing::EnhancedCustomShapeTextFrame >::const_iterator aEnd = vTextFrame.end();
- com::sun::star::drawing::EnhancedCustomShapeTextFrame* pValues = aTextFrameSeq.getArray();
-
- while ( aIter != aEnd )
- *pValues++ = *aIter++;
-
beans::PropertyValue aProp;
aProp.Name = EASGet( eDestProp );
- aProp.Value <<= aTextFrameSeq;
+ aProp.Value <<= comphelper::containerToSequence(vTextFrame);
rDest.push_back( aProp );
}
}
@@ -823,32 +800,16 @@ void GetEnhancedPath( std::vector< com::sun::star::beans::PropertyValue >& rDest
nParameterCount = 0;
}
}
- // adding the Coordinates property
- uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > seqCoordinates( vCoordinates.size() );
- std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aCoordinatesIter = vCoordinates.begin();
- std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aCoordinatesEnd = vCoordinates.end();
- com::sun::star::drawing::EnhancedCustomShapeParameterPair* pCoordinateValues = seqCoordinates.getArray();
-
- while ( aCoordinatesIter != aCoordinatesEnd )
- *pCoordinateValues++ = *aCoordinatesIter++;
+ // adding the Coordinates property
beans::PropertyValue aProp;
aProp.Name = EASGet( EAS_Coordinates );
- aProp.Value <<= seqCoordinates;
+ aProp.Value <<= comphelper::containerToSequence(vCoordinates);
rDest.push_back( aProp );
-
// adding the Segments property
- uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > seqSegments( vSegments.size() );
- std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >::const_iterator aSegmentsIter = vSegments.begin();
- std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >::const_iterator aSegmentsEnd = vSegments.end();
- com::sun::star::drawing::EnhancedCustomShapeSegment* pSegmentValues = seqSegments.getArray();
-
- while ( aSegmentsIter != aSegmentsEnd )
- *pSegmentValues++ = *aSegmentsIter++;
-
aProp.Name = EASGet( EAS_Segments );
- aProp.Value <<= seqSegments;
+ aProp.Value <<= comphelper::containerToSequence(vSegments);
rDest.push_back( aProp );
}
@@ -875,17 +836,9 @@ void GetAdjustmentValues( std::vector< com::sun::star::beans::PropertyValue >& r
sal_Int32 nAdjustmentValues = vAdjustmentValue.size();
if ( nAdjustmentValues )
{
- uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentValues( nAdjustmentValues );
- std::vector< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue >::const_iterator aIter = vAdjustmentValue.begin();
- std::vector< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue >::const_iterator aEnd = vAdjustmentValue.end();
- com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue* pValues = aAdjustmentValues.getArray();
-
- while ( aIter != aEnd )
- *pValues++ = *aIter++;
-
beans::PropertyValue aProp;
aProp.Name = EASGet( EAS_AdjustmentValues );
- aProp.Value <<= aAdjustmentValues;
+ aProp.Value <<= comphelper::containerToSequence(vAdjustmentValue);
rDest.push_back( aProp );
}
}
@@ -1155,17 +1108,9 @@ void SdXMLCustomShapePropertyMerge( std::vector< com::sun::star::beans::Property
{
if ( !rElement.empty() )
{
- uno::Sequence< beans::PropertyValues > aPropSeq( rElement.size() );
- std::vector< beans::PropertyValues >::const_iterator aIter = rElement.begin();
- std::vector< beans::PropertyValues >::const_iterator aEnd = rElement.end();
- beans::PropertyValues* pValues = aPropSeq.getArray();
-
- while ( aIter != aEnd )
- *pValues++ = *aIter++;
-
beans::PropertyValue aProp;
aProp.Name = rElementName;
- aProp.Value <<= aPropSeq;
+ aProp.Value <<= comphelper::containerToSequence(rElement);
rPropVec.push_back( aProp );
}
}
@@ -1176,17 +1121,9 @@ void SdXMLCustomShapePropertyMerge( std::vector< com::sun::star::beans::Property
{
if ( !rElement.empty() )
{
- uno::Sequence< OUString > aPropSeq( rElement.size() );
- std::vector< OUString >::const_iterator aIter = rElement.begin();
- std::vector< OUString >::const_iterator aEnd = rElement.end();
- OUString* pValues = aPropSeq.getArray();
-
- while ( aIter != aEnd )
- *pValues++ = *aIter++;
-
beans::PropertyValue aProp;
aProp.Name = rElementName;
- aProp.Value <<= aPropSeq;
+ aProp.Value <<= comphelper::containerToSequence(rElement);
rPropVec.push_back( aProp );
}
}
@@ -1197,17 +1134,9 @@ void SdXMLCustomShapePropertyMerge( std::vector< com::sun::star::beans::Property
{
if ( !rElement.empty() )
{
- uno::Sequence< beans::PropertyValue > aPropSeq( rElement.size() );
- std::vector< beans::PropertyValue >::const_iterator aIter = rElement.begin();
- std::vector< beans::PropertyValue >::const_iterator aEnd = rElement.end();
- beans::PropertyValue* pValues = aPropSeq.getArray();
-
- while ( aIter != aEnd )
- *pValues++ = *aIter++;
-
beans::PropertyValue aProp;
aProp.Name = rElementName;
- aProp.Value <<= aPropSeq;
+ aProp.Value <<= comphelper::containerToSequence(rElement);
rPropVec.push_back( aProp );
}
}
@@ -1450,15 +1379,7 @@ SvXMLImportContext* XMLEnhancedCustomShapeContext::CreateChildContext( sal_uInt1
break;
}
}
- beans::PropertyValues aPropSeq( aHandle.size() );
- std::vector< beans::PropertyValue >::const_iterator aIter = aHandle.begin();
- std::vector< beans::PropertyValue >::const_iterator aEnd = aHandle.end();
- beans::PropertyValue* pValues = aPropSeq.getArray();
-
- while ( aIter != aEnd )
- *pValues++ = *aIter++;
-
- maHandles.push_back( aPropSeq );
+ maHandles.push_back( comphelper::containerToSequence(aHandle) );
}
return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList );
}
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index bad7295224b5..41704fa5e625 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -58,6 +58,7 @@
#include <com/sun/star/drawing/HomogenMatrix3.hpp>
#include <sax/tools/converter.hxx>
+#include <comphelper/sequence.hxx>
#include "PropertySetMerger.hxx"
#include <xmloff/families.hxx>
@@ -3864,12 +3865,7 @@ void SdXMLCustomShapeContext::EndElement()
const OUString sCustomShapeGeometry ( "CustomShapeGeometry" );
// converting the vector to a sequence
- uno::Sequence< beans::PropertyValue > aSeq( maCustomShapeGeometry.size() );
- beans::PropertyValue* pValues = aSeq.getArray();
- std::vector< beans::PropertyValue >::const_iterator aIter( maCustomShapeGeometry.begin() );
- std::vector< beans::PropertyValue >::const_iterator aEnd( maCustomShapeGeometry.end() );
- while ( aIter != aEnd )
- *pValues++ = *aIter++;
+ uno::Sequence< beans::PropertyValue > aSeq( comphelper::containerToSequence(maCustomShapeGeometry) );
try
{
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
index b939c8f70d4b..2fe2953a8b40 100644
--- a/xmloff/source/style/prstylei.cxx
+++ b/xmloff/source/style/prstylei.cxx
@@ -36,6 +36,7 @@
#include <xmloff/xmlerror.hxx>
#include <xmloff/xmltypes.hxx>
#include <xmloff/maptype.hxx>
+#include <comphelper/sequence.hxx>
//UUUU
#include <com/sun/star/drawing/FillStyle.hpp>
@@ -401,16 +402,10 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite )
}
nCount = aNameSet.size();
- Sequence < OUString > aNames( nCount );
- OUString *pNames = aNames.getArray();
- PropertyNameSet::iterator aIter = aNameSet.begin();
- while( aIter != aNameSet.end() )
- *pNames++ = *aIter++;
-
- Sequence < PropertyState > aStates(
- xPropState->getPropertyStates( aNames ) );
+ Sequence<OUString> aNames( comphelper::containerToSequence<OUString>(aNameSet) );
+ Sequence < PropertyState > aStates( xPropState->getPropertyStates(aNames) );
const PropertyState *pStates = aStates.getConstArray();
- pNames = aNames.getArray();
+ OUString* pNames = aNames.getArray();
for( i = 0; i < nCount; i++ )
{