diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-07-13 21:16:54 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-07-13 21:16:54 +0200 |
commit | f1139806e56c468181d250bcfbb878d3a97eb94a (patch) | |
tree | c3963835b6c4f7897ed9aca9ae33cc96454e5feb /drawinglayer | |
parent | 76fd08ed822e791c812dd674265d977a4b3c59bb (diff) | |
parent | 87c6beddfb684cee702ec1c9225497b8541a780d (diff) |
Merge branch 'feature/gsoc_test_improvements2'
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/Library_drawinglayer.mk | 7 | ||||
-rw-r--r-- | drawinglayer/Package_inc.mk | 1 | ||||
-rw-r--r-- | drawinglayer/inc/drawinglayer/XShapeDumper.hxx | 71 | ||||
-rw-r--r-- | drawinglayer/source/dumper/EnhancedShapeDumper.cxx | 1079 | ||||
-rw-r--r-- | drawinglayer/source/dumper/EnhancedShapeDumper.hxx | 149 | ||||
-rw-r--r-- | drawinglayer/source/dumper/XShapeDumper.cxx | 1887 |
6 files changed, 3194 insertions, 0 deletions
diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk index 94ab023682ea..146c38b98348 100644 --- a/drawinglayer/Library_drawinglayer.mk +++ b/drawinglayer/Library_drawinglayer.mk @@ -31,6 +31,7 @@ $(eval $(call gb_Library_use_package,drawinglayer,drawinglayer_inc)) $(eval $(call gb_Library_set_include,drawinglayer,\ $$(INCLUDE) \ + -I$(SRCDIR)/drawinglayer/inc \ )) $(eval $(call gb_Library_add_defs,drawinglayer,\ @@ -39,6 +40,10 @@ $(eval $(call gb_Library_add_defs,drawinglayer,\ $(eval $(call gb_Library_use_sdk_api,drawinglayer)) +$(eval $(call gb_Library_use_externals,drawinglayer,\ + libxml2 \ +)) + $(eval $(call gb_Library_use_libraries,drawinglayer,\ basegfx \ canvastools \ @@ -171,6 +176,8 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\ drawinglayer/source/processor3d/zbufferprocessor3d \ drawinglayer/source/texture/texture3d \ drawinglayer/source/texture/texture \ + drawinglayer/source/dumper/XShapeDumper \ + drawinglayer/source/dumper/EnhancedShapeDumper \ )) # vim: set noet sw=4 ts=4: diff --git a/drawinglayer/Package_inc.mk b/drawinglayer/Package_inc.mk index 4cc1d34c530d..7d41e6c2b5d8 100644 --- a/drawinglayer/Package_inc.mk +++ b/drawinglayer/Package_inc.mk @@ -137,5 +137,6 @@ $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor3d/ $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor3d/zbufferprocessor3d.hxx,drawinglayer/processor3d/zbufferprocessor3d.hxx)) $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/texture/texture3d.hxx,drawinglayer/texture/texture3d.hxx)) $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/texture/texture.hxx,drawinglayer/texture/texture.hxx)) +$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/XShapeDumper.hxx,drawinglayer/XShapeDumper.hxx)) # vim: set noet sw=4 ts=4: diff --git a/drawinglayer/inc/drawinglayer/XShapeDumper.hxx b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx new file mode 100644 index 000000000000..a7d1d8d61b16 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/XShapeDumper.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2012 Artur Dorda <artur.dorda+libo@gmail.com> (initial developer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <drawinglayer/drawinglayerdllapi.h> + +#include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> +#include <com/sun/star/awt/Gradient.hpp> +#include <com/sun/star/drawing/Hatch.hpp> +#include <com/sun/star/awt/XBitmap.hpp> +#include <com/sun/star/drawing/RectanglePoint.hpp> +#include <com/sun/star/drawing/BitmapMode.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +#include <com/sun/star/drawing/LineStyle.hpp> +#include <com/sun/star/drawing/LineDash.hpp> +#include <com/sun/star/drawing/LineJoint.hpp> +#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> + +#include <com/sun/star/drawing/PolygonKind.hpp> + +#include <com/sun/star/drawing/TextFitToSizeType.hpp> +#include <com/sun/star/drawing/TextHorizontalAdjust.hpp> +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> +#include <com/sun/star/drawing/TextAnimationDirection.hpp> +#include <com/sun/star/drawing/TextAnimationKind.hpp> +#include <com/sun/star/text/WritingMode.hpp> + +#include <com/sun/star/drawing/HomogenMatrixLine3.hpp> +#include <com/sun/star/drawing/HomogenMatrix3.hpp> + +#include <com/sun/star/beans/PropertyValue.hpp> + +#ifndef XShapeDumper_hxx +#define XShapeDumper_hxx + +class DRAWINGLAYER_DLLPUBLIC XShapeDumper +{ + +public: + XShapeDumper(); + rtl::OUString dump(com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> xPageShapes); + +}; +#endif diff --git a/drawinglayer/source/dumper/EnhancedShapeDumper.cxx b/drawinglayer/source/dumper/EnhancedShapeDumper.cxx new file mode 100644 index 000000000000..4d7c05641db6 --- /dev/null +++ b/drawinglayer/source/dumper/EnhancedShapeDumper.cxx @@ -0,0 +1,1079 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2012 Artur Dorda <artur.dorda+libo@gmail.com> (initial developer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <EnhancedShapeDumper.hxx> +#include <rtl/strbuf.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> + +using namespace com::sun::star; + +// ------------------------------------------------------ +// ---------- EnhancedCustomShapeExtrusion.idl ---------- +// ------------------------------------------------------ + +void EnhancedShapeDumper::dumpEnhancedCustomShapeExtrusionService(uno::Reference< beans::XPropertySet > xPropSet) +{ + { + uno::Any anotherAny = xPropSet->getPropertyValue("Extrusion"); + sal_Bool bExtrusion; + if(anotherAny >>= bExtrusion) + dumpExtrusionAsAttribute(bExtrusion); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Brightness"); + double aBrightness; + if(anotherAny >>= aBrightness) + dumpBrightnessAsAttribute(aBrightness); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Depth"); + drawing::EnhancedCustomShapeParameterPair aDepth; + if(anotherAny >>= aDepth) + dumpDepthAsElement(aDepth); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Diffusion"); + double aDiffusion; + if(anotherAny >>= aDiffusion) + dumpDiffusionAsAttribute(aDiffusion); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("NumberOfLineSegments"); + sal_Int32 aNumberOfLineSegments; + if(anotherAny >>= aNumberOfLineSegments) + dumpNumberOfLineSegmentsAsAttribute(aNumberOfLineSegments); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LightFace"); + sal_Bool bLightFace; + if(anotherAny >>= bLightFace) + dumpLightFaceAsAttribute(bLightFace); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FirstLightHarsh"); + sal_Bool bFirstLightHarsh; + if(anotherAny >>= bFirstLightHarsh) + dumpFirstLightHarshAsAttribute(bFirstLightHarsh); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("SecondLightHarsh"); + sal_Bool bSecondLightHarsh; + if(anotherAny >>= bSecondLightHarsh) + dumpSecondLightHarshAsAttribute(bSecondLightHarsh); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FirstLightLevel"); + double aFirstLightLevel; + if(anotherAny >>= aFirstLightLevel) + dumpFirstLightLevelAsAttribute(aFirstLightLevel); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("SecondLightLevel"); + double aSecondLightLevel; + if(anotherAny >>= aSecondLightLevel) + dumpSecondLightLevelAsAttribute(aSecondLightLevel); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FirstLightDirection"); + drawing::Direction3D aFirstLightDirection; + if(anotherAny >>= aFirstLightDirection) + dumpFirstLightDirectionAsElement(aFirstLightDirection); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("SecondLightDirection"); + drawing::Direction3D aSecondLightDirection; + if(anotherAny >>= aSecondLightDirection) + dumpSecondLightDirectionAsElement(aSecondLightDirection); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Metal"); + sal_Bool bMetal; + if(anotherAny >>= bMetal) + dumpMetalAsAttribute(bMetal); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("ShadeMode"); + drawing::ShadeMode eShadeMode; + if(anotherAny >>= eShadeMode) + dumpShadeModeAsAttribute(eShadeMode); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("RotateAngle"); + drawing::EnhancedCustomShapeParameterPair aRotateAngle; + if(anotherAny >>= aRotateAngle) + dumpRotateAngleAsElement(aRotateAngle); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("RotationCenter"); + drawing::Direction3D aRotationCenter; + if(anotherAny >>= aRotationCenter) + dumpRotationCenterAsElement(aRotationCenter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Shininess"); + double aShininess; + if(anotherAny >>= aShininess) + dumpShininessAsAttribute(aShininess); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Skew"); + drawing::EnhancedCustomShapeParameterPair aSkew; + if(anotherAny >>= aSkew) + dumpSkewAsElement(aSkew); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Specularity"); + double aSpecularity; + if(anotherAny >>= aSpecularity) + dumpSpecularityAsAttribute(aSpecularity); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("ProjectionMode"); + drawing::ProjectionMode eProjectionMode; + if(anotherAny >>= eProjectionMode) + dumpProjectionModeAsAttribute(eProjectionMode); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("ViewPoint"); + drawing::Position3D aViewPoint; + if(anotherAny >>= aViewPoint) + dumpViewPointAsElement(aViewPoint); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Origin"); + drawing::EnhancedCustomShapeParameterPair aOrigin; + if(anotherAny >>= aOrigin) + dumpOriginAsElement(aOrigin); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("ExtrusionColor"); + sal_Bool bExtrusionColor; + if(anotherAny >>= bExtrusionColor) + dumpExtrusionColorAsAttribute(bExtrusionColor); + } +} +void EnhancedShapeDumper::dumpExtrusionAsAttribute(sal_Bool bExtrusion) +{ + if(bExtrusion) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("extrusion"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("extrusion"), "%s", "false"); +} + +void EnhancedShapeDumper::dumpBrightnessAsAttribute(double aBrightness) +{ + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("brightness"), "%f", aBrightness); +} + +void EnhancedShapeDumper::dumpEnhancedCustomShapeParameterPair(drawing::EnhancedCustomShapeParameterPair aParameterPair) +{ + { + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "First" )); + dumpEnhancedCustomShapeParameter(aParameterPair.First); + xmlTextWriterEndElement( xmlWriter ); + } + { + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Second" )); + dumpEnhancedCustomShapeParameter(aParameterPair.Second); + xmlTextWriterEndElement( xmlWriter ); + } +} + +void EnhancedShapeDumper::dumpDepthAsElement(drawing::EnhancedCustomShapeParameterPair aDepth) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Depth" )); + dumpEnhancedCustomShapeParameterPair(aDepth); + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpDiffusionAsAttribute(double aDiffusion) +{ + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("diffusion"), "%f", aDiffusion); +} + +void EnhancedShapeDumper::dumpNumberOfLineSegmentsAsAttribute(sal_Int32 aNumberOfLineSegments) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("numberOfLineSegments"), "%" SAL_PRIdINT32, aNumberOfLineSegments); +} + +void EnhancedShapeDumper::dumpLightFaceAsAttribute(sal_Bool bLightFace) +{ + if(bLightFace) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lightFace"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lightFace"), "%s", "false"); +} + +void EnhancedShapeDumper::dumpFirstLightHarshAsAttribute(sal_Bool bFirstLightHarsh) +{ + if(bFirstLightHarsh) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("firstLightHarsh"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("firstLightHarsh"), "%s", "false"); +} + +void EnhancedShapeDumper::dumpSecondLightHarshAsAttribute(sal_Bool bSecondLightHarsh) +{ + if(bSecondLightHarsh) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("secondLightHarsh"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("secondLightHarsh"), "%s", "false"); +} + +void EnhancedShapeDumper::dumpFirstLightLevelAsAttribute(double aFirstLightLevel) +{ + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("firstLightLevel"), "%f", aFirstLightLevel); +} + +void EnhancedShapeDumper::dumpSecondLightLevelAsAttribute(double aSecondLightLevel) +{ + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("secondLightLevel"), "%f", aSecondLightLevel); +} + +void EnhancedShapeDumper::dumpDirection3D(drawing::Direction3D aDirection3D) +{ + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("directionX"), "%f", aDirection3D.DirectionX); + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("directionY"), "%f", aDirection3D.DirectionY); + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("directionZ"), "%f", aDirection3D.DirectionZ); +} + +void EnhancedShapeDumper::dumpFirstLightDirectionAsElement(drawing::Direction3D aFirstLightDirection) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FirstLightDirection" )); + dumpDirection3D(aFirstLightDirection); + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpSecondLightDirectionAsElement(drawing::Direction3D aSecondLightDirection) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "SecondLightDirection" )); + dumpDirection3D(aSecondLightDirection); + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpMetalAsAttribute(sal_Bool bMetal) +{ + if(bMetal) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("metal"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("metal"), "%s", "false"); +} + +void EnhancedShapeDumper::dumpShadeModeAsAttribute(drawing::ShadeMode eShadeMode) +{ + switch(eShadeMode) + { + case drawing::ShadeMode_FLAT: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadeMode"), "%s", "FLAT"); + break; + case drawing::ShadeMode_PHONG: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadeMode"), "%s", "PHONG"); + break; + case drawing::ShadeMode_SMOOTH: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadeMode"), "%s", "SMOOTH"); + break; + case drawing::ShadeMode_DRAFT: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadeMode"), "%s", "DRAFT"); + break; + default: + break; + } +} + +void EnhancedShapeDumper::dumpRotateAngleAsElement(drawing::EnhancedCustomShapeParameterPair aRotateAngle) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "RotateAngle" )); + dumpEnhancedCustomShapeParameterPair(aRotateAngle); + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpRotationCenterAsElement(drawing::Direction3D aRotationCenter) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "RotationCenter" )); + dumpDirection3D(aRotationCenter); + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpShininessAsAttribute(double aShininess) +{ + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shininess"), "%f", aShininess); +} + +void EnhancedShapeDumper::dumpSkewAsElement(drawing::EnhancedCustomShapeParameterPair aSkew) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Skew" )); + dumpEnhancedCustomShapeParameterPair(aSkew); + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpSpecularityAsAttribute(double aSpecularity) +{ + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("specularity"), "%f", aSpecularity); +} + +void EnhancedShapeDumper::dumpProjectionModeAsAttribute(drawing::ProjectionMode eProjectionMode) +{ + switch(eProjectionMode) + { + case drawing::ProjectionMode_PARALLEL: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("projectionMode"), "%s", "PARALLEL"); + break; + case drawing::ProjectionMode_PERSPECTIVE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("projectionMode"), "%s", "PERSPECTIVE"); + break; + default: + break; + } +} + +void EnhancedShapeDumper::dumpViewPointAsElement(drawing::Position3D aViewPoint) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "ViewPoint" )); + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("positionX"), "%f", aViewPoint.PositionX); + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("positionY"), "%f", aViewPoint.PositionY); + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("positionZ"), "%f", aViewPoint.PositionZ); + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpOriginAsElement(drawing::EnhancedCustomShapeParameterPair aOrigin) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Origin" )); + dumpEnhancedCustomShapeParameterPair(aOrigin); + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpExtrusionColorAsAttribute(sal_Bool bExtrusionColor) +{ + if(bExtrusionColor) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("extrusionColor"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("extrusionColor"), "%s", "false"); +} + +// ------------------------------------------------------ +// ---------- EnhancedCustomShapeGeometry.idl ----------- +// ------------------------------------------------------ + +void EnhancedShapeDumper::dumpEnhancedCustomShapeGeometryService(uno::Reference< beans::XPropertySet > xPropSet) +{ + { + uno::Any anotherAny = xPropSet->getPropertyValue("Type"); + rtl::OUString sType; + if(anotherAny >>= sType) + dumpTypeAsAttribute(sType); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("ViewBox"); + awt::Rectangle aViewBox; + if(anotherAny >>= aViewBox) + dumpViewBoxAsElement(aViewBox); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("MirroredX"); + sal_Bool bMirroredX; + if(anotherAny >>= bMirroredX) + dumpMirroredXAsAttribute(bMirroredX); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("MirroredY"); + sal_Bool bMirroredY; + if(anotherAny >>= bMirroredY) + dumpMirroredYAsAttribute(bMirroredY); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextRotateAngle"); + double aTextRotateAngle; + if(anotherAny >>= aTextRotateAngle) + dumpTextRotateAngleAsAttribute(aTextRotateAngle); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("AdjustmentValues"); + uno::Sequence< drawing::EnhancedCustomShapeAdjustmentValue> aAdjustmentValues; + if(anotherAny >>= aAdjustmentValues) + dumpAdjustmentValuesAsElement(aAdjustmentValues); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Extrusion"); + uno::Sequence< beans::PropertyValue > aExtrusion; + if(anotherAny >>= aExtrusion) + dumpExtrusionAsElement(aExtrusion); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Path"); + uno::Sequence< beans::PropertyValue > aPath; + if(anotherAny >>= aPath) + dumpPathAsElement(aPath); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextPath"); + uno::Sequence< beans::PropertyValue > aTextPath; + if(anotherAny >>= aTextPath) + dumpTextPathAsElement(aTextPath); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Equations"); + uno::Sequence< rtl::OUString > aEquations; + if(anotherAny >>= aEquations) + dumpEquationsAsElement(aEquations); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Handles"); + uno::Sequence< beans::PropertyValues > aHandles; + if(anotherAny >>= aHandles) + dumpHandlesAsElement(aHandles); + } +} +void EnhancedShapeDumper::dumpTypeAsAttribute(rtl::OUString sType) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("type"), "%s", + rtl::OUStringToOString(sType, RTL_TEXTENCODING_UTF8).getStr()); +} + +void EnhancedShapeDumper::dumpViewBoxAsElement(awt::Rectangle aViewBox) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "ViewBox" )); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("x"), "%" SAL_PRIdINT32, aViewBox.X); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("y"), "%" SAL_PRIdINT32, aViewBox.Y); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("width"), "%" SAL_PRIdINT32, aViewBox.Width); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("height"), "%" SAL_PRIdINT32, aViewBox.Height); + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpMirroredXAsAttribute(sal_Bool bMirroredX) +{ + if(bMirroredX) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("mirroredX"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("mirroredX"), "%s", "false"); +} + +void EnhancedShapeDumper::dumpMirroredYAsAttribute(sal_Bool bMirroredY) +{ + if(bMirroredY) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("mirroredY"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("mirroredY"), "%s", "false"); +} + +void EnhancedShapeDumper::dumpTextRotateAngleAsAttribute(double aTextRotateAngle) +{ + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textRotateAngle"), "%f", aTextRotateAngle); +} + +void EnhancedShapeDumper::dumpAdjustmentValuesAsElement(uno::Sequence< drawing::EnhancedCustomShapeAdjustmentValue> aAdjustmentValues) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "AdjustmentValues" )); + sal_Int32 nLength = aAdjustmentValues.getLength(); + for (sal_Int32 i = 0; i < nLength; ++i) + { + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "EnhancedCustomShapeAdjustmentValue" )); + uno::Any aAny = aAdjustmentValues[i].Value; + rtl::OUString sValue; + if(aAny >>= sValue) + { + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s", + rtl::OUStringToOString(sValue, RTL_TEXTENCODING_UTF8).getStr()); + } + switch(aAdjustmentValues[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 ); +} + +void EnhancedShapeDumper::dumpPropertyValueAsElement(beans::PropertyValue aPropertyValue) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PropertyValue" )); + + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s", + rtl::OUStringToOString(aPropertyValue.Name, RTL_TEXTENCODING_UTF8).getStr()); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("handle"), "%" SAL_PRIdINT32, aPropertyValue.Handle); + + uno::Any aAny = aPropertyValue.Value; + rtl::OUString sValue; + if(aAny >>= sValue) + { + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s", + rtl::OUStringToOString(sValue, RTL_TEXTENCODING_UTF8).getStr()); + } + switch(aPropertyValue.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 ); +} + +void EnhancedShapeDumper::dumpExtrusionAsElement(uno::Sequence< beans::PropertyValue > aExtrusion) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Extrusion" )); + sal_Int32 nLength = aExtrusion.getLength(); + for (sal_Int32 i = 0; i < nLength; ++i) + { + dumpPropertyValueAsElement(aExtrusion[i]); + } + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpPathAsElement(uno::Sequence< beans::PropertyValue > aPath) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Path" )); + sal_Int32 nLength = aPath.getLength(); + for (sal_Int32 i = 0; i < nLength; ++i) + { + dumpPropertyValueAsElement(aPath[i]); + } + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpTextPathAsElement(uno::Sequence< beans::PropertyValue > aTextPath) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "TextPath" )); + sal_Int32 nLength = aTextPath.getLength(); + for (sal_Int32 i = 0; i < nLength; ++i) + { + dumpPropertyValueAsElement(aTextPath[i]); + } + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpEquationsAsElement(uno::Sequence< rtl::OUString > aEquations) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Equations" )); + sal_Int32 nLength = aEquations.getLength(); + for (sal_Int32 i = 0; i < nLength; ++i) + { + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s", + rtl::OUStringToOString(aEquations[i], RTL_TEXTENCODING_UTF8).getStr()); + } + xmlTextWriterEndElement( xmlWriter ); +} + +// PropertyValues specifies a sequence of PropertyValue instances. +// so in this case it's a Sequence of a Sequence of a PropertyValue instances. +// Welcome to Sequenception again. +void EnhancedShapeDumper::dumpHandlesAsElement(uno::Sequence< beans::PropertyValues > aHandles) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Handles" )); + sal_Int32 nSequenceLength = aHandles.getLength(); + for (sal_Int32 i = 0; i < nSequenceLength; ++i) + { + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PropertyValues" )); + uno::Sequence< beans::PropertyValue > propertyValueSequence = aHandles[i]; + sal_Int32 nLength = propertyValueSequence.getLength(); + for (sal_Int32 j = 0; j < nLength; ++j) + { + dumpPropertyValueAsElement(propertyValueSequence[j]); + } + xmlTextWriterEndElement( xmlWriter ); + } + xmlTextWriterEndElement( xmlWriter ); +} + +// ------------------------------------------------------ +// ---------- EnhancedCustomShapeHandle.idl ----------- +// ------------------------------------------------------ + +void EnhancedShapeDumper::dumpEnhancedCustomShapeHandleService(uno::Reference< beans::XPropertySet > xPropSet) +{ + { + uno::Any anotherAny = xPropSet->getPropertyValue("MirroredX"); + sal_Bool bMirroredX; + if(anotherAny >>= bMirroredX) + dumpMirroredXAsAttribute(bMirroredX); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("MirroredY"); + sal_Bool bMirroredY; + if(anotherAny >>= bMirroredY) + dumpMirroredYAsAttribute(bMirroredY); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Switched"); + sal_Bool bSwitched; + if(anotherAny >>= bSwitched) + dumpSwitchedAsAttribute(bSwitched); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Position"); + drawing::EnhancedCustomShapeParameterPair aPosition; + if(anotherAny >>= aPosition) + dumpPositionAsElement(aPosition); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Polar"); + drawing::EnhancedCustomShapeParameterPair aPolar; + if(anotherAny >>= aPolar) + dumpPolarAsElement(aPolar); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("RefX"); + sal_Int32 aRefX; + if(anotherAny >>= aRefX) + dumpRefXAsAttribute(aRefX); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("RefY"); + sal_Int32 aRefY; + if(anotherAny >>= aRefY) + dumpRefYAsAttribute(aRefY); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("RefAngle"); + sal_Int32 aRefAngle; + if(anotherAny >>= aRefAngle) + dumpRefAngleAsAttribute(aRefAngle); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("RefR"); + sal_Int32 aRefR; + if(anotherAny >>= aRefR) + dumpRefRAsAttribute(aRefR); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("RangeXMinimum"); + drawing::EnhancedCustomShapeParameter aRangeXMinimum; + if(anotherAny >>= aRangeXMinimum) + dumpRangeXMinimumAsElement(aRangeXMinimum); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("RangeXMaximum"); + drawing::EnhancedCustomShapeParameter aRangeXMaximum; + if(anotherAny >>= aRangeXMaximum) + dumpRangeXMaximumAsElement(aRangeXMaximum); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("RangeYMinimum"); + drawing::EnhancedCustomShapeParameter aRangeYMinimum; + if(anotherAny >>= aRangeYMinimum) + dumpRangeYMinimumAsElement(aRangeYMinimum); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("RangeYMaximum"); + drawing::EnhancedCustomShapeParameter aRangeYMaximum; + if(anotherAny >>= aRangeYMaximum) + dumpRangeYMaximumAsElement(aRangeYMaximum); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("RadiusRangeMinimum"); + drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum; + if(anotherAny >>= aRadiusRangeMinimum) + dumpRadiusRangeMinimumAsElement(aRadiusRangeMinimum); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("RadiusRangeMaximum"); + drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum; + if(anotherAny >>= aRadiusRangeMaximum) + dumpRadiusRangeMaximumAsElement(aRadiusRangeMaximum); + } +} + +void EnhancedShapeDumper::dumpSwitchedAsAttribute(sal_Bool bSwitched) +{ + if(bSwitched) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("switched"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("switched"), "%s", "false"); +} + +void EnhancedShapeDumper::dumpPositionAsElement(drawing::EnhancedCustomShapeParameterPair aPosition) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Position" )); + dumpEnhancedCustomShapeParameterPair(aPosition); + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpPolarAsElement(drawing::EnhancedCustomShapeParameterPair aPolar) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Polar" )); + dumpEnhancedCustomShapeParameterPair(aPolar); + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpRefXAsAttribute(sal_Int32 aRefX) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("refX"), "%" SAL_PRIdINT32, aRefX); +} + +void EnhancedShapeDumper::dumpRefYAsAttribute(sal_Int32 aRefY) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("refY"), "%" SAL_PRIdINT32, aRefY); +} + +void EnhancedShapeDumper::dumpRefAngleAsAttribute(sal_Int32 aRefAngle) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("refAngle"), "%" SAL_PRIdINT32, aRefAngle); +} + +void EnhancedShapeDumper::dumpRefRAsAttribute(sal_Int32 aRefR) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("refR"), "%" SAL_PRIdINT32, aRefR); +} + +void EnhancedShapeDumper::dumpEnhancedCustomShapeParameter(drawing::EnhancedCustomShapeParameter aParameter) +{ + uno::Any aAny = aParameter.Value; + rtl::OUString sValue; + if(aAny >>= sValue) + { + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s", + rtl::OUStringToOString(sValue, RTL_TEXTENCODING_UTF8).getStr()); + } + sal_Int32 aType = aParameter.Type; + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("type"), "%" SAL_PRIdINT32, aType); +} + +void EnhancedShapeDumper::dumpRangeXMinimumAsElement(drawing::EnhancedCustomShapeParameter aRangeXMinimum) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "RangeXMinimum" )); + dumpEnhancedCustomShapeParameter(aRangeXMinimum); + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpRangeXMaximumAsElement(drawing::EnhancedCustomShapeParameter aRangeXMaximum) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "RangeXMaximum" )); + dumpEnhancedCustomShapeParameter(aRangeXMaximum); + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpRangeYMinimumAsElement(drawing::EnhancedCustomShapeParameter aRangeYMinimum) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "RangeYMinimum" )); + dumpEnhancedCustomShapeParameter(aRangeYMinimum); + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpRangeYMaximumAsElement(drawing::EnhancedCustomShapeParameter aRangeYMaximum) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "RangeYMaximum" )); + dumpEnhancedCustomShapeParameter(aRangeYMaximum); + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpRadiusRangeMinimumAsElement(drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "RadiusRangeMinimum" )); + dumpEnhancedCustomShapeParameter(aRadiusRangeMinimum); + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpRadiusRangeMaximumAsElement(drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "RadiusRangeMaximum" )); + dumpEnhancedCustomShapeParameter(aRadiusRangeMaximum); + xmlTextWriterEndElement( xmlWriter ); +} + +// ------------------------------------------------------ +// ---------- EnhancedCustomShapePath.idl --------------- +// ------------------------------------------------------ + +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); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("StretchX"); + sal_Int32 aStretchX; + if(anotherAny >>= aStretchX) + dumpStretchXAsAttribute(aStretchX); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("StretchY"); + sal_Int32 aStretchY; + if(anotherAny >>= aStretchY) + dumpStretchYAsAttribute(aStretchY); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextFrames"); + uno::Sequence< drawing::EnhancedCustomShapeTextFrame > aTextFrames; + if(anotherAny >>= aTextFrames) + dumpTextFramesAsElement(aTextFrames); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("GluePoints"); + uno::Sequence< drawing::EnhancedCustomShapeParameterPair > aGluePoints; + if(anotherAny >>= aGluePoints) + dumpGluePointsAsElement(aGluePoints); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("GluePointLeavingDirections"); + uno::Sequence< double > aGluePointLeavingDirections; + if(anotherAny >>= aGluePointLeavingDirections) + dumpGluePointLeavingDirectionsAsElement(aGluePointLeavingDirections); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("GluePointType"); + sal_Int32 aGluePointType; + if(anotherAny >>= aGluePointType) + dumpGluePointTypeAsAttribute(aGluePointType); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("ExtrusionAllowed"); + sal_Bool bExtrusionAllowed; + if(anotherAny >>= bExtrusionAllowed) + dumpExtrusionAllowedAsAttribute(bExtrusionAllowed); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("ConcentricGradientFillAllowed"); + sal_Bool bConcentricGradientFillAllowed; + if(anotherAny >>= bConcentricGradientFillAllowed) + dumpConcentricGradientFillAllowedAsAttribute(bConcentricGradientFillAllowed); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextPathAllowed"); + sal_Bool bTextPathAllowed; + if(anotherAny >>= bTextPathAllowed) + dumpTextPathAllowedAsAttribute(bTextPathAllowed); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("SubViewSize"); + uno::Sequence< awt::Size > aSubViewSize; + if(anotherAny >>= aSubViewSize) + dumpSubViewSizeAsElement(aSubViewSize); + } +} + +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 ); +} + +void EnhancedShapeDumper::dumpStretchXAsAttribute(sal_Int32 aStretchX) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("stretchX"), "%" SAL_PRIdINT32, aStretchX); +} + +void EnhancedShapeDumper::dumpStretchYAsAttribute(sal_Int32 aStretchY) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("stretchY"), "%" SAL_PRIdINT32, aStretchY); +} + +void EnhancedShapeDumper::dumpTextFramesAsElement(uno::Sequence< drawing::EnhancedCustomShapeTextFrame > aTextFrames) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "TextFrames" )); + sal_Int32 nLength = aTextFrames.getLength(); + for (sal_Int32 i = 0; i < nLength; ++i) + { + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "EnhancedCustomShapeTextFrame" )); + { + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "TopLeft" )); + dumpEnhancedCustomShapeParameterPair(aTextFrames[i].TopLeft); + xmlTextWriterEndElement( xmlWriter ); + + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "BottomRight" )); + dumpEnhancedCustomShapeParameterPair(aTextFrames[i].BottomRight); + xmlTextWriterEndElement( xmlWriter ); + } + xmlTextWriterEndElement( xmlWriter ); + } + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpGluePointsAsElement(uno::Sequence< drawing::EnhancedCustomShapeParameterPair > aGluePoints) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "GluePoints" )); + sal_Int32 nLength = aGluePoints.getLength(); + for (sal_Int32 i = 0; i < nLength; ++i) + { + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "EnhancedCustomShapeParameterPair" )); + dumpEnhancedCustomShapeParameterPair(aGluePoints[i]); + xmlTextWriterEndElement( xmlWriter ); + } + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpGluePointLeavingDirectionsAsElement(uno::Sequence< double > aGluePointLeavingDirections) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "GluePointLeavingDirections" )); + sal_Int32 nLength = aGluePointLeavingDirections.getLength(); + for (sal_Int32 i = 0; i < nLength; ++i) + { + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("value"), "%f", aGluePointLeavingDirections[i]); + } + xmlTextWriterEndElement( xmlWriter ); +} + +void EnhancedShapeDumper::dumpGluePointTypeAsAttribute(sal_Int32 aGluePointType) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("gluePointType"), "%" SAL_PRIdINT32, aGluePointType); +} + +void EnhancedShapeDumper::dumpExtrusionAllowedAsAttribute(sal_Bool bExtrusionAllowed) +{ + if(bExtrusionAllowed) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("extrusionAllowed"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("extrusionAllowed"), "%s", "false"); +} + +void EnhancedShapeDumper::dumpConcentricGradientFillAllowedAsAttribute(sal_Bool bConcentricGradientFillAllowed) +{ + if(bConcentricGradientFillAllowed) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("concentricGradientFillAllowed"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("concentricGradientFillAllowed"), "%s", "false"); +} + +void EnhancedShapeDumper::dumpTextPathAllowedAsAttribute(sal_Bool bTextPathAllowed) +{ + if(bTextPathAllowed) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textPathAllowed"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textPathAllowed"), "%s", "false"); +} + +void EnhancedShapeDumper::dumpSubViewSizeAsElement(uno::Sequence< awt::Size > aSubViewSize) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "SubViewSize" )); + sal_Int32 nLength = aSubViewSize.getLength(); + for (sal_Int32 i = 0; i < nLength; ++i) + { + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Size" )); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("width"), "%" SAL_PRIdINT32, aSubViewSize[i].Width); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("height"), "%" SAL_PRIdINT32, aSubViewSize[i].Height); + xmlTextWriterEndElement( xmlWriter ); + } + xmlTextWriterEndElement( xmlWriter ); +} + +// ---------------------------------------------------------- +// ---------- EnhancedCustomShapeTextPath.idl --------------- +// ---------------------------------------------------------- + +void EnhancedShapeDumper::dumpEnhancedCustomShapeTextPathService(uno::Reference< beans::XPropertySet > xPropSet) +{ + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextPath"); + sal_Bool bTextPath; + if(anotherAny >>= bTextPath) + dumpTextPathAsAttribute(bTextPath); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextPathMode"); + drawing::EnhancedCustomShapeTextPathMode eTextPathMode; + if(anotherAny >>= eTextPathMode) + dumpTextPathModeAsAttribute(eTextPathMode); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("ScaleX"); + sal_Bool bScaleX; + if(anotherAny >>= bScaleX) + dumpScaleXAsAttribute(bScaleX); + } +} + +void EnhancedShapeDumper::dumpTextPathAsAttribute(sal_Bool bTextPath) +{ + if(bTextPath) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textPath"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textPath"), "%s", "false"); +} + +void EnhancedShapeDumper::dumpTextPathModeAsAttribute(drawing::EnhancedCustomShapeTextPathMode eTextPathMode) +{ + switch(eTextPathMode) + { + case drawing::EnhancedCustomShapeTextPathMode_NORMAL: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textPathMode"), "%s", "NORMAL"); + break; + case drawing::EnhancedCustomShapeTextPathMode_PATH: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textPathMode"), "%s", "PATH"); + break; + case drawing::EnhancedCustomShapeTextPathMode_SHAPE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textPathMode"), "%s", "SHAPE"); + break; + default: + break; + } +} + +void EnhancedShapeDumper::dumpScaleXAsAttribute(sal_Bool bScaleX) +{ + if(bScaleX) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("scaleX"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("scaleX"), "%s", "false"); +} diff --git a/drawinglayer/source/dumper/EnhancedShapeDumper.hxx b/drawinglayer/source/dumper/EnhancedShapeDumper.hxx new file mode 100644 index 000000000000..7ed9359535f7 --- /dev/null +++ b/drawinglayer/source/dumper/EnhancedShapeDumper.hxx @@ -0,0 +1,149 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2012 Artur Dorda <artur.dorda+libo@gmail.com> (initial developer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <libxml/xmlwriter.h> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> +#include <com/sun/star/drawing/Direction3D.hpp> +#include <com/sun/star/drawing/ShadeMode.hpp> +#include <com/sun/star/drawing/ProjectionMode.hpp> +#include <com/sun/star/drawing/Position3D.hpp> + +#include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/PropertyValues.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeParameter.hpp> + +#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp> +#include <com/sun/star/awt/Size.hpp> + +#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp> + +#ifndef EnhancedShapeDumper_hxx +#define EnhancedShapeDumper_hxx + +class EnhancedShapeDumper +{ +public: + EnhancedShapeDumper(xmlTextWriterPtr writer) + : + xmlWriter(writer) + { + + } + + // auxiliary functions + void dumpEnhancedCustomShapeParameterPair(com::sun::star::drawing::EnhancedCustomShapeParameterPair aParameterPair); + void dumpDirection3D(com::sun::star::drawing::Direction3D aDirection3D); + void dumpPropertyValueAsElement(com::sun::star::beans::PropertyValue aPropertyValue); + void dumpEnhancedCustomShapeParameter(com::sun::star::drawing::EnhancedCustomShapeParameter aParameter); + + // EnhancedCustomShapeExtrusion.idl + void dumpEnhancedCustomShapeExtrusionService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet); + void dumpExtrusionAsAttribute(sal_Bool bExtrusion); + void dumpBrightnessAsAttribute(double aBrightness); + void dumpDepthAsElement(com::sun::star::drawing::EnhancedCustomShapeParameterPair aDepth); + void dumpDiffusionAsAttribute(double aDiffusion); + void dumpNumberOfLineSegmentsAsAttribute(sal_Int32 aNumberOfLineSegments); + void dumpLightFaceAsAttribute(sal_Bool bLightFace); + void dumpFirstLightHarshAsAttribute(sal_Bool bFirstLightHarsh); + void dumpSecondLightHarshAsAttribute(sal_Bool bSecondLightHarsh); + void dumpFirstLightLevelAsAttribute(double aFirstLightLevel); + void dumpSecondLightLevelAsAttribute(double aSecondLightLevel); + void dumpFirstLightDirectionAsElement(com::sun::star::drawing::Direction3D aFirstLightDirection); + void dumpSecondLightDirectionAsElement(com::sun::star::drawing::Direction3D aSecondLightDirection); + void dumpMetalAsAttribute(sal_Bool bMetal); + void dumpShadeModeAsAttribute(com::sun::star::drawing::ShadeMode eShadeMode); + void dumpRotateAngleAsElement(com::sun::star::drawing::EnhancedCustomShapeParameterPair aRotateAngle); + void dumpRotationCenterAsElement(com::sun::star::drawing::Direction3D aRotationCenter); + void dumpShininessAsAttribute(double aShininess); + void dumpSkewAsElement(com::sun::star::drawing::EnhancedCustomShapeParameterPair aSkew); + void dumpSpecularityAsAttribute(double aSpecularity); + void dumpProjectionModeAsAttribute(com::sun::star::drawing::ProjectionMode eProjectionMode); + void dumpViewPointAsElement(com::sun::star::drawing::Position3D aViewPoint); + void dumpOriginAsElement(com::sun::star::drawing::EnhancedCustomShapeParameterPair aOrigin); + void dumpExtrusionColorAsAttribute(sal_Bool bExtrusionColor); + + // EnhancedCustomShapeGeometry.idl + void dumpEnhancedCustomShapeGeometryService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet); + void dumpTypeAsAttribute(rtl::OUString sType); + void dumpViewBoxAsElement(com::sun::star::awt::Rectangle aViewBox); + void dumpMirroredXAsAttribute(sal_Bool bMirroredX); // also used in EnhancedCustomShapeHandle + void dumpMirroredYAsAttribute(sal_Bool bMirroredY); // also used in EnhancedCustomShapeHandle + void dumpTextRotateAngleAsAttribute(double aTextRotateAngle); + void dumpAdjustmentValuesAsElement(com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue> aAdjustmentValues); + void dumpExtrusionAsElement(com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aExtrusion); + void dumpPathAsElement(com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aPath); + void dumpTextPathAsElement(com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aTextPath); + void dumpEquationsAsElement(com::sun::star::uno::Sequence< rtl::OUString > aEquations); + void dumpHandlesAsElement(com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValues > aHandles); + + // EnhancedCustomShapeHandle.idl + void dumpEnhancedCustomShapeHandleService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet); + void dumpSwitchedAsAttribute(sal_Bool bSwitched); + void dumpPositionAsElement(com::sun::star::drawing::EnhancedCustomShapeParameterPair aPosition); + void dumpPolarAsElement(com::sun::star::drawing::EnhancedCustomShapeParameterPair aPolar); + void dumpRefXAsAttribute(sal_Int32 aRefX); + void dumpRefYAsAttribute(sal_Int32 aRefY); + void dumpRefAngleAsAttribute(sal_Int32 aRefAngle); + void dumpRefRAsAttribute(sal_Int32 aRefR); + void dumpRangeXMinimumAsElement(com::sun::star::drawing::EnhancedCustomShapeParameter aRangeXMinimum); + void dumpRangeXMaximumAsElement(com::sun::star::drawing::EnhancedCustomShapeParameter aRangeXMaximum); + void dumpRangeYMinimumAsElement(com::sun::star::drawing::EnhancedCustomShapeParameter aRangeYMinimum); + void dumpRangeYMaximumAsElement(com::sun::star::drawing::EnhancedCustomShapeParameter aRangeXMaximum); + void dumpRadiusRangeMinimumAsElement(com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum); + void dumpRadiusRangeMaximumAsElement(com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum); + + // 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); + void dumpStretchXAsAttribute(sal_Int32 aStretchX); + void dumpStretchYAsAttribute(sal_Int32 aStretchY); + void dumpTextFramesAsElement(com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > aTextFrames); + void dumpGluePointsAsElement(com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aGluePoints); + void dumpGluePointLeavingDirectionsAsElement(com::sun::star::uno::Sequence< double > aGluePointLeavingDirections); + void dumpGluePointTypeAsAttribute(sal_Int32 aGluePointType); + void dumpExtrusionAllowedAsAttribute(sal_Bool bExtrusionAllowed); + void dumpConcentricGradientFillAllowedAsAttribute(sal_Bool bConcentricGradientFillAllowed); + void dumpTextPathAllowedAsAttribute(sal_Bool bTextPathAllowed); + void dumpSubViewSizeAsElement(com::sun::star::uno::Sequence< com::sun::star::awt::Size > aSubViewSize); + + // EnhancedCustomShapePath.idl + void dumpEnhancedCustomShapeTextPathService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet); + void dumpTextPathAsAttribute(sal_Bool bTextPath); + void dumpTextPathModeAsAttribute(com::sun::star::drawing::EnhancedCustomShapeTextPathMode eTextPathMode); + void dumpScaleXAsAttribute(sal_Bool bScaleX); + +private: + xmlTextWriterPtr xmlWriter; +}; +#endif diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx new file mode 100644 index 000000000000..c5055410f59b --- /dev/null +++ b/drawinglayer/source/dumper/XShapeDumper.cxx @@ -0,0 +1,1887 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2012 Artur Dorda <artur.dorda+libo@gmail.com> (initial developer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <drawinglayer/XShapeDumper.hxx> +#include "EnhancedShapeDumper.hxx" +#include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/text/XText.hpp> +#include <rtl/strbuf.hxx> +#include <libxml/xmlwriter.h> + +#define DEBUG_DUMPER 0 + +using namespace com::sun::star; +//class XShapeDumper + +XShapeDumper::XShapeDumper() +{ + +} + +namespace { + +// FUNCTION DECLARATIONS + +// auxiliary functions +void dumpGradientProperty(com::sun::star::awt::Gradient aGradient, xmlTextWriterPtr xmlWriter); +void dumpPolyPolygonBezierCoords(com::sun::star::drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords, xmlTextWriterPtr xmlWriter); +void dumpPointSequenceSequence(com::sun::star::drawing::PointSequenceSequence aPointSequenceSequence, uno::Sequence<uno::Sequence<drawing::PolygonFlags> >*, xmlTextWriterPtr xmlWriter); + +// FillProperties.idl +void dumpFillStyleAsAttribute(com::sun::star::drawing::FillStyle eFillStyle, xmlTextWriterPtr xmlWriter); +void dumpFillColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter); +void dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr xmlWriter); +void dumpFillTransparenceGradientNameAsAttribute(rtl::OUString sTranspGradName, xmlTextWriterPtr xmlWriter); +void dumpFillTransparenceGradientAsElement(com::sun::star::awt::Gradient aTranspGrad, xmlTextWriterPtr xmlWriter); +void dumpFillGradientNameAsAttribute(rtl::OUString sGradName, xmlTextWriterPtr xmlWriter); +void dumpFillGradientAsElement(com::sun::star::awt::Gradient aGradient, xmlTextWriterPtr xmlWriter); +void dumpFillHatchNameAsAttribute(rtl::OUString sHatchName, xmlTextWriterPtr xmlWriter); +void dumpFillHatchAsElement(com::sun::star::drawing::Hatch aHatch, xmlTextWriterPtr xmlWriter); +void dumpFillBackgroundAsAttribute(sal_Bool bBackground, xmlTextWriterPtr xmlWriter); +void dumpFillBitmapNameAsAttribute(rtl::OUString sBitmapName, xmlTextWriterPtr xmlWriter); +void dumpFillBitmapAsElement(com::sun::star::uno::Reference<com::sun::star::awt::XBitmap> xBitmap, xmlTextWriterPtr xmlWriter); +void dumpFillBitmapURLAsAttribute(rtl::OUString sBitmapURL, xmlTextWriterPtr xmlWriter); +void dumpFillBitmapPositionOffsetXAsAttribute(sal_Int32 aBitmapPositionOffsetX, xmlTextWriterPtr xmlWriter); +void dumpFillBitmapPositionOffsetYAsAttribute(sal_Int32 aBitmapPositionOffsetY, xmlTextWriterPtr xmlWriter); +void dumpFillBitmapOffsetXAsAttribute(sal_Int32 aBitmapOffsetX, xmlTextWriterPtr xmlWriter); +void dumpFillBitmapOffsetYAsAttribute(sal_Int32 aBitmapOffsetY, xmlTextWriterPtr xmlWriter); +void dumpFillBitmapRectanglePointAsAttribute(com::sun::star::drawing::RectanglePoint eBitmapRectanglePoint, xmlTextWriterPtr xmlWriter); +void dumpFillBitmapLogicalSizeAsAttribute(sal_Bool bBitmapLogicalSize, xmlTextWriterPtr xmlWriter); +void dumpFillBitmapSizeXAsAttribute(sal_Int32 aBitmapSizeX, xmlTextWriterPtr xmlWriter); +void dumpFillBitmapSizeYAsAttribute(sal_Int32 aBitmapSizeY, xmlTextWriterPtr xmlWriter); +void dumpFillBitmapModeAsAttribute(com::sun::star::drawing::BitmapMode eBitmapMode, xmlTextWriterPtr xmlWriter); +void dumpFillBitmapStretchAsAttribute(sal_Bool bBitmapStretch, xmlTextWriterPtr xmlWriter); +void dumpFillBitmapTileAsAttribute(sal_Bool bBitmapTile, xmlTextWriterPtr xmlWriter); + +// LineProperties.idl +void dumpLineStyleAsAttribute(com::sun::star::drawing::LineStyle eLineStyle, xmlTextWriterPtr xmlWriter); +void dumpLineDashAsElement(com::sun::star::drawing::LineDash aLineDash, xmlTextWriterPtr xmlWriter); +void dumpLineDashNameAsAttribute(rtl::OUString sLineDashName, xmlTextWriterPtr xmlWriter); +void dumpLineColorAsAttribute(sal_Int32 aLineColor, xmlTextWriterPtr xmlWriter); +void dumpLineTransparenceAsAttribute(sal_Int32 aLineTransparence, xmlTextWriterPtr xmlWriter); +void dumpLineWidthAsAttribute(sal_Int32 aLineWidth, xmlTextWriterPtr xmlWriter); +void dumpLineJointAsAttribute(com::sun::star::drawing::LineJoint eLineJoint, xmlTextWriterPtr xmlWriter); +void dumpLineStartNameAsAttribute(rtl::OUString sLineStartName, xmlTextWriterPtr xmlWriter); +void dumpLineEndNameAsAttribute(rtl::OUString sLineEndName, xmlTextWriterPtr xmlWriter); +void dumpLineStartAsElement(com::sun::star::drawing::PolyPolygonBezierCoords aLineStart, xmlTextWriterPtr xmlWriter); +void dumpLineEndAsElement(com::sun::star::drawing::PolyPolygonBezierCoords aLineEnd, xmlTextWriterPtr xmlWriter); +void dumpLineStartCenterAsAttribute(sal_Bool bLineStartCenter, xmlTextWriterPtr xmlWriter); +void dumpLineStartWidthAsAttribute(sal_Int32 aLineStartWidth, xmlTextWriterPtr xmlWriter); +void dumpLineEndCenterAsAttribute(sal_Bool bLineEndCenter, xmlTextWriterPtr xmlWriter); +void dumpLineEndWidthAsAttribute(sal_Int32 aLineEndWidth, xmlTextWriterPtr xmlWriter); + +// PolyPolygonDescriptor.idl +void dumpPolygonKindAsAttribute(com::sun::star::drawing::PolygonKind ePolygonKind, xmlTextWriterPtr xmlWriter); +void dumpPolyPolygonAsElement(com::sun::star::drawing::PointSequenceSequence aPolyPolygon, xmlTextWriterPtr xmlWriter); +void dumpGeometryAsElement(com::sun::star::drawing::PointSequenceSequence aGeometry, xmlTextWriterPtr xmlWriter); + +// TextProperties.idl +void dumpIsNumberingAsAttribute(sal_Bool bIsNumbering, xmlTextWriterPtr xmlWriter); +void dumpTextAutoGrowHeightAsAttribute(sal_Bool bTextAutoGrowHeight, xmlTextWriterPtr xmlWriter); +void dumpTextAutoGrowWidthAsAttribute(sal_Bool bTextAutoGrowWidth, xmlTextWriterPtr xmlWriter); +void dumpTextContourFrameAsAttribute(sal_Bool bTextContourFrame, xmlTextWriterPtr xmlWriter); +void dumpTextFitToSizeAsAttribute(com::sun::star::drawing::TextFitToSizeType eTextFitToSize, xmlTextWriterPtr xmlWriter); +void dumpTextHorizontalAdjustAsAttribute(com::sun::star::drawing::TextHorizontalAdjust eTextHorizontalAdjust, xmlTextWriterPtr xmlWriter); +void dumpTextVerticalAdjustAsAttribute(com::sun::star::drawing::TextVerticalAdjust eTextVerticalAdjust, xmlTextWriterPtr xmlWriter); +void dumpTextLeftDistanceAsAttribute(sal_Int32 aTextLeftDistance, xmlTextWriterPtr xmlWriter); +void dumpTextRightDistanceAsAttribute(sal_Int32 aTextRightDistance, xmlTextWriterPtr xmlWriter); +void dumpTextUpperDistanceAsAttribute(sal_Int32 aTextUpperDistance, xmlTextWriterPtr xmlWriter); +void dumpTextLowerDistanceAsAttribute(sal_Int32 aTextLowerDistance, xmlTextWriterPtr xmlWriter); +void dumpTextMaximumFrameHeightAsAttribute(sal_Int32 aTextMaximumFrameHeight, xmlTextWriterPtr xmlWriter); +void dumpTextMaximumFrameWidthAsAttribute(sal_Int32 aTextMaximumFrameWidth, xmlTextWriterPtr xmlWriter); +void dumpTextMinimumFrameHeightAsAttribute(sal_Int32 aTextMinimumFrameHeight, xmlTextWriterPtr xmlWriter); +void dumpTextMinimumFrameWidthAsAttribute(sal_Int32 aTextMinimumFrameWidth, xmlTextWriterPtr xmlWriter); +void dumpTextAnimationAmountAsAttribute(sal_Int32 aTextAnimationAmount, xmlTextWriterPtr xmlWriter); +void dumpTextAnimationCountAsAttribute(sal_Int32 aTextAnimationCount, xmlTextWriterPtr xmlWriter); +void dumpTextAnimationDelayAsAttribute(sal_Int32 aTextAnimationDelay, xmlTextWriterPtr xmlWriter); +void dumpTextAnimationDirectionAsAttribute(com::sun::star::drawing::TextAnimationDirection eTextAnimationDirection, xmlTextWriterPtr xmlWriter); +void dumpTextAnimationKindAsAttribute(com::sun::star::drawing::TextAnimationKind eTextAnimationKind, xmlTextWriterPtr xmlWriter); +void dumpTextAnimationStartInsideAsAttribute(sal_Bool bTextAnimationStartInside, xmlTextWriterPtr xmlWriter); +void dumpTextAnimationStopInsideAsAttribute(sal_Bool bTextAnimationStopInside, xmlTextWriterPtr xmlWriter); +void dumpTextWritingModeAsAttribute(com::sun::star::text::WritingMode eWritingMode, xmlTextWriterPtr xmlWriter); + +// ShadowProperties.idl +void dumpShadowAsAttribute(sal_Bool bShadow, xmlTextWriterPtr xmlWriter); +void dumpShadowColorAsAttribute(sal_Int32 aShadowColor, xmlTextWriterPtr xmlWriter); +void dumpShadowTransparenceAsAttribute(sal_Int32 aShadowTransparence, xmlTextWriterPtr xmlWriter); +void dumpShadowXDistanceAsAttribute(sal_Int32 aShadowXDistance, xmlTextWriterPtr xmlWriter); +void dumpShadowYDistanceAsAttribute(sal_Int32 aShadowYDistance, xmlTextWriterPtr xmlWriter); + +//Shape.idl +void dumpZOrderAsAttribute(sal_Int32 aZOrder, xmlTextWriterPtr xmlWriter); +void dumpLayerIDAsAttribute(sal_Int32 aLayerID, xmlTextWriterPtr xmlWriter); +void dumpLayerNameAsAttribute(rtl::OUString sLayerName, xmlTextWriterPtr xmlWriter); +void dumpVisibleAsAttribute(sal_Bool bVisible, xmlTextWriterPtr xmlWriter); +void dumpPrintableAsAttribute(sal_Bool bPrintable, xmlTextWriterPtr xmlWriter); +void dumpMoveProtectAsAttribute(sal_Bool bMoveProtect, xmlTextWriterPtr xmlWriter); +void dumpNameAsAttribute(rtl::OUString sName, xmlTextWriterPtr xmlWriter); +void dumpSizeProtectAsAttribute(sal_Bool bSizeProtect, xmlTextWriterPtr xmlWriter); +void dumpHomogenMatrixLine3(com::sun::star::drawing::HomogenMatrixLine3 aLine, xmlTextWriterPtr xmlWriter); +void dumpTransformationAsElement(com::sun::star::drawing::HomogenMatrix3 aTransformation, xmlTextWriterPtr xmlWriter); +void dumpNavigationOrderAsAttribute(sal_Int32 aNavigationOrder, xmlTextWriterPtr xmlWriter); +void dumpHyperlinkAsAttribute(rtl::OUString sHyperlink, xmlTextWriterPtr xmlWriter); + +// PolyPolygonBezierDescriptor.idl +void dumpPolyPolygonBezierAsElement(com::sun::star::drawing::PolyPolygonBezierCoords aPolyPolygonBezier, xmlTextWriterPtr xmlWriter); +void dumpGeometryAsElement(com::sun::star::drawing::PolyPolygonBezierCoords aGeometry, xmlTextWriterPtr xmlWriter); + +// 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); +void dumpCustomShapeReplacementURLAsAttribute(rtl::OUString sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter); + +// XShape.idl +void dumpPositionAsAttribute(const com::sun::star::awt::Point& rPoint, xmlTextWriterPtr xmlWriter); +void dumpSizeAsAttribute(const com::sun::star::awt::Size& rSize, xmlTextWriterPtr xmlWriter); + +// the rest +void dumpShapeDescriptorAsAttribute( com::sun::star::uno::Reference< com::sun::star::drawing::XShapeDescriptor > xDescr, xmlTextWriterPtr xmlWriter ); +void dumpXShape(com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape, xmlTextWriterPtr xmlWriter); +void dumpXShapes( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xShapes, xmlTextWriterPtr xmlWriter ); +void dumpTextPropertiesService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter); +void dumpFillPropertiesService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter); +void dumpLinePropertiesService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter); +void dumpShadowPropertiesService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter); +void dumpPolyPolygonDescriptorService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter); +void dumpShapeService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter); +void dumpPolyPolygonBezierDescriptorService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter); +void dumpCustomShapeService(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter); + + +int writeCallback(void* pContext, const char* sBuffer, int nLen) +{ + rtl::OStringBuffer* pBuffer = static_cast<rtl::OStringBuffer*>(pContext); + pBuffer->append(sBuffer); + return nLen; +} + +int closeCallback(void* ) +{ + return 0; +} + +// ---------------------------------------- +// ---------- FillProperties.idl ---------- +// ---------------------------------------- +void dumpFillStyleAsAttribute(drawing::FillStyle eFillStyle, xmlTextWriterPtr xmlWriter) +{ + switch(eFillStyle) + { + case drawing::FillStyle_NONE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "NONE"); + break; + case drawing::FillStyle_SOLID: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "SOLID"); + break; + case drawing::FillStyle_GRADIENT: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "GRADIENT"); + break; + case drawing::FillStyle_HATCH: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "HATCH"); + break; + case drawing::FillStyle_BITMAP: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "BITMAP"); + break; + default: + break; + } +} + +void dumpFillColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillColor"), "%" SAL_PRIdINT32, aColor); +} + +void dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillTransparence"), "%" SAL_PRIdINT32, aTransparence); +} + +void dumpFillTransparenceGradientNameAsAttribute(rtl::OUString sTranspGradName, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillTransparenceGradientName"), "%s", + rtl::OUStringToOString(sTranspGradName, RTL_TEXTENCODING_UTF8).getStr()); +} + +//because there's more awt::Gradient properties to dump +void dumpGradientProperty(awt::Gradient aGradient, xmlTextWriterPtr xmlWriter) +{ + switch(aGradient.Style) //enum GradientStyle + { + case awt::GradientStyle_LINEAR: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "LINEAR"); + break; + case awt::GradientStyle_AXIAL: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "AXIAL"); + break; + case awt::GradientStyle_RADIAL: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "RADIAL"); + break; + case awt::GradientStyle_ELLIPTICAL: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "ELLIPTICAL"); + break; + case awt::GradientStyle_SQUARE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "SQUARE"); + break; + case awt::GradientStyle_RECT: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "RECT"); + break; + default: + break; + } + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("startColor"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.StartColor); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("endColor"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.EndColor); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("angle"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.Angle); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("border"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.Border); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("xOffset"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.XOffset); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("yOffset"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.YOffset); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("startIntensity"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.StartIntensity); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("endIntensity"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.EndIntensity); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("stepCount"), "%" SAL_PRIdINT32, (sal_Int32) aGradient.StepCount); +} + +void dumpFillTransparenceGradientAsElement(awt::Gradient aTranspGrad, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FillTransparenceGradient" )); + dumpGradientProperty(aTranspGrad, xmlWriter); + xmlTextWriterEndElement( xmlWriter ); +} + +void dumpFillGradientNameAsAttribute(rtl::OUString sGradName, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillGradientName"), "%s", + rtl::OUStringToOString(sGradName, RTL_TEXTENCODING_UTF8).getStr()); +} + +void dumpFillGradientAsElement(awt::Gradient aGradient, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FillGradient" )); + dumpGradientProperty(aGradient, xmlWriter); + xmlTextWriterEndElement( xmlWriter ); +} + +void dumpFillHatchNameAsAttribute(rtl::OUString sHatchName, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillHatchName"), "%s", + rtl::OUStringToOString(sHatchName, RTL_TEXTENCODING_UTF8).getStr()); +} + +void dumpFillHatchAsElement(drawing::Hatch aHatch, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FillHatch" )); + switch(aHatch.Style) + { + case drawing::HatchStyle_SINGLE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "SINGLE"); + break; + case drawing::HatchStyle_DOUBLE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "DOUBLE"); + break; + case drawing::HatchStyle_TRIPLE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "TRIPLE"); + break; + default: + break; + } + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("color"), "%" SAL_PRIdINT32, (sal_Int32) aHatch.Color); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("distance"), "%" SAL_PRIdINT32, (sal_Int32) aHatch.Distance); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("angle"), "%" SAL_PRIdINT32, (sal_Int32) aHatch.Angle); + xmlTextWriterEndElement( xmlWriter ); +} + +void dumpFillBackgroundAsAttribute(sal_Bool bBackground, xmlTextWriterPtr xmlWriter) +{ + if(bBackground) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBackground"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBackground"), "%s", "false"); +} + +void dumpFillBitmapNameAsAttribute(rtl::OUString sBitmapName, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillGradientName"), "%s", + rtl::OUStringToOString(sBitmapName, RTL_TEXTENCODING_UTF8).getStr()); +} + +void dumpFillBitmapAsElement(uno::Reference<awt::XBitmap> xBitmap, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FillBitmap" )); + if (xBitmap.is()) + { + awt::Size const aSize = xBitmap->getSize(); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("width"), "%" SAL_PRIdINT32, aSize.Width); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("height"), "%" SAL_PRIdINT32, aSize.Height); + } + xmlTextWriterEndElement( xmlWriter ); +} + +void dumpFillBitmapURLAsAttribute(rtl::OUString sBitmapURL, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapURL"), "%s", + rtl::OUStringToOString(sBitmapURL, RTL_TEXTENCODING_UTF8).getStr()); +} + +void dumpFillBitmapPositionOffsetXAsAttribute(sal_Int32 aBitmapPositionOffsetX, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapPositionOffsetX"), "%" SAL_PRIdINT32, aBitmapPositionOffsetX); +} + +void dumpFillBitmapPositionOffsetYAsAttribute(sal_Int32 aBitmapPositionOffsetY, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapPositionOffsetY"), "%" SAL_PRIdINT32, aBitmapPositionOffsetY); +} + +void dumpFillBitmapOffsetXAsAttribute(sal_Int32 aBitmapOffsetX, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapOffsetX"), "%" SAL_PRIdINT32, aBitmapOffsetX); +} + +void dumpFillBitmapOffsetYAsAttribute(sal_Int32 aBitmapOffsetY, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapOffsetY"), "%" SAL_PRIdINT32, aBitmapOffsetY); +} + +void dumpFillBitmapRectanglePointAsAttribute(drawing::RectanglePoint eBitmapRectanglePoint, xmlTextWriterPtr xmlWriter) +{ + switch(eBitmapRectanglePoint) + { + case drawing::RectanglePoint_LEFT_TOP: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "LEFT_TOP"); + break; + case drawing::RectanglePoint_MIDDLE_TOP: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "MIDDLE_TOP"); + break; + case drawing::RectanglePoint_RIGHT_TOP: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "RIGHT_TOP"); + break; + case drawing::RectanglePoint_LEFT_MIDDLE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "LEFT_MIDDLE"); + break; + case drawing::RectanglePoint_MIDDLE_MIDDLE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "MIDDLE_MIDDLE"); + break; + case drawing::RectanglePoint_RIGHT_MIDDLE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "RIGHT_MIDDLE"); + break; + case drawing::RectanglePoint_LEFT_BOTTOM: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "LEFT_BOTTOM"); + break; + case drawing::RectanglePoint_MIDDLE_BOTTOM: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "MIDDLE_BOTTOM"); + break; + case drawing::RectanglePoint_RIGHT_BOTTOM: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "RIGHT_BOTTOM"); + break; + default: + break; + } +} + +void dumpFillBitmapLogicalSizeAsAttribute(sal_Bool bBitmapLogicalSize, xmlTextWriterPtr xmlWriter) +{ + if(bBitmapLogicalSize) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapLogicalSize"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapLogicalSize"), "%s", "false"); +} + +void dumpFillBitmapSizeXAsAttribute(sal_Int32 aBitmapSizeX, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapSizeX"), "%" SAL_PRIdINT32, aBitmapSizeX); +} + +void dumpFillBitmapSizeYAsAttribute(sal_Int32 aBitmapSizeY, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapSizeY"), "%" SAL_PRIdINT32, aBitmapSizeY); +} + +void dumpFillBitmapModeAsAttribute(drawing::BitmapMode eBitmapMode, xmlTextWriterPtr xmlWriter) +{ + switch(eBitmapMode) + { + case drawing::BitmapMode_REPEAT: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapMode"), "%s", "REPEAT"); + break; + case drawing::BitmapMode_STRETCH: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapMode"), "%s", "STRETCH"); + break; + case drawing::BitmapMode_NO_REPEAT: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapMode"), "%s", "NO_REPEAT"); + break; + default: + break; + } +} + +void dumpFillBitmapStretchAsAttribute(sal_Bool bBitmapStretch, xmlTextWriterPtr xmlWriter) +{ + if(bBitmapStretch) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapStretch"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapStretch"), "%s", "false"); +} + +void dumpFillBitmapTileAsAttribute(sal_Bool bBitmapTile, xmlTextWriterPtr xmlWriter) +{ + if(bBitmapTile) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapTile"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapTile"), "%s", "false"); +} + +// ---------------------------------------- +// ---------- LineProperties.idl ---------- +// ---------------------------------------- + +void dumpLineStyleAsAttribute(drawing::LineStyle eLineStyle, xmlTextWriterPtr xmlWriter) +{ + switch(eLineStyle) + { + case drawing::LineStyle_NONE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStyle"), "%s", "NONE"); + break; + case drawing::LineStyle_SOLID: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStyle"), "%s", "SOLID"); + break; + case drawing::LineStyle_DASH: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStyle"), "%s", "DASH"); + break; + default: + break; + } +} + +void dumpLineDashAsElement(drawing::LineDash aLineDash, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "LineDash" )); + switch(aLineDash.Style) + { + case drawing::DashStyle_RECT: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "RECT"); + break; + case drawing::DashStyle_ROUND: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "ROUND"); + break; + case drawing::DashStyle_RECTRELATIVE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "RECTRELATIVE"); + break; + case drawing::DashStyle_ROUNDRELATIVE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "ROUNDRELATIVE"); + break; + default: + break; + } + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dots"), "%" SAL_PRIdINT32, (sal_Int32) aLineDash.Dots); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dotLen"), "%" SAL_PRIdINT32, (sal_Int32) aLineDash.DotLen); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dashes"), "%" SAL_PRIdINT32, (sal_Int32) aLineDash.Dashes); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dashLen"), "%" SAL_PRIdINT32, (sal_Int32) aLineDash.DashLen); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("distance"), "%" SAL_PRIdINT32, (sal_Int32) aLineDash.Distance); + xmlTextWriterEndElement( xmlWriter ); +} + +void dumpLineDashNameAsAttribute(rtl::OUString sLineDashName, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineDashName"), "%s", + rtl::OUStringToOString(sLineDashName, RTL_TEXTENCODING_UTF8).getStr()); +} + +void dumpLineColorAsAttribute(sal_Int32 aLineColor, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineColor"), "%" SAL_PRIdINT32, aLineColor); +} + +void dumpLineTransparenceAsAttribute(sal_Int32 aLineTransparence, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineTransparence"), "%" SAL_PRIdINT32, aLineTransparence); +} + +void dumpLineWidthAsAttribute(sal_Int32 aLineWidth, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineWidth"), "%" SAL_PRIdINT32, aLineWidth); +} + +void dumpLineJointAsAttribute(drawing::LineJoint eLineJoint, xmlTextWriterPtr xmlWriter) +{ + switch(eLineJoint) + { + case drawing::LineJoint_NONE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineJoint"), "%s", "NONE"); + break; + case drawing::LineJoint_MIDDLE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineJoint"), "%s", "MIDDLE"); + break; + case drawing::LineJoint_BEVEL: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineJoint"), "%s", "BEVEL"); + break; + case drawing::LineJoint_MITER: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineJoint"), "%s", "MITER"); + break; + case drawing::LineJoint_ROUND: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineJoint"), "%s", "ROUND"); + break; + default: + break; + } +} + +void dumpLineStartNameAsAttribute(rtl::OUString sLineStartName, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineStartName"), "%s", + rtl::OUStringToOString(sLineStartName, RTL_TEXTENCODING_UTF8).getStr()); +} + +void dumpLineEndNameAsAttribute(rtl::OUString sLineEndName, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineEndName"), "%s", + rtl::OUStringToOString(sLineEndName, RTL_TEXTENCODING_UTF8).getStr()); +} + +void dumpPolyPolygonBezierCoords(drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords, xmlTextWriterPtr xmlWriter) +{ + dumpPointSequenceSequence(aPolyPolygonBezierCoords.Coordinates, &aPolyPolygonBezierCoords.Flags, xmlWriter); +} + +void dumpLineStartAsElement(drawing::PolyPolygonBezierCoords aLineStart, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "LineStart" )); + dumpPolyPolygonBezierCoords(aLineStart, xmlWriter); + xmlTextWriterEndElement( xmlWriter ); +} + +void dumpLineEndAsElement(drawing::PolyPolygonBezierCoords aLineEnd, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "LineEnd" )); + dumpPolyPolygonBezierCoords(aLineEnd, xmlWriter); + xmlTextWriterEndElement( xmlWriter ); +} + +void dumpLineStartCenterAsAttribute(sal_Bool bLineStartCenter, xmlTextWriterPtr xmlWriter) +{ + if(bLineStartCenter) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStartCenter"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStartCenter"), "%s", "false"); +} + +void dumpLineStartWidthAsAttribute(sal_Int32 aLineStartWidth, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineStartWidth"), "%" SAL_PRIdINT32, aLineStartWidth); +} + +void dumpLineEndCenterAsAttribute(sal_Bool bLineEndCenter, xmlTextWriterPtr xmlWriter) +{ + if(bLineEndCenter) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineEndCenter"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineEndCenter"), "%s", "false"); +} + +void dumpLineEndWidthAsAttribute(sal_Int32 aLineEndWidth, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineEndWidth"), "%" SAL_PRIdINT32, aLineEndWidth); +} + +// ----------------------------------------------- +// ---------- PolyPolygonDescriptor.idl ---------- +// ----------------------------------------------- + +void dumpPolygonKindAsAttribute(drawing::PolygonKind ePolygonKind, xmlTextWriterPtr xmlWriter) +{ + switch(ePolygonKind) + { + case drawing::PolygonKind_LINE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "LINE"); + break; + case drawing::PolygonKind_POLY: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "POLY"); + break; + case drawing::PolygonKind_PLIN: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PLIN"); + break; + case drawing::PolygonKind_PATHLINE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PATHLINE"); + break; + case drawing::PolygonKind_PATHFILL: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PATHFILL"); + break; + case drawing::PolygonKind_FREELINE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "FREELINE"); + break; + case drawing::PolygonKind_FREEFILL: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "FREEFILL"); + break; + case drawing::PolygonKind_PATHPOLY: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PATHPOLY"); + break; + case drawing::PolygonKind_PATHPLIN: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PATHPLIN"); + break; + default: + break; + } +} + +void dumpPointSequenceSequence(drawing::PointSequenceSequence aPointSequenceSequence, uno::Sequence<uno::Sequence< drawing::PolygonFlags > >* pFlags, xmlTextWriterPtr xmlWriter) +{ + // LibreOffice proudly presents - The Sequenception + uno::Sequence<uno::Sequence< awt::Point > > pointSequenceSequence = aPointSequenceSequence; + sal_Int32 nPointsSequence = pointSequenceSequence.getLength(); + + for (sal_Int32 i = 0; i < nPointsSequence; ++i) + { + uno::Sequence< awt::Point > pointSequence = pointSequenceSequence[i]; + sal_Int32 nPoints = pointSequence.getLength(); + + uno::Sequence< drawing::PolygonFlags> flagsSequence; + if(pFlags) + flagsSequence = (*pFlags)[i]; + + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "pointSequence" )); + + for(sal_Int32 j = 0; j < nPoints; ++j) + { + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "point" )); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, pointSequence[j].X); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionY"), "%" SAL_PRIdINT32, pointSequence[j].Y); + + if(pFlags) + { + switch(flagsSequence[j]) + { + case drawing::PolygonFlags_NORMAL: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonFlags"), "%s", "NORMAL"); + break; + case drawing::PolygonFlags_SMOOTH: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonFlags"), "%s", "SMOOTH"); + break; + case drawing::PolygonFlags_CONTROL: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonFlags"), "%s", "CONTROL"); + break; + case drawing::PolygonFlags_SYMMETRIC: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonFlags"), "%s", "SYMMETRIC"); + break; + default: + break; + } + } + + xmlTextWriterEndElement( xmlWriter ); + } + xmlTextWriterEndElement( xmlWriter ); + } +} + +void dumpPolyPolygonAsElement(drawing::PointSequenceSequence aPolyPolygon, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PolyPolygon" )); + dumpPointSequenceSequence(aPolyPolygon, NULL, xmlWriter); + xmlTextWriterEndElement( xmlWriter ); +} + +void dumpGeometryAsElement(drawing::PointSequenceSequence aGeometry, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Geometry" )); + dumpPointSequenceSequence(aGeometry, NULL, xmlWriter); + xmlTextWriterEndElement( xmlWriter ); +} + +// ---------------------------------------- +// ---------- TextProperties.idl ---------- +// ---------------------------------------- + +void dumpIsNumberingAsAttribute(sal_Bool bIsNumbering, xmlTextWriterPtr xmlWriter) +{ + if(bIsNumbering) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("isNumbering"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("isNumbering"), "%s", "false"); +} + +void dumpTextAutoGrowHeightAsAttribute(sal_Bool bTextAutoGrowHeight, xmlTextWriterPtr xmlWriter) +{ + if(bTextAutoGrowHeight) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowHeight"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowHeight"), "%s", "false"); +} + +void dumpTextAutoGrowWidthAsAttribute(sal_Bool bTextAutoGrowWidth, xmlTextWriterPtr xmlWriter) +{ + if(bTextAutoGrowWidth) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowWidth"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowWidth"), "%s", "false"); +} + +void dumpTextContourFrameAsAttribute(sal_Bool bTextContourFrame, xmlTextWriterPtr xmlWriter) +{ + if(bTextContourFrame) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textContourFrame"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textContourFrame"), "%s", "false"); +} + +void dumpTextFitToSizeAsAttribute(drawing::TextFitToSizeType eTextFitToSize, xmlTextWriterPtr xmlWriter) +{ + switch(eTextFitToSize) + { + case drawing::TextFitToSizeType_NONE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textFitToSize"), "%s", "NONE"); + break; + case drawing::TextFitToSizeType_PROPORTIONAL: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textFitToSize"), "%s", "PROPORTIONAL"); + break; + case drawing::TextFitToSizeType_ALLLINES: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textFitToSize"), "%s", "ALLLINES"); + break; + case drawing::TextFitToSizeType_AUTOFIT: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textFitToSize"), "%s", "AUTOFIT"); + break; + default: + break; + } +} + +void dumpTextHorizontalAdjustAsAttribute(drawing::TextHorizontalAdjust eTextHorizontalAdjust, xmlTextWriterPtr xmlWriter) +{ + switch(eTextHorizontalAdjust) + { + case drawing::TextHorizontalAdjust_LEFT: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textHorizontalAdjust"), "%s", "LEFT"); + break; + case drawing::TextHorizontalAdjust_CENTER: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textHorizontalAdjust"), "%s", "CENTER"); + break; + case drawing::TextHorizontalAdjust_RIGHT: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textHorizontalAdjust"), "%s", "RIGHT"); + break; + case drawing::TextHorizontalAdjust_BLOCK: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textHorizontalAdjust"), "%s", "BLOCK"); + break; + default: + break; + } +} + +void dumpTextVerticalAdjustAsAttribute(drawing::TextVerticalAdjust eTextVerticalAdjust, xmlTextWriterPtr xmlWriter) +{ + switch(eTextVerticalAdjust) + { + case drawing::TextVerticalAdjust_TOP: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textVerticalAdjust"), "%s", "TOP"); + break; + case drawing::TextVerticalAdjust_CENTER: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textVerticalAdjust"), "%s", "CENTER"); + break; + case drawing::TextVerticalAdjust_BOTTOM: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textVerticalAdjust"), "%s", "BOTTOM"); + break; + case drawing::TextVerticalAdjust_BLOCK: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textVerticalAdjust"), "%s", "BLOCK"); + break; + default: + break; + } +} + +void dumpTextLeftDistanceAsAttribute(sal_Int32 aTextLeftDistance, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textLeftDistance"), "%" SAL_PRIdINT32, aTextLeftDistance); +} + +void dumpTextRightDistanceAsAttribute(sal_Int32 aTextRightDistance, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textRightDistance"), "%" SAL_PRIdINT32, aTextRightDistance); +} + +void dumpTextUpperDistanceAsAttribute(sal_Int32 aTextUpperDistance, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textUpperDistance"), "%" SAL_PRIdINT32, aTextUpperDistance); +} + +void dumpTextLowerDistanceAsAttribute(sal_Int32 aTextLowerDistance, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textLowerDistance"), "%" SAL_PRIdINT32, aTextLowerDistance); +} + +void dumpTextMaximumFrameHeightAsAttribute(sal_Int32 aTextMaximumFrameHeight, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMaximumFrameHeight"), "%" SAL_PRIdINT32, aTextMaximumFrameHeight); +} + +void dumpTextMaximumFrameWidthAsAttribute(sal_Int32 aTextMaximumFrameWidth, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMaximumFrameWidth"), "%" SAL_PRIdINT32, aTextMaximumFrameWidth); +} + +void dumpTextMinimumFrameHeightAsAttribute(sal_Int32 aTextMinimumFrameHeight, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMinimumFrameHeight"), "%" SAL_PRIdINT32, aTextMinimumFrameHeight); +} + +void dumpTextMinimumFrameWidthAsAttribute(sal_Int32 aTextMinimumFrameWidth, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMinimumFrameWidth"), "%" SAL_PRIdINT32, aTextMinimumFrameWidth); +} + +void dumpTextAnimationAmountAsAttribute(sal_Int32 aTextAnimationAmount, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textAnimationAmount"), "%" SAL_PRIdINT32, aTextAnimationAmount); +} + +void dumpTextAnimationCountAsAttribute(sal_Int32 aTextAnimationCount, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textAnimationCount"), "%" SAL_PRIdINT32, aTextAnimationCount); +} + +void dumpTextAnimationDelayAsAttribute(sal_Int32 aTextAnimationDelay, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textAnimationDelay"), "%" SAL_PRIdINT32, aTextAnimationDelay); +} + +void dumpTextAnimationDirectionAsAttribute(drawing::TextAnimationDirection eTextAnimationDirection, xmlTextWriterPtr xmlWriter) +{ + switch(eTextAnimationDirection) + { + case drawing::TextAnimationDirection_LEFT: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationDirection"), "%s", "LEFT"); + break; + case drawing::TextAnimationDirection_RIGHT: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationDirection"), "%s", "RIGHT"); + break; + case drawing::TextAnimationDirection_UP: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationDirection"), "%s", "UP"); + break; + case drawing::TextAnimationDirection_DOWN: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationDirection"), "%s", "DOWN"); + break; + default: + break; + } +} + +void dumpTextAnimationKindAsAttribute(drawing::TextAnimationKind eTextAnimationKind, xmlTextWriterPtr xmlWriter) +{ + switch(eTextAnimationKind) + { + case drawing::TextAnimationKind_NONE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "NONE"); + break; + case drawing::TextAnimationKind_BLINK: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "BLINK"); + break; + case drawing::TextAnimationKind_SCROLL: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "SCROLL"); + break; + case drawing::TextAnimationKind_ALTERNATE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "ALTERNATE"); + break; + case drawing::TextAnimationKind_SLIDE: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "SLIDE"); + break; + default: + break; + } +} + +void dumpTextAnimationStartInsideAsAttribute(sal_Bool bTextAnimationStartInside, xmlTextWriterPtr xmlWriter) +{ + if(bTextAnimationStartInside) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStartInside"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStartInside"), "%s", "false"); +} + +void dumpTextAnimationStopInsideAsAttribute(sal_Bool bTextAnimationStopInside, xmlTextWriterPtr xmlWriter) +{ + if(bTextAnimationStopInside) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStopInside"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStopInside"), "%s", "false"); +} + +void dumpTextWritingModeAsAttribute(text::WritingMode eTextWritingMode, xmlTextWriterPtr xmlWriter) +{ + switch(eTextWritingMode) + { + case text::WritingMode_LR_TB: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textWritingMode"), "%s", "LR_TB"); + break; + case text::WritingMode_RL_TB: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textWritingMode"), "%s", "RL_TB"); + break; + case text::WritingMode_TB_RL: + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textWritingMode"), "%s", "TB_RL"); + break; + default: + break; + } +} + +// ------------------------------------------ +// ---------- ShadowProperties.idl ---------- +// ------------------------------------------ + +void dumpShadowAsAttribute(sal_Bool bShadow, xmlTextWriterPtr xmlWriter) +{ + if(bShadow) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadow"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadow"), "%s", "false"); +} + +void dumpShadowColorAsAttribute(sal_Int32 aShadowColor, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowColor"), "%" SAL_PRIdINT32, aShadowColor); +} + +void dumpShadowTransparenceAsAttribute(sal_Int32 aShadowTransparence, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowTransparence"), "%" SAL_PRIdINT32, aShadowTransparence); +} + +void dumpShadowXDistanceAsAttribute(sal_Int32 aShadowXDistance, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowXDistance"), "%" SAL_PRIdINT32, aShadowXDistance); +} + +void dumpShadowYDistanceAsAttribute(sal_Int32 aShadowYDistance, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowYDistance"), "%" SAL_PRIdINT32, aShadowYDistance); +} + +// ------------------------------- +// ---------- Shape.idl ---------- +// ------------------------------- + +void dumpZOrderAsAttribute(sal_Int32 aZOrder, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("zOrder"), "%" SAL_PRIdINT32, aZOrder); +} + +void dumpLayerIDAsAttribute(sal_Int32 aLayerID, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("layerID"), "%" SAL_PRIdINT32, aLayerID); +} + +void dumpLayerNameAsAttribute(rtl::OUString sLayerName, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("layerName"), "%s", + rtl::OUStringToOString(sLayerName, RTL_TEXTENCODING_UTF8).getStr()); +} + +void dumpVisibleAsAttribute(sal_Bool bVisible, xmlTextWriterPtr xmlWriter) +{ + if(bVisible) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("visible"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("visible"), "%s", "false"); +} + +void dumpPrintableAsAttribute(sal_Bool bPrintable, xmlTextWriterPtr xmlWriter) +{ + if(bPrintable) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("printable"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("printable"), "%s", "false"); +} + +void dumpMoveProtectAsAttribute(sal_Bool bMoveProtect, xmlTextWriterPtr xmlWriter) +{ + if(bMoveProtect) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("moveProtect"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("moveProtect"), "%s", "false"); +} + +void dumpNameAsAttribute(rtl::OUString sName, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s", + rtl::OUStringToOString(sName, RTL_TEXTENCODING_UTF8).getStr()); +} + +void dumpSizeProtectAsAttribute(sal_Bool bSizeProtect, xmlTextWriterPtr xmlWriter) +{ + if(bSizeProtect) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("sizeProtect"), "%s", "true"); + else + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("sizeProtect"), "%s", "false"); +} + +void dumpHomogenMatrixLine3(drawing::HomogenMatrixLine3 aHomogenMatrixLine3, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("column1"), "%f", aHomogenMatrixLine3.Column1); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("column2"), "%f", aHomogenMatrixLine3.Column2); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("column3"), "%f", aHomogenMatrixLine3.Column3); +} + +void dumpTransformationAsElement(drawing::HomogenMatrix3 aTransformation, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Transformation" )); + { + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Line1" )); + dumpHomogenMatrixLine3(aTransformation.Line1, xmlWriter); + xmlTextWriterEndElement( xmlWriter ); + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Line2" )); + dumpHomogenMatrixLine3(aTransformation.Line2, xmlWriter); + xmlTextWriterEndElement( xmlWriter ); + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Line3" )); + dumpHomogenMatrixLine3(aTransformation.Line3, xmlWriter); + xmlTextWriterEndElement( xmlWriter ); + } + xmlTextWriterEndElement( xmlWriter ); +} + +void dumpNavigationOrderAsAttribute(sal_Int32 aNavigationOrder, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("navigationOrder"), "%" SAL_PRIdINT32, aNavigationOrder); +} + +void dumpHyperlinkAsAttribute(rtl::OUString sHyperlink, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("hyperlink"), "%s", + rtl::OUStringToOString(sHyperlink, RTL_TEXTENCODING_UTF8).getStr()); +} + +// -------------------------------- +// ---------- XShape.idl ---------- +// -------------------------------- + +void dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionY"), "%" SAL_PRIdINT32, rPoint.Y); +} + +void dumpSizeAsAttribute(const awt::Size& rSize, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("sizeX"), "%" SAL_PRIdINT32, rSize.Width); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("sizeY"), "%" SAL_PRIdINT32, rSize.Height); +} + +void dumpShapeDescriptorAsAttribute( uno::Reference< drawing::XShapeDescriptor > xDescr, xmlTextWriterPtr xmlWriter ) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("type"), "%s", + rtl::OUStringToOString(xDescr->getShapeType(), RTL_TEXTENCODING_UTF8).getStr()); +} + +// ----------------------------------------------------- +// ---------- PolyPolygonBezierDescriptor.idl ---------- +// ----------------------------------------------------- + +void dumpPolyPolygonBezierAsElement(drawing::PolyPolygonBezierCoords aPolyPolygonBezier, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PolyPolygonBezier" )); + dumpPolyPolygonBezierCoords(aPolyPolygonBezier, xmlWriter); + xmlTextWriterEndElement( xmlWriter ); +} + +void dumpGeometryAsElement(drawing::PolyPolygonBezierCoords aGeometry, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Geometry" )); + dumpPolyPolygonBezierCoords(aGeometry, xmlWriter); + xmlTextWriterEndElement( xmlWriter ); +} + +// ------------------------------------- +// ---------- CustomShape.idl ---------- +// ------------------------------------- + +void dumpCustomShapeEngineAsAttribute(rtl::OUString sCustomShapeEngine, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeEngine"), "%s", + rtl::OUStringToOString(sCustomShapeEngine, RTL_TEXTENCODING_UTF8).getStr()); +} + +void dumpCustomShapeDataAsAttribute(rtl::OUString sCustomShapeData, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeData"), "%s", + rtl::OUStringToOString(sCustomShapeData, RTL_TEXTENCODING_UTF8).getStr()); +} + +void 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(sValue, 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 ); +} + +void dumpCustomShapeReplacementURLAsAttribute(rtl::OUString sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeReplacementURL"), "%s", + rtl::OUStringToOString(sCustomShapeReplacementURL, RTL_TEXTENCODING_UTF8).getStr()); +} + +// methods dumping whole services + +void dumpTextPropertiesService(uno::Reference< beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter) +{ + uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo(); + if(xInfo->hasPropertyByName("IsNumbering")) + { + uno::Any anotherAny = xPropSet->getPropertyValue("IsNumbering"); + sal_Bool bIsNumbering; + if(anotherAny >>= bIsNumbering) + dumpIsNumberingAsAttribute(bIsNumbering, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextAutoGrowHeight"); + sal_Bool bTextAutoGrowHeight; + if(anotherAny >>= bTextAutoGrowHeight) + dumpTextAutoGrowHeightAsAttribute(bTextAutoGrowHeight, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextAutoGrowWidth"); + sal_Bool bTextAutoGrowWidth; + if(anotherAny >>= bTextAutoGrowWidth) + dumpTextAutoGrowWidthAsAttribute(bTextAutoGrowWidth, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextContourFrame"); + sal_Bool bTextContourFrame; + if(anotherAny >>= bTextContourFrame) + dumpTextContourFrameAsAttribute(bTextContourFrame, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextFitToSize"); + drawing::TextFitToSizeType eTextFitToSize; + if(anotherAny >>= eTextFitToSize) + dumpTextFitToSizeAsAttribute(eTextFitToSize, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextHorizontalAdjust"); + drawing::TextHorizontalAdjust eTextHorizontalAdjust; + if(anotherAny >>= eTextHorizontalAdjust) + dumpTextHorizontalAdjustAsAttribute(eTextHorizontalAdjust, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextVerticalAdjust"); + drawing::TextVerticalAdjust eTextVerticalAdjust; + if(anotherAny >>= eTextVerticalAdjust) + dumpTextVerticalAdjustAsAttribute(eTextVerticalAdjust, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextLeftDistance"); + sal_Int32 aTextLeftDistance; + if(anotherAny >>= aTextLeftDistance) + dumpTextLeftDistanceAsAttribute(aTextLeftDistance, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextRightDistance"); + sal_Int32 aTextRightDistance; + if(anotherAny >>= aTextRightDistance) + dumpTextRightDistanceAsAttribute(aTextRightDistance, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextUpperDistance"); + sal_Int32 aTextUpperDistance; + if(anotherAny >>= aTextUpperDistance) + dumpTextUpperDistanceAsAttribute(aTextUpperDistance, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextLowerDistance"); + sal_Int32 aTextLowerDistance; + if(anotherAny >>= aTextLowerDistance) + dumpTextLowerDistanceAsAttribute(aTextLowerDistance, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextMaximumFrameHeight"); + sal_Int32 aTextMaximumFrameHeight; + if(anotherAny >>= aTextMaximumFrameHeight) + dumpTextMaximumFrameHeightAsAttribute(aTextMaximumFrameHeight, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextMaximumFrameWidth"); + sal_Int32 aTextMaximumFrameWidth; + if(anotherAny >>= aTextMaximumFrameWidth) + dumpTextMaximumFrameWidthAsAttribute(aTextMaximumFrameWidth, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextMinimumFrameHeight"); + sal_Int32 aTextMinimumFrameHeight; + if(anotherAny >>= aTextMinimumFrameHeight) + dumpTextMinimumFrameHeightAsAttribute(aTextMinimumFrameHeight, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextMinimumFrameWidth"); + sal_Int32 aTextMinimumFrameWidth; + if(anotherAny >>= aTextMinimumFrameWidth) + dumpTextMinimumFrameWidthAsAttribute(aTextMinimumFrameWidth, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationAmount"); + sal_Int32 aTextAnimationAmount; + if(anotherAny >>= aTextAnimationAmount) + dumpTextAnimationAmountAsAttribute(aTextAnimationAmount, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationCount"); + sal_Int32 aTextAnimationCount; + if(anotherAny >>= aTextAnimationCount) + dumpTextAnimationCountAsAttribute(aTextAnimationCount, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationDelay"); + sal_Int32 aTextAnimationDelay; + if(anotherAny >>= aTextAnimationDelay) + dumpTextAnimationDelayAsAttribute(aTextAnimationDelay, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationDirection"); + drawing::TextAnimationDirection eTextAnimationDirection; + if(anotherAny >>= eTextAnimationDirection) + dumpTextAnimationDirectionAsAttribute(eTextAnimationDirection, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationKind"); + drawing::TextAnimationKind eTextAnimationKind; + if(anotherAny >>= eTextAnimationKind) + dumpTextAnimationKindAsAttribute(eTextAnimationKind, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationStartInside"); + sal_Bool bTextAnimationStartInside; + if(anotherAny >>= bTextAnimationStartInside) + dumpTextAnimationStartInsideAsAttribute(bTextAnimationStartInside, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationStopInside"); + sal_Bool bTextAnimationStopInside; + if(anotherAny >>= bTextAnimationStopInside) + dumpTextAnimationStopInsideAsAttribute(bTextAnimationStopInside, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("TextWritingMode"); + text::WritingMode eTextWritingMode; + if(anotherAny >>= eTextWritingMode) + dumpTextWritingModeAsAttribute(eTextWritingMode, xmlWriter); + } +} + +void dumpFillPropertiesService(uno::Reference< beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter) +{ + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillStyle"); + drawing::FillStyle eFillStyle; + if(anotherAny >>= eFillStyle) + dumpFillStyleAsAttribute(eFillStyle, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillColor"); + sal_Int32 aColor; + if(anotherAny >>= aColor) + dumpFillColorAsAttribute(aColor, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillTransparence"); + sal_Int32 aTransparence; + if(anotherAny >>= aTransparence) + dumpFillTransparenceAsAttribute(aTransparence, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillTransparenceGradientName"); + rtl::OUString sTranspGradName; + if(anotherAny >>= sTranspGradName) + dumpFillTransparenceGradientNameAsAttribute(sTranspGradName, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillTransparenceGradient"); + awt::Gradient aTranspGrad; + if(anotherAny >>= aTranspGrad) + dumpFillTransparenceGradientAsElement(aTranspGrad, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillGradientName"); + rtl::OUString sGradName; + if(anotherAny >>= sGradName) + dumpFillGradientNameAsAttribute(sGradName, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillGradient"); + awt::Gradient aGradient; + if(anotherAny >>= aGradient) + dumpFillGradientAsElement(aGradient, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillHatchName"); + rtl::OUString sHatchName; + if(anotherAny >>= sHatchName) + dumpFillGradientNameAsAttribute(sHatchName, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillHatch"); + drawing::Hatch aHatch; + if(anotherAny >>= aHatch) + dumpFillHatchAsElement(aHatch, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillBackground"); + sal_Bool bFillBackground; + if(anotherAny >>= bFillBackground) + dumpFillBackgroundAsAttribute(bFillBackground, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapName"); + rtl::OUString sBitmapName; + if(anotherAny >>= sBitmapName) + dumpFillGradientNameAsAttribute(sBitmapName, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmap"); + uno::Reference<awt::XBitmap> xBitmap; + if(anotherAny >>= xBitmap) + dumpFillBitmapAsElement(xBitmap, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapURL"); + rtl::OUString sBitmapURL; + if(anotherAny >>= sBitmapURL) + dumpFillBitmapURLAsAttribute(sBitmapURL, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapPositionOffsetX"); + sal_Int32 aBitmapPositionOffsetX; + if(anotherAny >>= aBitmapPositionOffsetX) + dumpFillBitmapPositionOffsetXAsAttribute(aBitmapPositionOffsetX, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapPositionOffsetY"); + sal_Int32 aBitmapPositionOffsetY; + if(anotherAny >>= aBitmapPositionOffsetY) + dumpFillBitmapPositionOffsetYAsAttribute(aBitmapPositionOffsetY, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapOffsetX"); + sal_Int32 aBitmapOffsetX; + if(anotherAny >>= aBitmapOffsetX) + dumpFillBitmapOffsetXAsAttribute(aBitmapOffsetX, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapOffsetY"); + sal_Int32 aBitmapOffsetY; + if(anotherAny >>= aBitmapOffsetY) + dumpFillBitmapOffsetYAsAttribute(aBitmapOffsetY, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapRectanglePoint"); + drawing::RectanglePoint eBitmapRectanglePoint; + if(anotherAny >>= eBitmapRectanglePoint) + dumpFillBitmapRectanglePointAsAttribute(eBitmapRectanglePoint, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapLogicalSize"); + sal_Bool bBitmapLogicalSize; + if(anotherAny >>= bBitmapLogicalSize) + dumpFillBitmapLogicalSizeAsAttribute(bBitmapLogicalSize, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapSizeX"); + sal_Int32 aBitmapSizeX; + if(anotherAny >>= aBitmapSizeX) + dumpFillBitmapSizeXAsAttribute(aBitmapSizeX, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapSizeY"); + sal_Int32 aBitmapSizeY; + if(anotherAny >>= aBitmapSizeY) + dumpFillBitmapSizeYAsAttribute(aBitmapSizeY, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapMode"); + drawing::BitmapMode eBitmapMode; + if(anotherAny >>= eBitmapMode) + dumpFillBitmapModeAsAttribute(eBitmapMode, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapStretch"); + sal_Bool bBitmapStretch; + if(anotherAny >>= bBitmapStretch) + dumpFillBitmapStretchAsAttribute(bBitmapStretch, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapTile"); + sal_Bool bBitmapTile; + if(anotherAny >>= bBitmapTile) + dumpFillBitmapTileAsAttribute(bBitmapTile, xmlWriter); + } +} + +void dumpLinePropertiesService(uno::Reference< beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter) +{ + { + uno::Any anotherAny = xPropSet->getPropertyValue("LineStyle"); + drawing::LineStyle eLineStyle; + if(anotherAny >>= eLineStyle) + dumpLineStyleAsAttribute(eLineStyle, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LineDash"); + drawing::LineDash aLineDash; + if(anotherAny >>= aLineDash) + dumpLineDashAsElement(aLineDash, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LineDashName"); + rtl::OUString sLineDashName; + if(anotherAny >>= sLineDashName) + dumpLineDashNameAsAttribute(sLineDashName, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LineColor"); + sal_Int32 aLineColor; + if(anotherAny >>= aLineColor) + dumpLineColorAsAttribute(aLineColor, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LineTransparence"); + sal_Int32 aLineTransparence; + if(anotherAny >>= aLineTransparence) + dumpLineTransparenceAsAttribute(aLineTransparence, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LineWidth"); + sal_Int32 aLineWidth; + if(anotherAny >>= aLineWidth) + dumpLineWidthAsAttribute(aLineWidth, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LineJoint"); + drawing::LineJoint eLineJoint; + if(anotherAny >>= eLineJoint) + dumpLineJointAsAttribute(eLineJoint, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LineStartName"); + rtl::OUString sLineStartName; + if(anotherAny >>= sLineStartName) + dumpLineStartNameAsAttribute(sLineStartName, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LineEndName"); + rtl::OUString sLineEndName; + if(anotherAny >>= sLineEndName) + dumpLineEndNameAsAttribute(sLineEndName, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LineStart"); + drawing::PolyPolygonBezierCoords aLineStart; + if(anotherAny >>= aLineStart) + dumpLineStartAsElement(aLineStart, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LineEnd"); + drawing::PolyPolygonBezierCoords aLineEnd; + if(anotherAny >>= aLineEnd) + dumpLineEndAsElement(aLineEnd, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LineStartCenter"); + sal_Bool bLineStartCenter; + if(anotherAny >>= bLineStartCenter) + dumpLineStartCenterAsAttribute(bLineStartCenter, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LineStartWidth"); + sal_Int32 aLineStartWidth; + if(anotherAny >>= aLineStartWidth) + dumpLineStartWidthAsAttribute(aLineStartWidth, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LineEndCenter"); + sal_Bool bLineEndCenter; + if(anotherAny >>= bLineEndCenter) + dumpLineEndCenterAsAttribute(bLineEndCenter, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LineEndWidth"); + sal_Int32 aLineEndWidth; + if(anotherAny >>= aLineEndWidth) + dumpLineEndWidthAsAttribute(aLineEndWidth, xmlWriter); + } +} + +void dumpShadowPropertiesService(uno::Reference< beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter) +{ + { + uno::Any anotherAny = xPropSet->getPropertyValue("Shadow"); + sal_Bool bShadow; + if(anotherAny >>= bShadow) + dumpShadowAsAttribute(bShadow, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("ShadowColor"); + sal_Int32 aShadowColor; + if(anotherAny >>= aShadowColor) + dumpShadowColorAsAttribute(aShadowColor, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("ShadowTransparence"); + sal_Int32 aShadowTransparence; + if(anotherAny >>= aShadowTransparence) + dumpShadowTransparenceAsAttribute(aShadowTransparence, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("ShadowXDistance"); + sal_Int32 aShadowXDistance; + if(anotherAny >>= aShadowXDistance) + dumpShadowXDistanceAsAttribute(aShadowXDistance, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("ShadowYDistance"); + sal_Int32 aShadowYDistance; + if(anotherAny >>= aShadowYDistance) + dumpShadowYDistanceAsAttribute(aShadowYDistance, xmlWriter); + } +} + +void dumpPolyPolygonDescriptorService(uno::Reference< beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter) +{ + { + uno::Any anotherAny = xPropSet->getPropertyValue("PolygonKind"); + drawing::PolygonKind ePolygonKind; + if(anotherAny >>= ePolygonKind) + dumpPolygonKindAsAttribute(ePolygonKind, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("PolyPolygon"); + drawing::PointSequenceSequence aPolyPolygon; + if(anotherAny >>= aPolyPolygon) + dumpPolyPolygonAsElement(aPolyPolygon, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Geometry"); + drawing::PointSequenceSequence aGeometry; + if(anotherAny >>= aGeometry) + dumpGeometryAsElement(aGeometry, xmlWriter); + } +} + +void dumpShapeService(uno::Reference< beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter) +{ + uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo(); + { + uno::Any anotherAny = xPropSet->getPropertyValue("ZOrder"); + sal_Int32 aZOrder; + if(anotherAny >>= aZOrder) + dumpZOrderAsAttribute(aZOrder, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LayerID"); + sal_Int32 aLayerID; + if(anotherAny >>= aLayerID) + dumpLayerIDAsAttribute(aLayerID, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("LayerName"); + rtl::OUString sLayerName; + if(anotherAny >>= sLayerName) + dumpLayerNameAsAttribute(sLayerName, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Visible"); + sal_Bool bVisible; + if(anotherAny >>= bVisible) + dumpVisibleAsAttribute(bVisible, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Printable"); + sal_Bool bPrintable; + if(anotherAny >>= bPrintable) + dumpPrintableAsAttribute(bPrintable, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("MoveProtect"); + sal_Bool bMoveProtect; + if(anotherAny >>= bMoveProtect) + dumpMoveProtectAsAttribute(bMoveProtect, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Name"); + rtl::OUString sName; + if(anotherAny >>= sName) + dumpNameAsAttribute(sName, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("SizeProtect"); + sal_Bool bSizeProtect; + if(anotherAny >>= bSizeProtect) + dumpSizeProtectAsAttribute(bSizeProtect, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Transformation"); + drawing::HomogenMatrix3 aTransformation; + if(anotherAny >>= aTransformation) + dumpTransformationAsElement(aTransformation, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("NavigationOrder"); + sal_Int32 aNavigationOrder; + if(anotherAny >>= aNavigationOrder) + dumpNavigationOrderAsAttribute(aNavigationOrder, xmlWriter); + } + if(xInfo->hasPropertyByName("Hyperlink")) + { + uno::Any anotherAny = xPropSet->getPropertyValue("Hyperlink"); + rtl::OUString sHyperlink; + if(anotherAny >>= sHyperlink) + dumpHyperlinkAsAttribute(sHyperlink, xmlWriter); + } +} + +void dumpPolyPolygonBezierDescriptorService(uno::Reference< beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter) +{ + { + uno::Any anotherAny = xPropSet->getPropertyValue("PolygonKind"); + drawing::PolygonKind ePolygonKind; + if(anotherAny >>= ePolygonKind) + dumpPolygonKindAsAttribute(ePolygonKind, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("PolyPolygonBezier"); + drawing::PolyPolygonBezierCoords aPolyPolygonBezier; + if(anotherAny >>= aPolyPolygonBezier) + dumpPolyPolygonBezierCoords(aPolyPolygonBezier, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("Geometry"); + drawing::PolyPolygonBezierCoords aGeometry; + if(anotherAny >>= aGeometry) + dumpPolyPolygonBezierCoords(aGeometry, xmlWriter); + } +} + +void dumpCustomShapeService(uno::Reference< beans::XPropertySet > xPropSet, xmlTextWriterPtr xmlWriter) +{ + uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo(); + { + uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeEngine"); + rtl::OUString sCustomShapeEngine; + if(anotherAny >>= sCustomShapeEngine) + dumpCustomShapeEngineAsAttribute(sCustomShapeEngine, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeData"); + rtl::OUString sCustomShapeData; + if(anotherAny >>= sCustomShapeData) + dumpCustomShapeDataAsAttribute(sCustomShapeData, xmlWriter); + } + { + uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeGeometry"); + uno::Sequence< beans::PropertyValue> aCustomShapeGeometry; + if(anotherAny >>= aCustomShapeGeometry) + dumpCustomShapeGeometryAsElement(aCustomShapeGeometry, xmlWriter); + } + if(xInfo->hasPropertyByName("CustomShapeReplacementURL")) + { + uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeReplacementURL"); + rtl::OUString sCustomShapeReplacementURL; + if(anotherAny >>= sCustomShapeReplacementURL) + dumpCustomShapeReplacementURLAsAttribute(sCustomShapeReplacementURL, xmlWriter); + } +} + +void dumpXShape(uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlWriter) +{ + xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShape" ) ); + uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySetInfo> xPropSetInfo = xPropSet->getPropertySetInfo(); + rtl::OUString aName; + + dumpPositionAsAttribute(xShape->getPosition(), xmlWriter); + dumpSizeAsAttribute(xShape->getSize(), xmlWriter); + uno::Reference< drawing::XShapeDescriptor > xDescr(xShape, uno::UNO_QUERY_THROW); + dumpShapeDescriptorAsAttribute(xDescr, xmlWriter); + + // uno::Sequence<beans::Property> aProperties = xPropSetInfo->getProperties(); + + uno::Reference< lang::XServiceInfo > xServiceInfo( xShape, uno::UNO_QUERY_THROW ); + uno::Sequence< rtl::OUString > aServiceNames = xServiceInfo->getSupportedServiceNames(); + + uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo(); + if(xInfo->hasPropertyByName("Name")) + { + uno::Any aAny = xPropSet->getPropertyValue("Name"); + if (aAny >>= aName) + { + if (!aName.isEmpty()) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("name"), "%s", rtl::OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr()); + } + } + + try + { + if (xServiceInfo->supportsService("com.sun.star.drawing.Text")) + { + uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY_THROW); + rtl::OUString aText = xText->getString(); + if(!aText.isEmpty()) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("text"), "%s", rtl::OUStringToOString(aText, RTL_TEXTENCODING_UTF8).getStr()); + } + if(xServiceInfo->supportsService("com.sun.star.drawing.TextProperties")) + dumpTextPropertiesService(xPropSet, xmlWriter); + + if(xServiceInfo->supportsService("com.sun.star.drawing.GroupShape")) + { + uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY_THROW); + dumpXShapes(xShapes, xmlWriter); + } + if(xServiceInfo->supportsService("com.sun.star.drawing.FillProperties")) + dumpFillPropertiesService(xPropSet, xmlWriter); + + if(xServiceInfo->supportsService("com.sun.star.drawing.LineProperties")) + dumpLinePropertiesService(xPropSet, xmlWriter); + + if(xServiceInfo->supportsService("com.sun.star.drawing.PolyPolygonDescriptor")) + dumpPolyPolygonDescriptorService(xPropSet, xmlWriter); + + if(xServiceInfo->supportsService("com.sun.star.drawing.ShadowProperties")) + dumpShadowPropertiesService(xPropSet, xmlWriter); + + if(xServiceInfo->supportsService("com.sun.star.drawing.Shape")) + dumpShapeService(xPropSet, xmlWriter); + + if(xServiceInfo->supportsService("com.sun.star.drawing.PolyPolygonBezierDescriptor")) + dumpPolyPolygonBezierDescriptorService(xPropSet, xmlWriter); + + if(xServiceInfo->supportsService("com.sun.star.drawing.CustomShape")) + dumpCustomShapeService(xPropSet, xmlWriter); + + // EnhancedShapeDumper used + + if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeExtrusion")) + { + EnhancedShapeDumper enhancedDumper(xmlWriter); + enhancedDumper.dumpEnhancedCustomShapeExtrusionService(xPropSet); + } + if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeGeometry")) + { + EnhancedShapeDumper enhancedDumper(xmlWriter); + enhancedDumper.dumpEnhancedCustomShapeGeometryService(xPropSet); + } + if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeHandle")) + { + EnhancedShapeDumper enhancedDumper(xmlWriter); + enhancedDumper.dumpEnhancedCustomShapeHandleService(xPropSet); + } + if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapePath")) + { + EnhancedShapeDumper enhancedDumper(xmlWriter); + enhancedDumper.dumpEnhancedCustomShapePathService(xPropSet); + } + if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeTextPath")) + { + EnhancedShapeDumper enhancedDumper(xmlWriter); + enhancedDumper.dumpEnhancedCustomShapeTextPathService(xPropSet); + } + } // end of the 'try' block + catch (com::sun::star::beans::UnknownPropertyException &e) + { + printf("Problem in the XShapeDumper"); + } + + #if DEBUG_DUMPER + sal_Int32 nServices = aServiceNames.getLength(); + for (sal_Int32 i = 0; i < nServices; ++i) + { + xmlTextWriterStartElement(xmlWriter, BAD_CAST( "ServiceName" )); + xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST( "name" ), "%s", rtl::OUStringToOString(aServiceNames[i], RTL_TEXTENCODING_UTF8).getStr()); + xmlTextWriterEndElement( xmlWriter ); + } + #endif + + xmlTextWriterEndElement( xmlWriter ); +} + +void dumpXShapes( uno::Reference< drawing::XShapes > xShapes, xmlTextWriterPtr xmlWriter ) +{ + xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShapes" ) ); + uno::Reference< container::XIndexAccess > xIA( xShapes, uno::UNO_QUERY_THROW); + sal_Int32 nLength = xIA->getCount(); + for (sal_Int32 i = 0; i < nLength; ++i) + { + uno::Reference< drawing::XShape > xShape( xIA->getByIndex( i ), uno::UNO_QUERY_THROW ); + dumpXShape( xShape, xmlWriter ); + } + + xmlTextWriterEndElement( xmlWriter ); +} +} //end of namespace + +rtl::OUString XShapeDumper::dump(uno::Reference<drawing::XShapes> xPageShapes) +{ + + rtl::OStringBuffer aString; + xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO( writeCallback, closeCallback, &aString, NULL ); + xmlTextWriterPtr xmlWriter = xmlNewTextWriter( xmlOutBuffer ); + xmlTextWriterSetIndent( xmlWriter, 1 ); + + xmlTextWriterStartDocument( xmlWriter, NULL, NULL, NULL ); + + dumpXShapes( xPageShapes, xmlWriter ); + + xmlTextWriterEndDocument( xmlWriter ); + xmlFreeTextWriter( xmlWriter ); + + return OStringToOUString(aString.makeStringAndClear(), RTL_TEXTENCODING_UTF8); +} + |