cool#10630 lok doc sign: fix Impress sign line when picking a certificate
[LibreOffice.git] / drawinglayer / source / dumper / XShapeDumper.cxx
blob5a9fef72a941dff15ef1fa43a12b7183105c5e32
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <drawinglayer/XShapeDumper.hxx>
11 #include "EnhancedShapeDumper.hxx"
12 #include <com/sun/star/drawing/XShapes.hpp>
13 #include <com/sun/star/drawing/XShape.hpp>
14 #include <com/sun/star/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>
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>
26 #include <com/sun/star/drawing/PolygonKind.hpp>
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>
35 #include <com/sun/star/drawing/HomogenMatrixLine3.hpp>
36 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
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>
48 #define DEBUG_DUMPER 0
50 using namespace com::sun::star;
52 namespace {
54 // FUNCTION DECLARATIONS
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);
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);
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);
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);
107 // CharacterProperties.idl
108 void dumpCharHeightAsAttribute(float fHeight, xmlTextWriterPtr xmlWriter);
109 void dumpCharColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter);
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);
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);
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);
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);
165 // XShape.idl
166 void dumpPositionAsAttribute(const css::awt::Point& rPoint, xmlTextWriterPtr xmlWriter);
167 void dumpSizeAsAttribute(const css::awt::Size& rSize, xmlTextWriterPtr xmlWriter);
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);
183 int writeCallback(void* pContext, const char* sBuffer, int nLen)
185 OStringBuffer* pBuffer = static_cast<OStringBuffer*>(pContext);
186 pBuffer->append(sBuffer);
187 return nLen;
190 int closeCallback(void* )
192 return 0;
195 bool m_bNameDumped;
198 // ---------- FillProperties.idl ----------
200 void dumpFillStyleAsAttribute(drawing::FillStyle eFillStyle, xmlTextWriterPtr xmlWriter)
202 switch(eFillStyle)
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;
224 void dumpFillColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter)
226 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillColor"), "%06x", static_cast<unsigned int>(aColor));
229 void dumpFillTransparenceAsAttribute(sal_Int32 aTransparence, xmlTextWriterPtr xmlWriter)
231 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillTransparence"), "%" SAL_PRIdINT32, aTransparence);
234 void dumpFillTransparenceGradientNameAsAttribute(std::u16string_view sTranspGradName, xmlTextWriterPtr xmlWriter)
236 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillTransparenceGradientName"), "%s",
237 OUStringToOString(sTranspGradName, RTL_TEXTENCODING_UTF8).getStr());
240 //because there's more awt::Gradient properties to dump
241 void dumpGradientProperty(const awt::Gradient& rGradient, xmlTextWriterPtr xmlWriter)
243 switch (rGradient.Style) //enum GradientStyle
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;
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));
277 void dumpFillTransparenceGradientAsElement(const awt::Gradient& rTranspGrad, xmlTextWriterPtr xmlWriter)
279 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FillTransparenceGradient" ));
280 dumpGradientProperty(rTranspGrad, xmlWriter);
281 (void)xmlTextWriterEndElement( xmlWriter );
284 void dumpFillGradientNameAsAttribute(std::u16string_view sGradName, xmlTextWriterPtr xmlWriter)
286 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillGradientName"), "%s",
287 OUStringToOString(sGradName, RTL_TEXTENCODING_UTF8).getStr());
290 void dumpFillGradientAsElement(const awt::Gradient& rGradient, xmlTextWriterPtr xmlWriter)
292 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FillGradient" ));
293 dumpGradientProperty(rGradient, xmlWriter);
294 (void)xmlTextWriterEndElement( xmlWriter );
297 void dumpFillHatchAsElement(const drawing::Hatch& rHatch, xmlTextWriterPtr xmlWriter)
299 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FillHatch" ));
300 switch (rHatch.Style)
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;
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 );
320 void dumpFillBackgroundAsAttribute(bool bBackground, xmlTextWriterPtr xmlWriter)
322 if(bBackground)
323 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBackground"), "%s", "true");
324 else
325 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBackground"), "%s", "false");
328 void dumpFillBitmapAsElement(const uno::Reference<awt::XBitmap>& xBitmap, xmlTextWriterPtr xmlWriter)
330 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FillBitmap" ));
331 if (xBitmap.is())
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);
337 (void)xmlTextWriterEndElement( xmlWriter );
340 void dumpFillBitmapPositionOffsetXAsAttribute(sal_Int32 aBitmapPositionOffsetX, xmlTextWriterPtr xmlWriter)
342 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapPositionOffsetX"), "%" SAL_PRIdINT32, aBitmapPositionOffsetX);
345 void dumpFillBitmapPositionOffsetYAsAttribute(sal_Int32 aBitmapPositionOffsetY, xmlTextWriterPtr xmlWriter)
347 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapPositionOffsetY"), "%" SAL_PRIdINT32, aBitmapPositionOffsetY);
350 void dumpFillBitmapOffsetXAsAttribute(sal_Int32 aBitmapOffsetX, xmlTextWriterPtr xmlWriter)
352 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapOffsetX"), "%" SAL_PRIdINT32, aBitmapOffsetX);
355 void dumpFillBitmapOffsetYAsAttribute(sal_Int32 aBitmapOffsetY, xmlTextWriterPtr xmlWriter)
357 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapOffsetY"), "%" SAL_PRIdINT32, aBitmapOffsetY);
360 void dumpFillBitmapRectanglePointAsAttribute(drawing::RectanglePoint eBitmapRectanglePoint, xmlTextWriterPtr xmlWriter)
362 switch(eBitmapRectanglePoint)
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;
396 void dumpFillBitmapLogicalSizeAsAttribute(bool bBitmapLogicalSize, xmlTextWriterPtr xmlWriter)
398 if(bBitmapLogicalSize)
399 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapLogicalSize"), "%s", "true");
400 else
401 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapLogicalSize"), "%s", "false");
404 void dumpFillBitmapSizeXAsAttribute(sal_Int32 aBitmapSizeX, xmlTextWriterPtr xmlWriter)
406 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapSizeX"), "%" SAL_PRIdINT32, aBitmapSizeX);
409 void dumpFillBitmapSizeYAsAttribute(sal_Int32 aBitmapSizeY, xmlTextWriterPtr xmlWriter)
411 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapSizeY"), "%" SAL_PRIdINT32, aBitmapSizeY);
414 void dumpFillBitmapModeAsAttribute(drawing::BitmapMode eBitmapMode, xmlTextWriterPtr xmlWriter)
416 switch(eBitmapMode)
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;
432 void dumpFillBitmapStretchAsAttribute(bool bBitmapStretch, xmlTextWriterPtr xmlWriter)
434 if(bBitmapStretch)
435 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapStretch"), "%s", "true");
436 else
437 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapStretch"), "%s", "false");
440 void dumpFillBitmapTileAsAttribute(bool bBitmapTile, xmlTextWriterPtr xmlWriter)
442 if(bBitmapTile)
443 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapTile"), "%s", "true");
444 else
445 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fillBitmapTile"), "%s", "false");
449 // ---------- LineProperties.idl ----------
452 void dumpLineStyleAsAttribute(drawing::LineStyle eLineStyle, xmlTextWriterPtr xmlWriter)
454 switch(eLineStyle)
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;
470 void dumpLineDashAsElement(const drawing::LineDash& rLineDash, xmlTextWriterPtr xmlWriter)
472 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "LineDash" ));
473 switch (rLineDash.Style)
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;
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 );
498 void dumpLineDashNameAsAttribute(std::u16string_view sLineDashName, xmlTextWriterPtr xmlWriter)
500 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineDashName"), "%s",
501 OUStringToOString(sLineDashName, RTL_TEXTENCODING_UTF8).getStr());
504 void dumpLineColorAsAttribute(sal_Int32 aLineColor, xmlTextWriterPtr xmlWriter)
506 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineColor"), "%06x", static_cast<unsigned int>(aLineColor));
509 void dumpLineTransparenceAsAttribute(sal_Int32 aLineTransparence, xmlTextWriterPtr xmlWriter)
511 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineTransparence"), "%" SAL_PRIdINT32, aLineTransparence);
514 void dumpLineWidthAsAttribute(sal_Int32 aLineWidth, xmlTextWriterPtr xmlWriter)
516 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineWidth"), "%" SAL_PRIdINT32, aLineWidth);
519 void dumpLineJointAsAttribute(drawing::LineJoint eLineJoint, xmlTextWriterPtr xmlWriter)
521 switch(eLineJoint)
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;
543 void dumpLineStartNameAsAttribute(std::u16string_view sLineStartName, xmlTextWriterPtr xmlWriter)
545 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineStartName"), "%s",
546 OUStringToOString(sLineStartName, RTL_TEXTENCODING_UTF8).getStr());
549 void dumpLineEndNameAsAttribute(std::u16string_view sLineEndName, xmlTextWriterPtr xmlWriter)
551 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineEndName"), "%s",
552 OUStringToOString(sLineEndName, RTL_TEXTENCODING_UTF8).getStr());
555 void dumpPolyPolygonBezierCoords(const drawing::PolyPolygonBezierCoords& rPolyPolygonBezierCoords, xmlTextWriterPtr xmlWriter)
557 dumpPointSequenceSequence(rPolyPolygonBezierCoords.Coordinates, &rPolyPolygonBezierCoords.Flags, xmlWriter);
560 void dumpLineStartAsElement(const drawing::PolyPolygonBezierCoords& rLineStart, xmlTextWriterPtr xmlWriter)
562 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "LineStart" ));
563 dumpPolyPolygonBezierCoords(rLineStart, xmlWriter);
564 (void)xmlTextWriterEndElement( xmlWriter );
567 void dumpLineEndAsElement(const drawing::PolyPolygonBezierCoords& rLineEnd, xmlTextWriterPtr xmlWriter)
569 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "LineEnd" ));
570 dumpPolyPolygonBezierCoords(rLineEnd, xmlWriter);
571 (void)xmlTextWriterEndElement( xmlWriter );
574 void dumpLineStartCenterAsAttribute(bool bLineStartCenter, xmlTextWriterPtr xmlWriter)
576 if(bLineStartCenter)
577 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStartCenter"), "%s", "true");
578 else
579 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineStartCenter"), "%s", "false");
582 void dumpLineStartWidthAsAttribute(sal_Int32 aLineStartWidth, xmlTextWriterPtr xmlWriter)
584 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineStartWidth"), "%" SAL_PRIdINT32, aLineStartWidth);
587 void dumpLineEndCenterAsAttribute(bool bLineEndCenter, xmlTextWriterPtr xmlWriter)
589 if(bLineEndCenter)
590 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineEndCenter"), "%s", "true");
591 else
592 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lineEndCenter"), "%s", "false");
595 void dumpLineEndWidthAsAttribute(sal_Int32 aLineEndWidth, xmlTextWriterPtr xmlWriter)
597 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("lineEndWidth"), "%" SAL_PRIdINT32, aLineEndWidth);
601 // ---------- PolyPolygonDescriptor.idl ----------
604 void dumpPolygonKindAsAttribute(drawing::PolygonKind ePolygonKind, xmlTextWriterPtr xmlWriter)
606 switch(ePolygonKind)
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;
640 void dumpPointSequenceSequence(const drawing::PointSequenceSequence& aPointSequenceSequence, const uno::Sequence<uno::Sequence< drawing::PolygonFlags > >* pFlags, xmlTextWriterPtr xmlWriter)
642 // LibreOffice proudly presents - The Sequenception
643 sal_Int32 nPointsSequence = aPointSequenceSequence.getLength();
645 for (sal_Int32 i = 0; i < nPointsSequence; ++i)
647 const uno::Sequence< awt::Point >& pointSequence = aPointSequenceSequence[i];
648 sal_Int32 nPoints = pointSequence.getLength();
650 uno::Sequence< drawing::PolygonFlags> flagsSequence;
651 if(pFlags)
652 flagsSequence = (*pFlags)[i];
654 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "pointSequence" ));
656 for(sal_Int32 j = 0; j < nPoints; ++j)
658 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "point" ));
659 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, pointSequence[j].X);
660 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionY"), "%" SAL_PRIdINT32, pointSequence[j].Y);
662 if(pFlags)
664 switch(flagsSequence[j])
666 case drawing::PolygonFlags_NORMAL:
667 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonFlags"), "%s", "NORMAL");
668 break;
669 case drawing::PolygonFlags_SMOOTH:
670 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonFlags"), "%s", "SMOOTH");
671 break;
672 case drawing::PolygonFlags_CONTROL:
673 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonFlags"), "%s", "CONTROL");
674 break;
675 case drawing::PolygonFlags_SYMMETRIC:
676 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("polygonFlags"), "%s", "SYMMETRIC");
677 break;
678 default:
679 break;
683 (void)xmlTextWriterEndElement( xmlWriter );
685 (void)xmlTextWriterEndElement( xmlWriter );
689 void dumpPolyPolygonAsElement(const drawing::PointSequenceSequence& rPolyPolygon, xmlTextWriterPtr xmlWriter)
691 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PolyPolygon" ));
692 dumpPointSequenceSequence(rPolyPolygon, nullptr, xmlWriter);
693 (void)xmlTextWriterEndElement( xmlWriter );
696 void dumpGeometryAsElement(const drawing::PointSequenceSequence& aGeometry, xmlTextWriterPtr xmlWriter)
698 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Geometry" ));
699 dumpPointSequenceSequence(aGeometry, nullptr, xmlWriter);
700 (void)xmlTextWriterEndElement( xmlWriter );
703 // CharacterProperties.idl
704 void dumpCharHeightAsAttribute(float fHeight, xmlTextWriterPtr xmlWriter)
706 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fontHeight"), "%f", fHeight );
709 void dumpCharColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter)
711 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fontColor"), "%06x", static_cast<unsigned int>(aColor));
715 // ---------- TextProperties.idl ----------
718 void dumpIsNumberingAsAttribute(bool bIsNumbering, xmlTextWriterPtr xmlWriter)
720 if(bIsNumbering)
721 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("isNumbering"), "%s", "true");
722 else
723 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("isNumbering"), "%s", "false");
726 void dumpTextAutoGrowHeightAsAttribute(bool bTextAutoGrowHeight, xmlTextWriterPtr xmlWriter)
728 if(bTextAutoGrowHeight)
729 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowHeight"), "%s", "true");
730 else
731 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowHeight"), "%s", "false");
734 void dumpTextAutoGrowWidthAsAttribute(bool bTextAutoGrowWidth, xmlTextWriterPtr xmlWriter)
736 if(bTextAutoGrowWidth)
737 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowWidth"), "%s", "true");
738 else
739 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowWidth"), "%s", "false");
742 void dumpTextContourFrameAsAttribute(bool bTextContourFrame, xmlTextWriterPtr xmlWriter)
744 if(bTextContourFrame)
745 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textContourFrame"), "%s", "true");
746 else
747 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textContourFrame"), "%s", "false");
750 void dumpTextFitToSizeAsAttribute(drawing::TextFitToSizeType eTextFitToSize, xmlTextWriterPtr xmlWriter)
752 switch(eTextFitToSize)
754 case drawing::TextFitToSizeType_NONE:
755 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textFitToSize"), "%s", "NONE");
756 break;
757 case drawing::TextFitToSizeType_PROPORTIONAL:
758 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textFitToSize"), "%s", "PROPORTIONAL");
759 break;
760 case drawing::TextFitToSizeType_ALLLINES:
761 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textFitToSize"), "%s", "ALLLINES");
762 break;
763 case drawing::TextFitToSizeType_AUTOFIT:
764 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textFitToSize"), "%s", "AUTOFIT");
765 break;
766 default:
767 break;
771 void dumpTextHorizontalAdjustAsAttribute(drawing::TextHorizontalAdjust eTextHorizontalAdjust, xmlTextWriterPtr xmlWriter)
773 switch(eTextHorizontalAdjust)
775 case drawing::TextHorizontalAdjust_LEFT:
776 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textHorizontalAdjust"), "%s", "LEFT");
777 break;
778 case drawing::TextHorizontalAdjust_CENTER:
779 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textHorizontalAdjust"), "%s", "CENTER");
780 break;
781 case drawing::TextHorizontalAdjust_RIGHT:
782 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textHorizontalAdjust"), "%s", "RIGHT");
783 break;
784 case drawing::TextHorizontalAdjust_BLOCK:
785 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textHorizontalAdjust"), "%s", "BLOCK");
786 break;
787 default:
788 break;
792 void dumpTextVerticalAdjustAsAttribute(drawing::TextVerticalAdjust eTextVerticalAdjust, xmlTextWriterPtr xmlWriter)
794 switch(eTextVerticalAdjust)
796 case drawing::TextVerticalAdjust_TOP:
797 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textVerticalAdjust"), "%s", "TOP");
798 break;
799 case drawing::TextVerticalAdjust_CENTER:
800 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textVerticalAdjust"), "%s", "CENTER");
801 break;
802 case drawing::TextVerticalAdjust_BOTTOM:
803 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textVerticalAdjust"), "%s", "BOTTOM");
804 break;
805 case drawing::TextVerticalAdjust_BLOCK:
806 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textVerticalAdjust"), "%s", "BLOCK");
807 break;
808 default:
809 break;
813 void dumpTextLeftDistanceAsAttribute(sal_Int32 aTextLeftDistance, xmlTextWriterPtr xmlWriter)
815 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textLeftDistance"), "%" SAL_PRIdINT32, aTextLeftDistance);
818 void dumpTextRightDistanceAsAttribute(sal_Int32 aTextRightDistance, xmlTextWriterPtr xmlWriter)
820 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textRightDistance"), "%" SAL_PRIdINT32, aTextRightDistance);
823 void dumpTextUpperDistanceAsAttribute(sal_Int32 aTextUpperDistance, xmlTextWriterPtr xmlWriter)
825 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textUpperDistance"), "%" SAL_PRIdINT32, aTextUpperDistance);
828 void dumpTextLowerDistanceAsAttribute(sal_Int32 aTextLowerDistance, xmlTextWriterPtr xmlWriter)
830 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textLowerDistance"), "%" SAL_PRIdINT32, aTextLowerDistance);
833 void dumpTextMaximumFrameHeightAsAttribute(sal_Int32 aTextMaximumFrameHeight, xmlTextWriterPtr xmlWriter)
835 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMaximumFrameHeight"), "%" SAL_PRIdINT32, aTextMaximumFrameHeight);
838 void dumpTextMaximumFrameWidthAsAttribute(sal_Int32 aTextMaximumFrameWidth, xmlTextWriterPtr xmlWriter)
840 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMaximumFrameWidth"), "%" SAL_PRIdINT32, aTextMaximumFrameWidth);
843 void dumpTextMinimumFrameHeightAsAttribute(sal_Int32 aTextMinimumFrameHeight, xmlTextWriterPtr xmlWriter)
845 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMinimumFrameHeight"), "%" SAL_PRIdINT32, aTextMinimumFrameHeight);
848 void dumpTextMinimumFrameWidthAsAttribute(sal_Int32 aTextMinimumFrameWidth, xmlTextWriterPtr xmlWriter)
850 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMinimumFrameWidth"), "%" SAL_PRIdINT32, aTextMinimumFrameWidth);
853 void dumpTextAnimationAmountAsAttribute(sal_Int32 aTextAnimationAmount, xmlTextWriterPtr xmlWriter)
855 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textAnimationAmount"), "%" SAL_PRIdINT32, aTextAnimationAmount);
858 void dumpTextAnimationCountAsAttribute(sal_Int32 aTextAnimationCount, xmlTextWriterPtr xmlWriter)
860 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textAnimationCount"), "%" SAL_PRIdINT32, aTextAnimationCount);
863 void dumpTextAnimationDelayAsAttribute(sal_Int32 aTextAnimationDelay, xmlTextWriterPtr xmlWriter)
865 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textAnimationDelay"), "%" SAL_PRIdINT32, aTextAnimationDelay);
868 void dumpTextAnimationDirectionAsAttribute(drawing::TextAnimationDirection eTextAnimationDirection, xmlTextWriterPtr xmlWriter)
870 switch(eTextAnimationDirection)
872 case drawing::TextAnimationDirection_LEFT:
873 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationDirection"), "%s", "LEFT");
874 break;
875 case drawing::TextAnimationDirection_RIGHT:
876 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationDirection"), "%s", "RIGHT");
877 break;
878 case drawing::TextAnimationDirection_UP:
879 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationDirection"), "%s", "UP");
880 break;
881 case drawing::TextAnimationDirection_DOWN:
882 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationDirection"), "%s", "DOWN");
883 break;
884 default:
885 break;
889 void dumpTextAnimationKindAsAttribute(drawing::TextAnimationKind eTextAnimationKind, xmlTextWriterPtr xmlWriter)
891 switch(eTextAnimationKind)
893 case drawing::TextAnimationKind_NONE:
894 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "NONE");
895 break;
896 case drawing::TextAnimationKind_BLINK:
897 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "BLINK");
898 break;
899 case drawing::TextAnimationKind_SCROLL:
900 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "SCROLL");
901 break;
902 case drawing::TextAnimationKind_ALTERNATE:
903 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "ALTERNATE");
904 break;
905 case drawing::TextAnimationKind_SLIDE:
906 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationKind"), "%s", "SLIDE");
907 break;
908 default:
909 break;
913 void dumpTextAnimationStartInsideAsAttribute(bool bTextAnimationStartInside, xmlTextWriterPtr xmlWriter)
915 if(bTextAnimationStartInside)
916 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStartInside"), "%s", "true");
917 else
918 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStartInside"), "%s", "false");
921 void dumpTextAnimationStopInsideAsAttribute(bool bTextAnimationStopInside, xmlTextWriterPtr xmlWriter)
923 if(bTextAnimationStopInside)
924 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStopInside"), "%s", "true");
925 else
926 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStopInside"), "%s", "false");
929 void dumpTextWritingModeAsAttribute(text::WritingMode eTextWritingMode, xmlTextWriterPtr xmlWriter)
931 switch(eTextWritingMode)
933 case text::WritingMode_LR_TB:
934 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textWritingMode"), "%s", "LR_TB");
935 break;
936 case text::WritingMode_RL_TB:
937 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textWritingMode"), "%s", "RL_TB");
938 break;
939 case text::WritingMode_TB_RL:
940 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textWritingMode"), "%s", "TB_RL");
941 break;
942 default:
943 break;
948 // ---------- ShadowProperties.idl ----------
951 void dumpShadowAsAttribute(bool bShadow, xmlTextWriterPtr xmlWriter)
953 if(bShadow)
954 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadow"), "%s", "true");
955 else
956 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadow"), "%s", "false");
959 void dumpShadowColorAsAttribute(sal_Int32 aShadowColor, xmlTextWriterPtr xmlWriter)
961 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowColor"), "%06x", static_cast<unsigned int>(aShadowColor));
964 void dumpShadowTransparenceAsAttribute(sal_Int32 aShadowTransparence, xmlTextWriterPtr xmlWriter)
966 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowTransparence"), "%" SAL_PRIdINT32, aShadowTransparence);
969 void dumpShadowXDistanceAsAttribute(sal_Int32 aShadowXDistance, xmlTextWriterPtr xmlWriter)
971 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowXDistance"), "%" SAL_PRIdINT32, aShadowXDistance);
974 void dumpShadowYDistanceAsAttribute(sal_Int32 aShadowYDistance, xmlTextWriterPtr xmlWriter)
976 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowYDistance"), "%" SAL_PRIdINT32, aShadowYDistance);
980 // ---------- Shape.idl ----------
983 void dumpZOrderAsAttribute(sal_Int32 aZOrder, xmlTextWriterPtr xmlWriter)
985 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("zOrder"), "%" SAL_PRIdINT32, aZOrder);
988 void dumpLayerIDAsAttribute(sal_Int32 aLayerID, xmlTextWriterPtr xmlWriter)
990 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("layerID"), "%" SAL_PRIdINT32, aLayerID);
993 void dumpLayerNameAsAttribute(std::u16string_view sLayerName, xmlTextWriterPtr xmlWriter)
995 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("layerName"), "%s",
996 OUStringToOString(sLayerName, RTL_TEXTENCODING_UTF8).getStr());
999 void dumpVisibleAsAttribute(bool bVisible, xmlTextWriterPtr xmlWriter)
1001 if(bVisible)
1002 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("visible"), "%s", "true");
1003 else
1004 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("visible"), "%s", "false");
1007 void dumpPrintableAsAttribute(bool bPrintable, xmlTextWriterPtr xmlWriter)
1009 if(bPrintable)
1010 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("printable"), "%s", "true");
1011 else
1012 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("printable"), "%s", "false");
1015 void dumpMoveProtectAsAttribute(bool bMoveProtect, xmlTextWriterPtr xmlWriter)
1017 if(bMoveProtect)
1018 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("moveProtect"), "%s", "true");
1019 else
1020 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("moveProtect"), "%s", "false");
1023 void dumpNameAsAttribute(std::u16string_view sName, xmlTextWriterPtr xmlWriter)
1025 if(!sName.empty() && !m_bNameDumped)
1027 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s", OUStringToOString(sName, RTL_TEXTENCODING_UTF8).getStr());
1028 m_bNameDumped = true;
1032 void dumpSizeProtectAsAttribute(bool bSizeProtect, xmlTextWriterPtr xmlWriter)
1034 if(bSizeProtect)
1035 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("sizeProtect"), "%s", "true");
1036 else
1037 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("sizeProtect"), "%s", "false");
1040 void dumpHomogenMatrixLine3(const drawing::HomogenMatrixLine3& rHomogenMatrixLine3, xmlTextWriterPtr xmlWriter)
1042 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("column1"), "%f", rHomogenMatrixLine3.Column1);
1043 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("column2"), "%f", rHomogenMatrixLine3.Column2);
1044 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("column3"), "%f", rHomogenMatrixLine3.Column3);
1047 void dumpTransformationAsElement(const drawing::HomogenMatrix3& rTransformation, xmlTextWriterPtr xmlWriter)
1049 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Transformation" ));
1051 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Line1" ));
1052 dumpHomogenMatrixLine3(rTransformation.Line1, xmlWriter);
1053 (void)xmlTextWriterEndElement( xmlWriter );
1054 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Line2" ));
1055 dumpHomogenMatrixLine3(rTransformation.Line2, xmlWriter);
1056 (void)xmlTextWriterEndElement( xmlWriter );
1057 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Line3" ));
1058 dumpHomogenMatrixLine3(rTransformation.Line3, xmlWriter);
1059 (void)xmlTextWriterEndElement( xmlWriter );
1061 (void)xmlTextWriterEndElement( xmlWriter );
1064 void dumpNavigationOrderAsAttribute(sal_Int32 aNavigationOrder, xmlTextWriterPtr xmlWriter)
1066 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("navigationOrder"), "%" SAL_PRIdINT32, aNavigationOrder);
1069 void dumpHyperlinkAsAttribute(std::u16string_view sHyperlink, xmlTextWriterPtr xmlWriter)
1071 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("hyperlink"), "%s",
1072 OUStringToOString(sHyperlink, RTL_TEXTENCODING_UTF8).getStr());
1075 void dumpInteropGrabBagAsElement(const uno::Sequence< beans::PropertyValue>& aInteropGrabBag, xmlTextWriterPtr xmlWriter)
1077 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "InteropGrabBag" ));
1079 for (const auto& item: aInteropGrabBag)
1080 dumpPropertyValueAsElement(item, xmlWriter);
1082 (void)xmlTextWriterEndElement( xmlWriter );
1086 // ---------- XShape.idl ----------
1089 void dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
1091 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
1092 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionY"), "%" SAL_PRIdINT32, rPoint.Y);
1095 void dumpSizeAsAttribute(const awt::Size& rSize, xmlTextWriterPtr xmlWriter)
1097 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("sizeX"), "%" SAL_PRIdINT32, rSize.Width);
1098 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("sizeY"), "%" SAL_PRIdINT32, rSize.Height);
1101 void dumpShapeDescriptorAsAttribute( const uno::Reference< drawing::XShapeDescriptor >& xDescr, xmlTextWriterPtr xmlWriter )
1103 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("type"), "%s",
1104 OUStringToOString(xDescr->getShapeType(), RTL_TEXTENCODING_UTF8).getStr());
1108 // ---------- CustomShape.idl ----------
1111 void dumpCustomShapeEngineAsAttribute(std::u16string_view sCustomShapeEngine, xmlTextWriterPtr xmlWriter)
1113 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeEngine"), "%s",
1114 OUStringToOString(sCustomShapeEngine, RTL_TEXTENCODING_UTF8).getStr());
1117 void dumpCustomShapeDataAsAttribute(
1118 std::u16string_view sCustomShapeData, xmlTextWriterPtr xmlWriter)
1120 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeData"), "%s",
1121 OUStringToOString(sCustomShapeData, RTL_TEXTENCODING_UTF8).getStr());
1124 void dumpPropertyValueAsElement(const beans::PropertyValue& rPropertyValue, xmlTextWriterPtr xmlWriter)
1126 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PropertyValue" ));
1128 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s",
1129 OUStringToOString(rPropertyValue.Name, RTL_TEXTENCODING_UTF8).getStr());
1131 uno::Any aAny = rPropertyValue.Value;
1132 if(OUString sValue; aAny >>= sValue)
1134 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s",
1135 OUStringToOString(sValue, RTL_TEXTENCODING_UTF8).getStr());
1137 else if(sal_Int32 nValue; aAny >>= nValue)
1139 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%" SAL_PRIdINT32, nValue);
1141 else if(float fValue; aAny >>= fValue)
1143 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%f", fValue);
1145 else if(bool bValue; aAny >>= bValue)
1147 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s", (bValue? "true": "false"));
1149 else if(awt::Rectangle aRectangleValue;
1150 rPropertyValue.Name == "ViewBox" && (aAny >>= aRectangleValue))
1152 EnhancedShapeDumper enhancedDumper(xmlWriter);
1153 enhancedDumper.dumpViewBoxAsElement(aRectangleValue);
1155 else if(uno::Sequence< drawing::EnhancedCustomShapeAdjustmentValue> aAdjustmentValues;
1156 rPropertyValue.Name == "AdjustmentValues" && (aAny >>= aAdjustmentValues))
1158 EnhancedShapeDumper enhancedDumper(xmlWriter);
1159 enhancedDumper.dumpAdjustmentValuesAsElement(aAdjustmentValues);
1161 else if(uno::Sequence< drawing::EnhancedCustomShapeParameterPair > aCoordinates;
1162 rPropertyValue.Name == "Coordinates" && (aAny >>= aCoordinates))
1164 EnhancedShapeDumper enhancedDumper(xmlWriter);
1165 enhancedDumper.dumpCoordinatesAsElement(aCoordinates);
1167 else if(uno::Sequence< drawing::EnhancedCustomShapeSegment > aSegments;
1168 rPropertyValue.Name == "Segments" && (aAny >>= aSegments))
1170 EnhancedShapeDumper enhancedDumper(xmlWriter);
1171 enhancedDumper.dumpSegmentsAsElement(aSegments);
1173 else if(uno::Sequence< beans::PropertyValue > aPropSeq; aAny >>= aPropSeq)
1175 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( OUStringToOString(rPropertyValue.Name, RTL_TEXTENCODING_UTF8).getStr() ));
1177 sal_Int32 i = 0, nCount = aPropSeq.getLength();
1178 for ( ; i < nCount; i++ )
1179 dumpPropertyValueAsElement(aPropSeq[ i ], xmlWriter);
1181 (void)xmlTextWriterEndElement(xmlWriter);
1184 // TODO: Add here dumping of XDocument for future OOX Smart-Art
1185 // properties.
1187 // TODO more, if necessary
1189 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("handle"), "%" SAL_PRIdINT32, rPropertyValue.Handle);
1191 switch(rPropertyValue.State)
1193 case beans::PropertyState_DIRECT_VALUE:
1194 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "DIRECT_VALUE");
1195 break;
1196 case beans::PropertyState_DEFAULT_VALUE:
1197 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "DEFAULT_VALUE");
1198 break;
1199 case beans::PropertyState_AMBIGUOUS_VALUE:
1200 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "AMBIGUOUS_VALUE");
1201 break;
1202 default:
1203 break;
1205 (void)xmlTextWriterEndElement( xmlWriter );
1208 void dumpCustomShapeGeometryAsElement(const uno::Sequence< beans::PropertyValue>& aCustomShapeGeometry, xmlTextWriterPtr xmlWriter)
1210 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "CustomShapeGeometry" ));
1212 sal_Int32 nLength = aCustomShapeGeometry.getLength();
1213 for (sal_Int32 i = 0; i < nLength; ++i)
1214 dumpPropertyValueAsElement(aCustomShapeGeometry[i], xmlWriter);
1216 (void)xmlTextWriterEndElement( xmlWriter );
1219 void dumpCustomShapeReplacementURLAsAttribute(std::u16string_view sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter)
1221 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeReplacementURL"), "%s",
1222 OUStringToOString(sCustomShapeReplacementURL, RTL_TEXTENCODING_UTF8).getStr());
1225 // methods dumping whole services
1227 void dumpTextPropertiesService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1229 uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
1230 if(xInfo->hasPropertyByName(u"CharHeight"_ustr))
1232 uno::Any anotherAny = xPropSet->getPropertyValue(u"CharHeight"_ustr);
1233 float fHeight;
1234 if(anotherAny >>= fHeight)
1235 dumpCharHeightAsAttribute(fHeight, xmlWriter);
1237 if(xInfo->hasPropertyByName(u"CharColor"_ustr))
1239 uno::Any anotherAny = xPropSet->getPropertyValue(u"CharColor"_ustr);
1240 sal_Int32 aColor = sal_Int32();
1241 if(anotherAny >>= aColor)
1242 dumpCharColorAsAttribute(aColor, xmlWriter);
1244 // TODO - more properties from CharacterProperties.idl (similar to above)
1246 if(xInfo->hasPropertyByName(u"IsNumbering"_ustr))
1248 uno::Any anotherAny = xPropSet->getPropertyValue(u"IsNumbering"_ustr);
1249 bool bIsNumbering;
1250 if(anotherAny >>= bIsNumbering)
1251 dumpIsNumberingAsAttribute(bIsNumbering, xmlWriter);
1254 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextAutoGrowHeight"_ustr);
1255 bool bTextAutoGrowHeight;
1256 if(anotherAny >>= bTextAutoGrowHeight)
1257 dumpTextAutoGrowHeightAsAttribute(bTextAutoGrowHeight, xmlWriter);
1260 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextAutoGrowWidth"_ustr);
1261 bool bTextAutoGrowWidth;
1262 if(anotherAny >>= bTextAutoGrowWidth)
1263 dumpTextAutoGrowWidthAsAttribute(bTextAutoGrowWidth, xmlWriter);
1266 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextContourFrame"_ustr);
1267 bool bTextContourFrame;
1268 if(anotherAny >>= bTextContourFrame)
1269 dumpTextContourFrameAsAttribute(bTextContourFrame, xmlWriter);
1272 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextFitToSize"_ustr);
1273 drawing::TextFitToSizeType eTextFitToSize;
1274 if(anotherAny >>= eTextFitToSize)
1275 dumpTextFitToSizeAsAttribute(eTextFitToSize, xmlWriter);
1278 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextHorizontalAdjust"_ustr);
1279 drawing::TextHorizontalAdjust eTextHorizontalAdjust;
1280 if(anotherAny >>= eTextHorizontalAdjust)
1281 dumpTextHorizontalAdjustAsAttribute(eTextHorizontalAdjust, xmlWriter);
1284 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextVerticalAdjust"_ustr);
1285 drawing::TextVerticalAdjust eTextVerticalAdjust;
1286 if(anotherAny >>= eTextVerticalAdjust)
1287 dumpTextVerticalAdjustAsAttribute(eTextVerticalAdjust, xmlWriter);
1290 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextLeftDistance"_ustr);
1291 sal_Int32 aTextLeftDistance = sal_Int32();
1292 if(anotherAny >>= aTextLeftDistance)
1293 dumpTextLeftDistanceAsAttribute(aTextLeftDistance, xmlWriter);
1296 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextRightDistance"_ustr);
1297 sal_Int32 aTextRightDistance = sal_Int32();
1298 if(anotherAny >>= aTextRightDistance)
1299 dumpTextRightDistanceAsAttribute(aTextRightDistance, xmlWriter);
1302 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextUpperDistance"_ustr);
1303 sal_Int32 aTextUpperDistance = sal_Int32();
1304 if(anotherAny >>= aTextUpperDistance)
1305 dumpTextUpperDistanceAsAttribute(aTextUpperDistance, xmlWriter);
1308 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextLowerDistance"_ustr);
1309 sal_Int32 aTextLowerDistance = sal_Int32();
1310 if(anotherAny >>= aTextLowerDistance)
1311 dumpTextLowerDistanceAsAttribute(aTextLowerDistance, xmlWriter);
1314 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextMaximumFrameHeight"_ustr);
1315 sal_Int32 aTextMaximumFrameHeight = sal_Int32();
1316 if(anotherAny >>= aTextMaximumFrameHeight)
1317 dumpTextMaximumFrameHeightAsAttribute(aTextMaximumFrameHeight, xmlWriter);
1320 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextMaximumFrameWidth"_ustr);
1321 sal_Int32 aTextMaximumFrameWidth = sal_Int32();
1322 if(anotherAny >>= aTextMaximumFrameWidth)
1323 dumpTextMaximumFrameWidthAsAttribute(aTextMaximumFrameWidth, xmlWriter);
1326 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextMinimumFrameHeight"_ustr);
1327 sal_Int32 aTextMinimumFrameHeight = sal_Int32();
1328 if(anotherAny >>= aTextMinimumFrameHeight)
1329 dumpTextMinimumFrameHeightAsAttribute(aTextMinimumFrameHeight, xmlWriter);
1332 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextMinimumFrameWidth"_ustr);
1333 sal_Int32 aTextMinimumFrameWidth = sal_Int32();
1334 if(anotherAny >>= aTextMinimumFrameWidth)
1335 dumpTextMinimumFrameWidthAsAttribute(aTextMinimumFrameWidth, xmlWriter);
1338 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextAnimationAmount"_ustr);
1339 sal_Int32 aTextAnimationAmount = sal_Int32();
1340 if(anotherAny >>= aTextAnimationAmount)
1341 dumpTextAnimationAmountAsAttribute(aTextAnimationAmount, xmlWriter);
1344 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextAnimationCount"_ustr);
1345 sal_Int32 aTextAnimationCount = sal_Int32();
1346 if(anotherAny >>= aTextAnimationCount)
1347 dumpTextAnimationCountAsAttribute(aTextAnimationCount, xmlWriter);
1350 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextAnimationDelay"_ustr);
1351 sal_Int32 aTextAnimationDelay = sal_Int32();
1352 if(anotherAny >>= aTextAnimationDelay)
1353 dumpTextAnimationDelayAsAttribute(aTextAnimationDelay, xmlWriter);
1356 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextAnimationDirection"_ustr);
1357 drawing::TextAnimationDirection eTextAnimationDirection;
1358 if(anotherAny >>= eTextAnimationDirection)
1359 dumpTextAnimationDirectionAsAttribute(eTextAnimationDirection, xmlWriter);
1362 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextAnimationKind"_ustr);
1363 drawing::TextAnimationKind eTextAnimationKind;
1364 if(anotherAny >>= eTextAnimationKind)
1365 dumpTextAnimationKindAsAttribute(eTextAnimationKind, xmlWriter);
1368 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextAnimationStartInside"_ustr);
1369 bool bTextAnimationStartInside;
1370 if(anotherAny >>= bTextAnimationStartInside)
1371 dumpTextAnimationStartInsideAsAttribute(bTextAnimationStartInside, xmlWriter);
1374 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextAnimationStopInside"_ustr);
1375 bool bTextAnimationStopInside;
1376 if(anotherAny >>= bTextAnimationStopInside)
1377 dumpTextAnimationStopInsideAsAttribute(bTextAnimationStopInside, xmlWriter);
1380 uno::Any anotherAny = xPropSet->getPropertyValue(u"TextWritingMode"_ustr);
1381 text::WritingMode eTextWritingMode;
1382 if(anotherAny >>= eTextWritingMode)
1383 dumpTextWritingModeAsAttribute(eTextWritingMode, xmlWriter);
1387 void dumpFillPropertiesService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1390 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillStyle"_ustr);
1391 drawing::FillStyle eFillStyle;
1392 if(anotherAny >>= eFillStyle)
1393 dumpFillStyleAsAttribute(eFillStyle, xmlWriter);
1396 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillColor"_ustr);
1397 sal_Int32 aColor = sal_Int32();
1398 if(anotherAny >>= aColor)
1399 dumpFillColorAsAttribute(aColor, xmlWriter);
1402 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillTransparence"_ustr);
1403 sal_Int32 aTransparence = sal_Int32();
1404 if(anotherAny >>= aTransparence)
1405 dumpFillTransparenceAsAttribute(aTransparence, xmlWriter);
1408 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillTransparenceGradientName"_ustr);
1409 OUString sTranspGradName;
1410 if(anotherAny >>= sTranspGradName)
1411 dumpFillTransparenceGradientNameAsAttribute(sTranspGradName, xmlWriter);
1414 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillTransparenceGradient"_ustr);
1415 awt::Gradient aTranspGrad;
1416 if(anotherAny >>= aTranspGrad)
1417 dumpFillTransparenceGradientAsElement(aTranspGrad, xmlWriter);
1420 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillGradientName"_ustr);
1421 OUString sGradName;
1422 if(anotherAny >>= sGradName)
1423 dumpFillGradientNameAsAttribute(sGradName, xmlWriter);
1426 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillGradient"_ustr);
1427 awt::Gradient aGradient;
1428 if(anotherAny >>= aGradient)
1429 dumpFillGradientAsElement(aGradient, xmlWriter);
1432 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillHatchName"_ustr);
1433 OUString sHatchName;
1434 if(anotherAny >>= sHatchName)
1435 dumpFillGradientNameAsAttribute(sHatchName, xmlWriter);
1438 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillHatch"_ustr);
1439 drawing::Hatch aHatch;
1440 if(anotherAny >>= aHatch)
1441 dumpFillHatchAsElement(aHatch, xmlWriter);
1444 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillBackground"_ustr);
1445 bool bFillBackground;
1446 if(anotherAny >>= bFillBackground)
1447 dumpFillBackgroundAsAttribute(bFillBackground, xmlWriter);
1450 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillBitmapName"_ustr);
1451 OUString sBitmapName;
1452 if(anotherAny >>= sBitmapName)
1453 dumpFillGradientNameAsAttribute(sBitmapName, xmlWriter);
1456 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillBitmap"_ustr);
1457 uno::Reference<awt::XBitmap> xBitmap;
1458 if(anotherAny >>= xBitmap)
1459 dumpFillBitmapAsElement(xBitmap, xmlWriter);
1462 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillBitmapPositionOffsetX"_ustr);
1463 sal_Int32 aBitmapPositionOffsetX = sal_Int32();
1464 if(anotherAny >>= aBitmapPositionOffsetX)
1465 dumpFillBitmapPositionOffsetXAsAttribute(aBitmapPositionOffsetX, xmlWriter);
1468 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillBitmapPositionOffsetY"_ustr);
1469 sal_Int32 aBitmapPositionOffsetY = sal_Int32();
1470 if(anotherAny >>= aBitmapPositionOffsetY)
1471 dumpFillBitmapPositionOffsetYAsAttribute(aBitmapPositionOffsetY, xmlWriter);
1474 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillBitmapOffsetX"_ustr);
1475 sal_Int32 aBitmapOffsetX = sal_Int32();
1476 if(anotherAny >>= aBitmapOffsetX)
1477 dumpFillBitmapOffsetXAsAttribute(aBitmapOffsetX, xmlWriter);
1480 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillBitmapOffsetY"_ustr);
1481 sal_Int32 aBitmapOffsetY = sal_Int32();
1482 if(anotherAny >>= aBitmapOffsetY)
1483 dumpFillBitmapOffsetYAsAttribute(aBitmapOffsetY, xmlWriter);
1486 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillBitmapRectanglePoint"_ustr);
1487 drawing::RectanglePoint eBitmapRectanglePoint;
1488 if(anotherAny >>= eBitmapRectanglePoint)
1489 dumpFillBitmapRectanglePointAsAttribute(eBitmapRectanglePoint, xmlWriter);
1492 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillBitmapLogicalSize"_ustr);
1493 bool bBitmapLogicalSize;
1494 if(anotherAny >>= bBitmapLogicalSize)
1495 dumpFillBitmapLogicalSizeAsAttribute(bBitmapLogicalSize, xmlWriter);
1498 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillBitmapSizeX"_ustr);
1499 sal_Int32 aBitmapSizeX = sal_Int32();
1500 if(anotherAny >>= aBitmapSizeX)
1501 dumpFillBitmapSizeXAsAttribute(aBitmapSizeX, xmlWriter);
1504 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillBitmapSizeY"_ustr);
1505 sal_Int32 aBitmapSizeY = sal_Int32();
1506 if(anotherAny >>= aBitmapSizeY)
1507 dumpFillBitmapSizeYAsAttribute(aBitmapSizeY, xmlWriter);
1510 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillBitmapMode"_ustr);
1511 drawing::BitmapMode eBitmapMode;
1512 if(anotherAny >>= eBitmapMode)
1513 dumpFillBitmapModeAsAttribute(eBitmapMode, xmlWriter);
1516 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillBitmapStretch"_ustr);
1517 bool bBitmapStretch;
1518 if(anotherAny >>= bBitmapStretch)
1519 dumpFillBitmapStretchAsAttribute(bBitmapStretch, xmlWriter);
1522 uno::Any anotherAny = xPropSet->getPropertyValue(u"FillBitmapTile"_ustr);
1523 bool bBitmapTile;
1524 if(anotherAny >>= bBitmapTile)
1525 dumpFillBitmapTileAsAttribute(bBitmapTile, xmlWriter);
1529 void dumpLinePropertiesService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1532 uno::Any anotherAny = xPropSet->getPropertyValue(u"LineStyle"_ustr);
1533 drawing::LineStyle eLineStyle;
1534 if(anotherAny >>= eLineStyle)
1535 dumpLineStyleAsAttribute(eLineStyle, xmlWriter);
1538 uno::Any anotherAny = xPropSet->getPropertyValue(u"LineDash"_ustr);
1539 drawing::LineDash aLineDash;
1540 if(anotherAny >>= aLineDash)
1541 dumpLineDashAsElement(aLineDash, xmlWriter);
1544 uno::Any anotherAny = xPropSet->getPropertyValue(u"LineDashName"_ustr);
1545 OUString sLineDashName;
1546 if(anotherAny >>= sLineDashName)
1547 dumpLineDashNameAsAttribute(sLineDashName, xmlWriter);
1550 uno::Any anotherAny = xPropSet->getPropertyValue(u"LineColor"_ustr);
1551 sal_Int32 aLineColor = sal_Int32();
1552 if(anotherAny >>= aLineColor)
1553 dumpLineColorAsAttribute(aLineColor, xmlWriter);
1556 uno::Any anotherAny = xPropSet->getPropertyValue(u"LineTransparence"_ustr);
1557 sal_Int32 aLineTransparence = sal_Int32();
1558 if(anotherAny >>= aLineTransparence)
1559 dumpLineTransparenceAsAttribute(aLineTransparence, xmlWriter);
1562 uno::Any anotherAny = xPropSet->getPropertyValue(u"LineWidth"_ustr);
1563 sal_Int32 aLineWidth = sal_Int32();
1564 if(anotherAny >>= aLineWidth)
1565 dumpLineWidthAsAttribute(aLineWidth, xmlWriter);
1568 uno::Any anotherAny = xPropSet->getPropertyValue(u"LineJoint"_ustr);
1569 drawing::LineJoint eLineJoint;
1570 if(anotherAny >>= eLineJoint)
1571 dumpLineJointAsAttribute(eLineJoint, xmlWriter);
1574 uno::Any anotherAny = xPropSet->getPropertyValue(u"LineStartName"_ustr);
1575 OUString sLineStartName;
1576 if(anotherAny >>= sLineStartName)
1577 dumpLineStartNameAsAttribute(sLineStartName, xmlWriter);
1580 uno::Any anotherAny = xPropSet->getPropertyValue(u"LineEndName"_ustr);
1581 OUString sLineEndName;
1582 if(anotherAny >>= sLineEndName)
1583 dumpLineEndNameAsAttribute(sLineEndName, xmlWriter);
1586 uno::Any anotherAny = xPropSet->getPropertyValue(u"LineStart"_ustr);
1587 drawing::PolyPolygonBezierCoords aLineStart;
1588 if(anotherAny >>= aLineStart)
1589 dumpLineStartAsElement(aLineStart, xmlWriter);
1592 uno::Any anotherAny = xPropSet->getPropertyValue(u"LineEnd"_ustr);
1593 drawing::PolyPolygonBezierCoords aLineEnd;
1594 if(anotherAny >>= aLineEnd)
1595 dumpLineEndAsElement(aLineEnd, xmlWriter);
1598 uno::Any anotherAny = xPropSet->getPropertyValue(u"LineStartCenter"_ustr);
1599 bool bLineStartCenter;
1600 if(anotherAny >>= bLineStartCenter)
1601 dumpLineStartCenterAsAttribute(bLineStartCenter, xmlWriter);
1604 uno::Any anotherAny = xPropSet->getPropertyValue(u"LineStartWidth"_ustr);
1605 sal_Int32 aLineStartWidth = sal_Int32();
1606 if(anotherAny >>= aLineStartWidth)
1607 dumpLineStartWidthAsAttribute(aLineStartWidth, xmlWriter);
1610 uno::Any anotherAny = xPropSet->getPropertyValue(u"LineEndCenter"_ustr);
1611 bool bLineEndCenter;
1612 if(anotherAny >>= bLineEndCenter)
1613 dumpLineEndCenterAsAttribute(bLineEndCenter, xmlWriter);
1616 uno::Any anotherAny = xPropSet->getPropertyValue(u"LineEndWidth"_ustr);
1617 sal_Int32 aLineEndWidth = sal_Int32();
1618 if(anotherAny >>= aLineEndWidth)
1619 dumpLineEndWidthAsAttribute(aLineEndWidth, xmlWriter);
1623 void dumpShadowPropertiesService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1626 uno::Any anotherAny = xPropSet->getPropertyValue(u"Shadow"_ustr);
1627 bool bShadow;
1628 if(anotherAny >>= bShadow)
1629 dumpShadowAsAttribute(bShadow, xmlWriter);
1632 uno::Any anotherAny = xPropSet->getPropertyValue(u"ShadowColor"_ustr);
1633 sal_Int32 aShadowColor = sal_Int32();
1634 if(anotherAny >>= aShadowColor)
1635 dumpShadowColorAsAttribute(aShadowColor, xmlWriter);
1638 uno::Any anotherAny = xPropSet->getPropertyValue(u"ShadowTransparence"_ustr);
1639 sal_Int32 aShadowTransparence = sal_Int32();
1640 if(anotherAny >>= aShadowTransparence)
1641 dumpShadowTransparenceAsAttribute(aShadowTransparence, xmlWriter);
1644 uno::Any anotherAny = xPropSet->getPropertyValue(u"ShadowXDistance"_ustr);
1645 sal_Int32 aShadowXDistance = sal_Int32();
1646 if(anotherAny >>= aShadowXDistance)
1647 dumpShadowXDistanceAsAttribute(aShadowXDistance, xmlWriter);
1650 uno::Any anotherAny = xPropSet->getPropertyValue(u"ShadowYDistance"_ustr);
1651 sal_Int32 aShadowYDistance = sal_Int32();
1652 if(anotherAny >>= aShadowYDistance)
1653 dumpShadowYDistanceAsAttribute(aShadowYDistance, xmlWriter);
1657 void dumpPolyPolygonDescriptorService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1660 uno::Any anotherAny = xPropSet->getPropertyValue(u"PolygonKind"_ustr);
1661 drawing::PolygonKind ePolygonKind;
1662 if(anotherAny >>= ePolygonKind)
1663 dumpPolygonKindAsAttribute(ePolygonKind, xmlWriter);
1666 uno::Any anotherAny = xPropSet->getPropertyValue(u"PolyPolygon"_ustr);
1667 drawing::PointSequenceSequence aPolyPolygon;
1668 if(anotherAny >>= aPolyPolygon)
1669 dumpPolyPolygonAsElement(aPolyPolygon, xmlWriter);
1672 uno::Any anotherAny = xPropSet->getPropertyValue(u"Geometry"_ustr);
1673 drawing::PointSequenceSequence aGeometry;
1674 if(anotherAny >>= aGeometry)
1675 dumpGeometryAsElement(aGeometry, xmlWriter);
1679 void dumpShapeService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties)
1681 uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
1683 uno::Any anotherAny = xPropSet->getPropertyValue(u"ZOrder"_ustr);
1684 sal_Int32 aZOrder = sal_Int32();
1685 if(anotherAny >>= aZOrder)
1686 dumpZOrderAsAttribute(aZOrder, xmlWriter);
1689 uno::Any anotherAny = xPropSet->getPropertyValue(u"LayerID"_ustr);
1690 sal_Int32 aLayerID = sal_Int32();
1691 if(anotherAny >>= aLayerID)
1692 dumpLayerIDAsAttribute(aLayerID, xmlWriter);
1695 uno::Any anotherAny = xPropSet->getPropertyValue(u"LayerName"_ustr);
1696 OUString sLayerName;
1697 if(anotherAny >>= sLayerName)
1698 dumpLayerNameAsAttribute(sLayerName, xmlWriter);
1701 uno::Any anotherAny = xPropSet->getPropertyValue(u"Visible"_ustr);
1702 bool bVisible;
1703 if(anotherAny >>= bVisible)
1704 dumpVisibleAsAttribute(bVisible, xmlWriter);
1707 uno::Any anotherAny = xPropSet->getPropertyValue(u"Printable"_ustr);
1708 bool bPrintable;
1709 if(anotherAny >>= bPrintable)
1710 dumpPrintableAsAttribute(bPrintable, xmlWriter);
1713 uno::Any anotherAny = xPropSet->getPropertyValue(u"MoveProtect"_ustr);
1714 bool bMoveProtect;
1715 if(anotherAny >>= bMoveProtect)
1716 dumpMoveProtectAsAttribute(bMoveProtect, xmlWriter);
1719 uno::Any anotherAny = xPropSet->getPropertyValue(u"Name"_ustr);
1720 OUString sName;
1721 if(anotherAny >>= sName)
1722 dumpNameAsAttribute(sName, xmlWriter);
1725 uno::Any anotherAny = xPropSet->getPropertyValue(u"SizeProtect"_ustr);
1726 bool bSizeProtect;
1727 if(anotherAny >>= bSizeProtect)
1728 dumpSizeProtectAsAttribute(bSizeProtect, xmlWriter);
1731 uno::Any anotherAny = xPropSet->getPropertyValue(u"Transformation"_ustr);
1732 drawing::HomogenMatrix3 aTransformation;
1733 if(anotherAny >>= aTransformation)
1734 dumpTransformationAsElement(aTransformation, xmlWriter);
1737 uno::Any anotherAny = xPropSet->getPropertyValue(u"NavigationOrder"_ustr);
1738 sal_Int32 aNavigationOrder = sal_Int32();
1739 if(anotherAny >>= aNavigationOrder)
1740 dumpNavigationOrderAsAttribute(aNavigationOrder, xmlWriter);
1742 if(xInfo->hasPropertyByName(u"Hyperlink"_ustr))
1744 uno::Any anotherAny = xPropSet->getPropertyValue(u"Hyperlink"_ustr);
1745 OUString sHyperlink;
1746 if(anotherAny >>= sHyperlink)
1747 dumpHyperlinkAsAttribute(sHyperlink, xmlWriter);
1749 if(xInfo->hasPropertyByName(u"InteropGrabBag"_ustr) && bDumpInteropProperties)
1751 uno::Any anotherAny = xPropSet->getPropertyValue(u"InteropGrabBag"_ustr);
1752 uno::Sequence< beans::PropertyValue> aInteropGrabBag;
1753 if(anotherAny >>= aInteropGrabBag)
1754 dumpInteropGrabBagAsElement(aInteropGrabBag, xmlWriter);
1758 void dumpPolyPolygonBezierDescriptorService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1761 uno::Any anotherAny = xPropSet->getPropertyValue(u"PolygonKind"_ustr);
1762 drawing::PolygonKind ePolygonKind;
1763 if(anotherAny >>= ePolygonKind)
1764 dumpPolygonKindAsAttribute(ePolygonKind, xmlWriter);
1767 uno::Any anotherAny = xPropSet->getPropertyValue(u"PolyPolygonBezier"_ustr);
1768 drawing::PolyPolygonBezierCoords aPolyPolygonBezier;
1769 if(anotherAny >>= aPolyPolygonBezier)
1770 dumpPolyPolygonBezierCoords(aPolyPolygonBezier, xmlWriter);
1773 uno::Any anotherAny = xPropSet->getPropertyValue(u"Geometry"_ustr);
1774 drawing::PolyPolygonBezierCoords aGeometry;
1775 if(anotherAny >>= aGeometry)
1776 dumpPolyPolygonBezierCoords(aGeometry, xmlWriter);
1780 void dumpCustomShapeService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1782 uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
1784 uno::Any anotherAny = xPropSet->getPropertyValue(u"CustomShapeEngine"_ustr);
1785 OUString sCustomShapeEngine;
1786 if(anotherAny >>= sCustomShapeEngine)
1787 dumpCustomShapeEngineAsAttribute(sCustomShapeEngine, xmlWriter);
1790 uno::Any anotherAny = xPropSet->getPropertyValue(u"CustomShapeData"_ustr);
1791 OUString sCustomShapeData;
1792 if(anotherAny >>= sCustomShapeData)
1793 dumpCustomShapeDataAsAttribute(sCustomShapeData, xmlWriter);
1796 uno::Any anotherAny = xPropSet->getPropertyValue(u"CustomShapeGeometry"_ustr);
1797 uno::Sequence< beans::PropertyValue> aCustomShapeGeometry;
1798 if(anotherAny >>= aCustomShapeGeometry)
1799 dumpCustomShapeGeometryAsElement(aCustomShapeGeometry, xmlWriter);
1801 if(xInfo->hasPropertyByName(u"CustomShapeReplacementURL"_ustr))
1803 uno::Any anotherAny = xPropSet->getPropertyValue(u"CustomShapeReplacementURL"_ustr);
1804 OUString sCustomShapeReplacementURL;
1805 if(anotherAny >>= sCustomShapeReplacementURL)
1806 dumpCustomShapeReplacementURLAsAttribute(sCustomShapeReplacementURL, xmlWriter);
1810 void dumpXShape(const uno::Reference< drawing::XShape >& xShape, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties)
1812 (void)xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShape" ) );
1813 uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY_THROW);
1814 OUString aName;
1815 m_bNameDumped = false;
1817 dumpPositionAsAttribute(xShape->getPosition(), xmlWriter);
1818 dumpSizeAsAttribute(xShape->getSize(), xmlWriter);
1819 uno::Reference< drawing::XShapeDescriptor > xDescr(xShape, uno::UNO_QUERY_THROW);
1820 dumpShapeDescriptorAsAttribute(xDescr, xmlWriter);
1822 // uno::Sequence<beans::Property> aProperties = xPropSetInfo->getProperties();
1824 uno::Reference< lang::XServiceInfo > xServiceInfo( xShape, uno::UNO_QUERY_THROW );
1826 uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
1827 if(xInfo->hasPropertyByName(u"Name"_ustr))
1829 uno::Any aAny = xPropSet->getPropertyValue(u"Name"_ustr);
1830 if ((aAny >>= aName) && !aName.isEmpty())
1832 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("name"), "%s", OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
1833 m_bNameDumped = true;
1839 if (xServiceInfo->supportsService(u"com.sun.star.drawing.Text"_ustr))
1841 uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY_THROW);
1842 OUString aText = xText->getString();
1843 if(!aText.isEmpty())
1844 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("text"), "%s", OUStringToOString(aText, RTL_TEXTENCODING_UTF8).getStr());
1846 if(xServiceInfo->supportsService(u"com.sun.star.drawing.TextProperties"_ustr))
1847 dumpTextPropertiesService(xPropSet, xmlWriter);
1849 if(xServiceInfo->supportsService(u"com.sun.star.drawing.GroupShape"_ustr))
1851 uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY_THROW);
1852 dumpXShapes(xShapes, xmlWriter, bDumpInteropProperties);
1854 if(xServiceInfo->supportsService(u"com.sun.star.drawing.FillProperties"_ustr))
1855 dumpFillPropertiesService(xPropSet, xmlWriter);
1857 if(xServiceInfo->supportsService(u"com.sun.star.drawing.LineProperties"_ustr))
1858 dumpLinePropertiesService(xPropSet, xmlWriter);
1860 if(xServiceInfo->supportsService(u"com.sun.star.drawing.PolyPolygonDescriptor"_ustr))
1861 dumpPolyPolygonDescriptorService(xPropSet, xmlWriter);
1863 if(xServiceInfo->supportsService(u"com.sun.star.drawing.ShadowProperties"_ustr))
1864 dumpShadowPropertiesService(xPropSet, xmlWriter);
1866 if(xServiceInfo->supportsService(u"com.sun.star.drawing.Shape"_ustr))
1867 dumpShapeService(xPropSet, xmlWriter, bDumpInteropProperties);
1869 if(xServiceInfo->supportsService(u"com.sun.star.drawing.PolyPolygonBezierDescriptor"_ustr))
1870 dumpPolyPolygonBezierDescriptorService(xPropSet, xmlWriter);
1872 if(xServiceInfo->supportsService(u"com.sun.star.drawing.CustomShape"_ustr))
1873 dumpCustomShapeService(xPropSet, xmlWriter);
1875 // EnhancedShapeDumper used
1877 if(xServiceInfo->supportsService(u"com.sun.star.drawing.EnhancedCustomShapeExtrusion"_ustr))
1879 EnhancedShapeDumper enhancedDumper(xmlWriter);
1880 enhancedDumper.dumpEnhancedCustomShapeExtrusionService(xPropSet);
1882 if(xServiceInfo->supportsService(u"com.sun.star.drawing.EnhancedCustomShapeGeometry"_ustr))
1884 EnhancedShapeDumper enhancedDumper(xmlWriter);
1885 enhancedDumper.dumpEnhancedCustomShapeGeometryService(xPropSet);
1887 if(xServiceInfo->supportsService(u"com.sun.star.drawing.EnhancedCustomShapeHandle"_ustr))
1889 EnhancedShapeDumper enhancedDumper(xmlWriter);
1890 enhancedDumper.dumpEnhancedCustomShapeHandleService(xPropSet);
1892 if(xServiceInfo->supportsService(u"com.sun.star.drawing.EnhancedCustomShapePath"_ustr))
1894 EnhancedShapeDumper enhancedDumper(xmlWriter);
1895 enhancedDumper.dumpEnhancedCustomShapePathService(xPropSet);
1897 if(xServiceInfo->supportsService(u"com.sun.star.drawing.EnhancedCustomShapeTextPath"_ustr))
1899 EnhancedShapeDumper enhancedDumper(xmlWriter);
1900 enhancedDumper.dumpEnhancedCustomShapeTextPathService(xPropSet);
1902 } // end of the 'try' block
1903 catch (const beans::UnknownPropertyException& e)
1905 std::cout << "Exception caught in XShapeDumper.cxx: " << e.Message << std::endl;
1908 #if DEBUG_DUMPER
1909 uno::Sequence< OUString > aServiceNames = xServiceInfo->getSupportedServiceNames();
1910 sal_Int32 nServices = aServiceNames.getLength();
1911 for (sal_Int32 i = 0; i < nServices; ++i)
1913 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "ServiceName" ));
1914 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST( "name" ), "%s", OUStringToOString(aServiceNames[i], RTL_TEXTENCODING_UTF8).getStr());
1915 (void)xmlTextWriterEndElement( xmlWriter );
1917 #endif
1919 (void)xmlTextWriterEndElement( xmlWriter );
1922 void dumpXShapes( const uno::Reference< drawing::XShapes >& xShapes, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties )
1924 (void)xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShapes" ) );
1925 uno::Reference< container::XIndexAccess > xIA( xShapes, uno::UNO_QUERY_THROW);
1926 sal_Int32 nLength = xIA->getCount();
1927 for (sal_Int32 i = 0; i < nLength; ++i)
1929 uno::Reference< drawing::XShape > xShape( xIA->getByIndex( i ), uno::UNO_QUERY_THROW );
1930 dumpXShape( xShape, xmlWriter, bDumpInteropProperties );
1933 (void)xmlTextWriterEndElement( xmlWriter );
1935 } //end of namespace
1937 OUString XShapeDumper::dump(const uno::Reference<drawing::XShapes>& xPageShapes, bool bDumpInteropProperties)
1939 OStringBuffer aString;
1940 xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO( writeCallback, closeCallback, &aString, nullptr );
1941 xmlTextWriterPtr xmlWriter = xmlNewTextWriter( xmlOutBuffer );
1942 xmlTextWriterSetIndent( xmlWriter, 1 );
1944 (void)xmlTextWriterStartDocument( xmlWriter, nullptr, nullptr, nullptr );
1948 dumpXShapes( xPageShapes, xmlWriter, bDumpInteropProperties );
1950 catch (const beans::UnknownPropertyException& e)
1952 std::cout << "Exception caught in XShapeDumper: " << e.Message << std::endl;
1955 (void)xmlTextWriterEndDocument( xmlWriter );
1956 xmlFreeTextWriter( xmlWriter );
1958 return OUString::fromUtf8(aString);
1961 OUString XShapeDumper::dump(const uno::Reference<drawing::XShape>& xPageShapes, bool bDumpInteropProperties)
1963 OStringBuffer aString;
1964 xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO( writeCallback, closeCallback, &aString, nullptr );
1965 xmlTextWriterPtr xmlWriter = xmlNewTextWriter( xmlOutBuffer );
1966 xmlTextWriterSetIndent( xmlWriter, 1 );
1968 (void)xmlTextWriterStartDocument( xmlWriter, nullptr, nullptr, nullptr );
1972 dumpXShape( xPageShapes, xmlWriter, bDumpInteropProperties );
1974 catch (const beans::UnknownPropertyException& e)
1976 std::cout << "Exception caught in XShapeDumper: " << e.Message << std::endl;
1979 (void)xmlTextWriterEndDocument( xmlWriter );
1980 xmlFreeTextWriter( xmlWriter );
1982 return OUString::fromUtf8(aString);
1985 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */