1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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  */
9 
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/drawing/FillStyle.hpp>
15 #include <com/sun/star/awt/Gradient.hpp>
16 #include <com/sun/star/drawing/Hatch.hpp>
17 #include <com/sun/star/awt/XBitmap.hpp>
18 #include <com/sun/star/drawing/RectanglePoint.hpp>
19 #include <com/sun/star/drawing/BitmapMode.hpp>
20 
21 #include <com/sun/star/drawing/LineStyle.hpp>
22 #include <com/sun/star/drawing/LineDash.hpp>
23 #include <com/sun/star/drawing/LineJoint.hpp>
24 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
25 
26 #include <com/sun/star/drawing/PolygonKind.hpp>
27 
28 #include <com/sun/star/drawing/TextFitToSizeType.hpp>
29 #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
30 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
31 #include <com/sun/star/drawing/TextAnimationDirection.hpp>
32 #include <com/sun/star/drawing/TextAnimationKind.hpp>
33 #include <com/sun/star/text/WritingMode.hpp>
34 
35 #include <com/sun/star/drawing/HomogenMatrixLine3.hpp>
36 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
37 
38 #include <com/sun/star/beans/PropertyValue.hpp>
39 #include <com/sun/star/lang/XServiceInfo.hpp>
40 #include <com/sun/star/beans/XPropertySet.hpp>
41 #include <com/sun/star/text/XText.hpp>
42 #include <rtl/strbuf.hxx>
43 #include <libxml/xmlwriter.h>
44 #include <iostream>
45 #include <rtl/ustring.hxx>
46 
47 #define DEBUG_DUMPER 0
48 
49 using namespace com::sun::star;
50 
51 namespace {
52 
53 // FUNCTION DECLARATIONS
54 
55 // auxiliary functions
56 void dumpGradientProperty(const css::awt::Gradient& rGradient, xmlTextWriterPtr xmlWriter);
57 void dumpPolyPolygonBezierCoords(const css::drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoords, xmlTextWriterPtr xmlWriter);
58 void dumpPointSequenceSequence(const css::drawing::PointSequenceSequence& rPointSequenceSequence, const uno::Sequence<uno::Sequence<drawing::PolygonFlags> >*, xmlTextWriterPtr xmlWriter);
59 void dumpPropertyValueAsElement(const beans::PropertyValue& rPropertyValue, xmlTextWriterPtr xmlWriter);
60 
61 // FillProperties.idl
62 void dumpFillStyleAsAttribute(css::drawing::FillStyle eFillStyle, xmlTextWriterPtr xmlWriter);
63 void dumpFillColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter);
64 void dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr xmlWriter);
65 void dumpFillTransparenceGradientNameAsAttribute(const OUString& sTranspGradName, xmlTextWriterPtr xmlWriter);
66 void dumpFillTransparenceGradientAsElement(const css::awt::Gradient& rTranspGrad, xmlTextWriterPtr xmlWriter);
67 void dumpFillGradientNameAsAttribute(const OUString& sGradName, xmlTextWriterPtr xmlWriter);
68 void dumpFillGradientAsElement(const css::awt::Gradient& rGradient, xmlTextWriterPtr xmlWriter);
69 void dumpFillHatchAsElement(const css::drawing::Hatch& rHatch, xmlTextWriterPtr xmlWriter);
70 void dumpFillBackgroundAsAttribute(bool bBackground, xmlTextWriterPtr xmlWriter);
71 void dumpFillBitmapAsElement(const css::uno::Reference<css::awt::XBitmap>& xBitmap, xmlTextWriterPtr xmlWriter);
72 void dumpFillBitmapPositionOffsetXAsAttribute(sal_Int32 aBitmapPositionOffsetX, xmlTextWriterPtr xmlWriter);
73 void dumpFillBitmapPositionOffsetYAsAttribute(sal_Int32 aBitmapPositionOffsetY, xmlTextWriterPtr xmlWriter);
74 void dumpFillBitmapOffsetXAsAttribute(sal_Int32 aBitmapOffsetX, xmlTextWriterPtr xmlWriter);
75 void dumpFillBitmapOffsetYAsAttribute(sal_Int32 aBitmapOffsetY, xmlTextWriterPtr xmlWriter);
76 void dumpFillBitmapRectanglePointAsAttribute(css::drawing::RectanglePoint eBitmapRectanglePoint, xmlTextWriterPtr xmlWriter);
77 void dumpFillBitmapLogicalSizeAsAttribute(bool bBitmapLogicalSize, xmlTextWriterPtr xmlWriter);
78 void dumpFillBitmapSizeXAsAttribute(sal_Int32 aBitmapSizeX, xmlTextWriterPtr xmlWriter);
79 void dumpFillBitmapSizeYAsAttribute(sal_Int32 aBitmapSizeY, xmlTextWriterPtr xmlWriter);
80 void dumpFillBitmapModeAsAttribute(css::drawing::BitmapMode eBitmapMode, xmlTextWriterPtr xmlWriter);
81 void dumpFillBitmapStretchAsAttribute(bool bBitmapStretch, xmlTextWriterPtr xmlWriter);
82 void dumpFillBitmapTileAsAttribute(bool bBitmapTile, xmlTextWriterPtr xmlWriter);
83 
84 // LineProperties.idl
85 void dumpLineStyleAsAttribute(css::drawing::LineStyle eLineStyle, xmlTextWriterPtr xmlWriter);
86 void dumpLineDashAsElement(const css::drawing::LineDash& rLineDash, xmlTextWriterPtr xmlWriter);
87 void dumpLineDashNameAsAttribute(const OUString& sLineDashName, xmlTextWriterPtr xmlWriter);
88 void dumpLineColorAsAttribute(sal_Int32 aLineColor, xmlTextWriterPtr xmlWriter);
89 void dumpLineTransparenceAsAttribute(sal_Int32 aLineTransparence, xmlTextWriterPtr xmlWriter);
90 void dumpLineWidthAsAttribute(sal_Int32 aLineWidth, xmlTextWriterPtr xmlWriter);
91 void dumpLineJointAsAttribute(css::drawing::LineJoint eLineJoint, xmlTextWriterPtr xmlWriter);
92 void dumpLineStartNameAsAttribute(const OUString& sLineStartName, xmlTextWriterPtr xmlWriter);
93 void dumpLineEndNameAsAttribute(const OUString& sLineEndName, xmlTextWriterPtr xmlWriter);
94 void dumpLineStartAsElement(const css::drawing::PolyPolygonBezierCoords& rLineStart, xmlTextWriterPtr xmlWriter);
95 void dumpLineEndAsElement(const css::drawing::PolyPolygonBezierCoords& rLineEnd, xmlTextWriterPtr xmlWriter);
96 void dumpLineStartCenterAsAttribute(bool bLineStartCenter, xmlTextWriterPtr xmlWriter);
97 void dumpLineStartWidthAsAttribute(sal_Int32 aLineStartWidth, xmlTextWriterPtr xmlWriter);
98 void dumpLineEndCenterAsAttribute(bool bLineEndCenter, xmlTextWriterPtr xmlWriter);
99 void dumpLineEndWidthAsAttribute(sal_Int32 aLineEndWidth, xmlTextWriterPtr xmlWriter);
100 
101 // PolyPolygonDescriptor.idl
102 void dumpPolygonKindAsAttribute(css::drawing::PolygonKind ePolygonKind, xmlTextWriterPtr xmlWriter);
103 void dumpPolyPolygonAsElement(const css::drawing::PointSequenceSequence& rPolyPolygon, xmlTextWriterPtr xmlWriter);
104 void dumpGeometryAsElement(const css::drawing::PointSequenceSequence& rGeometry, xmlTextWriterPtr xmlWriter);
105 
106 // CharacterProperties.idl
107 void dumpCharHeightAsAttribute(float fHeight, xmlTextWriterPtr xmlWriter);
108 void dumpCharColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter);
109 
110 // TextProperties.idl
111 void dumpIsNumberingAsAttribute(bool bIsNumbering, xmlTextWriterPtr xmlWriter);
112 void dumpTextAutoGrowHeightAsAttribute(bool bTextAutoGrowHeight, xmlTextWriterPtr xmlWriter);
113 void dumpTextAutoGrowWidthAsAttribute(bool bTextAutoGrowWidth, xmlTextWriterPtr xmlWriter);
114 void dumpTextContourFrameAsAttribute(bool bTextContourFrame, xmlTextWriterPtr xmlWriter);
115 void dumpTextFitToSizeAsAttribute(css::drawing::TextFitToSizeType eTextFitToSize, xmlTextWriterPtr xmlWriter);
116 void dumpTextHorizontalAdjustAsAttribute(css::drawing::TextHorizontalAdjust eTextHorizontalAdjust, xmlTextWriterPtr xmlWriter);
117 void dumpTextVerticalAdjustAsAttribute(css::drawing::TextVerticalAdjust eTextVerticalAdjust, xmlTextWriterPtr xmlWriter);
118 void dumpTextLeftDistanceAsAttribute(sal_Int32 aTextLeftDistance, xmlTextWriterPtr xmlWriter);
119 void dumpTextRightDistanceAsAttribute(sal_Int32 aTextRightDistance, xmlTextWriterPtr xmlWriter);
120 void dumpTextUpperDistanceAsAttribute(sal_Int32 aTextUpperDistance, xmlTextWriterPtr xmlWriter);
121 void dumpTextLowerDistanceAsAttribute(sal_Int32 aTextLowerDistance, xmlTextWriterPtr xmlWriter);
122 void dumpTextMaximumFrameHeightAsAttribute(sal_Int32 aTextMaximumFrameHeight, xmlTextWriterPtr xmlWriter);
123 void dumpTextMaximumFrameWidthAsAttribute(sal_Int32 aTextMaximumFrameWidth, xmlTextWriterPtr xmlWriter);
124 void dumpTextMinimumFrameHeightAsAttribute(sal_Int32 aTextMinimumFrameHeight, xmlTextWriterPtr xmlWriter);
125 void dumpTextMinimumFrameWidthAsAttribute(sal_Int32 aTextMinimumFrameWidth, xmlTextWriterPtr xmlWriter);
126 void dumpTextAnimationAmountAsAttribute(sal_Int32 aTextAnimationAmount, xmlTextWriterPtr xmlWriter);
127 void dumpTextAnimationCountAsAttribute(sal_Int32 aTextAnimationCount, xmlTextWriterPtr xmlWriter);
128 void dumpTextAnimationDelayAsAttribute(sal_Int32 aTextAnimationDelay, xmlTextWriterPtr xmlWriter);
129 void dumpTextAnimationDirectionAsAttribute(css::drawing::TextAnimationDirection eTextAnimationDirection, xmlTextWriterPtr xmlWriter);
130 void dumpTextAnimationKindAsAttribute(css::drawing::TextAnimationKind eTextAnimationKind, xmlTextWriterPtr xmlWriter);
131 void dumpTextAnimationStartInsideAsAttribute(bool bTextAnimationStartInside, xmlTextWriterPtr xmlWriter);
132 void dumpTextAnimationStopInsideAsAttribute(bool bTextAnimationStopInside, xmlTextWriterPtr xmlWriter);
133 void dumpTextWritingModeAsAttribute(css::text::WritingMode eWritingMode, xmlTextWriterPtr xmlWriter);
134 
135 // ShadowProperties.idl
136 void dumpShadowAsAttribute(bool bShadow, xmlTextWriterPtr xmlWriter);
137 void dumpShadowColorAsAttribute(sal_Int32 aShadowColor, xmlTextWriterPtr xmlWriter);
138 void dumpShadowTransparenceAsAttribute(sal_Int32 aShadowTransparence, xmlTextWriterPtr xmlWriter);
139 void dumpShadowXDistanceAsAttribute(sal_Int32 aShadowXDistance, xmlTextWriterPtr xmlWriter);
140 void dumpShadowYDistanceAsAttribute(sal_Int32 aShadowYDistance, xmlTextWriterPtr xmlWriter);
141 
142 //Shape.idl
143 void dumpZOrderAsAttribute(sal_Int32 aZOrder, xmlTextWriterPtr xmlWriter);
144 void dumpLayerIDAsAttribute(sal_Int32 aLayerID, xmlTextWriterPtr xmlWriter);
145 void dumpLayerNameAsAttribute(const OUString& sLayerName, xmlTextWriterPtr xmlWriter);
146 void dumpVisibleAsAttribute(bool bVisible, xmlTextWriterPtr xmlWriter);
147 void dumpPrintableAsAttribute(bool bPrintable, xmlTextWriterPtr xmlWriter);
148 void dumpMoveProtectAsAttribute(bool bMoveProtect, xmlTextWriterPtr xmlWriter);
149 void dumpNameAsAttribute(const OUString& sName, xmlTextWriterPtr xmlWriter);
150 void dumpSizeProtectAsAttribute(bool bSizeProtect, xmlTextWriterPtr xmlWriter);
151 void dumpHomogenMatrixLine3(const css::drawing::HomogenMatrixLine3& rLine, xmlTextWriterPtr xmlWriter);
152 void dumpTransformationAsElement(const css::drawing::HomogenMatrix3& rTransformation, xmlTextWriterPtr xmlWriter);
153 void dumpNavigationOrderAsAttribute(sal_Int32 aNavigationOrder, xmlTextWriterPtr xmlWriter);
154 void dumpHyperlinkAsAttribute(const OUString& sHyperlink, xmlTextWriterPtr xmlWriter);
155 void dumpInteropGrabBagAsElement(const uno::Sequence< beans::PropertyValue>& aInteropGrabBag, xmlTextWriterPtr xmlWriter);
156 
157 // CustomShape.idl
158 void dumpCustomShapeEngineAsAttribute(const OUString& sCustomShapeEngine, xmlTextWriterPtr xmlWriter);
159 void dumpCustomShapeDataAsAttribute(const OUString& sCustomShapeData, xmlTextWriterPtr xmlWriter);
160 void dumpCustomShapeGeometryAsElement(const css::uno::Sequence< css::beans::PropertyValue>& aCustomShapeGeometry, xmlTextWriterPtr xmlWriter);
161 void dumpCustomShapeReplacementURLAsAttribute(const OUString& sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter);
162 
163 // XShape.idl
164 void dumpPositionAsAttribute(const css::awt::Point& rPoint, xmlTextWriterPtr xmlWriter);
165 void dumpSizeAsAttribute(const css::awt::Size& rSize, xmlTextWriterPtr xmlWriter);
166 
167 // the rest
168 void dumpShapeDescriptorAsAttribute( const css::uno::Reference< css::drawing::XShapeDescriptor >& xDescr, xmlTextWriterPtr xmlWriter );
169 void dumpXShape(const css::uno::Reference< css::drawing::XShape >& xShape, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties);
170 void dumpXShapes( const css::uno::Reference< css::drawing::XShapes >& xShapes, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties );
171 void dumpTextPropertiesService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter);
172 void dumpFillPropertiesService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter);
173 void dumpLinePropertiesService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter);
174 void dumpShadowPropertiesService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter);
175 void dumpPolyPolygonDescriptorService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter);
176 void dumpShapeService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties);
177 void dumpPolyPolygonBezierDescriptorService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter);
178 void dumpCustomShapeService(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter);
179 
180 
writeCallback(void * pContext,const char * sBuffer,int nLen)181 int writeCallback(void* pContext, const char* sBuffer, int nLen)
182 {
183     OStringBuffer* pBuffer = static_cast<OStringBuffer*>(pContext);
184     pBuffer->append(sBuffer);
185     return nLen;
186 }
187 
closeCallback(void *)188 int closeCallback(void* )
189 {
190     return 0;
191 }
192 
193 bool m_bNameDumped;
194 
195 
196 // ---------- FillProperties.idl ----------
197 
dumpFillStyleAsAttribute(drawing::FillStyle eFillStyle,xmlTextWriterPtr xmlWriter)198 void dumpFillStyleAsAttribute(drawing::FillStyle eFillStyle, xmlTextWriterPtr xmlWriter)
199 {
200     switch(eFillStyle)
201     {
202         case drawing::FillStyle_NONE:
203             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "NONE");
204             break;
205         case drawing::FillStyle_SOLID:
206             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "SOLID");
207             break;
208         case drawing::FillStyle_GRADIENT:
209             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "GRADIENT");
210             break;
211         case drawing::FillStyle_HATCH:
212             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "HATCH");
213             break;
214         case drawing::FillStyle_BITMAP:
215             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillStyle"), "%s", "BITMAP");
216             break;
217         default:
218             break;
219     }
220 }
221 
dumpFillColorAsAttribute(sal_Int32 aColor,xmlTextWriterPtr xmlWriter)222 void dumpFillColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter)
223 {
224     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillColor"), "%06x", static_cast<unsigned int>(aColor));
225 }
226 
dumpFillTransparenceAsAttribute(sal_Int32 aTransparence,xmlTextWriterPtr xmlWriter)227 void dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr xmlWriter)
228 {
229     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillTransparence"), "%" SAL_PRIdINT32, aTransparence);
230 }
231 
dumpFillTransparenceGradientNameAsAttribute(const OUString & sTranspGradName,xmlTextWriterPtr xmlWriter)232 void dumpFillTransparenceGradientNameAsAttribute(const OUString& sTranspGradName, xmlTextWriterPtr xmlWriter)
233 {
234     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillTransparenceGradientName"), "%s",
235         OUStringToOString(sTranspGradName, RTL_TEXTENCODING_UTF8).getStr());
236 }
237 
238 //because there's more awt::Gradient properties to dump
dumpGradientProperty(const awt::Gradient & rGradient,xmlTextWriterPtr xmlWriter)239 void dumpGradientProperty(const awt::Gradient& rGradient, xmlTextWriterPtr xmlWriter)
240 {
241     switch (rGradient.Style)   //enum GradientStyle
242     {
243         case awt::GradientStyle_LINEAR:
244             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "LINEAR");
245             break;
246         case awt::GradientStyle_AXIAL:
247             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "AXIAL");
248             break;
249         case awt::GradientStyle_RADIAL:
250             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "RADIAL");
251             break;
252         case awt::GradientStyle_ELLIPTICAL:
253             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "ELLIPTICAL");
254             break;
255         case awt::GradientStyle_SQUARE:
256             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "SQUARE");
257             break;
258         case awt::GradientStyle_RECT:
259             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "RECT");
260             break;
261         default:
262             break;
263     }
264     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("startColor"), "%06x", static_cast<unsigned int>(rGradient.StartColor));
265     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("endColor"), "%06x", static_cast<unsigned int>(rGradient.EndColor));
266     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("angle"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rGradient.Angle));
267     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("border"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rGradient.Border));
268     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("xOffset"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rGradient.XOffset));
269     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("yOffset"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rGradient.YOffset));
270     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("startIntensity"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rGradient.StartIntensity));
271     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("endIntensity"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rGradient.EndIntensity));
272     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("stepCount"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rGradient.StepCount));
273 }
274 
dumpFillTransparenceGradientAsElement(const awt::Gradient & rTranspGrad,xmlTextWriterPtr xmlWriter)275 void dumpFillTransparenceGradientAsElement(const awt::Gradient& rTranspGrad, xmlTextWriterPtr xmlWriter)
276 {
277     xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FillTransparenceGradient" ));
278     dumpGradientProperty(rTranspGrad, xmlWriter);
279     xmlTextWriterEndElement( xmlWriter );
280 }
281 
dumpFillGradientNameAsAttribute(const OUString & sGradName,xmlTextWriterPtr xmlWriter)282 void dumpFillGradientNameAsAttribute(const OUString& sGradName, xmlTextWriterPtr xmlWriter)
283 {
284     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillGradientName"), "%s",
285         OUStringToOString(sGradName, RTL_TEXTENCODING_UTF8).getStr());
286 }
287 
dumpFillGradientAsElement(const awt::Gradient & rGradient,xmlTextWriterPtr xmlWriter)288 void dumpFillGradientAsElement(const awt::Gradient& rGradient, xmlTextWriterPtr xmlWriter)
289 {
290     xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FillGradient" ));
291     dumpGradientProperty(rGradient, xmlWriter);
292     xmlTextWriterEndElement( xmlWriter );
293 }
294 
dumpFillHatchAsElement(const drawing::Hatch & rHatch,xmlTextWriterPtr xmlWriter)295 void dumpFillHatchAsElement(const drawing::Hatch& rHatch, xmlTextWriterPtr xmlWriter)
296 {
297     xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FillHatch" ));
298     switch (rHatch.Style)
299     {
300         case drawing::HatchStyle_SINGLE:
301             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "SINGLE");
302             break;
303         case drawing::HatchStyle_DOUBLE:
304             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "DOUBLE");
305             break;
306         case drawing::HatchStyle_TRIPLE:
307             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "TRIPLE");
308             break;
309         default:
310             break;
311     }
312     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("color"), "%06x", static_cast<unsigned int>(rHatch.Color));
313     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("distance"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rHatch.Distance));
314     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("angle"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rHatch.Angle));
315     xmlTextWriterEndElement( xmlWriter );
316 }
317 
dumpFillBackgroundAsAttribute(bool bBackground,xmlTextWriterPtr xmlWriter)318 void dumpFillBackgroundAsAttribute(bool bBackground, xmlTextWriterPtr xmlWriter)
319 {
320     if(bBackground)
321         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBackground"), "%s", "true");
322     else
323         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBackground"), "%s", "false");
324 }
325 
dumpFillBitmapAsElement(const uno::Reference<awt::XBitmap> & xBitmap,xmlTextWriterPtr xmlWriter)326 void dumpFillBitmapAsElement(const uno::Reference<awt::XBitmap>& xBitmap, xmlTextWriterPtr xmlWriter)
327 {
328     xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FillBitmap" ));
329     if (xBitmap.is())
330     {
331         awt::Size const aSize = xBitmap->getSize();
332         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("width"), "%" SAL_PRIdINT32, aSize.Width);
333         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("height"), "%" SAL_PRIdINT32, aSize.Height);
334     }
335     xmlTextWriterEndElement( xmlWriter );
336 }
337 
dumpFillBitmapPositionOffsetXAsAttribute(sal_Int32 aBitmapPositionOffsetX,xmlTextWriterPtr xmlWriter)338 void dumpFillBitmapPositionOffsetXAsAttribute(sal_Int32 aBitmapPositionOffsetX, xmlTextWriterPtr xmlWriter)
339 {
340     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapPositionOffsetX"), "%" SAL_PRIdINT32, aBitmapPositionOffsetX);
341 }
342 
dumpFillBitmapPositionOffsetYAsAttribute(sal_Int32 aBitmapPositionOffsetY,xmlTextWriterPtr xmlWriter)343 void dumpFillBitmapPositionOffsetYAsAttribute(sal_Int32 aBitmapPositionOffsetY, xmlTextWriterPtr xmlWriter)
344 {
345     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapPositionOffsetY"), "%" SAL_PRIdINT32, aBitmapPositionOffsetY);
346 }
347 
dumpFillBitmapOffsetXAsAttribute(sal_Int32 aBitmapOffsetX,xmlTextWriterPtr xmlWriter)348 void dumpFillBitmapOffsetXAsAttribute(sal_Int32 aBitmapOffsetX, xmlTextWriterPtr xmlWriter)
349 {
350     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapOffsetX"), "%" SAL_PRIdINT32, aBitmapOffsetX);
351 }
352 
dumpFillBitmapOffsetYAsAttribute(sal_Int32 aBitmapOffsetY,xmlTextWriterPtr xmlWriter)353 void dumpFillBitmapOffsetYAsAttribute(sal_Int32 aBitmapOffsetY, xmlTextWriterPtr xmlWriter)
354 {
355     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapOffsetY"), "%" SAL_PRIdINT32, aBitmapOffsetY);
356 }
357 
dumpFillBitmapRectanglePointAsAttribute(drawing::RectanglePoint eBitmapRectanglePoint,xmlTextWriterPtr xmlWriter)358 void dumpFillBitmapRectanglePointAsAttribute(drawing::RectanglePoint eBitmapRectanglePoint, xmlTextWriterPtr xmlWriter)
359 {
360     switch(eBitmapRectanglePoint)
361     {
362         case drawing::RectanglePoint_LEFT_TOP:
363             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "LEFT_TOP");
364             break;
365         case drawing::RectanglePoint_MIDDLE_TOP:
366             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "MIDDLE_TOP");
367             break;
368         case drawing::RectanglePoint_RIGHT_TOP:
369             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "RIGHT_TOP");
370             break;
371         case drawing::RectanglePoint_LEFT_MIDDLE:
372             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "LEFT_MIDDLE");
373             break;
374         case drawing::RectanglePoint_MIDDLE_MIDDLE:
375             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "MIDDLE_MIDDLE");
376             break;
377         case drawing::RectanglePoint_RIGHT_MIDDLE:
378             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "RIGHT_MIDDLE");
379             break;
380         case drawing::RectanglePoint_LEFT_BOTTOM:
381             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "LEFT_BOTTOM");
382             break;
383         case drawing::RectanglePoint_MIDDLE_BOTTOM:
384             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "MIDDLE_BOTTOM");
385             break;
386         case drawing::RectanglePoint_RIGHT_BOTTOM:
387             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapRectanglePoint"), "%s", "RIGHT_BOTTOM");
388             break;
389         default:
390             break;
391     }
392 }
393 
dumpFillBitmapLogicalSizeAsAttribute(bool bBitmapLogicalSize,xmlTextWriterPtr xmlWriter)394 void dumpFillBitmapLogicalSizeAsAttribute(bool bBitmapLogicalSize, xmlTextWriterPtr xmlWriter)
395 {
396     if(bBitmapLogicalSize)
397         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapLogicalSize"), "%s", "true");
398     else
399         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapLogicalSize"), "%s", "false");
400 }
401 
dumpFillBitmapSizeXAsAttribute(sal_Int32 aBitmapSizeX,xmlTextWriterPtr xmlWriter)402 void dumpFillBitmapSizeXAsAttribute(sal_Int32 aBitmapSizeX, xmlTextWriterPtr xmlWriter)
403 {
404     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapSizeX"), "%" SAL_PRIdINT32, aBitmapSizeX);
405 }
406 
dumpFillBitmapSizeYAsAttribute(sal_Int32 aBitmapSizeY,xmlTextWriterPtr xmlWriter)407 void dumpFillBitmapSizeYAsAttribute(sal_Int32 aBitmapSizeY, xmlTextWriterPtr xmlWriter)
408 {
409     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapSizeY"), "%" SAL_PRIdINT32, aBitmapSizeY);
410 }
411 
dumpFillBitmapModeAsAttribute(drawing::BitmapMode eBitmapMode,xmlTextWriterPtr xmlWriter)412 void dumpFillBitmapModeAsAttribute(drawing::BitmapMode eBitmapMode, xmlTextWriterPtr xmlWriter)
413 {
414     switch(eBitmapMode)
415     {
416         case drawing::BitmapMode_REPEAT:
417             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapMode"), "%s", "REPEAT");
418             break;
419         case drawing::BitmapMode_STRETCH:
420             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapMode"), "%s", "STRETCH");
421             break;
422         case drawing::BitmapMode_NO_REPEAT:
423             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapMode"), "%s", "NO_REPEAT");
424             break;
425         default:
426             break;
427     }
428 }
429 
dumpFillBitmapStretchAsAttribute(bool bBitmapStretch,xmlTextWriterPtr xmlWriter)430 void dumpFillBitmapStretchAsAttribute(bool bBitmapStretch, xmlTextWriterPtr xmlWriter)
431 {
432     if(bBitmapStretch)
433         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapStretch"), "%s", "true");
434     else
435         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapStretch"), "%s", "false");
436 }
437 
dumpFillBitmapTileAsAttribute(bool bBitmapTile,xmlTextWriterPtr xmlWriter)438 void dumpFillBitmapTileAsAttribute(bool bBitmapTile, xmlTextWriterPtr xmlWriter)
439 {
440     if(bBitmapTile)
441         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapTile"), "%s", "true");
442     else
443         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapTile"), "%s", "false");
444 }
445 
446 
447 // ---------- LineProperties.idl ----------
448 
449 
dumpLineStyleAsAttribute(drawing::LineStyle eLineStyle,xmlTextWriterPtr xmlWriter)450 void dumpLineStyleAsAttribute(drawing::LineStyle eLineStyle, xmlTextWriterPtr xmlWriter)
451 {
452     switch(eLineStyle)
453     {
454         case drawing::LineStyle_NONE:
455             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStyle"), "%s", "NONE");
456             break;
457         case drawing::LineStyle_SOLID:
458             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStyle"), "%s", "SOLID");
459             break;
460         case drawing::LineStyle_DASH:
461             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStyle"), "%s", "DASH");
462             break;
463         default:
464             break;
465     }
466 }
467 
dumpLineDashAsElement(const drawing::LineDash & rLineDash,xmlTextWriterPtr xmlWriter)468 void dumpLineDashAsElement(const drawing::LineDash& rLineDash, xmlTextWriterPtr xmlWriter)
469 {
470     xmlTextWriterStartElement(xmlWriter, BAD_CAST( "LineDash" ));
471     switch (rLineDash.Style)
472     {
473         case drawing::DashStyle_RECT:
474             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "RECT");
475             break;
476         case drawing::DashStyle_ROUND:
477             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "ROUND");
478             break;
479         case drawing::DashStyle_RECTRELATIVE:
480             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "RECTRELATIVE");
481             break;
482         case drawing::DashStyle_ROUNDRELATIVE:
483             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("style"), "%s", "ROUNDRELATIVE");
484             break;
485         default:
486             break;
487     }
488     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dots"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rLineDash.Dots));
489     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dotLen"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rLineDash.DotLen));
490     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dashes"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rLineDash.Dashes));
491     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("dashLen"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rLineDash.DashLen));
492     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("distance"), "%" SAL_PRIdINT32, static_cast<sal_Int32>(rLineDash.Distance));
493     xmlTextWriterEndElement( xmlWriter );
494 }
495 
dumpLineDashNameAsAttribute(const OUString & sLineDashName,xmlTextWriterPtr xmlWriter)496 void dumpLineDashNameAsAttribute(const OUString& sLineDashName, xmlTextWriterPtr xmlWriter)
497 {
498     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineDashName"), "%s",
499         OUStringToOString(sLineDashName, RTL_TEXTENCODING_UTF8).getStr());
500 }
501 
dumpLineColorAsAttribute(sal_Int32 aLineColor,xmlTextWriterPtr xmlWriter)502 void dumpLineColorAsAttribute(sal_Int32 aLineColor, xmlTextWriterPtr xmlWriter)
503 {
504     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineColor"), "%06x", static_cast<unsigned int>(aLineColor));
505 }
506 
dumpLineTransparenceAsAttribute(sal_Int32 aLineTransparence,xmlTextWriterPtr xmlWriter)507 void dumpLineTransparenceAsAttribute(sal_Int32 aLineTransparence, xmlTextWriterPtr xmlWriter)
508 {
509     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineTransparence"), "%" SAL_PRIdINT32, aLineTransparence);
510 }
511 
dumpLineWidthAsAttribute(sal_Int32 aLineWidth,xmlTextWriterPtr xmlWriter)512 void dumpLineWidthAsAttribute(sal_Int32 aLineWidth, xmlTextWriterPtr xmlWriter)
513 {
514     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineWidth"), "%" SAL_PRIdINT32, aLineWidth);
515 }
516 
dumpLineJointAsAttribute(drawing::LineJoint eLineJoint,xmlTextWriterPtr xmlWriter)517 void dumpLineJointAsAttribute(drawing::LineJoint eLineJoint, xmlTextWriterPtr xmlWriter)
518 {
519     switch(eLineJoint)
520     {
521         case drawing::LineJoint_NONE:
522             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineJoint"), "%s", "NONE");
523             break;
524         case drawing::LineJoint_MIDDLE:
525             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineJoint"), "%s", "MIDDLE");
526             break;
527         case drawing::LineJoint_BEVEL:
528             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineJoint"), "%s", "BEVEL");
529             break;
530         case drawing::LineJoint_MITER:
531             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineJoint"), "%s", "MITER");
532             break;
533         case drawing::LineJoint_ROUND:
534             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineJoint"), "%s", "ROUND");
535             break;
536         default:
537             break;
538     }
539 }
540 
dumpLineStartNameAsAttribute(const OUString & sLineStartName,xmlTextWriterPtr xmlWriter)541 void dumpLineStartNameAsAttribute(const OUString& sLineStartName, xmlTextWriterPtr xmlWriter)
542 {
543     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineStartName"), "%s",
544     OUStringToOString(sLineStartName, RTL_TEXTENCODING_UTF8).getStr());
545 }
546 
dumpLineEndNameAsAttribute(const OUString & sLineEndName,xmlTextWriterPtr xmlWriter)547 void dumpLineEndNameAsAttribute(const OUString& sLineEndName, xmlTextWriterPtr xmlWriter)
548 {
549     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineEndName"), "%s",
550     OUStringToOString(sLineEndName, RTL_TEXTENCODING_UTF8).getStr());
551 }
552 
dumpPolyPolygonBezierCoords(const drawing::PolyPolygonBezierCoords & rPolyPolygonBezierCoords,xmlTextWriterPtr xmlWriter)553 void dumpPolyPolygonBezierCoords(const drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoords, xmlTextWriterPtr xmlWriter)
554 {
555     dumpPointSequenceSequence(rPolyPolygonBezierCoords.Coordinates, &rPolyPolygonBezierCoords.Flags, xmlWriter);
556 }
557 
dumpLineStartAsElement(const drawing::PolyPolygonBezierCoords & rLineStart,xmlTextWriterPtr xmlWriter)558 void dumpLineStartAsElement(const drawing::PolyPolygonBezierCoords& rLineStart, xmlTextWriterPtr xmlWriter)
559 {
560     xmlTextWriterStartElement(xmlWriter, BAD_CAST( "LineStart" ));
561     dumpPolyPolygonBezierCoords(rLineStart, xmlWriter);
562     xmlTextWriterEndElement( xmlWriter );
563 }
564 
dumpLineEndAsElement(const drawing::PolyPolygonBezierCoords & rLineEnd,xmlTextWriterPtr xmlWriter)565 void dumpLineEndAsElement(const drawing::PolyPolygonBezierCoords& rLineEnd, xmlTextWriterPtr xmlWriter)
566 {
567     xmlTextWriterStartElement(xmlWriter, BAD_CAST( "LineEnd" ));
568     dumpPolyPolygonBezierCoords(rLineEnd, xmlWriter);
569     xmlTextWriterEndElement( xmlWriter );
570 }
571 
dumpLineStartCenterAsAttribute(bool bLineStartCenter,xmlTextWriterPtr xmlWriter)572 void dumpLineStartCenterAsAttribute(bool bLineStartCenter, xmlTextWriterPtr xmlWriter)
573 {
574     if(bLineStartCenter)
575         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStartCenter"), "%s", "true");
576     else
577         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStartCenter"), "%s", "false");
578 }
579 
dumpLineStartWidthAsAttribute(sal_Int32 aLineStartWidth,xmlTextWriterPtr xmlWriter)580 void dumpLineStartWidthAsAttribute(sal_Int32 aLineStartWidth, xmlTextWriterPtr xmlWriter)
581 {
582     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineStartWidth"), "%" SAL_PRIdINT32, aLineStartWidth);
583 }
584 
dumpLineEndCenterAsAttribute(bool bLineEndCenter,xmlTextWriterPtr xmlWriter)585 void dumpLineEndCenterAsAttribute(bool bLineEndCenter, xmlTextWriterPtr xmlWriter)
586 {
587     if(bLineEndCenter)
588         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineEndCenter"), "%s", "true");
589     else
590         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineEndCenter"), "%s", "false");
591 }
592 
dumpLineEndWidthAsAttribute(sal_Int32 aLineEndWidth,xmlTextWriterPtr xmlWriter)593 void dumpLineEndWidthAsAttribute(sal_Int32 aLineEndWidth, xmlTextWriterPtr xmlWriter)
594 {
595     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineEndWidth"), "%" SAL_PRIdINT32, aLineEndWidth);
596 }
597 
598 
599 // ---------- PolyPolygonDescriptor.idl ----------
600 
601 
dumpPolygonKindAsAttribute(drawing::PolygonKind ePolygonKind,xmlTextWriterPtr xmlWriter)602 void dumpPolygonKindAsAttribute(drawing::PolygonKind ePolygonKind, xmlTextWriterPtr xmlWriter)
603 {
604     switch(ePolygonKind)
605     {
606         case drawing::PolygonKind_LINE:
607             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "LINE");
608             break;
609         case drawing::PolygonKind_POLY:
610             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "POLY");
611             break;
612         case drawing::PolygonKind_PLIN:
613             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PLIN");
614             break;
615         case drawing::PolygonKind_PATHLINE:
616             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PATHLINE");
617             break;
618         case drawing::PolygonKind_PATHFILL:
619             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PATHFILL");
620             break;
621         case drawing::PolygonKind_FREELINE:
622             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "FREELINE");
623             break;
624         case drawing::PolygonKind_FREEFILL:
625             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "FREEFILL");
626             break;
627         case drawing::PolygonKind_PATHPOLY:
628             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PATHPOLY");
629             break;
630         case drawing::PolygonKind_PATHPLIN:
631             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonKind"), "%s", "PATHPLIN");
632             break;
633         default:
634             break;
635     }
636 }
637 
dumpPointSequenceSequence(const drawing::PointSequenceSequence & aPointSequenceSequence,const uno::Sequence<uno::Sequence<drawing::PolygonFlags>> * pFlags,xmlTextWriterPtr xmlWriter)638 void dumpPointSequenceSequence(const drawing::PointSequenceSequence& aPointSequenceSequence, const uno::Sequence<uno::Sequence< drawing::PolygonFlags > >* pFlags, xmlTextWriterPtr xmlWriter)
639 {
640     // LibreOffice proudly presents - The Sequenception
641     uno::Sequence<uno::Sequence< awt::Point > > pointSequenceSequence = aPointSequenceSequence;
642     sal_Int32 nPointsSequence = pointSequenceSequence.getLength();
643 
644     for (sal_Int32 i = 0; i < nPointsSequence; ++i)
645     {
646         uno::Sequence< awt::Point > pointSequence = pointSequenceSequence[i];
647         sal_Int32 nPoints = pointSequence.getLength();
648 
649         uno::Sequence< drawing::PolygonFlags> flagsSequence;
650         if(pFlags)
651             flagsSequence = (*pFlags)[i];
652 
653         xmlTextWriterStartElement(xmlWriter, BAD_CAST( "pointSequence" ));
654 
655         for(sal_Int32 j = 0; j < nPoints; ++j)
656         {
657             xmlTextWriterStartElement(xmlWriter, BAD_CAST( "point" ));
658             xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, pointSequence[j].X);
659             xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionY"), "%" SAL_PRIdINT32, pointSequence[j].Y);
660 
661             if(pFlags)
662             {
663                 switch(flagsSequence[j])
664                 {
665                     case drawing::PolygonFlags_NORMAL:
666                         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonFlags"), "%s", "NORMAL");
667                         break;
668                     case drawing::PolygonFlags_SMOOTH:
669                         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonFlags"), "%s", "SMOOTH");
670                         break;
671                     case drawing::PolygonFlags_CONTROL:
672                         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonFlags"), "%s", "CONTROL");
673                         break;
674                     case drawing::PolygonFlags_SYMMETRIC:
675                         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonFlags"), "%s", "SYMMETRIC");
676                         break;
677                     default:
678                         break;
679                 }
680             }
681 
682             xmlTextWriterEndElement( xmlWriter );
683         }
684         xmlTextWriterEndElement( xmlWriter );
685     }
686 }
687 
dumpPolyPolygonAsElement(const drawing::PointSequenceSequence & rPolyPolygon,xmlTextWriterPtr xmlWriter)688 void dumpPolyPolygonAsElement(const drawing::PointSequenceSequence& rPolyPolygon, xmlTextWriterPtr xmlWriter)
689 {
690     xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PolyPolygon" ));
691     dumpPointSequenceSequence(rPolyPolygon, nullptr, xmlWriter);
692     xmlTextWriterEndElement( xmlWriter );
693 }
694 
dumpGeometryAsElement(const drawing::PointSequenceSequence & aGeometry,xmlTextWriterPtr xmlWriter)695 void dumpGeometryAsElement(const drawing::PointSequenceSequence& aGeometry, xmlTextWriterPtr xmlWriter)
696 {
697     xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Geometry" ));
698     dumpPointSequenceSequence(aGeometry, nullptr, xmlWriter);
699     xmlTextWriterEndElement( xmlWriter );
700 }
701 
702 // CharacterProperties.idl
dumpCharHeightAsAttribute(float fHeight,xmlTextWriterPtr xmlWriter)703 void dumpCharHeightAsAttribute(float fHeight, xmlTextWriterPtr xmlWriter)
704 {
705     xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fontHeight"), "%f", fHeight );
706 }
707 
dumpCharColorAsAttribute(sal_Int32 aColor,xmlTextWriterPtr xmlWriter)708 void dumpCharColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter)
709 {
710     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fontColor"), "%06x", static_cast<unsigned int>(aColor));
711 }
712 
713 
714 // ---------- TextProperties.idl ----------
715 
716 
dumpIsNumberingAsAttribute(bool bIsNumbering,xmlTextWriterPtr xmlWriter)717 void dumpIsNumberingAsAttribute(bool bIsNumbering, xmlTextWriterPtr xmlWriter)
718 {
719     if(bIsNumbering)
720         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("isNumbering"), "%s", "true");
721     else
722         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("isNumbering"), "%s", "false");
723 }
724 
dumpTextAutoGrowHeightAsAttribute(bool bTextAutoGrowHeight,xmlTextWriterPtr xmlWriter)725 void dumpTextAutoGrowHeightAsAttribute(bool bTextAutoGrowHeight, xmlTextWriterPtr xmlWriter)
726 {
727     if(bTextAutoGrowHeight)
728         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowHeight"), "%s", "true");
729     else
730         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowHeight"), "%s", "false");
731 }
732 
dumpTextAutoGrowWidthAsAttribute(bool bTextAutoGrowWidth,xmlTextWriterPtr xmlWriter)733 void dumpTextAutoGrowWidthAsAttribute(bool bTextAutoGrowWidth, xmlTextWriterPtr xmlWriter)
734 {
735     if(bTextAutoGrowWidth)
736         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowWidth"), "%s", "true");
737     else
738         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowWidth"), "%s", "false");
739 }
740 
dumpTextContourFrameAsAttribute(bool bTextContourFrame,xmlTextWriterPtr xmlWriter)741 void dumpTextContourFrameAsAttribute(bool bTextContourFrame, xmlTextWriterPtr xmlWriter)
742 {
743     if(bTextContourFrame)
744         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textContourFrame"), "%s", "true");
745     else
746         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textContourFrame"), "%s", "false");
747 }
748 
dumpTextFitToSizeAsAttribute(drawing::TextFitToSizeType eTextFitToSize,xmlTextWriterPtr xmlWriter)749 void dumpTextFitToSizeAsAttribute(drawing::TextFitToSizeType eTextFitToSize, xmlTextWriterPtr xmlWriter)
750 {
751     switch(eTextFitToSize)
752     {
753         case drawing::TextFitToSizeType_NONE:
754             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textFitToSize"), "%s", "NONE");
755             break;
756         case drawing::TextFitToSizeType_PROPORTIONAL:
757             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textFitToSize"), "%s", "PROPORTIONAL");
758             break;
759         case drawing::TextFitToSizeType_ALLLINES:
760             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textFitToSize"), "%s", "ALLLINES");
761             break;
762         case drawing::TextFitToSizeType_AUTOFIT:
763             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textFitToSize"), "%s", "AUTOFIT");
764             break;
765         default:
766             break;
767     }
768 }
769 
dumpTextHorizontalAdjustAsAttribute(drawing::TextHorizontalAdjust eTextHorizontalAdjust,xmlTextWriterPtr xmlWriter)770 void dumpTextHorizontalAdjustAsAttribute(drawing::TextHorizontalAdjust eTextHorizontalAdjust, xmlTextWriterPtr xmlWriter)
771 {
772     switch(eTextHorizontalAdjust)
773     {
774         case drawing::TextHorizontalAdjust_LEFT:
775             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textHorizontalAdjust"), "%s", "LEFT");
776             break;
777         case drawing::TextHorizontalAdjust_CENTER:
778             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textHorizontalAdjust"), "%s", "CENTER");
779             break;
780         case drawing::TextHorizontalAdjust_RIGHT:
781             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textHorizontalAdjust"), "%s", "RIGHT");
782             break;
783         case drawing::TextHorizontalAdjust_BLOCK:
784             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textHorizontalAdjust"), "%s", "BLOCK");
785             break;
786         default:
787             break;
788     }
789 }
790 
dumpTextVerticalAdjustAsAttribute(drawing::TextVerticalAdjust eTextVerticalAdjust,xmlTextWriterPtr xmlWriter)791 void dumpTextVerticalAdjustAsAttribute(drawing::TextVerticalAdjust eTextVerticalAdjust, xmlTextWriterPtr xmlWriter)
792 {
793     switch(eTextVerticalAdjust)
794     {
795         case drawing::TextVerticalAdjust_TOP:
796             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textVerticalAdjust"), "%s", "TOP");
797             break;
798         case drawing::TextVerticalAdjust_CENTER:
799             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textVerticalAdjust"), "%s", "CENTER");
800             break;
801         case drawing::TextVerticalAdjust_BOTTOM:
802             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textVerticalAdjust"), "%s", "BOTTOM");
803             break;
804         case drawing::TextVerticalAdjust_BLOCK:
805             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textVerticalAdjust"), "%s", "BLOCK");
806             break;
807         default:
808             break;
809     }
810 }
811 
dumpTextLeftDistanceAsAttribute(sal_Int32 aTextLeftDistance,xmlTextWriterPtr xmlWriter)812 void dumpTextLeftDistanceAsAttribute(sal_Int32 aTextLeftDistance, xmlTextWriterPtr xmlWriter)
813 {
814     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textLeftDistance"), "%" SAL_PRIdINT32, aTextLeftDistance);
815 }
816 
dumpTextRightDistanceAsAttribute(sal_Int32 aTextRightDistance,xmlTextWriterPtr xmlWriter)817 void dumpTextRightDistanceAsAttribute(sal_Int32 aTextRightDistance, xmlTextWriterPtr xmlWriter)
818 {
819     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textRightDistance"), "%" SAL_PRIdINT32, aTextRightDistance);
820 }
821 
dumpTextUpperDistanceAsAttribute(sal_Int32 aTextUpperDistance,xmlTextWriterPtr xmlWriter)822 void dumpTextUpperDistanceAsAttribute(sal_Int32 aTextUpperDistance, xmlTextWriterPtr xmlWriter)
823 {
824     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textUpperDistance"), "%" SAL_PRIdINT32, aTextUpperDistance);
825 }
826 
dumpTextLowerDistanceAsAttribute(sal_Int32 aTextLowerDistance,xmlTextWriterPtr xmlWriter)827 void dumpTextLowerDistanceAsAttribute(sal_Int32 aTextLowerDistance, xmlTextWriterPtr xmlWriter)
828 {
829     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textLowerDistance"), "%" SAL_PRIdINT32, aTextLowerDistance);
830 }
831 
dumpTextMaximumFrameHeightAsAttribute(sal_Int32 aTextMaximumFrameHeight,xmlTextWriterPtr xmlWriter)832 void dumpTextMaximumFrameHeightAsAttribute(sal_Int32 aTextMaximumFrameHeight, xmlTextWriterPtr xmlWriter)
833 {
834     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMaximumFrameHeight"), "%" SAL_PRIdINT32, aTextMaximumFrameHeight);
835 }
836 
dumpTextMaximumFrameWidthAsAttribute(sal_Int32 aTextMaximumFrameWidth,xmlTextWriterPtr xmlWriter)837 void dumpTextMaximumFrameWidthAsAttribute(sal_Int32 aTextMaximumFrameWidth, xmlTextWriterPtr xmlWriter)
838 {
839     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMaximumFrameWidth"), "%" SAL_PRIdINT32, aTextMaximumFrameWidth);
840 }
841 
dumpTextMinimumFrameHeightAsAttribute(sal_Int32 aTextMinimumFrameHeight,xmlTextWriterPtr xmlWriter)842 void dumpTextMinimumFrameHeightAsAttribute(sal_Int32 aTextMinimumFrameHeight, xmlTextWriterPtr xmlWriter)
843 {
844     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMinimumFrameHeight"), "%" SAL_PRIdINT32, aTextMinimumFrameHeight);
845 }
846 
dumpTextMinimumFrameWidthAsAttribute(sal_Int32 aTextMinimumFrameWidth,xmlTextWriterPtr xmlWriter)847 void dumpTextMinimumFrameWidthAsAttribute(sal_Int32 aTextMinimumFrameWidth, xmlTextWriterPtr xmlWriter)
848 {
849     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMinimumFrameWidth"), "%" SAL_PRIdINT32, aTextMinimumFrameWidth);
850 }
851 
dumpTextAnimationAmountAsAttribute(sal_Int32 aTextAnimationAmount,xmlTextWriterPtr xmlWriter)852 void dumpTextAnimationAmountAsAttribute(sal_Int32 aTextAnimationAmount, xmlTextWriterPtr xmlWriter)
853 {
854     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textAnimationAmount"), "%" SAL_PRIdINT32, aTextAnimationAmount);
855 }
856 
dumpTextAnimationCountAsAttribute(sal_Int32 aTextAnimationCount,xmlTextWriterPtr xmlWriter)857 void dumpTextAnimationCountAsAttribute(sal_Int32 aTextAnimationCount, xmlTextWriterPtr xmlWriter)
858 {
859     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textAnimationCount"), "%" SAL_PRIdINT32, aTextAnimationCount);
860 }
861 
dumpTextAnimationDelayAsAttribute(sal_Int32 aTextAnimationDelay,xmlTextWriterPtr xmlWriter)862 void dumpTextAnimationDelayAsAttribute(sal_Int32 aTextAnimationDelay, xmlTextWriterPtr xmlWriter)
863 {
864     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textAnimationDelay"), "%" SAL_PRIdINT32, aTextAnimationDelay);
865 }
866 
dumpTextAnimationDirectionAsAttribute(drawing::TextAnimationDirection eTextAnimationDirection,xmlTextWriterPtr xmlWriter)867 void dumpTextAnimationDirectionAsAttribute(drawing::TextAnimationDirection eTextAnimationDirection, xmlTextWriterPtr xmlWriter)
868 {
869     switch(eTextAnimationDirection)
870     {
871         case drawing::TextAnimationDirection_LEFT:
872             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationDirection"), "%s", "LEFT");
873             break;
874         case drawing::TextAnimationDirection_RIGHT:
875             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationDirection"), "%s", "RIGHT");
876             break;
877         case drawing::TextAnimationDirection_UP:
878             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationDirection"), "%s", "UP");
879             break;
880         case drawing::TextAnimationDirection_DOWN:
881             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationDirection"), "%s", "DOWN");
882             break;
883         default:
884             break;
885     }
886 }
887 
dumpTextAnimationKindAsAttribute(drawing::TextAnimationKind eTextAnimationKind,xmlTextWriterPtr xmlWriter)888 void dumpTextAnimationKindAsAttribute(drawing::TextAnimationKind eTextAnimationKind, xmlTextWriterPtr xmlWriter)
889 {
890     switch(eTextAnimationKind)
891     {
892         case drawing::TextAnimationKind_NONE:
893             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "NONE");
894             break;
895         case drawing::TextAnimationKind_BLINK:
896             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "BLINK");
897             break;
898         case drawing::TextAnimationKind_SCROLL:
899             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "SCROLL");
900             break;
901         case drawing::TextAnimationKind_ALTERNATE:
902             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "ALTERNATE");
903             break;
904         case drawing::TextAnimationKind_SLIDE:
905             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "SLIDE");
906             break;
907         default:
908             break;
909     }
910 }
911 
dumpTextAnimationStartInsideAsAttribute(bool bTextAnimationStartInside,xmlTextWriterPtr xmlWriter)912 void dumpTextAnimationStartInsideAsAttribute(bool bTextAnimationStartInside, xmlTextWriterPtr xmlWriter)
913 {
914     if(bTextAnimationStartInside)
915         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStartInside"), "%s", "true");
916     else
917         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStartInside"), "%s", "false");
918 }
919 
dumpTextAnimationStopInsideAsAttribute(bool bTextAnimationStopInside,xmlTextWriterPtr xmlWriter)920 void dumpTextAnimationStopInsideAsAttribute(bool bTextAnimationStopInside, xmlTextWriterPtr xmlWriter)
921 {
922     if(bTextAnimationStopInside)
923         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStopInside"), "%s", "true");
924     else
925         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStopInside"), "%s", "false");
926 }
927 
dumpTextWritingModeAsAttribute(text::WritingMode eTextWritingMode,xmlTextWriterPtr xmlWriter)928 void dumpTextWritingModeAsAttribute(text::WritingMode eTextWritingMode, xmlTextWriterPtr xmlWriter)
929 {
930     switch(eTextWritingMode)
931     {
932         case text::WritingMode_LR_TB:
933             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textWritingMode"), "%s", "LR_TB");
934             break;
935         case text::WritingMode_RL_TB:
936             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textWritingMode"), "%s", "RL_TB");
937             break;
938         case text::WritingMode_TB_RL:
939             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textWritingMode"), "%s", "TB_RL");
940             break;
941         default:
942             break;
943     }
944 }
945 
946 
947 // ---------- ShadowProperties.idl ----------
948 
949 
dumpShadowAsAttribute(bool bShadow,xmlTextWriterPtr xmlWriter)950 void dumpShadowAsAttribute(bool bShadow, xmlTextWriterPtr xmlWriter)
951 {
952     if(bShadow)
953         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadow"), "%s", "true");
954     else
955         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadow"), "%s", "false");
956 }
957 
dumpShadowColorAsAttribute(sal_Int32 aShadowColor,xmlTextWriterPtr xmlWriter)958 void dumpShadowColorAsAttribute(sal_Int32 aShadowColor, xmlTextWriterPtr xmlWriter)
959 {
960     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowColor"), "%06x", static_cast<unsigned int>(aShadowColor));
961 }
962 
dumpShadowTransparenceAsAttribute(sal_Int32 aShadowTransparence,xmlTextWriterPtr xmlWriter)963 void dumpShadowTransparenceAsAttribute(sal_Int32 aShadowTransparence, xmlTextWriterPtr xmlWriter)
964 {
965     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowTransparence"), "%" SAL_PRIdINT32, aShadowTransparence);
966 }
967 
dumpShadowXDistanceAsAttribute(sal_Int32 aShadowXDistance,xmlTextWriterPtr xmlWriter)968 void dumpShadowXDistanceAsAttribute(sal_Int32 aShadowXDistance, xmlTextWriterPtr xmlWriter)
969 {
970     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowXDistance"), "%" SAL_PRIdINT32, aShadowXDistance);
971 }
972 
dumpShadowYDistanceAsAttribute(sal_Int32 aShadowYDistance,xmlTextWriterPtr xmlWriter)973 void dumpShadowYDistanceAsAttribute(sal_Int32 aShadowYDistance, xmlTextWriterPtr xmlWriter)
974 {
975     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowYDistance"), "%" SAL_PRIdINT32, aShadowYDistance);
976 }
977 
978 
979 // ---------- Shape.idl ----------
980 
981 
dumpZOrderAsAttribute(sal_Int32 aZOrder,xmlTextWriterPtr xmlWriter)982 void dumpZOrderAsAttribute(sal_Int32 aZOrder, xmlTextWriterPtr xmlWriter)
983 {
984     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("zOrder"), "%" SAL_PRIdINT32, aZOrder);
985 }
986 
dumpLayerIDAsAttribute(sal_Int32 aLayerID,xmlTextWriterPtr xmlWriter)987 void dumpLayerIDAsAttribute(sal_Int32 aLayerID, xmlTextWriterPtr xmlWriter)
988 {
989     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("layerID"), "%" SAL_PRIdINT32, aLayerID);
990 }
991 
dumpLayerNameAsAttribute(const OUString & sLayerName,xmlTextWriterPtr xmlWriter)992 void dumpLayerNameAsAttribute(const OUString& sLayerName, xmlTextWriterPtr xmlWriter)
993 {
994     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("layerName"), "%s",
995         OUStringToOString(sLayerName, RTL_TEXTENCODING_UTF8).getStr());
996 }
997 
dumpVisibleAsAttribute(bool bVisible,xmlTextWriterPtr xmlWriter)998 void dumpVisibleAsAttribute(bool bVisible, xmlTextWriterPtr xmlWriter)
999 {
1000     if(bVisible)
1001         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("visible"), "%s", "true");
1002     else
1003         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("visible"), "%s", "false");
1004 }
1005 
dumpPrintableAsAttribute(bool bPrintable,xmlTextWriterPtr xmlWriter)1006 void dumpPrintableAsAttribute(bool bPrintable, xmlTextWriterPtr xmlWriter)
1007 {
1008     if(bPrintable)
1009         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("printable"), "%s", "true");
1010     else
1011         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("printable"), "%s", "false");
1012 }
1013 
dumpMoveProtectAsAttribute(bool bMoveProtect,xmlTextWriterPtr xmlWriter)1014 void dumpMoveProtectAsAttribute(bool bMoveProtect, xmlTextWriterPtr xmlWriter)
1015 {
1016     if(bMoveProtect)
1017         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("moveProtect"), "%s", "true");
1018     else
1019         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("moveProtect"), "%s", "false");
1020 }
1021 
dumpNameAsAttribute(const OUString & sName,xmlTextWriterPtr xmlWriter)1022 void dumpNameAsAttribute(const OUString& sName, xmlTextWriterPtr xmlWriter)
1023 {
1024     if(!sName.isEmpty() && !m_bNameDumped)
1025     {
1026         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s", OUStringToOString(sName, RTL_TEXTENCODING_UTF8).getStr());
1027         m_bNameDumped = true;
1028     }
1029 }
1030 
dumpSizeProtectAsAttribute(bool bSizeProtect,xmlTextWriterPtr xmlWriter)1031 void dumpSizeProtectAsAttribute(bool bSizeProtect, xmlTextWriterPtr xmlWriter)
1032 {
1033     if(bSizeProtect)
1034         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("sizeProtect"), "%s", "true");
1035     else
1036         xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("sizeProtect"), "%s", "false");
1037 }
1038 
dumpHomogenMatrixLine3(const drawing::HomogenMatrixLine3 & rHomogenMatrixLine3,xmlTextWriterPtr xmlWriter)1039 void dumpHomogenMatrixLine3(const drawing::HomogenMatrixLine3& rHomogenMatrixLine3, xmlTextWriterPtr xmlWriter)
1040 {
1041     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("column1"), "%f", rHomogenMatrixLine3.Column1);
1042     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("column2"), "%f", rHomogenMatrixLine3.Column2);
1043     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("column3"), "%f", rHomogenMatrixLine3.Column3);
1044 }
1045 
dumpTransformationAsElement(const drawing::HomogenMatrix3 & rTransformation,xmlTextWriterPtr xmlWriter)1046 void dumpTransformationAsElement(const drawing::HomogenMatrix3& rTransformation, xmlTextWriterPtr xmlWriter)
1047 {
1048     xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Transformation" ));
1049     {
1050     xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Line1" ));
1051     dumpHomogenMatrixLine3(rTransformation.Line1, xmlWriter);
1052     xmlTextWriterEndElement( xmlWriter );
1053     xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Line2" ));
1054     dumpHomogenMatrixLine3(rTransformation.Line2, xmlWriter);
1055     xmlTextWriterEndElement( xmlWriter );
1056     xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Line3" ));
1057     dumpHomogenMatrixLine3(rTransformation.Line3, xmlWriter);
1058     xmlTextWriterEndElement( xmlWriter );
1059     }
1060     xmlTextWriterEndElement( xmlWriter );
1061 }
1062 
dumpNavigationOrderAsAttribute(sal_Int32 aNavigationOrder,xmlTextWriterPtr xmlWriter)1063 void dumpNavigationOrderAsAttribute(sal_Int32 aNavigationOrder, xmlTextWriterPtr xmlWriter)
1064 {
1065     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("navigationOrder"), "%" SAL_PRIdINT32, aNavigationOrder);
1066 }
1067 
dumpHyperlinkAsAttribute(const OUString & sHyperlink,xmlTextWriterPtr xmlWriter)1068 void dumpHyperlinkAsAttribute(const OUString& sHyperlink, xmlTextWriterPtr xmlWriter)
1069 {
1070     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("hyperlink"), "%s",
1071         OUStringToOString(sHyperlink, RTL_TEXTENCODING_UTF8).getStr());
1072 }
1073 
dumpInteropGrabBagAsElement(const uno::Sequence<beans::PropertyValue> & aInteropGrabBag,xmlTextWriterPtr xmlWriter)1074 void dumpInteropGrabBagAsElement(const uno::Sequence< beans::PropertyValue>& aInteropGrabBag, xmlTextWriterPtr xmlWriter)
1075 {
1076     xmlTextWriterStartElement(xmlWriter, BAD_CAST( "InteropGrabBag" ));
1077 
1078     sal_Int32 nLength = aInteropGrabBag.getLength();
1079     for (sal_Int32 i = 0; i < nLength; ++i)
1080         dumpPropertyValueAsElement(aInteropGrabBag[i], xmlWriter);
1081 
1082     xmlTextWriterEndElement( xmlWriter );
1083 }
1084 
1085 
1086 // ---------- XShape.idl ----------
1087 
1088 
dumpPositionAsAttribute(const awt::Point & rPoint,xmlTextWriterPtr xmlWriter)1089 void dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
1090 {
1091     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
1092     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionY"), "%" SAL_PRIdINT32, rPoint.Y);
1093 }
1094 
dumpSizeAsAttribute(const awt::Size & rSize,xmlTextWriterPtr xmlWriter)1095 void dumpSizeAsAttribute(const awt::Size& rSize, xmlTextWriterPtr xmlWriter)
1096 {
1097     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("sizeX"), "%" SAL_PRIdINT32, rSize.Width);
1098     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("sizeY"), "%" SAL_PRIdINT32, rSize.Height);
1099 }
1100 
dumpShapeDescriptorAsAttribute(const uno::Reference<drawing::XShapeDescriptor> & xDescr,xmlTextWriterPtr xmlWriter)1101 void dumpShapeDescriptorAsAttribute( const uno::Reference< drawing::XShapeDescriptor >& xDescr, xmlTextWriterPtr xmlWriter )
1102 {
1103     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("type"), "%s",
1104         OUStringToOString(xDescr->getShapeType(), RTL_TEXTENCODING_UTF8).getStr());
1105 }
1106 
1107 
1108 // ---------- CustomShape.idl ----------
1109 
1110 
dumpCustomShapeEngineAsAttribute(const OUString & sCustomShapeEngine,xmlTextWriterPtr xmlWriter)1111 void dumpCustomShapeEngineAsAttribute(const OUString& sCustomShapeEngine, xmlTextWriterPtr xmlWriter)
1112 {
1113     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeEngine"), "%s",
1114         OUStringToOString(sCustomShapeEngine, RTL_TEXTENCODING_UTF8).getStr());
1115 }
1116 
dumpCustomShapeDataAsAttribute(const OUString & sCustomShapeData,xmlTextWriterPtr xmlWriter)1117 void dumpCustomShapeDataAsAttribute(const OUString& sCustomShapeData, xmlTextWriterPtr xmlWriter)
1118 {
1119     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeData"), "%s",
1120         OUStringToOString(sCustomShapeData, RTL_TEXTENCODING_UTF8).getStr());
1121 }
1122 
dumpPropertyValueAsElement(const beans::PropertyValue & rPropertyValue,xmlTextWriterPtr xmlWriter)1123 void dumpPropertyValueAsElement(const beans::PropertyValue& rPropertyValue, xmlTextWriterPtr xmlWriter)
1124 {
1125     xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PropertyValue" ));
1126 
1127     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s",
1128             OUStringToOString(rPropertyValue.Name, RTL_TEXTENCODING_UTF8).getStr());
1129 
1130     uno::Any aAny = rPropertyValue.Value;
1131     OUString sValue;
1132     float fValue;
1133     sal_Int32 nValue;
1134     bool bValue;
1135     awt::Rectangle aRectangleValue;
1136     uno::Sequence< drawing::EnhancedCustomShapeAdjustmentValue> aAdjustmentValues;
1137     uno::Sequence< drawing::EnhancedCustomShapeParameterPair > aCoordinates;
1138     uno::Sequence< drawing::EnhancedCustomShapeSegment > aSegments;
1139     uno::Sequence< beans::PropertyValue > aPropSeq;
1140     if(aAny >>= sValue)
1141     {
1142         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s",
1143                 OUStringToOString(sValue, RTL_TEXTENCODING_UTF8).getStr());
1144     }
1145     else if(aAny >>= nValue)
1146     {
1147         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%" SAL_PRIdINT32, nValue);
1148     }
1149     else if(aAny >>= fValue)
1150     {
1151         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%f", fValue);
1152     }
1153     else if(aAny >>= bValue)
1154     {
1155         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s", (bValue? "true": "false"));
1156     }
1157     else if(rPropertyValue.Name == "ViewBox" && (aAny >>= aRectangleValue))
1158     {
1159         EnhancedShapeDumper enhancedDumper(xmlWriter);
1160         enhancedDumper.dumpViewBoxAsElement(aRectangleValue);
1161     }
1162     else if(rPropertyValue.Name == "AdjustmentValues" && (aAny >>= aAdjustmentValues))
1163     {
1164         EnhancedShapeDumper enhancedDumper(xmlWriter);
1165         enhancedDumper.dumpAdjustmentValuesAsElement(aAdjustmentValues);
1166     }
1167     else if(rPropertyValue.Name == "Coordinates" && (aAny >>= aCoordinates))
1168     {
1169         EnhancedShapeDumper enhancedDumper(xmlWriter);
1170         enhancedDumper.dumpCoordinatesAsElement(aCoordinates);
1171     }
1172     else if(rPropertyValue.Name == "Segments" && (aAny >>= aSegments))
1173     {
1174         EnhancedShapeDumper enhancedDumper(xmlWriter);
1175         enhancedDumper.dumpSegmentsAsElement(aSegments);
1176     }
1177     else if(aAny >>= aPropSeq)
1178     {
1179         xmlTextWriterStartElement(xmlWriter, BAD_CAST( OUStringToOString(rPropertyValue.Name, RTL_TEXTENCODING_UTF8).getStr() ));
1180 
1181         sal_Int32 i = 0, nCount = aPropSeq.getLength();
1182         for ( ; i < nCount; i++ )
1183             dumpPropertyValueAsElement(aPropSeq[ i ], xmlWriter);
1184 
1185         xmlTextWriterEndElement(xmlWriter);
1186     }
1187 
1188     // TODO: Add here dumping of XDocument for future OOX Smart-Art
1189     // properties.
1190 
1191     // TODO more, if necessary
1192 
1193     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("handle"), "%" SAL_PRIdINT32, rPropertyValue.Handle);
1194 
1195     switch(rPropertyValue.State)
1196     {
1197         case beans::PropertyState_DIRECT_VALUE:
1198             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "DIRECT_VALUE");
1199             break;
1200         case beans::PropertyState_DEFAULT_VALUE:
1201             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "DEFAULT_VALUE");
1202             break;
1203         case beans::PropertyState_AMBIGUOUS_VALUE:
1204             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "AMBIGUOUS_VALUE");
1205             break;
1206         default:
1207             break;
1208     }
1209     xmlTextWriterEndElement( xmlWriter );
1210 }
1211 
dumpCustomShapeGeometryAsElement(const uno::Sequence<beans::PropertyValue> & aCustomShapeGeometry,xmlTextWriterPtr xmlWriter)1212 void dumpCustomShapeGeometryAsElement(const uno::Sequence< beans::PropertyValue>& aCustomShapeGeometry, xmlTextWriterPtr xmlWriter)
1213 {
1214     xmlTextWriterStartElement(xmlWriter, BAD_CAST( "CustomShapeGeometry" ));
1215 
1216     sal_Int32 nLength = aCustomShapeGeometry.getLength();
1217     for (sal_Int32 i = 0; i < nLength; ++i)
1218         dumpPropertyValueAsElement(aCustomShapeGeometry[i], xmlWriter);
1219 
1220     xmlTextWriterEndElement( xmlWriter );
1221 }
1222 
dumpCustomShapeReplacementURLAsAttribute(const OUString & sCustomShapeReplacementURL,xmlTextWriterPtr xmlWriter)1223 void dumpCustomShapeReplacementURLAsAttribute(const OUString& sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter)
1224 {
1225     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeReplacementURL"), "%s",
1226         OUStringToOString(sCustomShapeReplacementURL, RTL_TEXTENCODING_UTF8).getStr());
1227 }
1228 
1229 // methods dumping whole services
1230 
dumpTextPropertiesService(const uno::Reference<beans::XPropertySet> & xPropSet,xmlTextWriterPtr xmlWriter)1231 void dumpTextPropertiesService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1232 {
1233     uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
1234     if(xInfo->hasPropertyByName("CharHeight"))
1235     {
1236         uno::Any anotherAny = xPropSet->getPropertyValue("CharHeight");
1237         float fHeight;
1238         if(anotherAny >>= fHeight)
1239             dumpCharHeightAsAttribute(fHeight, xmlWriter);
1240     }
1241     if(xInfo->hasPropertyByName("CharColor"))
1242     {
1243         uno::Any anotherAny = xPropSet->getPropertyValue("CharColor");
1244         sal_Int32 aColor = sal_Int32();
1245         if(anotherAny >>= aColor)
1246             dumpCharColorAsAttribute(aColor, xmlWriter);
1247     }
1248     // TODO - more properties from CharacterProperties.idl (similar to above)
1249 
1250     if(xInfo->hasPropertyByName("IsNumbering"))
1251     {
1252         uno::Any anotherAny = xPropSet->getPropertyValue("IsNumbering");
1253         bool bIsNumbering;
1254         if(anotherAny >>= bIsNumbering)
1255             dumpIsNumberingAsAttribute(bIsNumbering, xmlWriter);
1256     }
1257     {
1258         uno::Any anotherAny = xPropSet->getPropertyValue("TextAutoGrowHeight");
1259         bool bTextAutoGrowHeight;
1260         if(anotherAny >>= bTextAutoGrowHeight)
1261             dumpTextAutoGrowHeightAsAttribute(bTextAutoGrowHeight, xmlWriter);
1262     }
1263     {
1264         uno::Any anotherAny = xPropSet->getPropertyValue("TextAutoGrowWidth");
1265         bool bTextAutoGrowWidth;
1266         if(anotherAny >>= bTextAutoGrowWidth)
1267             dumpTextAutoGrowWidthAsAttribute(bTextAutoGrowWidth, xmlWriter);
1268     }
1269     {
1270         uno::Any anotherAny = xPropSet->getPropertyValue("TextContourFrame");
1271         bool bTextContourFrame;
1272         if(anotherAny >>= bTextContourFrame)
1273             dumpTextContourFrameAsAttribute(bTextContourFrame, xmlWriter);
1274     }
1275     {
1276         uno::Any anotherAny = xPropSet->getPropertyValue("TextFitToSize");
1277         drawing::TextFitToSizeType eTextFitToSize;
1278         if(anotherAny >>= eTextFitToSize)
1279             dumpTextFitToSizeAsAttribute(eTextFitToSize, xmlWriter);
1280     }
1281     {
1282         uno::Any anotherAny = xPropSet->getPropertyValue("TextHorizontalAdjust");
1283         drawing::TextHorizontalAdjust eTextHorizontalAdjust;
1284         if(anotherAny >>= eTextHorizontalAdjust)
1285             dumpTextHorizontalAdjustAsAttribute(eTextHorizontalAdjust, xmlWriter);
1286     }
1287     {
1288         uno::Any anotherAny = xPropSet->getPropertyValue("TextVerticalAdjust");
1289         drawing::TextVerticalAdjust eTextVerticalAdjust;
1290         if(anotherAny >>= eTextVerticalAdjust)
1291             dumpTextVerticalAdjustAsAttribute(eTextVerticalAdjust, xmlWriter);
1292     }
1293     {
1294         uno::Any anotherAny = xPropSet->getPropertyValue("TextLeftDistance");
1295         sal_Int32 aTextLeftDistance = sal_Int32();
1296         if(anotherAny >>= aTextLeftDistance)
1297             dumpTextLeftDistanceAsAttribute(aTextLeftDistance, xmlWriter);
1298     }
1299     {
1300         uno::Any anotherAny = xPropSet->getPropertyValue("TextRightDistance");
1301         sal_Int32 aTextRightDistance = sal_Int32();
1302         if(anotherAny >>= aTextRightDistance)
1303             dumpTextRightDistanceAsAttribute(aTextRightDistance, xmlWriter);
1304     }
1305     {
1306         uno::Any anotherAny = xPropSet->getPropertyValue("TextUpperDistance");
1307         sal_Int32 aTextUpperDistance = sal_Int32();
1308         if(anotherAny >>= aTextUpperDistance)
1309             dumpTextUpperDistanceAsAttribute(aTextUpperDistance, xmlWriter);
1310     }
1311     {
1312         uno::Any anotherAny = xPropSet->getPropertyValue("TextLowerDistance");
1313         sal_Int32 aTextLowerDistance = sal_Int32();
1314         if(anotherAny >>= aTextLowerDistance)
1315             dumpTextLowerDistanceAsAttribute(aTextLowerDistance, xmlWriter);
1316     }
1317     {
1318         uno::Any anotherAny = xPropSet->getPropertyValue("TextMaximumFrameHeight");
1319         sal_Int32 aTextMaximumFrameHeight = sal_Int32();
1320         if(anotherAny >>= aTextMaximumFrameHeight)
1321             dumpTextMaximumFrameHeightAsAttribute(aTextMaximumFrameHeight, xmlWriter);
1322     }
1323     {
1324         uno::Any anotherAny = xPropSet->getPropertyValue("TextMaximumFrameWidth");
1325         sal_Int32 aTextMaximumFrameWidth = sal_Int32();
1326         if(anotherAny >>= aTextMaximumFrameWidth)
1327             dumpTextMaximumFrameWidthAsAttribute(aTextMaximumFrameWidth, xmlWriter);
1328     }
1329     {
1330         uno::Any anotherAny = xPropSet->getPropertyValue("TextMinimumFrameHeight");
1331         sal_Int32 aTextMinimumFrameHeight = sal_Int32();
1332         if(anotherAny >>= aTextMinimumFrameHeight)
1333             dumpTextMinimumFrameHeightAsAttribute(aTextMinimumFrameHeight, xmlWriter);
1334     }
1335     {
1336         uno::Any anotherAny = xPropSet->getPropertyValue("TextMinimumFrameWidth");
1337         sal_Int32 aTextMinimumFrameWidth = sal_Int32();
1338         if(anotherAny >>= aTextMinimumFrameWidth)
1339             dumpTextMinimumFrameWidthAsAttribute(aTextMinimumFrameWidth, xmlWriter);
1340     }
1341     {
1342         uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationAmount");
1343         sal_Int32 aTextAnimationAmount = sal_Int32();
1344         if(anotherAny >>= aTextAnimationAmount)
1345             dumpTextAnimationAmountAsAttribute(aTextAnimationAmount, xmlWriter);
1346     }
1347     {
1348         uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationCount");
1349         sal_Int32 aTextAnimationCount = sal_Int32();
1350         if(anotherAny >>= aTextAnimationCount)
1351             dumpTextAnimationCountAsAttribute(aTextAnimationCount, xmlWriter);
1352     }
1353     {
1354         uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationDelay");
1355         sal_Int32 aTextAnimationDelay = sal_Int32();
1356         if(anotherAny >>= aTextAnimationDelay)
1357             dumpTextAnimationDelayAsAttribute(aTextAnimationDelay, xmlWriter);
1358     }
1359     {
1360         uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationDirection");
1361         drawing::TextAnimationDirection eTextAnimationDirection;
1362         if(anotherAny >>= eTextAnimationDirection)
1363             dumpTextAnimationDirectionAsAttribute(eTextAnimationDirection, xmlWriter);
1364     }
1365     {
1366         uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationKind");
1367         drawing::TextAnimationKind eTextAnimationKind;
1368         if(anotherAny >>= eTextAnimationKind)
1369             dumpTextAnimationKindAsAttribute(eTextAnimationKind, xmlWriter);
1370     }
1371     {
1372         uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationStartInside");
1373         bool bTextAnimationStartInside;
1374         if(anotherAny >>= bTextAnimationStartInside)
1375             dumpTextAnimationStartInsideAsAttribute(bTextAnimationStartInside, xmlWriter);
1376     }
1377     {
1378         uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationStopInside");
1379         bool bTextAnimationStopInside;
1380         if(anotherAny >>= bTextAnimationStopInside)
1381             dumpTextAnimationStopInsideAsAttribute(bTextAnimationStopInside, xmlWriter);
1382     }
1383     {
1384         uno::Any anotherAny = xPropSet->getPropertyValue("TextWritingMode");
1385         text::WritingMode eTextWritingMode;
1386         if(anotherAny >>= eTextWritingMode)
1387             dumpTextWritingModeAsAttribute(eTextWritingMode, xmlWriter);
1388     }
1389 }
1390 
dumpFillPropertiesService(const uno::Reference<beans::XPropertySet> & xPropSet,xmlTextWriterPtr xmlWriter)1391 void dumpFillPropertiesService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1392 {
1393     {
1394         uno::Any anotherAny = xPropSet->getPropertyValue("FillStyle");
1395         drawing::FillStyle eFillStyle;
1396         if(anotherAny >>= eFillStyle)
1397             dumpFillStyleAsAttribute(eFillStyle, xmlWriter);
1398     }
1399     {
1400         uno::Any anotherAny = xPropSet->getPropertyValue("FillColor");
1401         sal_Int32 aColor = sal_Int32();
1402         if(anotherAny >>= aColor)
1403             dumpFillColorAsAttribute(aColor, xmlWriter);
1404     }
1405     {
1406         uno::Any anotherAny = xPropSet->getPropertyValue("FillTransparence");
1407         sal_Int32 aTransparence = sal_Int32();
1408         if(anotherAny >>= aTransparence)
1409             dumpFillTransparenceAsAttribute(aTransparence, xmlWriter);
1410     }
1411     {
1412         uno::Any anotherAny = xPropSet->getPropertyValue("FillTransparenceGradientName");
1413         OUString sTranspGradName;
1414         if(anotherAny >>= sTranspGradName)
1415             dumpFillTransparenceGradientNameAsAttribute(sTranspGradName, xmlWriter);
1416     }
1417     {
1418         uno::Any anotherAny = xPropSet->getPropertyValue("FillTransparenceGradient");
1419         awt::Gradient aTranspGrad;
1420         if(anotherAny >>= aTranspGrad)
1421             dumpFillTransparenceGradientAsElement(aTranspGrad, xmlWriter);
1422     }
1423     {
1424         uno::Any anotherAny = xPropSet->getPropertyValue("FillGradientName");
1425         OUString sGradName;
1426         if(anotherAny >>= sGradName)
1427             dumpFillGradientNameAsAttribute(sGradName, xmlWriter);
1428     }
1429     {
1430         uno::Any anotherAny = xPropSet->getPropertyValue("FillGradient");
1431         awt::Gradient aGradient;
1432         if(anotherAny >>= aGradient)
1433             dumpFillGradientAsElement(aGradient, xmlWriter);
1434     }
1435     {
1436         uno::Any anotherAny = xPropSet->getPropertyValue("FillHatchName");
1437         OUString sHatchName;
1438         if(anotherAny >>= sHatchName)
1439             dumpFillGradientNameAsAttribute(sHatchName, xmlWriter);
1440     }
1441     {
1442         uno::Any anotherAny = xPropSet->getPropertyValue("FillHatch");
1443         drawing::Hatch aHatch;
1444         if(anotherAny >>= aHatch)
1445             dumpFillHatchAsElement(aHatch, xmlWriter);
1446     }
1447     {
1448         uno::Any anotherAny = xPropSet->getPropertyValue("FillBackground");
1449         bool bFillBackground;
1450         if(anotherAny >>= bFillBackground)
1451             dumpFillBackgroundAsAttribute(bFillBackground, xmlWriter);
1452     }
1453     {
1454         uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapName");
1455         OUString sBitmapName;
1456         if(anotherAny >>= sBitmapName)
1457             dumpFillGradientNameAsAttribute(sBitmapName, xmlWriter);
1458     }
1459     {
1460         uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmap");
1461         uno::Reference<awt::XBitmap> xBitmap;
1462         if(anotherAny >>= xBitmap)
1463             dumpFillBitmapAsElement(xBitmap, xmlWriter);
1464     }
1465     {
1466         uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapPositionOffsetX");
1467         sal_Int32 aBitmapPositionOffsetX = sal_Int32();
1468         if(anotherAny >>= aBitmapPositionOffsetX)
1469             dumpFillBitmapPositionOffsetXAsAttribute(aBitmapPositionOffsetX, xmlWriter);
1470     }
1471     {
1472         uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapPositionOffsetY");
1473         sal_Int32 aBitmapPositionOffsetY = sal_Int32();
1474         if(anotherAny >>= aBitmapPositionOffsetY)
1475             dumpFillBitmapPositionOffsetYAsAttribute(aBitmapPositionOffsetY, xmlWriter);
1476     }
1477     {
1478         uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapOffsetX");
1479         sal_Int32 aBitmapOffsetX = sal_Int32();
1480         if(anotherAny >>= aBitmapOffsetX)
1481             dumpFillBitmapOffsetXAsAttribute(aBitmapOffsetX, xmlWriter);
1482     }
1483     {
1484         uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapOffsetY");
1485         sal_Int32 aBitmapOffsetY = sal_Int32();
1486         if(anotherAny >>= aBitmapOffsetY)
1487             dumpFillBitmapOffsetYAsAttribute(aBitmapOffsetY, xmlWriter);
1488     }
1489     {
1490         uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapRectanglePoint");
1491         drawing::RectanglePoint eBitmapRectanglePoint;
1492         if(anotherAny >>= eBitmapRectanglePoint)
1493             dumpFillBitmapRectanglePointAsAttribute(eBitmapRectanglePoint, xmlWriter);
1494     }
1495     {
1496         uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapLogicalSize");
1497         bool bBitmapLogicalSize;
1498         if(anotherAny >>= bBitmapLogicalSize)
1499             dumpFillBitmapLogicalSizeAsAttribute(bBitmapLogicalSize, xmlWriter);
1500     }
1501     {
1502         uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapSizeX");
1503         sal_Int32 aBitmapSizeX = sal_Int32();
1504         if(anotherAny >>= aBitmapSizeX)
1505             dumpFillBitmapSizeXAsAttribute(aBitmapSizeX, xmlWriter);
1506     }
1507     {
1508         uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapSizeY");
1509         sal_Int32 aBitmapSizeY = sal_Int32();
1510         if(anotherAny >>= aBitmapSizeY)
1511             dumpFillBitmapSizeYAsAttribute(aBitmapSizeY, xmlWriter);
1512     }
1513     {
1514         uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapMode");
1515         drawing::BitmapMode eBitmapMode;
1516         if(anotherAny >>= eBitmapMode)
1517             dumpFillBitmapModeAsAttribute(eBitmapMode, xmlWriter);
1518     }
1519     {
1520         uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapStretch");
1521         bool bBitmapStretch;
1522         if(anotherAny >>= bBitmapStretch)
1523             dumpFillBitmapStretchAsAttribute(bBitmapStretch, xmlWriter);
1524     }
1525     {
1526         uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapTile");
1527         bool bBitmapTile;
1528         if(anotherAny >>= bBitmapTile)
1529             dumpFillBitmapTileAsAttribute(bBitmapTile, xmlWriter);
1530     }
1531 }
1532 
dumpLinePropertiesService(const uno::Reference<beans::XPropertySet> & xPropSet,xmlTextWriterPtr xmlWriter)1533 void dumpLinePropertiesService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1534 {
1535     {
1536         uno::Any anotherAny = xPropSet->getPropertyValue("LineStyle");
1537         drawing::LineStyle eLineStyle;
1538         if(anotherAny >>= eLineStyle)
1539             dumpLineStyleAsAttribute(eLineStyle, xmlWriter);
1540     }
1541     {
1542         uno::Any anotherAny = xPropSet->getPropertyValue("LineDash");
1543         drawing::LineDash aLineDash;
1544         if(anotherAny >>= aLineDash)
1545             dumpLineDashAsElement(aLineDash, xmlWriter);
1546     }
1547     {
1548         uno::Any anotherAny = xPropSet->getPropertyValue("LineDashName");
1549         OUString sLineDashName;
1550         if(anotherAny >>= sLineDashName)
1551             dumpLineDashNameAsAttribute(sLineDashName, xmlWriter);
1552     }
1553     {
1554         uno::Any anotherAny = xPropSet->getPropertyValue("LineColor");
1555         sal_Int32 aLineColor = sal_Int32();
1556         if(anotherAny >>= aLineColor)
1557             dumpLineColorAsAttribute(aLineColor, xmlWriter);
1558     }
1559     {
1560         uno::Any anotherAny = xPropSet->getPropertyValue("LineTransparence");
1561         sal_Int32 aLineTransparence = sal_Int32();
1562         if(anotherAny >>= aLineTransparence)
1563             dumpLineTransparenceAsAttribute(aLineTransparence, xmlWriter);
1564     }
1565     {
1566         uno::Any anotherAny = xPropSet->getPropertyValue("LineWidth");
1567         sal_Int32 aLineWidth = sal_Int32();
1568         if(anotherAny >>= aLineWidth)
1569             dumpLineWidthAsAttribute(aLineWidth, xmlWriter);
1570     }
1571     {
1572         uno::Any anotherAny = xPropSet->getPropertyValue("LineJoint");
1573         drawing::LineJoint eLineJoint;
1574         if(anotherAny >>= eLineJoint)
1575             dumpLineJointAsAttribute(eLineJoint, xmlWriter);
1576     }
1577     {
1578         uno::Any anotherAny = xPropSet->getPropertyValue("LineStartName");
1579         OUString sLineStartName;
1580         if(anotherAny >>= sLineStartName)
1581             dumpLineStartNameAsAttribute(sLineStartName, xmlWriter);
1582     }
1583     {
1584         uno::Any anotherAny = xPropSet->getPropertyValue("LineEndName");
1585         OUString sLineEndName;
1586         if(anotherAny >>= sLineEndName)
1587             dumpLineEndNameAsAttribute(sLineEndName, xmlWriter);
1588     }
1589     {
1590         uno::Any anotherAny = xPropSet->getPropertyValue("LineStart");
1591         drawing::PolyPolygonBezierCoords aLineStart;
1592         if(anotherAny >>= aLineStart)
1593             dumpLineStartAsElement(aLineStart, xmlWriter);
1594     }
1595     {
1596         uno::Any anotherAny = xPropSet->getPropertyValue("LineEnd");
1597         drawing::PolyPolygonBezierCoords aLineEnd;
1598         if(anotherAny >>= aLineEnd)
1599             dumpLineEndAsElement(aLineEnd, xmlWriter);
1600     }
1601     {
1602         uno::Any anotherAny = xPropSet->getPropertyValue("LineStartCenter");
1603         bool bLineStartCenter;
1604         if(anotherAny >>= bLineStartCenter)
1605             dumpLineStartCenterAsAttribute(bLineStartCenter, xmlWriter);
1606     }
1607     {
1608         uno::Any anotherAny = xPropSet->getPropertyValue("LineStartWidth");
1609         sal_Int32 aLineStartWidth = sal_Int32();
1610         if(anotherAny >>= aLineStartWidth)
1611             dumpLineStartWidthAsAttribute(aLineStartWidth, xmlWriter);
1612     }
1613     {
1614         uno::Any anotherAny = xPropSet->getPropertyValue("LineEndCenter");
1615         bool bLineEndCenter;
1616         if(anotherAny >>= bLineEndCenter)
1617             dumpLineEndCenterAsAttribute(bLineEndCenter, xmlWriter);
1618     }
1619     {
1620         uno::Any anotherAny = xPropSet->getPropertyValue("LineEndWidth");
1621         sal_Int32 aLineEndWidth = sal_Int32();
1622         if(anotherAny >>= aLineEndWidth)
1623             dumpLineEndWidthAsAttribute(aLineEndWidth, xmlWriter);
1624     }
1625 }
1626 
dumpShadowPropertiesService(const uno::Reference<beans::XPropertySet> & xPropSet,xmlTextWriterPtr xmlWriter)1627 void dumpShadowPropertiesService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1628 {
1629     {
1630         uno::Any anotherAny = xPropSet->getPropertyValue("Shadow");
1631         bool bShadow;
1632         if(anotherAny >>= bShadow)
1633             dumpShadowAsAttribute(bShadow, xmlWriter);
1634     }
1635     {
1636         uno::Any anotherAny = xPropSet->getPropertyValue("ShadowColor");
1637         sal_Int32 aShadowColor = sal_Int32();
1638         if(anotherAny >>= aShadowColor)
1639             dumpShadowColorAsAttribute(aShadowColor, xmlWriter);
1640     }
1641     {
1642         uno::Any anotherAny = xPropSet->getPropertyValue("ShadowTransparence");
1643         sal_Int32 aShadowTransparence = sal_Int32();
1644         if(anotherAny >>= aShadowTransparence)
1645             dumpShadowTransparenceAsAttribute(aShadowTransparence, xmlWriter);
1646     }
1647     {
1648         uno::Any anotherAny = xPropSet->getPropertyValue("ShadowXDistance");
1649         sal_Int32 aShadowXDistance = sal_Int32();
1650         if(anotherAny >>= aShadowXDistance)
1651             dumpShadowXDistanceAsAttribute(aShadowXDistance, xmlWriter);
1652     }
1653     {
1654         uno::Any anotherAny = xPropSet->getPropertyValue("ShadowYDistance");
1655         sal_Int32 aShadowYDistance = sal_Int32();
1656         if(anotherAny >>= aShadowYDistance)
1657             dumpShadowYDistanceAsAttribute(aShadowYDistance, xmlWriter);
1658     }
1659 }
1660 
dumpPolyPolygonDescriptorService(const uno::Reference<beans::XPropertySet> & xPropSet,xmlTextWriterPtr xmlWriter)1661 void dumpPolyPolygonDescriptorService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1662 {
1663     {
1664         uno::Any anotherAny = xPropSet->getPropertyValue("PolygonKind");
1665         drawing::PolygonKind ePolygonKind;
1666         if(anotherAny >>= ePolygonKind)
1667             dumpPolygonKindAsAttribute(ePolygonKind, xmlWriter);
1668     }
1669     {
1670         uno::Any anotherAny = xPropSet->getPropertyValue("PolyPolygon");
1671         drawing::PointSequenceSequence aPolyPolygon;
1672         if(anotherAny >>= aPolyPolygon)
1673             dumpPolyPolygonAsElement(aPolyPolygon, xmlWriter);
1674     }
1675     {
1676         uno::Any anotherAny = xPropSet->getPropertyValue("Geometry");
1677         drawing::PointSequenceSequence aGeometry;
1678         if(anotherAny >>= aGeometry)
1679             dumpGeometryAsElement(aGeometry, xmlWriter);
1680     }
1681 }
1682 
dumpShapeService(const uno::Reference<beans::XPropertySet> & xPropSet,xmlTextWriterPtr xmlWriter,bool bDumpInteropProperties)1683 void dumpShapeService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties)
1684 {
1685     uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
1686     {
1687         uno::Any anotherAny = xPropSet->getPropertyValue("ZOrder");
1688         sal_Int32 aZOrder = sal_Int32();
1689         if(anotherAny >>= aZOrder)
1690             dumpZOrderAsAttribute(aZOrder, xmlWriter);
1691     }
1692     {
1693         uno::Any anotherAny = xPropSet->getPropertyValue("LayerID");
1694         sal_Int32 aLayerID = sal_Int32();
1695         if(anotherAny >>= aLayerID)
1696             dumpLayerIDAsAttribute(aLayerID, xmlWriter);
1697     }
1698     {
1699         uno::Any anotherAny = xPropSet->getPropertyValue("LayerName");
1700         OUString sLayerName;
1701         if(anotherAny >>= sLayerName)
1702             dumpLayerNameAsAttribute(sLayerName, xmlWriter);
1703     }
1704     {
1705         uno::Any anotherAny = xPropSet->getPropertyValue("Visible");
1706         bool bVisible;
1707         if(anotherAny >>= bVisible)
1708             dumpVisibleAsAttribute(bVisible, xmlWriter);
1709     }
1710     {
1711         uno::Any anotherAny = xPropSet->getPropertyValue("Printable");
1712         bool bPrintable;
1713         if(anotherAny >>= bPrintable)
1714             dumpPrintableAsAttribute(bPrintable, xmlWriter);
1715     }
1716     {
1717         uno::Any anotherAny = xPropSet->getPropertyValue("MoveProtect");
1718         bool bMoveProtect;
1719         if(anotherAny >>= bMoveProtect)
1720             dumpMoveProtectAsAttribute(bMoveProtect, xmlWriter);
1721     }
1722     {
1723         uno::Any anotherAny = xPropSet->getPropertyValue("Name");
1724         OUString sName;
1725         if(anotherAny >>= sName)
1726             dumpNameAsAttribute(sName, xmlWriter);
1727     }
1728     {
1729         uno::Any anotherAny = xPropSet->getPropertyValue("SizeProtect");
1730         bool bSizeProtect;
1731         if(anotherAny >>= bSizeProtect)
1732             dumpSizeProtectAsAttribute(bSizeProtect, xmlWriter);
1733     }
1734     {
1735         uno::Any anotherAny = xPropSet->getPropertyValue("Transformation");
1736         drawing::HomogenMatrix3 aTransformation;
1737         if(anotherAny >>= aTransformation)
1738             dumpTransformationAsElement(aTransformation, xmlWriter);
1739     }
1740     {
1741         uno::Any anotherAny = xPropSet->getPropertyValue("NavigationOrder");
1742         sal_Int32 aNavigationOrder = sal_Int32();
1743         if(anotherAny >>= aNavigationOrder)
1744             dumpNavigationOrderAsAttribute(aNavigationOrder, xmlWriter);
1745     }
1746     if(xInfo->hasPropertyByName("Hyperlink"))
1747     {
1748         uno::Any anotherAny = xPropSet->getPropertyValue("Hyperlink");
1749         OUString sHyperlink;
1750         if(anotherAny >>= sHyperlink)
1751             dumpHyperlinkAsAttribute(sHyperlink, xmlWriter);
1752     }
1753     if(xInfo->hasPropertyByName("InteropGrabBag") && bDumpInteropProperties)
1754     {
1755         uno::Any anotherAny = xPropSet->getPropertyValue("InteropGrabBag");
1756         uno::Sequence< beans::PropertyValue> aInteropGrabBag;
1757         if(anotherAny >>= aInteropGrabBag)
1758             dumpInteropGrabBagAsElement(aInteropGrabBag, xmlWriter);
1759     }
1760 }
1761 
dumpPolyPolygonBezierDescriptorService(const uno::Reference<beans::XPropertySet> & xPropSet,xmlTextWriterPtr xmlWriter)1762 void dumpPolyPolygonBezierDescriptorService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1763 {
1764     {
1765         uno::Any anotherAny = xPropSet->getPropertyValue("PolygonKind");
1766         drawing::PolygonKind ePolygonKind;
1767         if(anotherAny >>= ePolygonKind)
1768             dumpPolygonKindAsAttribute(ePolygonKind, xmlWriter);
1769     }
1770     {
1771         uno::Any anotherAny = xPropSet->getPropertyValue("PolyPolygonBezier");
1772         drawing::PolyPolygonBezierCoords aPolyPolygonBezier;
1773         if(anotherAny >>= aPolyPolygonBezier)
1774             dumpPolyPolygonBezierCoords(aPolyPolygonBezier, xmlWriter);
1775     }
1776     {
1777         uno::Any anotherAny = xPropSet->getPropertyValue("Geometry");
1778         drawing::PolyPolygonBezierCoords aGeometry;
1779         if(anotherAny >>= aGeometry)
1780             dumpPolyPolygonBezierCoords(aGeometry, xmlWriter);
1781     }
1782 }
1783 
dumpCustomShapeService(const uno::Reference<beans::XPropertySet> & xPropSet,xmlTextWriterPtr xmlWriter)1784 void dumpCustomShapeService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1785 {
1786     uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
1787     {
1788         uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeEngine");
1789         OUString sCustomShapeEngine;
1790         if(anotherAny >>= sCustomShapeEngine)
1791             dumpCustomShapeEngineAsAttribute(sCustomShapeEngine, xmlWriter);
1792     }
1793     {
1794         uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeData");
1795         OUString sCustomShapeData;
1796         if(anotherAny >>= sCustomShapeData)
1797             dumpCustomShapeDataAsAttribute(sCustomShapeData, xmlWriter);
1798     }
1799     {
1800         uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeGeometry");
1801         uno::Sequence< beans::PropertyValue> aCustomShapeGeometry;
1802         if(anotherAny >>= aCustomShapeGeometry)
1803             dumpCustomShapeGeometryAsElement(aCustomShapeGeometry, xmlWriter);
1804     }
1805     if(xInfo->hasPropertyByName("CustomShapeReplacementURL"))
1806     {
1807         uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeReplacementURL");
1808         OUString sCustomShapeReplacementURL;
1809         if(anotherAny >>= sCustomShapeReplacementURL)
1810             dumpCustomShapeReplacementURLAsAttribute(sCustomShapeReplacementURL, xmlWriter);
1811     }
1812 }
1813 
dumpXShape(const uno::Reference<drawing::XShape> & xShape,xmlTextWriterPtr xmlWriter,bool bDumpInteropProperties)1814 void dumpXShape(const uno::Reference< drawing::XShape >& xShape, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties)
1815 {
1816     xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShape" ) );
1817     uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY_THROW);
1818     OUString aName;
1819     m_bNameDumped = false;
1820 
1821     dumpPositionAsAttribute(xShape->getPosition(), xmlWriter);
1822     dumpSizeAsAttribute(xShape->getSize(), xmlWriter);
1823     uno::Reference< drawing::XShapeDescriptor > xDescr(xShape, uno::UNO_QUERY_THROW);
1824     dumpShapeDescriptorAsAttribute(xDescr, xmlWriter);
1825 
1826     // uno::Sequence<beans::Property> aProperties = xPropSetInfo->getProperties();
1827 
1828     uno::Reference< lang::XServiceInfo > xServiceInfo( xShape, uno::UNO_QUERY_THROW );
1829 
1830     uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
1831     if(xInfo->hasPropertyByName("Name"))
1832     {
1833         uno::Any aAny = xPropSet->getPropertyValue("Name");
1834         if ((aAny >>= aName) && !aName.isEmpty())
1835         {
1836             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("name"), "%s", OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
1837             m_bNameDumped = true;
1838         }
1839     }
1840 
1841     try
1842     {
1843     if (xServiceInfo->supportsService("com.sun.star.drawing.Text"))
1844     {
1845         uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY_THROW);
1846         OUString aText = xText->getString();
1847         if(!aText.isEmpty())
1848             xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("text"), "%s", OUStringToOString(aText, RTL_TEXTENCODING_UTF8).getStr());
1849     }
1850     if(xServiceInfo->supportsService("com.sun.star.drawing.TextProperties"))
1851         dumpTextPropertiesService(xPropSet, xmlWriter);
1852 
1853     if(xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"))
1854     {
1855         uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY_THROW);
1856         dumpXShapes(xShapes, xmlWriter, bDumpInteropProperties);
1857     }
1858     if(xServiceInfo->supportsService("com.sun.star.drawing.FillProperties"))
1859         dumpFillPropertiesService(xPropSet, xmlWriter);
1860 
1861     if(xServiceInfo->supportsService("com.sun.star.drawing.LineProperties"))
1862         dumpLinePropertiesService(xPropSet, xmlWriter);
1863 
1864     if(xServiceInfo->supportsService("com.sun.star.drawing.PolyPolygonDescriptor"))
1865         dumpPolyPolygonDescriptorService(xPropSet, xmlWriter);
1866 
1867     if(xServiceInfo->supportsService("com.sun.star.drawing.ShadowProperties"))
1868         dumpShadowPropertiesService(xPropSet, xmlWriter);
1869 
1870     if(xServiceInfo->supportsService("com.sun.star.drawing.Shape"))
1871         dumpShapeService(xPropSet, xmlWriter, bDumpInteropProperties);
1872 
1873     if(xServiceInfo->supportsService("com.sun.star.drawing.PolyPolygonBezierDescriptor"))
1874         dumpPolyPolygonBezierDescriptorService(xPropSet, xmlWriter);
1875 
1876     if(xServiceInfo->supportsService("com.sun.star.drawing.CustomShape"))
1877         dumpCustomShapeService(xPropSet, xmlWriter);
1878 
1879     // EnhancedShapeDumper used
1880 
1881     if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeExtrusion"))
1882     {
1883         EnhancedShapeDumper enhancedDumper(xmlWriter);
1884         enhancedDumper.dumpEnhancedCustomShapeExtrusionService(xPropSet);
1885     }
1886     if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeGeometry"))
1887     {
1888         EnhancedShapeDumper enhancedDumper(xmlWriter);
1889         enhancedDumper.dumpEnhancedCustomShapeGeometryService(xPropSet);
1890     }
1891     if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeHandle"))
1892     {
1893         EnhancedShapeDumper enhancedDumper(xmlWriter);
1894         enhancedDumper.dumpEnhancedCustomShapeHandleService(xPropSet);
1895     }
1896     if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapePath"))
1897     {
1898         EnhancedShapeDumper enhancedDumper(xmlWriter);
1899         enhancedDumper.dumpEnhancedCustomShapePathService(xPropSet);
1900     }
1901     if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeTextPath"))
1902     {
1903         EnhancedShapeDumper enhancedDumper(xmlWriter);
1904         enhancedDumper.dumpEnhancedCustomShapeTextPathService(xPropSet);
1905     }
1906     }   // end of the 'try' block
1907     catch (const beans::UnknownPropertyException& e)
1908     {
1909         std::cout << "Exception caught in XShapeDumper.cxx: " << e.Message << std::endl;
1910     }
1911 
1912     #if DEBUG_DUMPER
1913         uno::Sequence< OUString > aServiceNames = xServiceInfo->getSupportedServiceNames();
1914         sal_Int32 nServices = aServiceNames.getLength();
1915         for (sal_Int32 i = 0; i < nServices; ++i)
1916         {
1917             xmlTextWriterStartElement(xmlWriter, BAD_CAST( "ServiceName" ));
1918             xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST( "name" ), "%s", OUStringToOString(aServiceNames[i], RTL_TEXTENCODING_UTF8).getStr());
1919             xmlTextWriterEndElement( xmlWriter );
1920         }
1921     #endif
1922 
1923     xmlTextWriterEndElement( xmlWriter );
1924 }
1925 
dumpXShapes(const uno::Reference<drawing::XShapes> & xShapes,xmlTextWriterPtr xmlWriter,bool bDumpInteropProperties)1926 void dumpXShapes( const uno::Reference< drawing::XShapes >& xShapes, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties )
1927 {
1928     xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShapes" ) );
1929     uno::Reference< container::XIndexAccess > xIA( xShapes, uno::UNO_QUERY_THROW);
1930     sal_Int32 nLength = xIA->getCount();
1931     for (sal_Int32 i = 0; i < nLength; ++i)
1932     {
1933         uno::Reference< drawing::XShape > xShape( xIA->getByIndex( i ), uno::UNO_QUERY_THROW );
1934         dumpXShape( xShape, xmlWriter, bDumpInteropProperties );
1935     }
1936 
1937     xmlTextWriterEndElement( xmlWriter );
1938 }
1939 } //end of namespace
1940 
dump(const uno::Reference<drawing::XShapes> & xPageShapes,bool bDumpInteropProperties)1941 OUString XShapeDumper::dump(const uno::Reference<drawing::XShapes>& xPageShapes, bool bDumpInteropProperties)
1942 {
1943     OStringBuffer aString;
1944     xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO( writeCallback, closeCallback, &aString, nullptr );
1945     xmlTextWriterPtr xmlWriter = xmlNewTextWriter( xmlOutBuffer );
1946     xmlTextWriterSetIndent( xmlWriter, 1 );
1947 
1948     xmlTextWriterStartDocument( xmlWriter, nullptr, nullptr, nullptr );
1949 
1950     try
1951     {
1952         dumpXShapes( xPageShapes, xmlWriter, bDumpInteropProperties );
1953     }
1954     catch (const beans::UnknownPropertyException& e)
1955     {
1956         std::cout << "Exception caught in XShapeDumper: " << e.Message << std::endl;
1957     }
1958 
1959     xmlTextWriterEndDocument( xmlWriter );
1960     xmlFreeTextWriter( xmlWriter );
1961 
1962     return OUString::fromUtf8(aString.makeStringAndClear());
1963 }
1964 
dump(const uno::Reference<drawing::XShape> & xPageShapes,bool bDumpInteropProperties)1965 OUString XShapeDumper::dump(const uno::Reference<drawing::XShape>& xPageShapes, bool bDumpInteropProperties)
1966 {
1967     OStringBuffer aString;
1968     xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO( writeCallback, closeCallback, &aString, nullptr );
1969     xmlTextWriterPtr xmlWriter = xmlNewTextWriter( xmlOutBuffer );
1970     xmlTextWriterSetIndent( xmlWriter, 1 );
1971 
1972     xmlTextWriterStartDocument( xmlWriter, nullptr, nullptr, nullptr );
1973 
1974     try
1975     {
1976         dumpXShape( xPageShapes, xmlWriter, bDumpInteropProperties );
1977     }
1978     catch (const beans::UnknownPropertyException& e)
1979     {
1980         std::cout << "Exception caught in XShapeDumper: " << e.Message << std::endl;
1981     }
1982 
1983     xmlTextWriterEndDocument( xmlWriter );
1984     xmlFreeTextWriter( xmlWriter );
1985 
1986     return OUString::fromUtf8(aString.makeStringAndClear());
1987 }
1988 
1989 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
1990