Use comphelper::SequenceAsVector

Change-Id: I8c0328b1bae3d2c3f327d241acf3df0c078ea4cf
This commit is contained in:
Miklos Vajna 2014-06-30 18:38:09 +02:00
parent 6bb92c5eaf
commit c64a54bc3e

View File

@ -390,21 +390,17 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
} }
else if (i->first == "pSegmentInfo") else if (i->first == "pSegmentInfo")
{ {
uno::Sequence<drawing::EnhancedCustomShapeSegment> aSegments; comphelper::SequenceAsVector<drawing::EnhancedCustomShapeSegment> aSegments;
sal_Int32 nSize = 0; sal_Int32 nSize = 0;
sal_Int32 nCount = 0; sal_Int32 nCount = 0;
sal_Int32 nCharIndex = 0; sal_Int32 nCharIndex = 0;
sal_Int32 nIndex = 0;
do do
{ {
sal_Int32 nSeg = i->second.getToken(0, ';', nCharIndex).toInt32(); sal_Int32 nSeg = i->second.getToken(0, ';', nCharIndex).toInt32();
if (!nSize) if (!nSize)
nSize = nSeg; nSize = nSeg;
else if (!nCount) else if (!nCount)
{
nCount = nSeg; nCount = nSeg;
aSegments.realloc(nCount);
}
else else
{ {
sal_Int32 nPoints = 1; sal_Int32 nPoints = 1;
@ -414,23 +410,28 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
nSeg &= 0xFF00; nSeg &= 0xFF00;
} }
drawing::EnhancedCustomShapeSegment aSegment;
switch (nSeg) switch (nSeg)
{ {
case 0x0001: // lineto case 0x0001: // lineto
aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::LINETO; aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::LINETO;
aSegments[nIndex].Count = sal_Int32(1); aSegment.Count = sal_Int32(1);
aSegments.push_back(aSegment);
break; break;
case 0x4000: // moveto case 0x4000: // moveto
aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::MOVETO; aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
aSegments[nIndex].Count = sal_Int32(1); aSegment.Count = sal_Int32(1);
aSegments.push_back(aSegment);
break; break;
case 0x2000: // curveto case 0x2000: // curveto
aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::CURVETO; aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::CURVETO;
aSegments[nIndex].Count = sal_Int32(nPoints); aSegment.Count = sal_Int32(nPoints);
aSegments.push_back(aSegment);
break; break;
case 0xb300: // arcto case 0xb300: // arcto
aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::ARCTO; aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::ARCTO;
aSegments[nIndex].Count = sal_Int32(0); aSegment.Count = sal_Int32(0);
aSegments.push_back(aSegment);
break; break;
case 0xac00: case 0xac00:
case 0xaa00: // nofill case 0xaa00: // nofill
@ -438,20 +439,21 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
case 0x6001: // close case 0x6001: // close
break; break;
case 0x8000: // end case 0x8000: // end
aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH; aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
aSegments[nIndex].Count = sal_Int32(0); aSegment.Count = sal_Int32(0);
aSegments.push_back(aSegment);
break; break;
default: // given number of lineto elements default: // given number of lineto elements
aSegments[nIndex].Command = drawing::EnhancedCustomShapeSegmentCommand::LINETO; aSegment.Command = drawing::EnhancedCustomShapeSegmentCommand::LINETO;
aSegments[nIndex].Count = nSeg; aSegment.Count = nSeg;
aSegments.push_back(aSegment);
break; break;
} }
nIndex++;
} }
} }
while (nCharIndex >= 0); while (nCharIndex >= 0);
aPropertyValue.Name = "Segments"; aPropertyValue.Name = "Segments";
aPropertyValue.Value <<= aSegments; aPropertyValue.Value <<= aSegments.getAsConstList();
aPath.push_back(aPropertyValue); aPath.push_back(aPropertyValue);
} }
else if (i->first == "geoLeft") else if (i->first == "geoLeft")