diff options
author | Artur Dorda <artur.dorda+libo@gmail.com> | 2012-06-16 02:40:37 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-07-12 03:10:13 +0200 |
commit | 111cc7b912e48da5f0f94151388233f4e7383105 (patch) | |
tree | 55242ad9f415afc5ad5517af078177aa76fb8be2 /drawinglayer | |
parent | 89683e605855995450320c9751b4a6832a1baa58 (diff) |
Added CustomShapeGeometry property
Change-Id: I2a4a22cef0c31a8535d33f920a74f61d712e9080
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/inc/drawinglayer/XShapeDumper.hxx | 3 | ||||
-rw-r--r-- | drawinglayer/source/dumper/XShapeDumper.cxx | 47 |
2 files changed, 50 insertions, 0 deletions
diff --git a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx index 135b15701e47..6cce5d278462 100644 --- a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx +++ b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx @@ -55,6 +55,8 @@ #include <com/sun/star/drawing/HomogenMatrixLine3.hpp> #include <com/sun/star/drawing/HomogenMatrix3.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> + #ifndef ChartViewDumper_hxx #define ChartViewDumper_hxx @@ -172,6 +174,7 @@ private: // CustomShape.idl void dumpCustomShapeEngineAsAttribute(rtl::OUString sCustomShapeEngine, xmlTextWriterPtr xmlWriter); void dumpCustomShapeDataAsAttribute(rtl::OUString sCustomShapeData, xmlTextWriterPtr xmlWriter); + void dumpCustomShapeGeometryAsElement(com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue> aCustomShapeGeometry, xmlTextWriterPtr xmlWriter); // XShape.idl void dumpPositionAsAttribute(const com::sun::star::awt::Point& rPoint, xmlTextWriterPtr xmlWriter); diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx index 9eb524b9fa16..5f76e1c42d82 100644 --- a/drawinglayer/source/dumper/XShapeDumper.cxx +++ b/drawinglayer/source/dumper/XShapeDumper.cxx @@ -1008,6 +1008,44 @@ namespace { rtl::OUStringToOString(sCustomShapeData, RTL_TEXTENCODING_UTF8).getStr()); } + void XShapeDumper::dumpCustomShapeGeometryAsElement(uno::Sequence< beans::PropertyValue> aCustomShapeGeometry, xmlTextWriterPtr xmlWriter) + { + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "CustomShapeGeometry" )); + sal_Int32 nLength = aCustomShapeGeometry.getLength(); + for (sal_Int32 i = 0; i < nLength; ++i) + { + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PropertyValue" )); + + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s", + rtl::OUStringToOString(aCustomShapeGeometry[i].Name, RTL_TEXTENCODING_UTF8).getStr()); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("handle"), "%" SAL_PRIdINT32, aCustomShapeGeometry[i].Handle); + + uno::Any aAny = aCustomShapeGeometry[i].Value; + rtl::OUString sValue; + if(aAny >>= sValue) + { + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s", + rtl::OUStringToOString(aCustomShapeGeometry[i].Name, RTL_TEXTENCODING_UTF8).getStr()); + } + switch(aCustomShapeGeometry[i].State) + { + case beans::PropertyState_DIRECT_VALUE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "DIRECT_VALUE"); + break; + case beans::PropertyState_DEFAULT_VALUE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "DEFAULT_VALUE"); + break; + case beans::PropertyState_AMBIGUOUS_VALUE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "AMBIGUOUS_VALUE"); + break; + default: + break; + } + xmlTextWriterEndElement( xmlWriter ); + } + xmlTextWriterEndElement( xmlWriter ); + } + // methods dumping whole services void XShapeDumper::dumpTextPropertiesService(uno::Reference< beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter) @@ -1560,6 +1598,12 @@ namespace { if(anotherAny >>= sCustomShapeData) dumpCustomShapeDataAsAttribute(sCustomShapeData, xmlWriter); } + { + uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeGeometry"); + uno::Sequence< beans::PropertyValue> aCustomShapeGeometry; + if(anotherAny >>= aCustomShapeGeometry) + dumpCustomShapeGeometryAsElement(aCustomShapeGeometry, xmlWriter); + } } void XShapeDumper::dumpXShape(uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlWriter) @@ -1618,6 +1662,9 @@ namespace { if(xServiceInfo->supportsService("com.sun.star.drawing.PolyPolygonBezierDescriptor")) dumpPolyPolygonBezierDescriptorService(xPropSet, xmlWriter); + if(xServiceInfo->supportsService("com.sun.star.drawing.CustomShape")) + dumpCustomShapeService(xPropSet, xmlWriter); + #if DEBUG_DUMPER sal_Int32 nServices = aServiceNames.getLength(); for (sal_Int32 i = 0; i < nServices; ++i) |