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