From 7cb81fc2ebccbf607bf0d08d65f74bb43a83d1ea Mon Sep 17 00:00:00 2001 From: Artur Dorda Date: Wed, 4 Jul 2012 17:57:42 +0200 Subject: Added dumping of Coordinates & Segments properties Change-Id: I4acfe9f1d1ca9bb4f434376bd6fd23804b66a25f --- .../inc/drawinglayer/EnhancedShapeDumper.hxx | 4 +++ drawinglayer/source/dumper/EnhancedShapeDumper.cxx | 42 ++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/drawinglayer/inc/drawinglayer/EnhancedShapeDumper.hxx b/drawinglayer/inc/drawinglayer/EnhancedShapeDumper.hxx index 74947ca11e5e..6742021ef064 100644 --- a/drawinglayer/inc/drawinglayer/EnhancedShapeDumper.hxx +++ b/drawinglayer/inc/drawinglayer/EnhancedShapeDumper.hxx @@ -42,6 +42,8 @@ #include #include +#include + #ifndef EnhancedShapeDumper_hxx #define EnhancedShapeDumper_hxx @@ -119,6 +121,8 @@ public: // EnhancedCustomShapePath.idl void dumpEnhancedCustomShapePathService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet); + void dumpCoordinatesAsElement(com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aCoordinates); + void dumpSegmentsAsElement(com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > aSegments); private: xmlTextWriterPtr xmlWriter; diff --git a/drawinglayer/source/dumper/EnhancedShapeDumper.cxx b/drawinglayer/source/dumper/EnhancedShapeDumper.cxx index e7940a28e65d..dbb7f5653264 100644 --- a/drawinglayer/source/dumper/EnhancedShapeDumper.cxx +++ b/drawinglayer/source/dumper/EnhancedShapeDumper.cxx @@ -817,5 +817,47 @@ void EnhancedShapeDumper::dumpRadiusRangeMaximumAsElement(drawing::EnhancedCusto void EnhancedShapeDumper::dumpEnhancedCustomShapePathService(uno::Reference< beans::XPropertySet > xPropSet) { + { + uno::Any anotherAny = xPropSet->getPropertyValue("Coordinates"); + uno::Sequence< drawing::EnhancedCustomShapeParameterPair > aCoordinates; + if(anotherAny >>= aCoordinates) + dumpCoordinatesAsElement(aCoordinates); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Segments"); + uno::Sequence< drawing::EnhancedCustomShapeSegment > aSegments; + if(anotherAny >>= aSegments) + dumpSegmentsAsElement(aSegments); + } +} +void EnhancedShapeDumper::dumpCoordinatesAsElement(uno::Sequence< drawing::EnhancedCustomShapeParameterPair > aCoordinates) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Coordinates" )); + sal_Int32 nLength = aCoordinates.getLength(); + for (sal_Int32 i = 0; i < nLength; ++i) + { + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "EnhancedCustomShapeParameterPair" )); + dumpEnhancedCustomShapeParameterPair(aCoordinates[i]); + xmlTextWriterEndElement( xmlWriter ); + } + xmlTextWriterEndElement( xmlWriter ); } + +void EnhancedShapeDumper::dumpSegmentsAsElement(uno::Sequence< drawing::EnhancedCustomShapeSegment > aSegments) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Segments" )); + sal_Int32 nLength = aSegments.getLength(); + for (sal_Int32 i = 0; i < nLength; ++i) + { + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "EnhancedCustomShapeSegment" )); + sal_Int32 aCommand = aSegments[i].Command; + sal_Int32 aCount = aSegments[i].Count; + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("command"), "%" SAL_PRIdINT32, aCommand); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("count"), "%" SAL_PRIdINT32, aCount); + xmlTextWriterEndElement( xmlWriter ); + } + xmlTextWriterEndElement( xmlWriter ); +} + + -- cgit v1.2.3