Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / drawinglayer / source / dumper / XShapeDumper.cxx
blob58551484c162733275358ffa01adfd9424f3208b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <drawinglayer/XShapeDumper.hxx>
11 #include "EnhancedShapeDumper.hxx"
12 #include <com/sun/star/drawing/XShapes.hpp>
13 #include <com/sun/star/drawing/XShape.hpp>
14 #include <com/sun/star/lang/XServiceInfo.hpp>
15 #include <com/sun/star/beans/XPropertySet.hpp>
16 #include <com/sun/star/text/XText.hpp>
17 #include <rtl/strbuf.hxx>
18 #include <libxml/xmlwriter.h>
19 #include <iostream>
20 #include <rtl/ustring.hxx>
22 #define DEBUG_DUMPER 0
24 using namespace com::sun::star;
25 //class XShapeDumper
27 XShapeDumper::XShapeDumper()
32 namespace {
34 // FUNCTION DECLARATIONS
36 // auxiliary functions
37 void dumpGradientProperty(const css::awt::Gradient& rGradient, xmlTextWriterPtr xmlWriter);
38 void dumpPolyPolygonBezierCoords(const css::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoords, xmlTextWriterPtr xmlWriter);
39 void dumpPointSequenceSequence(const css::drawing::PointSequenceSequence& rPointSequenceSequence, const uno::Sequence<uno::Sequence<drawing::PolygonFlags> >*, xmlTextWriterPtr xmlWriter);
40 void dumpPropertyValueAsElement(const beans::PropertyValue& rPropertyValue, xmlTextWriterPtr xmlWriter);
42 // FillProperties.idl
43 void dumpFillStyleAsAttribute(css::drawing::FillStyle eFillStyle, xmlTextWriterPtr xmlWriter);
44 void dumpFillColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter);
45 void dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr xmlWriter);
46 void dumpFillTransparenceGradientNameAsAttribute(const OUString& sTranspGradName, xmlTextWriterPtr xmlWriter);
47 void dumpFillTransparenceGradientAsElement(const css::awt::Gradient& rTranspGrad, xmlTextWriterPtr xmlWriter);
48 void dumpFillGradientNameAsAttribute(const OUString& sGradName, xmlTextWriterPtr xmlWriter);
49 void dumpFillGradientAsElement(const css::awt::Gradient& rGradient, xmlTextWriterPtr xmlWriter);
50 void dumpFillHatchAsElement(const css::drawing::Hatch& rHatch, xmlTextWriterPtr xmlWriter);
51 void dumpFillBackgroundAsAttribute(bool bBackground, xmlTextWriterPtr xmlWriter);
52 void dumpFillBitmapAsElement(const css::uno::Reference<css::awt::XBitmap>& xBitmap, xmlTextWriterPtr xmlWriter);
53 void dumpFillBitmapURLAsAttribute(const OUString& sBitmapURL, xmlTextWriterPtr xmlWriter);
54 void dumpFillBitmapPositionOffsetXAsAttribute(sal_Int32 aBitmapPositionOffsetX, xmlTextWriterPtr xmlWriter);
55 void dumpFillBitmapPositionOffsetYAsAttribute(sal_Int32 aBitmapPositionOffsetY, xmlTextWriterPtr xmlWriter);
56 void dumpFillBitmapOffsetXAsAttribute(sal_Int32 aBitmapOffsetX, xmlTextWriterPtr xmlWriter);
57 void dumpFillBitmapOffsetYAsAttribute(sal_Int32 aBitmapOffsetY, xmlTextWriterPtr xmlWriter);
58 void dumpFillBitmapRectanglePointAsAttribute(css::drawing::RectanglePoint eBitmapRectanglePoint, xmlTextWriterPtr xmlWriter);
59 void dumpFillBitmapLogicalSizeAsAttribute(bool bBitmapLogicalSize, xmlTextWriterPtr xmlWriter);
60 void dumpFillBitmapSizeXAsAttribute(sal_Int32 aBitmapSizeX, xmlTextWriterPtr xmlWriter);
61 void dumpFillBitmapSizeYAsAttribute(sal_Int32 aBitmapSizeY, xmlTextWriterPtr xmlWriter);
62 void dumpFillBitmapModeAsAttribute(css::drawing::BitmapMode eBitmapMode, xmlTextWriterPtr xmlWriter);
63 void dumpFillBitmapStretchAsAttribute(bool bBitmapStretch, xmlTextWriterPtr xmlWriter);
64 void dumpFillBitmapTileAsAttribute(bool bBitmapTile, xmlTextWriterPtr xmlWriter);
66 // LineProperties.idl
67 void dumpLineStyleAsAttribute(css::drawing::LineStyle eLineStyle, xmlTextWriterPtr xmlWriter);
68 void dumpLineDashAsElement(const css::drawing::LineDash& rLineDash, xmlTextWriterPtr xmlWriter);
69 void dumpLineDashNameAsAttribute(const OUString& sLineDashName, xmlTextWriterPtr xmlWriter);
70 void dumpLineColorAsAttribute(sal_Int32 aLineColor, xmlTextWriterPtr xmlWriter);
71 void dumpLineTransparenceAsAttribute(sal_Int32 aLineTransparence, xmlTextWriterPtr xmlWriter);
72 void dumpLineWidthAsAttribute(sal_Int32 aLineWidth, xmlTextWriterPtr xmlWriter);
73 void dumpLineJointAsAttribute(css::drawing::LineJoint eLineJoint, xmlTextWriterPtr xmlWriter);
74 void dumpLineStartNameAsAttribute(const OUString& sLineStartName, xmlTextWriterPtr xmlWriter);
75 void dumpLineEndNameAsAttribute(const OUString& sLineEndName, xmlTextWriterPtr xmlWriter);
76 void dumpLineStartAsElement(const css::drawing::PolyPolygonBezierCoords& rLineStart, xmlTextWriterPtr xmlWriter);
77 void dumpLineEndAsElement(const css::drawing::PolyPolygonBezierCoords& rLineEnd, xmlTextWriterPtr xmlWriter);
78 void dumpLineStartCenterAsAttribute(bool bLineStartCenter, xmlTextWriterPtr xmlWriter);
79 void dumpLineStartWidthAsAttribute(sal_Int32 aLineStartWidth, xmlTextWriterPtr xmlWriter);
80 void dumpLineEndCenterAsAttribute(bool bLineEndCenter, xmlTextWriterPtr xmlWriter);
81 void dumpLineEndWidthAsAttribute(sal_Int32 aLineEndWidth, xmlTextWriterPtr xmlWriter);
83 // PolyPolygonDescriptor.idl
84 void dumpPolygonKindAsAttribute(css::drawing::PolygonKind ePolygonKind, xmlTextWriterPtr xmlWriter);
85 void dumpPolyPolygonAsElement(const css::drawing::PointSequenceSequence& rPolyPolygon, xmlTextWriterPtr xmlWriter);
86 void dumpGeometryAsElement(const css::drawing::PointSequenceSequence& rGeometry, xmlTextWriterPtr xmlWriter);
88 // CharacterProperties.idl
89 void dumpCharHeightAsAttribute(float fHeight, xmlTextWriterPtr xmlWriter);
90 void dumpCharColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter);
92 // TextProperties.idl
93 void dumpIsNumberingAsAttribute(bool bIsNumbering, xmlTextWriterPtr xmlWriter);
94 void dumpTextAutoGrowHeightAsAttribute(bool bTextAutoGrowHeight, xmlTextWriterPtr xmlWriter);
95 void dumpTextAutoGrowWidthAsAttribute(bool bTextAutoGrowWidth, xmlTextWriterPtr xmlWriter);
96 void dumpTextContourFrameAsAttribute(bool bTextContourFrame, xmlTextWriterPtr xmlWriter);
97 void dumpTextFitToSizeAsAttribute(css::drawing::TextFitToSizeType eTextFitToSize, xmlTextWriterPtr xmlWriter);
98 void dumpTextHorizontalAdjustAsAttribute(css::drawing::TextHorizontalAdjust eTextHorizontalAdjust, xmlTextWriterPtr xmlWriter);
99 void dumpTextVerticalAdjustAsAttribute(css::drawing::TextVerticalAdjust eTextVerticalAdjust, xmlTextWriterPtr xmlWriter);
100 void dumpTextLeftDistanceAsAttribute(sal_Int32 aTextLeftDistance, xmlTextWriterPtr xmlWriter);
101 void dumpTextRightDistanceAsAttribute(sal_Int32 aTextRightDistance, xmlTextWriterPtr xmlWriter);
102 void dumpTextUpperDistanceAsAttribute(sal_Int32 aTextUpperDistance, xmlTextWriterPtr xmlWriter);
103 void dumpTextLowerDistanceAsAttribute(sal_Int32 aTextLowerDistance, xmlTextWriterPtr xmlWriter);
104 void dumpTextMaximumFrameHeightAsAttribute(sal_Int32 aTextMaximumFrameHeight, xmlTextWriterPtr xmlWriter);
105 void dumpTextMaximumFrameWidthAsAttribute(sal_Int32 aTextMaximumFrameWidth, xmlTextWriterPtr xmlWriter);
106 void dumpTextMinimumFrameHeightAsAttribute(sal_Int32 aTextMinimumFrameHeight, xmlTextWriterPtr xmlWriter);
107 void dumpTextMinimumFrameWidthAsAttribute(sal_Int32 aTextMinimumFrameWidth, xmlTextWriterPtr xmlWriter);
108 void dumpTextAnimationAmountAsAttribute(sal_Int32 aTextAnimationAmount, xmlTextWriterPtr xmlWriter);
109 void dumpTextAnimationCountAsAttribute(sal_Int32 aTextAnimationCount, xmlTextWriterPtr xmlWriter);
110 void dumpTextAnimationDelayAsAttribute(sal_Int32 aTextAnimationDelay, xmlTextWriterPtr xmlWriter);
111 void dumpTextAnimationDirectionAsAttribute(css::drawing::TextAnimationDirection eTextAnimationDirection, xmlTextWriterPtr xmlWriter);
112 void dumpTextAnimationKindAsAttribute(css::drawing::TextAnimationKind eTextAnimationKind, xmlTextWriterPtr xmlWriter);
113 void dumpTextAnimationStartInsideAsAttribute(bool bTextAnimationStartInside, xmlTextWriterPtr xmlWriter);
114 void dumpTextAnimationStopInsideAsAttribute(bool bTextAnimationStopInside, xmlTextWriterPtr xmlWriter);
115 void dumpTextWritingModeAsAttribute(css::text::WritingMode eWritingMode, xmlTextWriterPtr xmlWriter);
117 // ShadowProperties.idl
118 void dumpShadowAsAttribute(bool bShadow, xmlTextWriterPtr xmlWriter);
119 void dumpShadowColorAsAttribute(sal_Int32 aShadowColor, xmlTextWriterPtr xmlWriter);
120 void dumpShadowTransparenceAsAttribute(sal_Int32 aShadowTransparence, xmlTextWriterPtr xmlWriter);
121 void dumpShadowXDistanceAsAttribute(sal_Int32 aShadowXDistance, xmlTextWriterPtr xmlWriter);
122 void dumpShadowYDistanceAsAttribute(sal_Int32 aShadowYDistance, xmlTextWriterPtr xmlWriter);
124 //Shape.idl
125 void dumpZOrderAsAttribute(sal_Int32 aZOrder, xmlTextWriterPtr xmlWriter);
126 void dumpLayerIDAsAttribute(sal_Int32 aLayerID, xmlTextWriterPtr xmlWriter);
127 void dumpLayerNameAsAttribute(const OUString& sLayerName, xmlTextWriterPtr xmlWriter);
128 void dumpVisibleAsAttribute(bool bVisible, xmlTextWriterPtr xmlWriter);
129 void dumpPrintableAsAttribute(bool bPrintable, xmlTextWriterPtr xmlWriter);
130 void dumpMoveProtectAsAttribute(bool bMoveProtect, xmlTextWriterPtr xmlWriter);
131 void dumpNameAsAttribute(const OUString& sName, xmlTextWriterPtr xmlWriter);
132 void dumpSizeProtectAsAttribute(bool bSizeProtect, xmlTextWriterPtr xmlWriter);
133 void dumpHomogenMatrixLine3(const css::drawing::HomogenMatrixLine3& rLine, xmlTextWriterPtr xmlWriter);
134 void dumpTransformationAsElement(const css::drawing::HomogenMatrix3& rTransformation, xmlTextWriterPtr xmlWriter);
135 void dumpNavigationOrderAsAttribute(sal_Int32 aNavigationOrder, xmlTextWriterPtr xmlWriter);
136 void dumpHyperlinkAsAttribute(const OUString& sHyperlink, xmlTextWriterPtr xmlWriter);
137 void dumpInteropGrabBagAsElement(const uno::Sequence< beans::PropertyValue>& aInteropGrabBag, xmlTextWriterPtr xmlWriter);
139 // CustomShape.idl
140 void dumpCustomShapeEngineAsAttribute(const OUString& sCustomShapeEngine, xmlTextWriterPtr xmlWriter);
141 void dumpCustomShapeDataAsAttribute(const OUString& sCustomShapeData, xmlTextWriterPtr xmlWriter);
142 void dumpCustomShapeGeometryAsElement(const css::uno::Sequence< css::beans::PropertyValue>& aCustomShapeGeometry, xmlTextWriterPtr xmlWriter);
143 void dumpCustomShapeReplacementURLAsAttribute(const OUString& sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter);
145 // XShape.idl
146 void dumpPositionAsAttribute(const css::awt::Point& rPoint, xmlTextWriterPtr xmlWriter);
147 void dumpSizeAsAttribute(const css::awt::Size& rSize, xmlTextWriterPtr xmlWriter);
149 // the rest
150 void dumpShapeDescriptorAsAttribute( const css::uno::Reference< css::drawing::XShapeDescriptor >& xDescr, xmlTextWriterPtr xmlWriter );
151 void dumpXShape(const css::uno::Reference< css::drawing::XShape >& xShape, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties);
152 void dumpXShapes( const css::uno::Reference< css::drawing::XShapes >& xShapes, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties );
153 void dumpTextPropertiesService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter);
154 void dumpFillPropertiesService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter);
155 void dumpLinePropertiesService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter);
156 void dumpShadowPropertiesService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter);
157 void dumpPolyPolygonDescriptorService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter);
158 void dumpShapeService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties);
159 void dumpPolyPolygonBezierDescriptorService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter);
160 void dumpCustomShapeService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter);
163 int writeCallback(void* pContext, const char* sBuffer, int nLen)
165 OStringBuffer* pBuffer = static_cast<OStringBuffer*>(pContext);
166 pBuffer->append(sBuffer);
167 return nLen;
170 int closeCallback(void* )
172 return 0;
175 bool m_bNameDumped;
178 // ---------- FillProperties.idl ----------
180 void dumpFillStyleAsAttribute(drawing::FillStyle eFillStyle, xmlTextWriterPtr xmlWriter)
182 switch(eFillStyle)
184 case drawing::FillStyle_NONE:
185 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "NONE");
186 break;
187 case drawing::FillStyle_SOLID:
188 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "SOLID");
189 break;
190 case drawing::FillStyle_GRADIENT:
191 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "GRADIENT");
192 break;
193 case drawing::FillStyle_HATCH:
194 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "HATCH");
195 break;
196 case drawing::FillStyle_BITMAP:
197 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "BITMAP");
198 break;
199 default:
200 break;
204 void dumpFillColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter)
206 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillColor"), "%06x", (unsigned int) aColor);
209 void dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr xmlWriter)
211 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillTransparence"), "%" SAL_PRIdINT32, aTransparence);
214 void dumpFillTransparenceGradientNameAsAttribute(const OUString& sTranspGradName, xmlTextWriterPtr xmlWriter)
216 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillTransparenceGradientName"), "%s",
217 OUStringToOString(sTranspGradName, RTL_TEXTENCODING_UTF8).getStr());
220 //because there's more awt::Gradient properties to dump
221 void dumpGradientProperty(const awt::Gradient& rGradient, xmlTextWriterPtr xmlWriter)
223 switch (rGradient.Style) //enum GradientStyle
225 case awt::GradientStyle_LINEAR:
226 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "LINEAR");
227 break;
228 case awt::GradientStyle_AXIAL:
229 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "AXIAL");
230 break;
231 case awt::GradientStyle_RADIAL:
232 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "RADIAL");
233 break;
234 case awt::GradientStyle_ELLIPTICAL:
235 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "ELLIPTICAL");
236 break;
237 case awt::GradientStyle_SQUARE:
238 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "SQUARE");
239 break;
240 case awt::GradientStyle_RECT:
241 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "RECT");
242 break;
243 default:
244 break;
246 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("startColor"), "%06x", (unsigned int) rGradient.StartColor);
247 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("endColor"), "%06x", (unsigned int) rGradient.EndColor);
248 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("angle"), "%" SAL_PRIdINT32, (sal_Int32) rGradient.Angle);
249 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("border"), "%" SAL_PRIdINT32, (sal_Int32) rGradient.Border);
250 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("xOffset"), "%" SAL_PRIdINT32, (sal_Int32) rGradient.XOffset);
251 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("yOffset"), "%" SAL_PRIdINT32, (sal_Int32) rGradient.YOffset);
252 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("startIntensity"), "%" SAL_PRIdINT32, (sal_Int32) rGradient.StartIntensity);
253 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("endIntensity"), "%" SAL_PRIdINT32, (sal_Int32) rGradient.EndIntensity);
254 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("stepCount"), "%" SAL_PRIdINT32, (sal_Int32) rGradient.StepCount);
257 void dumpFillTransparenceGradientAsElement(const awt::Gradient& rTranspGrad, xmlTextWriterPtr xmlWriter)
259 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FillTransparenceGradient" ));
260 dumpGradientProperty(rTranspGrad, xmlWriter);
261 xmlTextWriterEndElement( xmlWriter );
264 void dumpFillGradientNameAsAttribute(const OUString& sGradName, xmlTextWriterPtr xmlWriter)
266 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillGradientName"), "%s",
267 OUStringToOString(sGradName, RTL_TEXTENCODING_UTF8).getStr());
270 void dumpFillGradientAsElement(const awt::Gradient& rGradient, xmlTextWriterPtr xmlWriter)
272 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FillGradient" ));
273 dumpGradientProperty(rGradient, xmlWriter);
274 xmlTextWriterEndElement( xmlWriter );
277 void dumpFillHatchAsElement(const drawing::Hatch& rHatch, xmlTextWriterPtr xmlWriter)
279 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FillHatch" ));
280 switch (rHatch.Style)
282 case drawing::HatchStyle_SINGLE:
283 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "SINGLE");
284 break;
285 case drawing::HatchStyle_DOUBLE:
286 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "DOUBLE");
287 break;
288 case drawing::HatchStyle_TRIPLE:
289 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "TRIPLE");
290 break;
291 default:
292 break;
294 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("color"), "%06x", (unsigned int) rHatch.Color);
295 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("distance"), "%" SAL_PRIdINT32, (sal_Int32) rHatch.Distance);
296 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("angle"), "%" SAL_PRIdINT32, (sal_Int32) rHatch.Angle);
297 xmlTextWriterEndElement( xmlWriter );
300 void dumpFillBackgroundAsAttribute(bool bBackground, xmlTextWriterPtr xmlWriter)
302 if(bBackground)
303 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBackground"), "%s", "true");
304 else
305 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBackground"), "%s", "false");
308 void dumpFillBitmapAsElement(const uno::Reference<awt::XBitmap>& xBitmap, xmlTextWriterPtr xmlWriter)
310 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FillBitmap" ));
311 if (xBitmap.is())
313 awt::Size const aSize = xBitmap->getSize();
314 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("width"), "%" SAL_PRIdINT32, aSize.Width);
315 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("height"), "%" SAL_PRIdINT32, aSize.Height);
317 xmlTextWriterEndElement( xmlWriter );
320 void dumpFillBitmapURLAsAttribute(const OUString& sBitmapURL, xmlTextWriterPtr xmlWriter)
322 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapURL"), "%s",
323 OUStringToOString(sBitmapURL, RTL_TEXTENCODING_UTF8).getStr());
326 void dumpFillBitmapPositionOffsetXAsAttribute(sal_Int32 aBitmapPositionOffsetX, xmlTextWriterPtr xmlWriter)
328 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapPositionOffsetX"), "%" SAL_PRIdINT32, aBitmapPositionOffsetX);
331 void dumpFillBitmapPositionOffsetYAsAttribute(sal_Int32 aBitmapPositionOffsetY, xmlTextWriterPtr xmlWriter)
333 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapPositionOffsetY"), "%" SAL_PRIdINT32, aBitmapPositionOffsetY);
336 void dumpFillBitmapOffsetXAsAttribute(sal_Int32 aBitmapOffsetX, xmlTextWriterPtr xmlWriter)
338 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapOffsetX"), "%" SAL_PRIdINT32, aBitmapOffsetX);
341 void dumpFillBitmapOffsetYAsAttribute(sal_Int32 aBitmapOffsetY, xmlTextWriterPtr xmlWriter)
343 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapOffsetY"), "%" SAL_PRIdINT32, aBitmapOffsetY);
346 void dumpFillBitmapRectanglePointAsAttribute(drawing::RectanglePoint eBitmapRectanglePoint, xmlTextWriterPtr xmlWriter)
348 switch(eBitmapRectanglePoint)
350 case drawing::RectanglePoint_LEFT_TOP:
351 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "LEFT_TOP");
352 break;
353 case drawing::RectanglePoint_MIDDLE_TOP:
354 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "MIDDLE_TOP");
355 break;
356 case drawing::RectanglePoint_RIGHT_TOP:
357 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "RIGHT_TOP");
358 break;
359 case drawing::RectanglePoint_LEFT_MIDDLE:
360 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "LEFT_MIDDLE");
361 break;
362 case drawing::RectanglePoint_MIDDLE_MIDDLE:
363 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "MIDDLE_MIDDLE");
364 break;
365 case drawing::RectanglePoint_RIGHT_MIDDLE:
366 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "RIGHT_MIDDLE");
367 break;
368 case drawing::RectanglePoint_LEFT_BOTTOM:
369 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "LEFT_BOTTOM");
370 break;
371 case drawing::RectanglePoint_MIDDLE_BOTTOM:
372 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "MIDDLE_BOTTOM");
373 break;
374 case drawing::RectanglePoint_RIGHT_BOTTOM:
375 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "RIGHT_BOTTOM");
376 break;
377 default:
378 break;
382 void dumpFillBitmapLogicalSizeAsAttribute(bool bBitmapLogicalSize, xmlTextWriterPtr xmlWriter)
384 if(bBitmapLogicalSize)
385 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapLogicalSize"), "%s", "true");
386 else
387 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapLogicalSize"), "%s", "false");
390 void dumpFillBitmapSizeXAsAttribute(sal_Int32 aBitmapSizeX, xmlTextWriterPtr xmlWriter)
392 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapSizeX"), "%" SAL_PRIdINT32, aBitmapSizeX);
395 void dumpFillBitmapSizeYAsAttribute(sal_Int32 aBitmapSizeY, xmlTextWriterPtr xmlWriter)
397 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapSizeY"), "%" SAL_PRIdINT32, aBitmapSizeY);
400 void dumpFillBitmapModeAsAttribute(drawing::BitmapMode eBitmapMode, xmlTextWriterPtr xmlWriter)
402 switch(eBitmapMode)
404 case drawing::BitmapMode_REPEAT:
405 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapMode"), "%s", "REPEAT");
406 break;
407 case drawing::BitmapMode_STRETCH:
408 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapMode"), "%s", "STRETCH");
409 break;
410 case drawing::BitmapMode_NO_REPEAT:
411 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapMode"), "%s", "NO_REPEAT");
412 break;
413 default:
414 break;
418 void dumpFillBitmapStretchAsAttribute(bool bBitmapStretch, xmlTextWriterPtr xmlWriter)
420 if(bBitmapStretch)
421 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapStretch"), "%s", "true");
422 else
423 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapStretch"), "%s", "false");
426 void dumpFillBitmapTileAsAttribute(bool bBitmapTile, xmlTextWriterPtr xmlWriter)
428 if(bBitmapTile)
429 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapTile"), "%s", "true");
430 else
431 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapTile"), "%s", "false");
435 // ---------- LineProperties.idl ----------
438 void dumpLineStyleAsAttribute(drawing::LineStyle eLineStyle, xmlTextWriterPtr xmlWriter)
440 switch(eLineStyle)
442 case drawing::LineStyle_NONE:
443 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStyle"), "%s", "NONE");
444 break;
445 case drawing::LineStyle_SOLID:
446 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStyle"), "%s", "SOLID");
447 break;
448 case drawing::LineStyle_DASH:
449 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStyle"), "%s", "DASH");
450 break;
451 default:
452 break;
456 void dumpLineDashAsElement(const drawing::LineDash& rLineDash, xmlTextWriterPtr xmlWriter)
458 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "LineDash" ));
459 switch (rLineDash.Style)
461 case drawing::DashStyle_RECT:
462 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "RECT");
463 break;
464 case drawing::DashStyle_ROUND:
465 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "ROUND");
466 break;
467 case drawing::DashStyle_RECTRELATIVE:
468 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "RECTRELATIVE");
469 break;
470 case drawing::DashStyle_ROUNDRELATIVE:
471 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "ROUNDRELATIVE");
472 break;
473 default:
474 break;
476 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dots"), "%" SAL_PRIdINT32, (sal_Int32) rLineDash.Dots);
477 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dotLen"), "%" SAL_PRIdINT32, (sal_Int32) rLineDash.DotLen);
478 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dashes"), "%" SAL_PRIdINT32, (sal_Int32) rLineDash.Dashes);
479 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dashLen"), "%" SAL_PRIdINT32, (sal_Int32) rLineDash.DashLen);
480 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("distance"), "%" SAL_PRIdINT32, (sal_Int32) rLineDash.Distance);
481 xmlTextWriterEndElement( xmlWriter );
484 void dumpLineDashNameAsAttribute(const OUString& sLineDashName, xmlTextWriterPtr xmlWriter)
486 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineDashName"), "%s",
487 OUStringToOString(sLineDashName, RTL_TEXTENCODING_UTF8).getStr());
490 void dumpLineColorAsAttribute(sal_Int32 aLineColor, xmlTextWriterPtr xmlWriter)
492 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineColor"), "%06x", (unsigned int) aLineColor);
495 void dumpLineTransparenceAsAttribute(sal_Int32 aLineTransparence, xmlTextWriterPtr xmlWriter)
497 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineTransparence"), "%" SAL_PRIdINT32, aLineTransparence);
500 void dumpLineWidthAsAttribute(sal_Int32 aLineWidth, xmlTextWriterPtr xmlWriter)
502 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineWidth"), "%" SAL_PRIdINT32, aLineWidth);
505 void dumpLineJointAsAttribute(drawing::LineJoint eLineJoint, xmlTextWriterPtr xmlWriter)
507 switch(eLineJoint)
509 case drawing::LineJoint_NONE:
510 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineJoint"), "%s", "NONE");
511 break;
512 case drawing::LineJoint_MIDDLE:
513 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineJoint"), "%s", "MIDDLE");
514 break;
515 case drawing::LineJoint_BEVEL:
516 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineJoint"), "%s", "BEVEL");
517 break;
518 case drawing::LineJoint_MITER:
519 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineJoint"), "%s", "MITER");
520 break;
521 case drawing::LineJoint_ROUND:
522 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineJoint"), "%s", "ROUND");
523 break;
524 default:
525 break;
529 void dumpLineStartNameAsAttribute(const OUString& sLineStartName, xmlTextWriterPtr xmlWriter)
531 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineStartName"), "%s",
532 OUStringToOString(sLineStartName, RTL_TEXTENCODING_UTF8).getStr());
535 void dumpLineEndNameAsAttribute(const OUString& sLineEndName, xmlTextWriterPtr xmlWriter)
537 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineEndName"), "%s",
538 OUStringToOString(sLineEndName, RTL_TEXTENCODING_UTF8).getStr());
541 void dumpPolyPolygonBezierCoords(const drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoords, xmlTextWriterPtr xmlWriter)
543 dumpPointSequenceSequence(rPolyPolygonBezierCoords.Coordinates, &rPolyPolygonBezierCoords.Flags, xmlWriter);
546 void dumpLineStartAsElement(const drawing::PolyPolygonBezierCoords& rLineStart, xmlTextWriterPtr xmlWriter)
548 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "LineStart" ));
549 dumpPolyPolygonBezierCoords(rLineStart, xmlWriter);
550 xmlTextWriterEndElement( xmlWriter );
553 void dumpLineEndAsElement(const drawing::PolyPolygonBezierCoords& rLineEnd, xmlTextWriterPtr xmlWriter)
555 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "LineEnd" ));
556 dumpPolyPolygonBezierCoords(rLineEnd, xmlWriter);
557 xmlTextWriterEndElement( xmlWriter );
560 void dumpLineStartCenterAsAttribute(bool bLineStartCenter, xmlTextWriterPtr xmlWriter)
562 if(bLineStartCenter)
563 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStartCenter"), "%s", "true");
564 else
565 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStartCenter"), "%s", "false");
568 void dumpLineStartWidthAsAttribute(sal_Int32 aLineStartWidth, xmlTextWriterPtr xmlWriter)
570 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineStartWidth"), "%" SAL_PRIdINT32, aLineStartWidth);
573 void dumpLineEndCenterAsAttribute(bool bLineEndCenter, xmlTextWriterPtr xmlWriter)
575 if(bLineEndCenter)
576 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineEndCenter"), "%s", "true");
577 else
578 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineEndCenter"), "%s", "false");
581 void dumpLineEndWidthAsAttribute(sal_Int32 aLineEndWidth, xmlTextWriterPtr xmlWriter)
583 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineEndWidth"), "%" SAL_PRIdINT32, aLineEndWidth);
587 // ---------- PolyPolygonDescriptor.idl ----------
590 void dumpPolygonKindAsAttribute(drawing::PolygonKind ePolygonKind, xmlTextWriterPtr xmlWriter)
592 switch(ePolygonKind)
594 case drawing::PolygonKind_LINE:
595 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "LINE");
596 break;
597 case drawing::PolygonKind_POLY:
598 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "POLY");
599 break;
600 case drawing::PolygonKind_PLIN:
601 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PLIN");
602 break;
603 case drawing::PolygonKind_PATHLINE:
604 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PATHLINE");
605 break;
606 case drawing::PolygonKind_PATHFILL:
607 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PATHFILL");
608 break;
609 case drawing::PolygonKind_FREELINE:
610 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "FREELINE");
611 break;
612 case drawing::PolygonKind_FREEFILL:
613 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "FREEFILL");
614 break;
615 case drawing::PolygonKind_PATHPOLY:
616 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PATHPOLY");
617 break;
618 case drawing::PolygonKind_PATHPLIN:
619 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PATHPLIN");
620 break;
621 default:
622 break;
626 void dumpPointSequenceSequence(const drawing::PointSequenceSequence& aPointSequenceSequence, const uno::Sequence<uno::Sequence< drawing::PolygonFlags > >* pFlags, xmlTextWriterPtr xmlWriter)
628 // LibreOffice proudly presents - The Sequenception
629 uno::Sequence<uno::Sequence< awt::Point > > pointSequenceSequence = aPointSequenceSequence;
630 sal_Int32 nPointsSequence = pointSequenceSequence.getLength();
632 for (sal_Int32 i = 0; i < nPointsSequence; ++i)
634 uno::Sequence< awt::Point > pointSequence = pointSequenceSequence[i];
635 sal_Int32 nPoints = pointSequence.getLength();
637 uno::Sequence< drawing::PolygonFlags> flagsSequence;
638 if(pFlags)
639 flagsSequence = (*pFlags)[i];
641 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "pointSequence" ));
643 for(sal_Int32 j = 0; j < nPoints; ++j)
645 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "point" ));
646 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, pointSequence[j].X);
647 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionY"), "%" SAL_PRIdINT32, pointSequence[j].Y);
649 if(pFlags)
651 switch(flagsSequence[j])
653 case drawing::PolygonFlags_NORMAL:
654 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonFlags"), "%s", "NORMAL");
655 break;
656 case drawing::PolygonFlags_SMOOTH:
657 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonFlags"), "%s", "SMOOTH");
658 break;
659 case drawing::PolygonFlags_CONTROL:
660 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonFlags"), "%s", "CONTROL");
661 break;
662 case drawing::PolygonFlags_SYMMETRIC:
663 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonFlags"), "%s", "SYMMETRIC");
664 break;
665 default:
666 break;
670 xmlTextWriterEndElement( xmlWriter );
672 xmlTextWriterEndElement( xmlWriter );
676 void dumpPolyPolygonAsElement(const drawing::PointSequenceSequence& rPolyPolygon, xmlTextWriterPtr xmlWriter)
678 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PolyPolygon" ));
679 dumpPointSequenceSequence(rPolyPolygon, nullptr, xmlWriter);
680 xmlTextWriterEndElement( xmlWriter );
683 void dumpGeometryAsElement(const drawing::PointSequenceSequence& aGeometry, xmlTextWriterPtr xmlWriter)
685 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Geometry" ));
686 dumpPointSequenceSequence(aGeometry, nullptr, xmlWriter);
687 xmlTextWriterEndElement( xmlWriter );
690 // CharacterProperties.idl
691 void dumpCharHeightAsAttribute(float fHeight, xmlTextWriterPtr xmlWriter)
693 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fontHeight"), "%f", fHeight );
696 void dumpCharColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter)
698 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fontColor"), "%06x", (unsigned int) aColor);
702 // ---------- TextProperties.idl ----------
705 void dumpIsNumberingAsAttribute(bool bIsNumbering, xmlTextWriterPtr xmlWriter)
707 if(bIsNumbering)
708 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("isNumbering"), "%s", "true");
709 else
710 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("isNumbering"), "%s", "false");
713 void dumpTextAutoGrowHeightAsAttribute(bool bTextAutoGrowHeight, xmlTextWriterPtr xmlWriter)
715 if(bTextAutoGrowHeight)
716 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowHeight"), "%s", "true");
717 else
718 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowHeight"), "%s", "false");
721 void dumpTextAutoGrowWidthAsAttribute(bool bTextAutoGrowWidth, xmlTextWriterPtr xmlWriter)
723 if(bTextAutoGrowWidth)
724 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowWidth"), "%s", "true");
725 else
726 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowWidth"), "%s", "false");
729 void dumpTextContourFrameAsAttribute(bool bTextContourFrame, xmlTextWriterPtr xmlWriter)
731 if(bTextContourFrame)
732 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textContourFrame"), "%s", "true");
733 else
734 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textContourFrame"), "%s", "false");
737 void dumpTextFitToSizeAsAttribute(drawing::TextFitToSizeType eTextFitToSize, xmlTextWriterPtr xmlWriter)
739 switch(eTextFitToSize)
741 case drawing::TextFitToSizeType_NONE:
742 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textFitToSize"), "%s", "NONE");
743 break;
744 case drawing::TextFitToSizeType_PROPORTIONAL:
745 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textFitToSize"), "%s", "PROPORTIONAL");
746 break;
747 case drawing::TextFitToSizeType_ALLLINES:
748 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textFitToSize"), "%s", "ALLLINES");
749 break;
750 case drawing::TextFitToSizeType_AUTOFIT:
751 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textFitToSize"), "%s", "AUTOFIT");
752 break;
753 default:
754 break;
758 void dumpTextHorizontalAdjustAsAttribute(drawing::TextHorizontalAdjust eTextHorizontalAdjust, xmlTextWriterPtr xmlWriter)
760 switch(eTextHorizontalAdjust)
762 case drawing::TextHorizontalAdjust_LEFT:
763 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textHorizontalAdjust"), "%s", "LEFT");
764 break;
765 case drawing::TextHorizontalAdjust_CENTER:
766 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textHorizontalAdjust"), "%s", "CENTER");
767 break;
768 case drawing::TextHorizontalAdjust_RIGHT:
769 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textHorizontalAdjust"), "%s", "RIGHT");
770 break;
771 case drawing::TextHorizontalAdjust_BLOCK:
772 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textHorizontalAdjust"), "%s", "BLOCK");
773 break;
774 default:
775 break;
779 void dumpTextVerticalAdjustAsAttribute(drawing::TextVerticalAdjust eTextVerticalAdjust, xmlTextWriterPtr xmlWriter)
781 switch(eTextVerticalAdjust)
783 case drawing::TextVerticalAdjust_TOP:
784 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textVerticalAdjust"), "%s", "TOP");
785 break;
786 case drawing::TextVerticalAdjust_CENTER:
787 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textVerticalAdjust"), "%s", "CENTER");
788 break;
789 case drawing::TextVerticalAdjust_BOTTOM:
790 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textVerticalAdjust"), "%s", "BOTTOM");
791 break;
792 case drawing::TextVerticalAdjust_BLOCK:
793 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textVerticalAdjust"), "%s", "BLOCK");
794 break;
795 default:
796 break;
800 void dumpTextLeftDistanceAsAttribute(sal_Int32 aTextLeftDistance, xmlTextWriterPtr xmlWriter)
802 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textLeftDistance"), "%" SAL_PRIdINT32, aTextLeftDistance);
805 void dumpTextRightDistanceAsAttribute(sal_Int32 aTextRightDistance, xmlTextWriterPtr xmlWriter)
807 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textRightDistance"), "%" SAL_PRIdINT32, aTextRightDistance);
810 void dumpTextUpperDistanceAsAttribute(sal_Int32 aTextUpperDistance, xmlTextWriterPtr xmlWriter)
812 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textUpperDistance"), "%" SAL_PRIdINT32, aTextUpperDistance);
815 void dumpTextLowerDistanceAsAttribute(sal_Int32 aTextLowerDistance, xmlTextWriterPtr xmlWriter)
817 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textLowerDistance"), "%" SAL_PRIdINT32, aTextLowerDistance);
820 void dumpTextMaximumFrameHeightAsAttribute(sal_Int32 aTextMaximumFrameHeight, xmlTextWriterPtr xmlWriter)
822 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMaximumFrameHeight"), "%" SAL_PRIdINT32, aTextMaximumFrameHeight);
825 void dumpTextMaximumFrameWidthAsAttribute(sal_Int32 aTextMaximumFrameWidth, xmlTextWriterPtr xmlWriter)
827 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMaximumFrameWidth"), "%" SAL_PRIdINT32, aTextMaximumFrameWidth);
830 void dumpTextMinimumFrameHeightAsAttribute(sal_Int32 aTextMinimumFrameHeight, xmlTextWriterPtr xmlWriter)
832 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMinimumFrameHeight"), "%" SAL_PRIdINT32, aTextMinimumFrameHeight);
835 void dumpTextMinimumFrameWidthAsAttribute(sal_Int32 aTextMinimumFrameWidth, xmlTextWriterPtr xmlWriter)
837 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMinimumFrameWidth"), "%" SAL_PRIdINT32, aTextMinimumFrameWidth);
840 void dumpTextAnimationAmountAsAttribute(sal_Int32 aTextAnimationAmount, xmlTextWriterPtr xmlWriter)
842 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textAnimationAmount"), "%" SAL_PRIdINT32, aTextAnimationAmount);
845 void dumpTextAnimationCountAsAttribute(sal_Int32 aTextAnimationCount, xmlTextWriterPtr xmlWriter)
847 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textAnimationCount"), "%" SAL_PRIdINT32, aTextAnimationCount);
850 void dumpTextAnimationDelayAsAttribute(sal_Int32 aTextAnimationDelay, xmlTextWriterPtr xmlWriter)
852 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textAnimationDelay"), "%" SAL_PRIdINT32, aTextAnimationDelay);
855 void dumpTextAnimationDirectionAsAttribute(drawing::TextAnimationDirection eTextAnimationDirection, xmlTextWriterPtr xmlWriter)
857 switch(eTextAnimationDirection)
859 case drawing::TextAnimationDirection_LEFT:
860 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationDirection"), "%s", "LEFT");
861 break;
862 case drawing::TextAnimationDirection_RIGHT:
863 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationDirection"), "%s", "RIGHT");
864 break;
865 case drawing::TextAnimationDirection_UP:
866 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationDirection"), "%s", "UP");
867 break;
868 case drawing::TextAnimationDirection_DOWN:
869 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationDirection"), "%s", "DOWN");
870 break;
871 default:
872 break;
876 void dumpTextAnimationKindAsAttribute(drawing::TextAnimationKind eTextAnimationKind, xmlTextWriterPtr xmlWriter)
878 switch(eTextAnimationKind)
880 case drawing::TextAnimationKind_NONE:
881 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "NONE");
882 break;
883 case drawing::TextAnimationKind_BLINK:
884 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "BLINK");
885 break;
886 case drawing::TextAnimationKind_SCROLL:
887 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "SCROLL");
888 break;
889 case drawing::TextAnimationKind_ALTERNATE:
890 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "ALTERNATE");
891 break;
892 case drawing::TextAnimationKind_SLIDE:
893 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "SLIDE");
894 break;
895 default:
896 break;
900 void dumpTextAnimationStartInsideAsAttribute(bool bTextAnimationStartInside, xmlTextWriterPtr xmlWriter)
902 if(bTextAnimationStartInside)
903 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStartInside"), "%s", "true");
904 else
905 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStartInside"), "%s", "false");
908 void dumpTextAnimationStopInsideAsAttribute(bool bTextAnimationStopInside, xmlTextWriterPtr xmlWriter)
910 if(bTextAnimationStopInside)
911 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStopInside"), "%s", "true");
912 else
913 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStopInside"), "%s", "false");
916 void dumpTextWritingModeAsAttribute(text::WritingMode eTextWritingMode, xmlTextWriterPtr xmlWriter)
918 switch(eTextWritingMode)
920 case text::WritingMode_LR_TB:
921 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textWritingMode"), "%s", "LR_TB");
922 break;
923 case text::WritingMode_RL_TB:
924 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textWritingMode"), "%s", "RL_TB");
925 break;
926 case text::WritingMode_TB_RL:
927 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textWritingMode"), "%s", "TB_RL");
928 break;
929 default:
930 break;
935 // ---------- ShadowProperties.idl ----------
938 void dumpShadowAsAttribute(bool bShadow, xmlTextWriterPtr xmlWriter)
940 if(bShadow)
941 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadow"), "%s", "true");
942 else
943 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadow"), "%s", "false");
946 void dumpShadowColorAsAttribute(sal_Int32 aShadowColor, xmlTextWriterPtr xmlWriter)
948 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowColor"), "%06x", (unsigned int) aShadowColor);
951 void dumpShadowTransparenceAsAttribute(sal_Int32 aShadowTransparence, xmlTextWriterPtr xmlWriter)
953 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowTransparence"), "%" SAL_PRIdINT32, aShadowTransparence);
956 void dumpShadowXDistanceAsAttribute(sal_Int32 aShadowXDistance, xmlTextWriterPtr xmlWriter)
958 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowXDistance"), "%" SAL_PRIdINT32, aShadowXDistance);
961 void dumpShadowYDistanceAsAttribute(sal_Int32 aShadowYDistance, xmlTextWriterPtr xmlWriter)
963 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowYDistance"), "%" SAL_PRIdINT32, aShadowYDistance);
967 // ---------- Shape.idl ----------
970 void dumpZOrderAsAttribute(sal_Int32 aZOrder, xmlTextWriterPtr xmlWriter)
972 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("zOrder"), "%" SAL_PRIdINT32, aZOrder);
975 void dumpLayerIDAsAttribute(sal_Int32 aLayerID, xmlTextWriterPtr xmlWriter)
977 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("layerID"), "%" SAL_PRIdINT32, aLayerID);
980 void dumpLayerNameAsAttribute(const OUString& sLayerName, xmlTextWriterPtr xmlWriter)
982 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("layerName"), "%s",
983 OUStringToOString(sLayerName, RTL_TEXTENCODING_UTF8).getStr());
986 void dumpVisibleAsAttribute(bool bVisible, xmlTextWriterPtr xmlWriter)
988 if(bVisible)
989 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("visible"), "%s", "true");
990 else
991 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("visible"), "%s", "false");
994 void dumpPrintableAsAttribute(bool bPrintable, xmlTextWriterPtr xmlWriter)
996 if(bPrintable)
997 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("printable"), "%s", "true");
998 else
999 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("printable"), "%s", "false");
1002 void dumpMoveProtectAsAttribute(bool bMoveProtect, xmlTextWriterPtr xmlWriter)
1004 if(bMoveProtect)
1005 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("moveProtect"), "%s", "true");
1006 else
1007 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("moveProtect"), "%s", "false");
1010 void dumpNameAsAttribute(const OUString& sName, xmlTextWriterPtr xmlWriter)
1012 if(!sName.isEmpty() && !m_bNameDumped)
1014 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s", OUStringToOString(sName, RTL_TEXTENCODING_UTF8).getStr());
1015 m_bNameDumped = true;
1019 void dumpSizeProtectAsAttribute(bool bSizeProtect, xmlTextWriterPtr xmlWriter)
1021 if(bSizeProtect)
1022 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("sizeProtect"), "%s", "true");
1023 else
1024 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("sizeProtect"), "%s", "false");
1027 void dumpHomogenMatrixLine3(const drawing::HomogenMatrixLine3& rHomogenMatrixLine3, xmlTextWriterPtr xmlWriter)
1029 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("column1"), "%f", rHomogenMatrixLine3.Column1);
1030 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("column2"), "%f", rHomogenMatrixLine3.Column2);
1031 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("column3"), "%f", rHomogenMatrixLine3.Column3);
1034 void dumpTransformationAsElement(const drawing::HomogenMatrix3& rTransformation, xmlTextWriterPtr xmlWriter)
1036 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Transformation" ));
1038 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Line1" ));
1039 dumpHomogenMatrixLine3(rTransformation.Line1, xmlWriter);
1040 xmlTextWriterEndElement( xmlWriter );
1041 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Line2" ));
1042 dumpHomogenMatrixLine3(rTransformation.Line2, xmlWriter);
1043 xmlTextWriterEndElement( xmlWriter );
1044 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Line3" ));
1045 dumpHomogenMatrixLine3(rTransformation.Line3, xmlWriter);
1046 xmlTextWriterEndElement( xmlWriter );
1048 xmlTextWriterEndElement( xmlWriter );
1051 void dumpNavigationOrderAsAttribute(sal_Int32 aNavigationOrder, xmlTextWriterPtr xmlWriter)
1053 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("navigationOrder"), "%" SAL_PRIdINT32, aNavigationOrder);
1056 void dumpHyperlinkAsAttribute(const OUString& sHyperlink, xmlTextWriterPtr xmlWriter)
1058 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("hyperlink"), "%s",
1059 OUStringToOString(sHyperlink, RTL_TEXTENCODING_UTF8).getStr());
1062 void dumpInteropGrabBagAsElement(const uno::Sequence< beans::PropertyValue>& aInteropGrabBag, xmlTextWriterPtr xmlWriter)
1064 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "InteropGrabBag" ));
1066 sal_Int32 nLength = aInteropGrabBag.getLength();
1067 for (sal_Int32 i = 0; i < nLength; ++i)
1068 dumpPropertyValueAsElement(aInteropGrabBag[i], xmlWriter);
1070 xmlTextWriterEndElement( xmlWriter );
1074 // ---------- XShape.idl ----------
1077 void dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
1079 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
1080 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionY"), "%" SAL_PRIdINT32, rPoint.Y);
1083 void dumpSizeAsAttribute(const awt::Size& rSize, xmlTextWriterPtr xmlWriter)
1085 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("sizeX"), "%" SAL_PRIdINT32, rSize.Width);
1086 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("sizeY"), "%" SAL_PRIdINT32, rSize.Height);
1089 void dumpShapeDescriptorAsAttribute( const uno::Reference< drawing::XShapeDescriptor >& xDescr, xmlTextWriterPtr xmlWriter )
1091 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("type"), "%s",
1092 OUStringToOString(xDescr->getShapeType(), RTL_TEXTENCODING_UTF8).getStr());
1096 // ---------- CustomShape.idl ----------
1099 void dumpCustomShapeEngineAsAttribute(const OUString& sCustomShapeEngine, xmlTextWriterPtr xmlWriter)
1101 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeEngine"), "%s",
1102 OUStringToOString(sCustomShapeEngine, RTL_TEXTENCODING_UTF8).getStr());
1105 void dumpCustomShapeDataAsAttribute(const OUString& sCustomShapeData, xmlTextWriterPtr xmlWriter)
1107 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeData"), "%s",
1108 OUStringToOString(sCustomShapeData, RTL_TEXTENCODING_UTF8).getStr());
1111 void dumpPropertyValueAsElement(const beans::PropertyValue& rPropertyValue, xmlTextWriterPtr xmlWriter)
1113 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PropertyValue" ));
1115 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s",
1116 OUStringToOString(rPropertyValue.Name, RTL_TEXTENCODING_UTF8).getStr());
1118 uno::Any aAny = rPropertyValue.Value;
1119 OUString sValue;
1120 float fValue;
1121 sal_Int32 nValue;
1122 bool bValue;
1123 awt::Rectangle aRectangleValue;
1124 uno::Sequence< drawing::EnhancedCustomShapeAdjustmentValue> aAdjustmentValues;
1125 uno::Sequence< drawing::EnhancedCustomShapeParameterPair > aCoordinates;
1126 uno::Sequence< drawing::EnhancedCustomShapeSegment > aSegments;
1127 uno::Sequence< beans::PropertyValue > aPropSeq;
1128 if(aAny >>= sValue)
1130 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s",
1131 OUStringToOString(sValue, RTL_TEXTENCODING_UTF8).getStr());
1133 else if(aAny >>= nValue)
1135 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%" SAL_PRIdINT32, nValue);
1137 else if(aAny >>= fValue)
1139 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%f", fValue);
1141 else if(aAny >>= bValue)
1143 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s", (bValue? "true": "false"));
1145 else if(rPropertyValue.Name == "ViewBox" && (aAny >>= aRectangleValue))
1147 EnhancedShapeDumper enhancedDumper(xmlWriter);
1148 enhancedDumper.dumpViewBoxAsElement(aRectangleValue);
1150 else if(rPropertyValue.Name == "AdjustmentValues" && (aAny >>= aAdjustmentValues))
1152 EnhancedShapeDumper enhancedDumper(xmlWriter);
1153 enhancedDumper.dumpAdjustmentValuesAsElement(aAdjustmentValues);
1155 else if(rPropertyValue.Name == "Coordinates" && (aAny >>= aCoordinates))
1157 EnhancedShapeDumper enhancedDumper(xmlWriter);
1158 enhancedDumper.dumpCoordinatesAsElement(aCoordinates);
1160 else if(rPropertyValue.Name == "Segments" && (aAny >>= aSegments))
1162 EnhancedShapeDumper enhancedDumper(xmlWriter);
1163 enhancedDumper.dumpSegmentsAsElement(aSegments);
1165 else if(aAny >>= aPropSeq)
1167 xmlTextWriterStartElement(xmlWriter, BAD_CAST( OUStringToOString(rPropertyValue.Name, RTL_TEXTENCODING_UTF8).getStr() ));
1169 sal_Int32 i = 0, nCount = aPropSeq.getLength();
1170 for ( ; i < nCount; i++ )
1171 dumpPropertyValueAsElement(aPropSeq[ i ], xmlWriter);
1173 xmlTextWriterEndElement(xmlWriter);
1176 // TODO: Add here dumping of XDocument for future OOX Smart-Art
1177 // properties.
1179 // TODO more, if necessary
1181 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("handle"), "%" SAL_PRIdINT32, rPropertyValue.Handle);
1183 switch(rPropertyValue.State)
1185 case beans::PropertyState_DIRECT_VALUE:
1186 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "DIRECT_VALUE");
1187 break;
1188 case beans::PropertyState_DEFAULT_VALUE:
1189 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "DEFAULT_VALUE");
1190 break;
1191 case beans::PropertyState_AMBIGUOUS_VALUE:
1192 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "AMBIGUOUS_VALUE");
1193 break;
1194 default:
1195 break;
1197 xmlTextWriterEndElement( xmlWriter );
1200 void dumpCustomShapeGeometryAsElement(const uno::Sequence< beans::PropertyValue>& aCustomShapeGeometry, xmlTextWriterPtr xmlWriter)
1202 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "CustomShapeGeometry" ));
1204 sal_Int32 nLength = aCustomShapeGeometry.getLength();
1205 for (sal_Int32 i = 0; i < nLength; ++i)
1206 dumpPropertyValueAsElement(aCustomShapeGeometry[i], xmlWriter);
1208 xmlTextWriterEndElement( xmlWriter );
1211 void dumpCustomShapeReplacementURLAsAttribute(const OUString& sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter)
1213 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeReplacementURL"), "%s",
1214 OUStringToOString(sCustomShapeReplacementURL, RTL_TEXTENCODING_UTF8).getStr());
1217 // methods dumping whole services
1219 void dumpTextPropertiesService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1221 uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
1222 if(xInfo->hasPropertyByName("CharHeight"))
1224 uno::Any anotherAny = xPropSet->getPropertyValue("CharHeight");
1225 float fHeight;
1226 if(anotherAny >>= fHeight)
1227 dumpCharHeightAsAttribute(fHeight, xmlWriter);
1229 if(xInfo->hasPropertyByName("CharColor"))
1231 uno::Any anotherAny = xPropSet->getPropertyValue("CharColor");
1232 sal_Int32 aColor = sal_Int32();
1233 if(anotherAny >>= aColor)
1234 dumpCharColorAsAttribute(aColor, xmlWriter);
1236 // TODO - more properties from CharacterProperties.idl (similar to above)
1238 if(xInfo->hasPropertyByName("IsNumbering"))
1240 uno::Any anotherAny = xPropSet->getPropertyValue("IsNumbering");
1241 bool bIsNumbering;
1242 if(anotherAny >>= bIsNumbering)
1243 dumpIsNumberingAsAttribute(bIsNumbering, xmlWriter);
1246 uno::Any anotherAny = xPropSet->getPropertyValue("TextAutoGrowHeight");
1247 bool bTextAutoGrowHeight;
1248 if(anotherAny >>= bTextAutoGrowHeight)
1249 dumpTextAutoGrowHeightAsAttribute(bTextAutoGrowHeight, xmlWriter);
1252 uno::Any anotherAny = xPropSet->getPropertyValue("TextAutoGrowWidth");
1253 bool bTextAutoGrowWidth;
1254 if(anotherAny >>= bTextAutoGrowWidth)
1255 dumpTextAutoGrowWidthAsAttribute(bTextAutoGrowWidth, xmlWriter);
1258 uno::Any anotherAny = xPropSet->getPropertyValue("TextContourFrame");
1259 bool bTextContourFrame;
1260 if(anotherAny >>= bTextContourFrame)
1261 dumpTextContourFrameAsAttribute(bTextContourFrame, xmlWriter);
1264 uno::Any anotherAny = xPropSet->getPropertyValue("TextFitToSize");
1265 drawing::TextFitToSizeType eTextFitToSize;
1266 if(anotherAny >>= eTextFitToSize)
1267 dumpTextFitToSizeAsAttribute(eTextFitToSize, xmlWriter);
1270 uno::Any anotherAny = xPropSet->getPropertyValue("TextHorizontalAdjust");
1271 drawing::TextHorizontalAdjust eTextHorizontalAdjust;
1272 if(anotherAny >>= eTextHorizontalAdjust)
1273 dumpTextHorizontalAdjustAsAttribute(eTextHorizontalAdjust, xmlWriter);
1276 uno::Any anotherAny = xPropSet->getPropertyValue("TextVerticalAdjust");
1277 drawing::TextVerticalAdjust eTextVerticalAdjust;
1278 if(anotherAny >>= eTextVerticalAdjust)
1279 dumpTextVerticalAdjustAsAttribute(eTextVerticalAdjust, xmlWriter);
1282 uno::Any anotherAny = xPropSet->getPropertyValue("TextLeftDistance");
1283 sal_Int32 aTextLeftDistance = sal_Int32();
1284 if(anotherAny >>= aTextLeftDistance)
1285 dumpTextLeftDistanceAsAttribute(aTextLeftDistance, xmlWriter);
1288 uno::Any anotherAny = xPropSet->getPropertyValue("TextRightDistance");
1289 sal_Int32 aTextRightDistance = sal_Int32();
1290 if(anotherAny >>= aTextRightDistance)
1291 dumpTextRightDistanceAsAttribute(aTextRightDistance, xmlWriter);
1294 uno::Any anotherAny = xPropSet->getPropertyValue("TextUpperDistance");
1295 sal_Int32 aTextUpperDistance = sal_Int32();
1296 if(anotherAny >>= aTextUpperDistance)
1297 dumpTextUpperDistanceAsAttribute(aTextUpperDistance, xmlWriter);
1300 uno::Any anotherAny = xPropSet->getPropertyValue("TextLowerDistance");
1301 sal_Int32 aTextLowerDistance = sal_Int32();
1302 if(anotherAny >>= aTextLowerDistance)
1303 dumpTextLowerDistanceAsAttribute(aTextLowerDistance, xmlWriter);
1306 uno::Any anotherAny = xPropSet->getPropertyValue("TextMaximumFrameHeight");
1307 sal_Int32 aTextMaximumFrameHeight = sal_Int32();
1308 if(anotherAny >>= aTextMaximumFrameHeight)
1309 dumpTextMaximumFrameHeightAsAttribute(aTextMaximumFrameHeight, xmlWriter);
1312 uno::Any anotherAny = xPropSet->getPropertyValue("TextMaximumFrameWidth");
1313 sal_Int32 aTextMaximumFrameWidth = sal_Int32();
1314 if(anotherAny >>= aTextMaximumFrameWidth)
1315 dumpTextMaximumFrameWidthAsAttribute(aTextMaximumFrameWidth, xmlWriter);
1318 uno::Any anotherAny = xPropSet->getPropertyValue("TextMinimumFrameHeight");
1319 sal_Int32 aTextMinimumFrameHeight = sal_Int32();
1320 if(anotherAny >>= aTextMinimumFrameHeight)
1321 dumpTextMinimumFrameHeightAsAttribute(aTextMinimumFrameHeight, xmlWriter);
1324 uno::Any anotherAny = xPropSet->getPropertyValue("TextMinimumFrameWidth");
1325 sal_Int32 aTextMinimumFrameWidth = sal_Int32();
1326 if(anotherAny >>= aTextMinimumFrameWidth)
1327 dumpTextMinimumFrameWidthAsAttribute(aTextMinimumFrameWidth, xmlWriter);
1330 uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationAmount");
1331 sal_Int32 aTextAnimationAmount = sal_Int32();
1332 if(anotherAny >>= aTextAnimationAmount)
1333 dumpTextAnimationAmountAsAttribute(aTextAnimationAmount, xmlWriter);
1336 uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationCount");
1337 sal_Int32 aTextAnimationCount = sal_Int32();
1338 if(anotherAny >>= aTextAnimationCount)
1339 dumpTextAnimationCountAsAttribute(aTextAnimationCount, xmlWriter);
1342 uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationDelay");
1343 sal_Int32 aTextAnimationDelay = sal_Int32();
1344 if(anotherAny >>= aTextAnimationDelay)
1345 dumpTextAnimationDelayAsAttribute(aTextAnimationDelay, xmlWriter);
1348 uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationDirection");
1349 drawing::TextAnimationDirection eTextAnimationDirection;
1350 if(anotherAny >>= eTextAnimationDirection)
1351 dumpTextAnimationDirectionAsAttribute(eTextAnimationDirection, xmlWriter);
1354 uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationKind");
1355 drawing::TextAnimationKind eTextAnimationKind;
1356 if(anotherAny >>= eTextAnimationKind)
1357 dumpTextAnimationKindAsAttribute(eTextAnimationKind, xmlWriter);
1360 uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationStartInside");
1361 bool bTextAnimationStartInside;
1362 if(anotherAny >>= bTextAnimationStartInside)
1363 dumpTextAnimationStartInsideAsAttribute(bTextAnimationStartInside, xmlWriter);
1366 uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationStopInside");
1367 bool bTextAnimationStopInside;
1368 if(anotherAny >>= bTextAnimationStopInside)
1369 dumpTextAnimationStopInsideAsAttribute(bTextAnimationStopInside, xmlWriter);
1372 uno::Any anotherAny = xPropSet->getPropertyValue("TextWritingMode");
1373 text::WritingMode eTextWritingMode;
1374 if(anotherAny >>= eTextWritingMode)
1375 dumpTextWritingModeAsAttribute(eTextWritingMode, xmlWriter);
1379 void dumpFillPropertiesService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1382 uno::Any anotherAny = xPropSet->getPropertyValue("FillStyle");
1383 drawing::FillStyle eFillStyle;
1384 if(anotherAny >>= eFillStyle)
1385 dumpFillStyleAsAttribute(eFillStyle, xmlWriter);
1388 uno::Any anotherAny = xPropSet->getPropertyValue("FillColor");
1389 sal_Int32 aColor = sal_Int32();
1390 if(anotherAny >>= aColor)
1391 dumpFillColorAsAttribute(aColor, xmlWriter);
1394 uno::Any anotherAny = xPropSet->getPropertyValue("FillTransparence");
1395 sal_Int32 aTransparence = sal_Int32();
1396 if(anotherAny >>= aTransparence)
1397 dumpFillTransparenceAsAttribute(aTransparence, xmlWriter);
1400 uno::Any anotherAny = xPropSet->getPropertyValue("FillTransparenceGradientName");
1401 OUString sTranspGradName;
1402 if(anotherAny >>= sTranspGradName)
1403 dumpFillTransparenceGradientNameAsAttribute(sTranspGradName, xmlWriter);
1406 uno::Any anotherAny = xPropSet->getPropertyValue("FillTransparenceGradient");
1407 awt::Gradient aTranspGrad;
1408 if(anotherAny >>= aTranspGrad)
1409 dumpFillTransparenceGradientAsElement(aTranspGrad, xmlWriter);
1412 uno::Any anotherAny = xPropSet->getPropertyValue("FillGradientName");
1413 OUString sGradName;
1414 if(anotherAny >>= sGradName)
1415 dumpFillGradientNameAsAttribute(sGradName, xmlWriter);
1418 uno::Any anotherAny = xPropSet->getPropertyValue("FillGradient");
1419 awt::Gradient aGradient;
1420 if(anotherAny >>= aGradient)
1421 dumpFillGradientAsElement(aGradient, xmlWriter);
1424 uno::Any anotherAny = xPropSet->getPropertyValue("FillHatchName");
1425 OUString sHatchName;
1426 if(anotherAny >>= sHatchName)
1427 dumpFillGradientNameAsAttribute(sHatchName, xmlWriter);
1430 uno::Any anotherAny = xPropSet->getPropertyValue("FillHatch");
1431 drawing::Hatch aHatch;
1432 if(anotherAny >>= aHatch)
1433 dumpFillHatchAsElement(aHatch, xmlWriter);
1436 uno::Any anotherAny = xPropSet->getPropertyValue("FillBackground");
1437 bool bFillBackground;
1438 if(anotherAny >>= bFillBackground)
1439 dumpFillBackgroundAsAttribute(bFillBackground, xmlWriter);
1442 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapName");
1443 OUString sBitmapName;
1444 if(anotherAny >>= sBitmapName)
1445 dumpFillGradientNameAsAttribute(sBitmapName, xmlWriter);
1448 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmap");
1449 uno::Reference<awt::XBitmap> xBitmap;
1450 if(anotherAny >>= xBitmap)
1451 dumpFillBitmapAsElement(xBitmap, xmlWriter);
1454 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapURL");
1455 OUString sBitmapURL;
1456 if(anotherAny >>= sBitmapURL)
1457 dumpFillBitmapURLAsAttribute(sBitmapURL, xmlWriter);
1460 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapPositionOffsetX");
1461 sal_Int32 aBitmapPositionOffsetX = sal_Int32();
1462 if(anotherAny >>= aBitmapPositionOffsetX)
1463 dumpFillBitmapPositionOffsetXAsAttribute(aBitmapPositionOffsetX, xmlWriter);
1466 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapPositionOffsetY");
1467 sal_Int32 aBitmapPositionOffsetY = sal_Int32();
1468 if(anotherAny >>= aBitmapPositionOffsetY)
1469 dumpFillBitmapPositionOffsetYAsAttribute(aBitmapPositionOffsetY, xmlWriter);
1472 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapOffsetX");
1473 sal_Int32 aBitmapOffsetX = sal_Int32();
1474 if(anotherAny >>= aBitmapOffsetX)
1475 dumpFillBitmapOffsetXAsAttribute(aBitmapOffsetX, xmlWriter);
1478 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapOffsetY");
1479 sal_Int32 aBitmapOffsetY = sal_Int32();
1480 if(anotherAny >>= aBitmapOffsetY)
1481 dumpFillBitmapOffsetYAsAttribute(aBitmapOffsetY, xmlWriter);
1484 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapRectanglePoint");
1485 drawing::RectanglePoint eBitmapRectanglePoint;
1486 if(anotherAny >>= eBitmapRectanglePoint)
1487 dumpFillBitmapRectanglePointAsAttribute(eBitmapRectanglePoint, xmlWriter);
1490 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapLogicalSize");
1491 bool bBitmapLogicalSize;
1492 if(anotherAny >>= bBitmapLogicalSize)
1493 dumpFillBitmapLogicalSizeAsAttribute(bBitmapLogicalSize, xmlWriter);
1496 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapSizeX");
1497 sal_Int32 aBitmapSizeX = sal_Int32();
1498 if(anotherAny >>= aBitmapSizeX)
1499 dumpFillBitmapSizeXAsAttribute(aBitmapSizeX, xmlWriter);
1502 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapSizeY");
1503 sal_Int32 aBitmapSizeY = sal_Int32();
1504 if(anotherAny >>= aBitmapSizeY)
1505 dumpFillBitmapSizeYAsAttribute(aBitmapSizeY, xmlWriter);
1508 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapMode");
1509 drawing::BitmapMode eBitmapMode;
1510 if(anotherAny >>= eBitmapMode)
1511 dumpFillBitmapModeAsAttribute(eBitmapMode, xmlWriter);
1514 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapStretch");
1515 bool bBitmapStretch;
1516 if(anotherAny >>= bBitmapStretch)
1517 dumpFillBitmapStretchAsAttribute(bBitmapStretch, xmlWriter);
1520 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapTile");
1521 bool bBitmapTile;
1522 if(anotherAny >>= bBitmapTile)
1523 dumpFillBitmapTileAsAttribute(bBitmapTile, xmlWriter);
1527 void dumpLinePropertiesService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1530 uno::Any anotherAny = xPropSet->getPropertyValue("LineStyle");
1531 drawing::LineStyle eLineStyle;
1532 if(anotherAny >>= eLineStyle)
1533 dumpLineStyleAsAttribute(eLineStyle, xmlWriter);
1536 uno::Any anotherAny = xPropSet->getPropertyValue("LineDash");
1537 drawing::LineDash aLineDash;
1538 if(anotherAny >>= aLineDash)
1539 dumpLineDashAsElement(aLineDash, xmlWriter);
1542 uno::Any anotherAny = xPropSet->getPropertyValue("LineDashName");
1543 OUString sLineDashName;
1544 if(anotherAny >>= sLineDashName)
1545 dumpLineDashNameAsAttribute(sLineDashName, xmlWriter);
1548 uno::Any anotherAny = xPropSet->getPropertyValue("LineColor");
1549 sal_Int32 aLineColor = sal_Int32();
1550 if(anotherAny >>= aLineColor)
1551 dumpLineColorAsAttribute(aLineColor, xmlWriter);
1554 uno::Any anotherAny = xPropSet->getPropertyValue("LineTransparence");
1555 sal_Int32 aLineTransparence = sal_Int32();
1556 if(anotherAny >>= aLineTransparence)
1557 dumpLineTransparenceAsAttribute(aLineTransparence, xmlWriter);
1560 uno::Any anotherAny = xPropSet->getPropertyValue("LineWidth");
1561 sal_Int32 aLineWidth = sal_Int32();
1562 if(anotherAny >>= aLineWidth)
1563 dumpLineWidthAsAttribute(aLineWidth, xmlWriter);
1566 uno::Any anotherAny = xPropSet->getPropertyValue("LineJoint");
1567 drawing::LineJoint eLineJoint;
1568 if(anotherAny >>= eLineJoint)
1569 dumpLineJointAsAttribute(eLineJoint, xmlWriter);
1572 uno::Any anotherAny = xPropSet->getPropertyValue("LineStartName");
1573 OUString sLineStartName;
1574 if(anotherAny >>= sLineStartName)
1575 dumpLineStartNameAsAttribute(sLineStartName, xmlWriter);
1578 uno::Any anotherAny = xPropSet->getPropertyValue("LineEndName");
1579 OUString sLineEndName;
1580 if(anotherAny >>= sLineEndName)
1581 dumpLineEndNameAsAttribute(sLineEndName, xmlWriter);
1584 uno::Any anotherAny = xPropSet->getPropertyValue("LineStart");
1585 drawing::PolyPolygonBezierCoords aLineStart;
1586 if(anotherAny >>= aLineStart)
1587 dumpLineStartAsElement(aLineStart, xmlWriter);
1590 uno::Any anotherAny = xPropSet->getPropertyValue("LineEnd");
1591 drawing::PolyPolygonBezierCoords aLineEnd;
1592 if(anotherAny >>= aLineEnd)
1593 dumpLineEndAsElement(aLineEnd, xmlWriter);
1596 uno::Any anotherAny = xPropSet->getPropertyValue("LineStartCenter");
1597 bool bLineStartCenter;
1598 if(anotherAny >>= bLineStartCenter)
1599 dumpLineStartCenterAsAttribute(bLineStartCenter, xmlWriter);
1602 uno::Any anotherAny = xPropSet->getPropertyValue("LineStartWidth");
1603 sal_Int32 aLineStartWidth = sal_Int32();
1604 if(anotherAny >>= aLineStartWidth)
1605 dumpLineStartWidthAsAttribute(aLineStartWidth, xmlWriter);
1608 uno::Any anotherAny = xPropSet->getPropertyValue("LineEndCenter");
1609 bool bLineEndCenter;
1610 if(anotherAny >>= bLineEndCenter)
1611 dumpLineEndCenterAsAttribute(bLineEndCenter, xmlWriter);
1614 uno::Any anotherAny = xPropSet->getPropertyValue("LineEndWidth");
1615 sal_Int32 aLineEndWidth = sal_Int32();
1616 if(anotherAny >>= aLineEndWidth)
1617 dumpLineEndWidthAsAttribute(aLineEndWidth, xmlWriter);
1621 void dumpShadowPropertiesService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1624 uno::Any anotherAny = xPropSet->getPropertyValue("Shadow");
1625 bool bShadow;
1626 if(anotherAny >>= bShadow)
1627 dumpShadowAsAttribute(bShadow, xmlWriter);
1630 uno::Any anotherAny = xPropSet->getPropertyValue("ShadowColor");
1631 sal_Int32 aShadowColor = sal_Int32();
1632 if(anotherAny >>= aShadowColor)
1633 dumpShadowColorAsAttribute(aShadowColor, xmlWriter);
1636 uno::Any anotherAny = xPropSet->getPropertyValue("ShadowTransparence");
1637 sal_Int32 aShadowTransparence = sal_Int32();
1638 if(anotherAny >>= aShadowTransparence)
1639 dumpShadowTransparenceAsAttribute(aShadowTransparence, xmlWriter);
1642 uno::Any anotherAny = xPropSet->getPropertyValue("ShadowXDistance");
1643 sal_Int32 aShadowXDistance = sal_Int32();
1644 if(anotherAny >>= aShadowXDistance)
1645 dumpShadowXDistanceAsAttribute(aShadowXDistance, xmlWriter);
1648 uno::Any anotherAny = xPropSet->getPropertyValue("ShadowYDistance");
1649 sal_Int32 aShadowYDistance = sal_Int32();
1650 if(anotherAny >>= aShadowYDistance)
1651 dumpShadowYDistanceAsAttribute(aShadowYDistance, xmlWriter);
1655 void dumpPolyPolygonDescriptorService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1658 uno::Any anotherAny = xPropSet->getPropertyValue("PolygonKind");
1659 drawing::PolygonKind ePolygonKind;
1660 if(anotherAny >>= ePolygonKind)
1661 dumpPolygonKindAsAttribute(ePolygonKind, xmlWriter);
1664 uno::Any anotherAny = xPropSet->getPropertyValue("PolyPolygon");
1665 drawing::PointSequenceSequence aPolyPolygon;
1666 if(anotherAny >>= aPolyPolygon)
1667 dumpPolyPolygonAsElement(aPolyPolygon, xmlWriter);
1670 uno::Any anotherAny = xPropSet->getPropertyValue("Geometry");
1671 drawing::PointSequenceSequence aGeometry;
1672 if(anotherAny >>= aGeometry)
1673 dumpGeometryAsElement(aGeometry, xmlWriter);
1677 void dumpShapeService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties)
1679 uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
1681 uno::Any anotherAny = xPropSet->getPropertyValue("ZOrder");
1682 sal_Int32 aZOrder = sal_Int32();
1683 if(anotherAny >>= aZOrder)
1684 dumpZOrderAsAttribute(aZOrder, xmlWriter);
1687 uno::Any anotherAny = xPropSet->getPropertyValue("LayerID");
1688 sal_Int32 aLayerID = sal_Int32();
1689 if(anotherAny >>= aLayerID)
1690 dumpLayerIDAsAttribute(aLayerID, xmlWriter);
1693 uno::Any anotherAny = xPropSet->getPropertyValue("LayerName");
1694 OUString sLayerName;
1695 if(anotherAny >>= sLayerName)
1696 dumpLayerNameAsAttribute(sLayerName, xmlWriter);
1699 uno::Any anotherAny = xPropSet->getPropertyValue("Visible");
1700 bool bVisible;
1701 if(anotherAny >>= bVisible)
1702 dumpVisibleAsAttribute(bVisible, xmlWriter);
1705 uno::Any anotherAny = xPropSet->getPropertyValue("Printable");
1706 bool bPrintable;
1707 if(anotherAny >>= bPrintable)
1708 dumpPrintableAsAttribute(bPrintable, xmlWriter);
1711 uno::Any anotherAny = xPropSet->getPropertyValue("MoveProtect");
1712 bool bMoveProtect;
1713 if(anotherAny >>= bMoveProtect)
1714 dumpMoveProtectAsAttribute(bMoveProtect, xmlWriter);
1717 uno::Any anotherAny = xPropSet->getPropertyValue("Name");
1718 OUString sName;
1719 if(anotherAny >>= sName)
1720 dumpNameAsAttribute(sName, xmlWriter);
1723 uno::Any anotherAny = xPropSet->getPropertyValue("SizeProtect");
1724 bool bSizeProtect;
1725 if(anotherAny >>= bSizeProtect)
1726 dumpSizeProtectAsAttribute(bSizeProtect, xmlWriter);
1729 uno::Any anotherAny = xPropSet->getPropertyValue("Transformation");
1730 drawing::HomogenMatrix3 aTransformation;
1731 if(anotherAny >>= aTransformation)
1732 dumpTransformationAsElement(aTransformation, xmlWriter);
1735 uno::Any anotherAny = xPropSet->getPropertyValue("NavigationOrder");
1736 sal_Int32 aNavigationOrder = sal_Int32();
1737 if(anotherAny >>= aNavigationOrder)
1738 dumpNavigationOrderAsAttribute(aNavigationOrder, xmlWriter);
1740 if(xInfo->hasPropertyByName("Hyperlink"))
1742 uno::Any anotherAny = xPropSet->getPropertyValue("Hyperlink");
1743 OUString sHyperlink;
1744 if(anotherAny >>= sHyperlink)
1745 dumpHyperlinkAsAttribute(sHyperlink, xmlWriter);
1747 if(xInfo->hasPropertyByName("InteropGrabBag") && bDumpInteropProperties)
1749 uno::Any anotherAny = xPropSet->getPropertyValue("InteropGrabBag");
1750 uno::Sequence< beans::PropertyValue> aInteropGrabBag;
1751 if(anotherAny >>= aInteropGrabBag)
1752 dumpInteropGrabBagAsElement(aInteropGrabBag, xmlWriter);
1756 void dumpPolyPolygonBezierDescriptorService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1759 uno::Any anotherAny = xPropSet->getPropertyValue("PolygonKind");
1760 drawing::PolygonKind ePolygonKind;
1761 if(anotherAny >>= ePolygonKind)
1762 dumpPolygonKindAsAttribute(ePolygonKind, xmlWriter);
1765 uno::Any anotherAny = xPropSet->getPropertyValue("PolyPolygonBezier");
1766 drawing::PolyPolygonBezierCoords aPolyPolygonBezier;
1767 if(anotherAny >>= aPolyPolygonBezier)
1768 dumpPolyPolygonBezierCoords(aPolyPolygonBezier, xmlWriter);
1771 uno::Any anotherAny = xPropSet->getPropertyValue("Geometry");
1772 drawing::PolyPolygonBezierCoords aGeometry;
1773 if(anotherAny >>= aGeometry)
1774 dumpPolyPolygonBezierCoords(aGeometry, xmlWriter);
1778 void dumpCustomShapeService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1780 uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
1782 uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeEngine");
1783 OUString sCustomShapeEngine;
1784 if(anotherAny >>= sCustomShapeEngine)
1785 dumpCustomShapeEngineAsAttribute(sCustomShapeEngine, xmlWriter);
1788 uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeData");
1789 OUString sCustomShapeData;
1790 if(anotherAny >>= sCustomShapeData)
1791 dumpCustomShapeDataAsAttribute(sCustomShapeData, xmlWriter);
1794 uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeGeometry");
1795 uno::Sequence< beans::PropertyValue> aCustomShapeGeometry;
1796 if(anotherAny >>= aCustomShapeGeometry)
1797 dumpCustomShapeGeometryAsElement(aCustomShapeGeometry, xmlWriter);
1799 if(xInfo->hasPropertyByName("CustomShapeReplacementURL"))
1801 uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeReplacementURL");
1802 OUString sCustomShapeReplacementURL;
1803 if(anotherAny >>= sCustomShapeReplacementURL)
1804 dumpCustomShapeReplacementURLAsAttribute(sCustomShapeReplacementURL, xmlWriter);
1808 void dumpXShape(const uno::Reference< drawing::XShape >& xShape, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties)
1810 xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShape" ) );
1811 uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY_THROW);
1812 uno::Reference<beans::XPropertySetInfo> xPropSetInfo = xPropSet->getPropertySetInfo();
1813 OUString aName;
1814 m_bNameDumped = false;
1816 dumpPositionAsAttribute(xShape->getPosition(), xmlWriter);
1817 dumpSizeAsAttribute(xShape->getSize(), xmlWriter);
1818 uno::Reference< drawing::XShapeDescriptor > xDescr(xShape, uno::UNO_QUERY_THROW);
1819 dumpShapeDescriptorAsAttribute(xDescr, xmlWriter);
1821 // uno::Sequence<beans::Property> aProperties = xPropSetInfo->getProperties();
1823 uno::Reference< lang::XServiceInfo > xServiceInfo( xShape, uno::UNO_QUERY_THROW );
1825 uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
1826 if(xInfo->hasPropertyByName("Name"))
1828 uno::Any aAny = xPropSet->getPropertyValue("Name");
1829 if (aAny >>= aName)
1831 if (!aName.isEmpty())
1833 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("name"), "%s", OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
1834 m_bNameDumped = true;
1841 if (xServiceInfo->supportsService("com.sun.star.drawing.Text"))
1843 uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY_THROW);
1844 OUString aText = xText->getString();
1845 if(!aText.isEmpty())
1846 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("text"), "%s", OUStringToOString(aText, RTL_TEXTENCODING_UTF8).getStr());
1848 if(xServiceInfo->supportsService("com.sun.star.drawing.TextProperties"))
1849 dumpTextPropertiesService(xPropSet, xmlWriter);
1851 if(xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"))
1853 uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY_THROW);
1854 dumpXShapes(xShapes, xmlWriter, bDumpInteropProperties);
1856 if(xServiceInfo->supportsService("com.sun.star.drawing.FillProperties"))
1857 dumpFillPropertiesService(xPropSet, xmlWriter);
1859 if(xServiceInfo->supportsService("com.sun.star.drawing.LineProperties"))
1860 dumpLinePropertiesService(xPropSet, xmlWriter);
1862 if(xServiceInfo->supportsService("com.sun.star.drawing.PolyPolygonDescriptor"))
1863 dumpPolyPolygonDescriptorService(xPropSet, xmlWriter);
1865 if(xServiceInfo->supportsService("com.sun.star.drawing.ShadowProperties"))
1866 dumpShadowPropertiesService(xPropSet, xmlWriter);
1868 if(xServiceInfo->supportsService("com.sun.star.drawing.Shape"))
1869 dumpShapeService(xPropSet, xmlWriter, bDumpInteropProperties);
1871 if(xServiceInfo->supportsService("com.sun.star.drawing.PolyPolygonBezierDescriptor"))
1872 dumpPolyPolygonBezierDescriptorService(xPropSet, xmlWriter);
1874 if(xServiceInfo->supportsService("com.sun.star.drawing.CustomShape"))
1875 dumpCustomShapeService(xPropSet, xmlWriter);
1877 // EnhancedShapeDumper used
1879 if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeExtrusion"))
1881 EnhancedShapeDumper enhancedDumper(xmlWriter);
1882 enhancedDumper.dumpEnhancedCustomShapeExtrusionService(xPropSet);
1884 if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeGeometry"))
1886 EnhancedShapeDumper enhancedDumper(xmlWriter);
1887 enhancedDumper.dumpEnhancedCustomShapeGeometryService(xPropSet);
1889 if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeHandle"))
1891 EnhancedShapeDumper enhancedDumper(xmlWriter);
1892 enhancedDumper.dumpEnhancedCustomShapeHandleService(xPropSet);
1894 if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapePath"))
1896 EnhancedShapeDumper enhancedDumper(xmlWriter);
1897 enhancedDumper.dumpEnhancedCustomShapePathService(xPropSet);
1899 if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeTextPath"))
1901 EnhancedShapeDumper enhancedDumper(xmlWriter);
1902 enhancedDumper.dumpEnhancedCustomShapeTextPathService(xPropSet);
1904 } // end of the 'try' block
1905 catch (const beans::UnknownPropertyException& e)
1907 std::cout << "Exception caught in XShapeDumper.cxx: " << e.Message << std::endl;
1910 #if DEBUG_DUMPER
1911 uno::Sequence< OUString > aServiceNames = xServiceInfo->getSupportedServiceNames();
1912 sal_Int32 nServices = aServiceNames.getLength();
1913 for (sal_Int32 i = 0; i < nServices; ++i)
1915 xmlTextWriterStartElement(xmlWriter, BAD_CAST( "ServiceName" ));
1916 xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST( "name" ), "%s", OUStringToOString(aServiceNames[i], RTL_TEXTENCODING_UTF8).getStr());
1917 xmlTextWriterEndElement( xmlWriter );
1919 #endif
1921 xmlTextWriterEndElement( xmlWriter );
1924 void dumpXShapes( const uno::Reference< drawing::XShapes >& xShapes, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties )
1926 xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShapes" ) );
1927 uno::Reference< container::XIndexAccess > xIA( xShapes, uno::UNO_QUERY_THROW);
1928 sal_Int32 nLength = xIA->getCount();
1929 for (sal_Int32 i = 0; i < nLength; ++i)
1931 uno::Reference< drawing::XShape > xShape( xIA->getByIndex( i ), uno::UNO_QUERY_THROW );
1932 dumpXShape( xShape, xmlWriter, bDumpInteropProperties );
1935 xmlTextWriterEndElement( xmlWriter );
1937 } //end of namespace
1939 OUString XShapeDumper::dump(const uno::Reference<drawing::XShapes>& xPageShapes, bool bDumpInteropProperties)
1941 OStringBuffer aString;
1942 xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO( writeCallback, closeCallback, &aString, nullptr );
1943 xmlTextWriterPtr xmlWriter = xmlNewTextWriter( xmlOutBuffer );
1944 xmlTextWriterSetIndent( xmlWriter, 1 );
1946 xmlTextWriterStartDocument( xmlWriter, nullptr, nullptr, nullptr );
1950 dumpXShapes( xPageShapes, xmlWriter, bDumpInteropProperties );
1952 catch (const beans::UnknownPropertyException& e)
1954 std::cout << "Exception caught in XShapeDumper: " << e.Message << std::endl;
1957 xmlTextWriterEndDocument( xmlWriter );
1958 xmlFreeTextWriter( xmlWriter );
1960 return OUString::fromUtf8(aString.makeStringAndClear());
1963 OUString XShapeDumper::dump(const uno::Reference<drawing::XShape>& xPageShapes, bool bDumpInteropProperties)
1965 OStringBuffer aString;
1966 xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO( writeCallback, closeCallback, &aString, nullptr );
1967 xmlTextWriterPtr xmlWriter = xmlNewTextWriter( xmlOutBuffer );
1968 xmlTextWriterSetIndent( xmlWriter, 1 );
1970 xmlTextWriterStartDocument( xmlWriter, nullptr, nullptr, nullptr );
1974 dumpXShape( xPageShapes, xmlWriter, bDumpInteropProperties );
1976 catch (const beans::UnknownPropertyException& e)
1978 std::cout << "Exception caught in XShapeDumper: " << e.Message << std::endl;
1981 xmlTextWriterEndDocument( xmlWriter );
1982 xmlFreeTextWriter( xmlWriter );
1984 return OUString::fromUtf8(aString.makeStringAndClear());
1987 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */