From 2f46f8b9373891f49c4d30bf553c726fcd840448 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Sun, 22 Jun 2014 20:57:03 +0200 Subject: [PATCH] Use comphelper::SequenceAsVector Change-Id: I4bdd7c18e5ccf652a2fc0d651ce50c005254fa8a --- writerfilter/source/rtftok/rtfsdrimport.cxx | 31 ++++++++------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 05c4e12a95c0..bc2f99c952e4 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "../dmapper/GraphicHelpers.hxx" @@ -232,7 +233,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap uno::Any aAny; beans::PropertyValue aPropertyValue; awt::Rectangle aViewBox; - std::vector aPathPropVec; + comphelper::SequenceAsVector aPath; // Default line color is black in Word, blue in Writer. uno::Any aLineColor = uno::makeAny(COL_BLACK); // Default line width is 0.75 pt (26 mm100) in Word, 0 in Writer. @@ -388,7 +389,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap while (nCharIndex >= 0); aPropertyValue.Name = "Coordinates"; aPropertyValue.Value <<= aCoordinates; - aPathPropVec.push_back(aPropertyValue); + aPath.push_back(aPropertyValue); } else if (i->first == "pSegmentInfo") { @@ -454,7 +455,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap while (nCharIndex >= 0); aPropertyValue.Name = "Segments"; aPropertyValue.Value <<= aSegments; - aPathPropVec.push_back(aPropertyValue); + aPath.push_back(aPropertyValue); } else if (i->first == "geoLeft") aViewBox.X = i->second.toInt32(); @@ -669,34 +670,24 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap xDefaulter->createCustomShapeDefaults(OUString::number(nType)); } - // Creating Path property - uno::Sequence aPathPropSeq(aPathPropVec.size()); - beans::PropertyValue* pPathValues = aPathPropSeq.getArray(); - for (std::vector::iterator i = aPathPropVec.begin(); i != aPathPropVec.end(); ++i) - *pPathValues++ = *i; - // Creating CustomShapeGeometry property - std::vector aGeomPropVec; + comphelper::SequenceAsVector aGeometry; if (aViewBox.X || aViewBox.Y || aViewBox.Width || aViewBox.Height) { aViewBox.Width -= aViewBox.X; aViewBox.Height -= aViewBox.Y; aPropertyValue.Name = "ViewBox"; aPropertyValue.Value <<= aViewBox; - aGeomPropVec.push_back(aPropertyValue); + aGeometry.push_back(aPropertyValue); } - if (aPathPropSeq.getLength()) + if (!aPath.empty()) { aPropertyValue.Name = "Path"; - aPropertyValue.Value <<= aPathPropSeq; - aGeomPropVec.push_back(aPropertyValue); + aPropertyValue.Value <<= aPath.getAsConstList(); + aGeometry.push_back(aPropertyValue); } - uno::Sequence aGeomPropSeq(aGeomPropVec.size()); - beans::PropertyValue* pGeomValues = aGeomPropSeq.getArray(); - for (std::vector::iterator i = aGeomPropVec.begin(); i != aGeomPropVec.end(); ++i) - *pGeomValues++ = *i; - if (aGeomPropSeq.getLength() && xPropertySet.is()) - xPropertySet->setPropertyValue("CustomShapeGeometry", uno::Any(aGeomPropSeq)); + if (!aGeometry.empty() && xPropertySet.is()) + xPropertySet->setPropertyValue("CustomShapeGeometry", uno::Any(aGeometry.getAsConstList())); // Set position and size if (xShape.is())