calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / drawinglayer / source / dumper / XShapeDumper.cxx
blobcf0da17e43986caf0a93d33f353824ddc20baa09
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 uno::Sequence<uno::Sequence< awt::Point > > pointSequenceSequence = aPointSequenceSequence;
644 sal_Int32 nPointsSequence = pointSequenceSequence.getLength();
646 for (sal_Int32 i = 0; i < nPointsSequence; ++i)
648 uno::Sequence< awt::Point > pointSequence = pointSequenceSequence[i];
649 sal_Int32 nPoints = pointSequence.getLength();
651 uno::Sequence< drawing::PolygonFlags> flagsSequence;
652 if(pFlags)
653 flagsSequence = (*pFlags)[i];
655 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "pointSequence" ));
657 for(sal_Int32 j = 0; j < nPoints; ++j)
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);
663 if(pFlags)
665 switch(flagsSequence[j])
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;
684 (void)xmlTextWriterEndElement( xmlWriter );
686 (void)xmlTextWriterEndElement( xmlWriter );
690 void dumpPolyPolygonAsElement(const drawing::PointSequenceSequence& rPolyPolygon, xmlTextWriterPtr xmlWriter)
692 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PolyPolygon" ));
693 dumpPointSequenceSequence(rPolyPolygon, nullptr, xmlWriter);
694 (void)xmlTextWriterEndElement( xmlWriter );
697 void dumpGeometryAsElement(const drawing::PointSequenceSequence& aGeometry, xmlTextWriterPtr xmlWriter)
699 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Geometry" ));
700 dumpPointSequenceSequence(aGeometry, nullptr, xmlWriter);
701 (void)xmlTextWriterEndElement( xmlWriter );
704 // CharacterProperties.idl
705 void dumpCharHeightAsAttribute(float fHeight, xmlTextWriterPtr xmlWriter)
707 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("fontHeight"), "%f", fHeight );
710 void dumpCharColorAsAttribute(sal_Int32 aColor, xmlTextWriterPtr xmlWriter)
712 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fontColor"), "%06x", static_cast<unsigned int>(aColor));
716 // ---------- TextProperties.idl ----------
719 void dumpIsNumberingAsAttribute(bool bIsNumbering, xmlTextWriterPtr xmlWriter)
721 if(bIsNumbering)
722 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("isNumbering"), "%s", "true");
723 else
724 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("isNumbering"), "%s", "false");
727 void dumpTextAutoGrowHeightAsAttribute(bool bTextAutoGrowHeight, xmlTextWriterPtr xmlWriter)
729 if(bTextAutoGrowHeight)
730 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowHeight"), "%s", "true");
731 else
732 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowHeight"), "%s", "false");
735 void dumpTextAutoGrowWidthAsAttribute(bool bTextAutoGrowWidth, xmlTextWriterPtr xmlWriter)
737 if(bTextAutoGrowWidth)
738 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowWidth"), "%s", "true");
739 else
740 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAutoGrowWidth"), "%s", "false");
743 void dumpTextContourFrameAsAttribute(bool bTextContourFrame, xmlTextWriterPtr xmlWriter)
745 if(bTextContourFrame)
746 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textContourFrame"), "%s", "true");
747 else
748 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textContourFrame"), "%s", "false");
751 void dumpTextFitToSizeAsAttribute(drawing::TextFitToSizeType eTextFitToSize, xmlTextWriterPtr xmlWriter)
753 switch(eTextFitToSize)
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;
772 void dumpTextHorizontalAdjustAsAttribute(drawing::TextHorizontalAdjust eTextHorizontalAdjust, xmlTextWriterPtr xmlWriter)
774 switch(eTextHorizontalAdjust)
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;
793 void dumpTextVerticalAdjustAsAttribute(drawing::TextVerticalAdjust eTextVerticalAdjust, xmlTextWriterPtr xmlWriter)
795 switch(eTextVerticalAdjust)
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;
814 void dumpTextLeftDistanceAsAttribute(sal_Int32 aTextLeftDistance, xmlTextWriterPtr xmlWriter)
816 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textLeftDistance"), "%" SAL_PRIdINT32, aTextLeftDistance);
819 void dumpTextRightDistanceAsAttribute(sal_Int32 aTextRightDistance, xmlTextWriterPtr xmlWriter)
821 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textRightDistance"), "%" SAL_PRIdINT32, aTextRightDistance);
824 void dumpTextUpperDistanceAsAttribute(sal_Int32 aTextUpperDistance, xmlTextWriterPtr xmlWriter)
826 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textUpperDistance"), "%" SAL_PRIdINT32, aTextUpperDistance);
829 void dumpTextLowerDistanceAsAttribute(sal_Int32 aTextLowerDistance, xmlTextWriterPtr xmlWriter)
831 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textLowerDistance"), "%" SAL_PRIdINT32, aTextLowerDistance);
834 void dumpTextMaximumFrameHeightAsAttribute(sal_Int32 aTextMaximumFrameHeight, xmlTextWriterPtr xmlWriter)
836 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMaximumFrameHeight"), "%" SAL_PRIdINT32, aTextMaximumFrameHeight);
839 void dumpTextMaximumFrameWidthAsAttribute(sal_Int32 aTextMaximumFrameWidth, xmlTextWriterPtr xmlWriter)
841 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMaximumFrameWidth"), "%" SAL_PRIdINT32, aTextMaximumFrameWidth);
844 void dumpTextMinimumFrameHeightAsAttribute(sal_Int32 aTextMinimumFrameHeight, xmlTextWriterPtr xmlWriter)
846 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMinimumFrameHeight"), "%" SAL_PRIdINT32, aTextMinimumFrameHeight);
849 void dumpTextMinimumFrameWidthAsAttribute(sal_Int32 aTextMinimumFrameWidth, xmlTextWriterPtr xmlWriter)
851 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textMinimumFrameWidth"), "%" SAL_PRIdINT32, aTextMinimumFrameWidth);
854 void dumpTextAnimationAmountAsAttribute(sal_Int32 aTextAnimationAmount, xmlTextWriterPtr xmlWriter)
856 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textAnimationAmount"), "%" SAL_PRIdINT32, aTextAnimationAmount);
859 void dumpTextAnimationCountAsAttribute(sal_Int32 aTextAnimationCount, xmlTextWriterPtr xmlWriter)
861 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textAnimationCount"), "%" SAL_PRIdINT32, aTextAnimationCount);
864 void dumpTextAnimationDelayAsAttribute(sal_Int32 aTextAnimationDelay, xmlTextWriterPtr xmlWriter)
866 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("textAnimationDelay"), "%" SAL_PRIdINT32, aTextAnimationDelay);
869 void dumpTextAnimationDirectionAsAttribute(drawing::TextAnimationDirection eTextAnimationDirection, xmlTextWriterPtr xmlWriter)
871 switch(eTextAnimationDirection)
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;
890 void dumpTextAnimationKindAsAttribute(drawing::TextAnimationKind eTextAnimationKind, xmlTextWriterPtr xmlWriter)
892 switch(eTextAnimationKind)
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;
914 void dumpTextAnimationStartInsideAsAttribute(bool bTextAnimationStartInside, xmlTextWriterPtr xmlWriter)
916 if(bTextAnimationStartInside)
917 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStartInside"), "%s", "true");
918 else
919 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStartInside"), "%s", "false");
922 void dumpTextAnimationStopInsideAsAttribute(bool bTextAnimationStopInside, xmlTextWriterPtr xmlWriter)
924 if(bTextAnimationStopInside)
925 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStopInside"), "%s", "true");
926 else
927 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textAnimationStopInside"), "%s", "false");
930 void dumpTextWritingModeAsAttribute(text::WritingMode eTextWritingMode, xmlTextWriterPtr xmlWriter)
932 switch(eTextWritingMode)
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;
949 // ---------- ShadowProperties.idl ----------
952 void dumpShadowAsAttribute(bool bShadow, xmlTextWriterPtr xmlWriter)
954 if(bShadow)
955 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadow"), "%s", "true");
956 else
957 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadow"), "%s", "false");
960 void dumpShadowColorAsAttribute(sal_Int32 aShadowColor, xmlTextWriterPtr xmlWriter)
962 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowColor"), "%06x", static_cast<unsigned int>(aShadowColor));
965 void dumpShadowTransparenceAsAttribute(sal_Int32 aShadowTransparence, xmlTextWriterPtr xmlWriter)
967 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowTransparence"), "%" SAL_PRIdINT32, aShadowTransparence);
970 void dumpShadowXDistanceAsAttribute(sal_Int32 aShadowXDistance, xmlTextWriterPtr xmlWriter)
972 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowXDistance"), "%" SAL_PRIdINT32, aShadowXDistance);
975 void dumpShadowYDistanceAsAttribute(sal_Int32 aShadowYDistance, xmlTextWriterPtr xmlWriter)
977 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("shadowYDistance"), "%" SAL_PRIdINT32, aShadowYDistance);
981 // ---------- Shape.idl ----------
984 void dumpZOrderAsAttribute(sal_Int32 aZOrder, xmlTextWriterPtr xmlWriter)
986 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("zOrder"), "%" SAL_PRIdINT32, aZOrder);
989 void dumpLayerIDAsAttribute(sal_Int32 aLayerID, xmlTextWriterPtr xmlWriter)
991 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("layerID"), "%" SAL_PRIdINT32, aLayerID);
994 void dumpLayerNameAsAttribute(std::u16string_view sLayerName, xmlTextWriterPtr xmlWriter)
996 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("layerName"), "%s",
997 OUStringToOString(sLayerName, RTL_TEXTENCODING_UTF8).getStr());
1000 void dumpVisibleAsAttribute(bool bVisible, xmlTextWriterPtr xmlWriter)
1002 if(bVisible)
1003 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("visible"), "%s", "true");
1004 else
1005 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("visible"), "%s", "false");
1008 void dumpPrintableAsAttribute(bool bPrintable, xmlTextWriterPtr xmlWriter)
1010 if(bPrintable)
1011 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("printable"), "%s", "true");
1012 else
1013 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("printable"), "%s", "false");
1016 void dumpMoveProtectAsAttribute(bool bMoveProtect, xmlTextWriterPtr xmlWriter)
1018 if(bMoveProtect)
1019 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("moveProtect"), "%s", "true");
1020 else
1021 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("moveProtect"), "%s", "false");
1024 void dumpNameAsAttribute(std::u16string_view sName, xmlTextWriterPtr xmlWriter)
1026 if(!sName.empty() && !m_bNameDumped)
1028 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s", OUStringToOString(sName, RTL_TEXTENCODING_UTF8).getStr());
1029 m_bNameDumped = true;
1033 void dumpSizeProtectAsAttribute(bool bSizeProtect, xmlTextWriterPtr xmlWriter)
1035 if(bSizeProtect)
1036 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("sizeProtect"), "%s", "true");
1037 else
1038 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("sizeProtect"), "%s", "false");
1041 void dumpHomogenMatrixLine3(const drawing::HomogenMatrixLine3& rHomogenMatrixLine3, xmlTextWriterPtr xmlWriter)
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);
1048 void dumpTransformationAsElement(const drawing::HomogenMatrix3& rTransformation, xmlTextWriterPtr xmlWriter)
1050 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Transformation" ));
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 );
1062 (void)xmlTextWriterEndElement( xmlWriter );
1065 void dumpNavigationOrderAsAttribute(sal_Int32 aNavigationOrder, xmlTextWriterPtr xmlWriter)
1067 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("navigationOrder"), "%" SAL_PRIdINT32, aNavigationOrder);
1070 void dumpHyperlinkAsAttribute(std::u16string_view sHyperlink, xmlTextWriterPtr xmlWriter)
1072 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("hyperlink"), "%s",
1073 OUStringToOString(sHyperlink, RTL_TEXTENCODING_UTF8).getStr());
1076 void dumpInteropGrabBagAsElement(const uno::Sequence< beans::PropertyValue>& aInteropGrabBag, xmlTextWriterPtr xmlWriter)
1078 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "InteropGrabBag" ));
1080 for (const auto& item: aInteropGrabBag)
1081 dumpPropertyValueAsElement(item, xmlWriter);
1083 (void)xmlTextWriterEndElement( xmlWriter );
1087 // ---------- XShape.idl ----------
1090 void dumpPositionAsAttribute(const awt::Point& rPoint, xmlTextWriterPtr xmlWriter)
1092 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionX"), "%" SAL_PRIdINT32, rPoint.X);
1093 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("positionY"), "%" SAL_PRIdINT32, rPoint.Y);
1096 void dumpSizeAsAttribute(const awt::Size& rSize, xmlTextWriterPtr xmlWriter)
1098 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("sizeX"), "%" SAL_PRIdINT32, rSize.Width);
1099 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("sizeY"), "%" SAL_PRIdINT32, rSize.Height);
1102 void dumpShapeDescriptorAsAttribute( const uno::Reference< drawing::XShapeDescriptor >& xDescr, xmlTextWriterPtr xmlWriter )
1104 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("type"), "%s",
1105 OUStringToOString(xDescr->getShapeType(), RTL_TEXTENCODING_UTF8).getStr());
1109 // ---------- CustomShape.idl ----------
1112 void dumpCustomShapeEngineAsAttribute(std::u16string_view sCustomShapeEngine, xmlTextWriterPtr xmlWriter)
1114 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeEngine"), "%s",
1115 OUStringToOString(sCustomShapeEngine, RTL_TEXTENCODING_UTF8).getStr());
1118 void dumpCustomShapeDataAsAttribute(
1119 std::u16string_view sCustomShapeData, xmlTextWriterPtr xmlWriter)
1121 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeData"), "%s",
1122 OUStringToOString(sCustomShapeData, RTL_TEXTENCODING_UTF8).getStr());
1125 void dumpPropertyValueAsElement(const beans::PropertyValue& rPropertyValue, xmlTextWriterPtr xmlWriter)
1127 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PropertyValue" ));
1129 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s",
1130 OUStringToOString(rPropertyValue.Name, RTL_TEXTENCODING_UTF8).getStr());
1132 uno::Any aAny = rPropertyValue.Value;
1133 if(OUString sValue; aAny >>= sValue)
1135 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s",
1136 OUStringToOString(sValue, RTL_TEXTENCODING_UTF8).getStr());
1138 else if(sal_Int32 nValue; aAny >>= nValue)
1140 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%" SAL_PRIdINT32, nValue);
1142 else if(float fValue; aAny >>= fValue)
1144 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%f", fValue);
1146 else if(bool bValue; aAny >>= bValue)
1148 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s", (bValue? "true": "false"));
1150 else if(awt::Rectangle aRectangleValue;
1151 rPropertyValue.Name == "ViewBox" && (aAny >>= aRectangleValue))
1153 EnhancedShapeDumper enhancedDumper(xmlWriter);
1154 enhancedDumper.dumpViewBoxAsElement(aRectangleValue);
1156 else if(uno::Sequence< drawing::EnhancedCustomShapeAdjustmentValue> aAdjustmentValues;
1157 rPropertyValue.Name == "AdjustmentValues" && (aAny >>= aAdjustmentValues))
1159 EnhancedShapeDumper enhancedDumper(xmlWriter);
1160 enhancedDumper.dumpAdjustmentValuesAsElement(aAdjustmentValues);
1162 else if(uno::Sequence< drawing::EnhancedCustomShapeParameterPair > aCoordinates;
1163 rPropertyValue.Name == "Coordinates" && (aAny >>= aCoordinates))
1165 EnhancedShapeDumper enhancedDumper(xmlWriter);
1166 enhancedDumper.dumpCoordinatesAsElement(aCoordinates);
1168 else if(uno::Sequence< drawing::EnhancedCustomShapeSegment > aSegments;
1169 rPropertyValue.Name == "Segments" && (aAny >>= aSegments))
1171 EnhancedShapeDumper enhancedDumper(xmlWriter);
1172 enhancedDumper.dumpSegmentsAsElement(aSegments);
1174 else if(uno::Sequence< beans::PropertyValue > aPropSeq; aAny >>= aPropSeq)
1176 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( OUStringToOString(rPropertyValue.Name, RTL_TEXTENCODING_UTF8).getStr() ));
1178 sal_Int32 i = 0, nCount = aPropSeq.getLength();
1179 for ( ; i < nCount; i++ )
1180 dumpPropertyValueAsElement(aPropSeq[ i ], xmlWriter);
1182 (void)xmlTextWriterEndElement(xmlWriter);
1185 // TODO: Add here dumping of XDocument for future OOX Smart-Art
1186 // properties.
1188 // TODO more, if necessary
1190 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("handle"), "%" SAL_PRIdINT32, rPropertyValue.Handle);
1192 switch(rPropertyValue.State)
1194 case beans::PropertyState_DIRECT_VALUE:
1195 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "DIRECT_VALUE");
1196 break;
1197 case beans::PropertyState_DEFAULT_VALUE:
1198 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "DEFAULT_VALUE");
1199 break;
1200 case beans::PropertyState_AMBIGUOUS_VALUE:
1201 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "AMBIGUOUS_VALUE");
1202 break;
1203 default:
1204 break;
1206 (void)xmlTextWriterEndElement( xmlWriter );
1209 void dumpCustomShapeGeometryAsElement(const uno::Sequence< beans::PropertyValue>& aCustomShapeGeometry, xmlTextWriterPtr xmlWriter)
1211 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "CustomShapeGeometry" ));
1213 sal_Int32 nLength = aCustomShapeGeometry.getLength();
1214 for (sal_Int32 i = 0; i < nLength; ++i)
1215 dumpPropertyValueAsElement(aCustomShapeGeometry[i], xmlWriter);
1217 (void)xmlTextWriterEndElement( xmlWriter );
1220 void dumpCustomShapeReplacementURLAsAttribute(std::u16string_view sCustomShapeReplacementURL, xmlTextWriterPtr xmlWriter)
1222 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("customShapeReplacementURL"), "%s",
1223 OUStringToOString(sCustomShapeReplacementURL, RTL_TEXTENCODING_UTF8).getStr());
1226 // methods dumping whole services
1228 void dumpTextPropertiesService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1230 uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
1231 if(xInfo->hasPropertyByName("CharHeight"))
1233 uno::Any anotherAny = xPropSet->getPropertyValue("CharHeight");
1234 float fHeight;
1235 if(anotherAny >>= fHeight)
1236 dumpCharHeightAsAttribute(fHeight, xmlWriter);
1238 if(xInfo->hasPropertyByName("CharColor"))
1240 uno::Any anotherAny = xPropSet->getPropertyValue("CharColor");
1241 sal_Int32 aColor = sal_Int32();
1242 if(anotherAny >>= aColor)
1243 dumpCharColorAsAttribute(aColor, xmlWriter);
1245 // TODO - more properties from CharacterProperties.idl (similar to above)
1247 if(xInfo->hasPropertyByName("IsNumbering"))
1249 uno::Any anotherAny = xPropSet->getPropertyValue("IsNumbering");
1250 bool bIsNumbering;
1251 if(anotherAny >>= bIsNumbering)
1252 dumpIsNumberingAsAttribute(bIsNumbering, xmlWriter);
1255 uno::Any anotherAny = xPropSet->getPropertyValue("TextAutoGrowHeight");
1256 bool bTextAutoGrowHeight;
1257 if(anotherAny >>= bTextAutoGrowHeight)
1258 dumpTextAutoGrowHeightAsAttribute(bTextAutoGrowHeight, xmlWriter);
1261 uno::Any anotherAny = xPropSet->getPropertyValue("TextAutoGrowWidth");
1262 bool bTextAutoGrowWidth;
1263 if(anotherAny >>= bTextAutoGrowWidth)
1264 dumpTextAutoGrowWidthAsAttribute(bTextAutoGrowWidth, xmlWriter);
1267 uno::Any anotherAny = xPropSet->getPropertyValue("TextContourFrame");
1268 bool bTextContourFrame;
1269 if(anotherAny >>= bTextContourFrame)
1270 dumpTextContourFrameAsAttribute(bTextContourFrame, xmlWriter);
1273 uno::Any anotherAny = xPropSet->getPropertyValue("TextFitToSize");
1274 drawing::TextFitToSizeType eTextFitToSize;
1275 if(anotherAny >>= eTextFitToSize)
1276 dumpTextFitToSizeAsAttribute(eTextFitToSize, xmlWriter);
1279 uno::Any anotherAny = xPropSet->getPropertyValue("TextHorizontalAdjust");
1280 drawing::TextHorizontalAdjust eTextHorizontalAdjust;
1281 if(anotherAny >>= eTextHorizontalAdjust)
1282 dumpTextHorizontalAdjustAsAttribute(eTextHorizontalAdjust, xmlWriter);
1285 uno::Any anotherAny = xPropSet->getPropertyValue("TextVerticalAdjust");
1286 drawing::TextVerticalAdjust eTextVerticalAdjust;
1287 if(anotherAny >>= eTextVerticalAdjust)
1288 dumpTextVerticalAdjustAsAttribute(eTextVerticalAdjust, xmlWriter);
1291 uno::Any anotherAny = xPropSet->getPropertyValue("TextLeftDistance");
1292 sal_Int32 aTextLeftDistance = sal_Int32();
1293 if(anotherAny >>= aTextLeftDistance)
1294 dumpTextLeftDistanceAsAttribute(aTextLeftDistance, xmlWriter);
1297 uno::Any anotherAny = xPropSet->getPropertyValue("TextRightDistance");
1298 sal_Int32 aTextRightDistance = sal_Int32();
1299 if(anotherAny >>= aTextRightDistance)
1300 dumpTextRightDistanceAsAttribute(aTextRightDistance, xmlWriter);
1303 uno::Any anotherAny = xPropSet->getPropertyValue("TextUpperDistance");
1304 sal_Int32 aTextUpperDistance = sal_Int32();
1305 if(anotherAny >>= aTextUpperDistance)
1306 dumpTextUpperDistanceAsAttribute(aTextUpperDistance, xmlWriter);
1309 uno::Any anotherAny = xPropSet->getPropertyValue("TextLowerDistance");
1310 sal_Int32 aTextLowerDistance = sal_Int32();
1311 if(anotherAny >>= aTextLowerDistance)
1312 dumpTextLowerDistanceAsAttribute(aTextLowerDistance, xmlWriter);
1315 uno::Any anotherAny = xPropSet->getPropertyValue("TextMaximumFrameHeight");
1316 sal_Int32 aTextMaximumFrameHeight = sal_Int32();
1317 if(anotherAny >>= aTextMaximumFrameHeight)
1318 dumpTextMaximumFrameHeightAsAttribute(aTextMaximumFrameHeight, xmlWriter);
1321 uno::Any anotherAny = xPropSet->getPropertyValue("TextMaximumFrameWidth");
1322 sal_Int32 aTextMaximumFrameWidth = sal_Int32();
1323 if(anotherAny >>= aTextMaximumFrameWidth)
1324 dumpTextMaximumFrameWidthAsAttribute(aTextMaximumFrameWidth, xmlWriter);
1327 uno::Any anotherAny = xPropSet->getPropertyValue("TextMinimumFrameHeight");
1328 sal_Int32 aTextMinimumFrameHeight = sal_Int32();
1329 if(anotherAny >>= aTextMinimumFrameHeight)
1330 dumpTextMinimumFrameHeightAsAttribute(aTextMinimumFrameHeight, xmlWriter);
1333 uno::Any anotherAny = xPropSet->getPropertyValue("TextMinimumFrameWidth");
1334 sal_Int32 aTextMinimumFrameWidth = sal_Int32();
1335 if(anotherAny >>= aTextMinimumFrameWidth)
1336 dumpTextMinimumFrameWidthAsAttribute(aTextMinimumFrameWidth, xmlWriter);
1339 uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationAmount");
1340 sal_Int32 aTextAnimationAmount = sal_Int32();
1341 if(anotherAny >>= aTextAnimationAmount)
1342 dumpTextAnimationAmountAsAttribute(aTextAnimationAmount, xmlWriter);
1345 uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationCount");
1346 sal_Int32 aTextAnimationCount = sal_Int32();
1347 if(anotherAny >>= aTextAnimationCount)
1348 dumpTextAnimationCountAsAttribute(aTextAnimationCount, xmlWriter);
1351 uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationDelay");
1352 sal_Int32 aTextAnimationDelay = sal_Int32();
1353 if(anotherAny >>= aTextAnimationDelay)
1354 dumpTextAnimationDelayAsAttribute(aTextAnimationDelay, xmlWriter);
1357 uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationDirection");
1358 drawing::TextAnimationDirection eTextAnimationDirection;
1359 if(anotherAny >>= eTextAnimationDirection)
1360 dumpTextAnimationDirectionAsAttribute(eTextAnimationDirection, xmlWriter);
1363 uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationKind");
1364 drawing::TextAnimationKind eTextAnimationKind;
1365 if(anotherAny >>= eTextAnimationKind)
1366 dumpTextAnimationKindAsAttribute(eTextAnimationKind, xmlWriter);
1369 uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationStartInside");
1370 bool bTextAnimationStartInside;
1371 if(anotherAny >>= bTextAnimationStartInside)
1372 dumpTextAnimationStartInsideAsAttribute(bTextAnimationStartInside, xmlWriter);
1375 uno::Any anotherAny = xPropSet->getPropertyValue("TextAnimationStopInside");
1376 bool bTextAnimationStopInside;
1377 if(anotherAny >>= bTextAnimationStopInside)
1378 dumpTextAnimationStopInsideAsAttribute(bTextAnimationStopInside, xmlWriter);
1381 uno::Any anotherAny = xPropSet->getPropertyValue("TextWritingMode");
1382 text::WritingMode eTextWritingMode;
1383 if(anotherAny >>= eTextWritingMode)
1384 dumpTextWritingModeAsAttribute(eTextWritingMode, xmlWriter);
1388 void dumpFillPropertiesService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1391 uno::Any anotherAny = xPropSet->getPropertyValue("FillStyle");
1392 drawing::FillStyle eFillStyle;
1393 if(anotherAny >>= eFillStyle)
1394 dumpFillStyleAsAttribute(eFillStyle, xmlWriter);
1397 uno::Any anotherAny = xPropSet->getPropertyValue("FillColor");
1398 sal_Int32 aColor = sal_Int32();
1399 if(anotherAny >>= aColor)
1400 dumpFillColorAsAttribute(aColor, xmlWriter);
1403 uno::Any anotherAny = xPropSet->getPropertyValue("FillTransparence");
1404 sal_Int32 aTransparence = sal_Int32();
1405 if(anotherAny >>= aTransparence)
1406 dumpFillTransparenceAsAttribute(aTransparence, xmlWriter);
1409 uno::Any anotherAny = xPropSet->getPropertyValue("FillTransparenceGradientName");
1410 OUString sTranspGradName;
1411 if(anotherAny >>= sTranspGradName)
1412 dumpFillTransparenceGradientNameAsAttribute(sTranspGradName, xmlWriter);
1415 uno::Any anotherAny = xPropSet->getPropertyValue("FillTransparenceGradient");
1416 awt::Gradient aTranspGrad;
1417 if(anotherAny >>= aTranspGrad)
1418 dumpFillTransparenceGradientAsElement(aTranspGrad, xmlWriter);
1421 uno::Any anotherAny = xPropSet->getPropertyValue("FillGradientName");
1422 OUString sGradName;
1423 if(anotherAny >>= sGradName)
1424 dumpFillGradientNameAsAttribute(sGradName, xmlWriter);
1427 uno::Any anotherAny = xPropSet->getPropertyValue("FillGradient");
1428 awt::Gradient aGradient;
1429 if(anotherAny >>= aGradient)
1430 dumpFillGradientAsElement(aGradient, xmlWriter);
1433 uno::Any anotherAny = xPropSet->getPropertyValue("FillHatchName");
1434 OUString sHatchName;
1435 if(anotherAny >>= sHatchName)
1436 dumpFillGradientNameAsAttribute(sHatchName, xmlWriter);
1439 uno::Any anotherAny = xPropSet->getPropertyValue("FillHatch");
1440 drawing::Hatch aHatch;
1441 if(anotherAny >>= aHatch)
1442 dumpFillHatchAsElement(aHatch, xmlWriter);
1445 uno::Any anotherAny = xPropSet->getPropertyValue("FillBackground");
1446 bool bFillBackground;
1447 if(anotherAny >>= bFillBackground)
1448 dumpFillBackgroundAsAttribute(bFillBackground, xmlWriter);
1451 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapName");
1452 OUString sBitmapName;
1453 if(anotherAny >>= sBitmapName)
1454 dumpFillGradientNameAsAttribute(sBitmapName, xmlWriter);
1457 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmap");
1458 uno::Reference<awt::XBitmap> xBitmap;
1459 if(anotherAny >>= xBitmap)
1460 dumpFillBitmapAsElement(xBitmap, xmlWriter);
1463 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapPositionOffsetX");
1464 sal_Int32 aBitmapPositionOffsetX = sal_Int32();
1465 if(anotherAny >>= aBitmapPositionOffsetX)
1466 dumpFillBitmapPositionOffsetXAsAttribute(aBitmapPositionOffsetX, xmlWriter);
1469 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapPositionOffsetY");
1470 sal_Int32 aBitmapPositionOffsetY = sal_Int32();
1471 if(anotherAny >>= aBitmapPositionOffsetY)
1472 dumpFillBitmapPositionOffsetYAsAttribute(aBitmapPositionOffsetY, xmlWriter);
1475 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapOffsetX");
1476 sal_Int32 aBitmapOffsetX = sal_Int32();
1477 if(anotherAny >>= aBitmapOffsetX)
1478 dumpFillBitmapOffsetXAsAttribute(aBitmapOffsetX, xmlWriter);
1481 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapOffsetY");
1482 sal_Int32 aBitmapOffsetY = sal_Int32();
1483 if(anotherAny >>= aBitmapOffsetY)
1484 dumpFillBitmapOffsetYAsAttribute(aBitmapOffsetY, xmlWriter);
1487 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapRectanglePoint");
1488 drawing::RectanglePoint eBitmapRectanglePoint;
1489 if(anotherAny >>= eBitmapRectanglePoint)
1490 dumpFillBitmapRectanglePointAsAttribute(eBitmapRectanglePoint, xmlWriter);
1493 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapLogicalSize");
1494 bool bBitmapLogicalSize;
1495 if(anotherAny >>= bBitmapLogicalSize)
1496 dumpFillBitmapLogicalSizeAsAttribute(bBitmapLogicalSize, xmlWriter);
1499 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapSizeX");
1500 sal_Int32 aBitmapSizeX = sal_Int32();
1501 if(anotherAny >>= aBitmapSizeX)
1502 dumpFillBitmapSizeXAsAttribute(aBitmapSizeX, xmlWriter);
1505 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapSizeY");
1506 sal_Int32 aBitmapSizeY = sal_Int32();
1507 if(anotherAny >>= aBitmapSizeY)
1508 dumpFillBitmapSizeYAsAttribute(aBitmapSizeY, xmlWriter);
1511 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapMode");
1512 drawing::BitmapMode eBitmapMode;
1513 if(anotherAny >>= eBitmapMode)
1514 dumpFillBitmapModeAsAttribute(eBitmapMode, xmlWriter);
1517 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapStretch");
1518 bool bBitmapStretch;
1519 if(anotherAny >>= bBitmapStretch)
1520 dumpFillBitmapStretchAsAttribute(bBitmapStretch, xmlWriter);
1523 uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapTile");
1524 bool bBitmapTile;
1525 if(anotherAny >>= bBitmapTile)
1526 dumpFillBitmapTileAsAttribute(bBitmapTile, xmlWriter);
1530 void dumpLinePropertiesService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1533 uno::Any anotherAny = xPropSet->getPropertyValue("LineStyle");
1534 drawing::LineStyle eLineStyle;
1535 if(anotherAny >>= eLineStyle)
1536 dumpLineStyleAsAttribute(eLineStyle, xmlWriter);
1539 uno::Any anotherAny = xPropSet->getPropertyValue("LineDash");
1540 drawing::LineDash aLineDash;
1541 if(anotherAny >>= aLineDash)
1542 dumpLineDashAsElement(aLineDash, xmlWriter);
1545 uno::Any anotherAny = xPropSet->getPropertyValue("LineDashName");
1546 OUString sLineDashName;
1547 if(anotherAny >>= sLineDashName)
1548 dumpLineDashNameAsAttribute(sLineDashName, xmlWriter);
1551 uno::Any anotherAny = xPropSet->getPropertyValue("LineColor");
1552 sal_Int32 aLineColor = sal_Int32();
1553 if(anotherAny >>= aLineColor)
1554 dumpLineColorAsAttribute(aLineColor, xmlWriter);
1557 uno::Any anotherAny = xPropSet->getPropertyValue("LineTransparence");
1558 sal_Int32 aLineTransparence = sal_Int32();
1559 if(anotherAny >>= aLineTransparence)
1560 dumpLineTransparenceAsAttribute(aLineTransparence, xmlWriter);
1563 uno::Any anotherAny = xPropSet->getPropertyValue("LineWidth");
1564 sal_Int32 aLineWidth = sal_Int32();
1565 if(anotherAny >>= aLineWidth)
1566 dumpLineWidthAsAttribute(aLineWidth, xmlWriter);
1569 uno::Any anotherAny = xPropSet->getPropertyValue("LineJoint");
1570 drawing::LineJoint eLineJoint;
1571 if(anotherAny >>= eLineJoint)
1572 dumpLineJointAsAttribute(eLineJoint, xmlWriter);
1575 uno::Any anotherAny = xPropSet->getPropertyValue("LineStartName");
1576 OUString sLineStartName;
1577 if(anotherAny >>= sLineStartName)
1578 dumpLineStartNameAsAttribute(sLineStartName, xmlWriter);
1581 uno::Any anotherAny = xPropSet->getPropertyValue("LineEndName");
1582 OUString sLineEndName;
1583 if(anotherAny >>= sLineEndName)
1584 dumpLineEndNameAsAttribute(sLineEndName, xmlWriter);
1587 uno::Any anotherAny = xPropSet->getPropertyValue("LineStart");
1588 drawing::PolyPolygonBezierCoords aLineStart;
1589 if(anotherAny >>= aLineStart)
1590 dumpLineStartAsElement(aLineStart, xmlWriter);
1593 uno::Any anotherAny = xPropSet->getPropertyValue("LineEnd");
1594 drawing::PolyPolygonBezierCoords aLineEnd;
1595 if(anotherAny >>= aLineEnd)
1596 dumpLineEndAsElement(aLineEnd, xmlWriter);
1599 uno::Any anotherAny = xPropSet->getPropertyValue("LineStartCenter");
1600 bool bLineStartCenter;
1601 if(anotherAny >>= bLineStartCenter)
1602 dumpLineStartCenterAsAttribute(bLineStartCenter, xmlWriter);
1605 uno::Any anotherAny = xPropSet->getPropertyValue("LineStartWidth");
1606 sal_Int32 aLineStartWidth = sal_Int32();
1607 if(anotherAny >>= aLineStartWidth)
1608 dumpLineStartWidthAsAttribute(aLineStartWidth, xmlWriter);
1611 uno::Any anotherAny = xPropSet->getPropertyValue("LineEndCenter");
1612 bool bLineEndCenter;
1613 if(anotherAny >>= bLineEndCenter)
1614 dumpLineEndCenterAsAttribute(bLineEndCenter, xmlWriter);
1617 uno::Any anotherAny = xPropSet->getPropertyValue("LineEndWidth");
1618 sal_Int32 aLineEndWidth = sal_Int32();
1619 if(anotherAny >>= aLineEndWidth)
1620 dumpLineEndWidthAsAttribute(aLineEndWidth, xmlWriter);
1624 void dumpShadowPropertiesService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1627 uno::Any anotherAny = xPropSet->getPropertyValue("Shadow");
1628 bool bShadow;
1629 if(anotherAny >>= bShadow)
1630 dumpShadowAsAttribute(bShadow, xmlWriter);
1633 uno::Any anotherAny = xPropSet->getPropertyValue("ShadowColor");
1634 sal_Int32 aShadowColor = sal_Int32();
1635 if(anotherAny >>= aShadowColor)
1636 dumpShadowColorAsAttribute(aShadowColor, xmlWriter);
1639 uno::Any anotherAny = xPropSet->getPropertyValue("ShadowTransparence");
1640 sal_Int32 aShadowTransparence = sal_Int32();
1641 if(anotherAny >>= aShadowTransparence)
1642 dumpShadowTransparenceAsAttribute(aShadowTransparence, xmlWriter);
1645 uno::Any anotherAny = xPropSet->getPropertyValue("ShadowXDistance");
1646 sal_Int32 aShadowXDistance = sal_Int32();
1647 if(anotherAny >>= aShadowXDistance)
1648 dumpShadowXDistanceAsAttribute(aShadowXDistance, xmlWriter);
1651 uno::Any anotherAny = xPropSet->getPropertyValue("ShadowYDistance");
1652 sal_Int32 aShadowYDistance = sal_Int32();
1653 if(anotherAny >>= aShadowYDistance)
1654 dumpShadowYDistanceAsAttribute(aShadowYDistance, xmlWriter);
1658 void dumpPolyPolygonDescriptorService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1661 uno::Any anotherAny = xPropSet->getPropertyValue("PolygonKind");
1662 drawing::PolygonKind ePolygonKind;
1663 if(anotherAny >>= ePolygonKind)
1664 dumpPolygonKindAsAttribute(ePolygonKind, xmlWriter);
1667 uno::Any anotherAny = xPropSet->getPropertyValue("PolyPolygon");
1668 drawing::PointSequenceSequence aPolyPolygon;
1669 if(anotherAny >>= aPolyPolygon)
1670 dumpPolyPolygonAsElement(aPolyPolygon, xmlWriter);
1673 uno::Any anotherAny = xPropSet->getPropertyValue("Geometry");
1674 drawing::PointSequenceSequence aGeometry;
1675 if(anotherAny >>= aGeometry)
1676 dumpGeometryAsElement(aGeometry, xmlWriter);
1680 void dumpShapeService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties)
1682 uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
1684 uno::Any anotherAny = xPropSet->getPropertyValue("ZOrder");
1685 sal_Int32 aZOrder = sal_Int32();
1686 if(anotherAny >>= aZOrder)
1687 dumpZOrderAsAttribute(aZOrder, xmlWriter);
1690 uno::Any anotherAny = xPropSet->getPropertyValue("LayerID");
1691 sal_Int32 aLayerID = sal_Int32();
1692 if(anotherAny >>= aLayerID)
1693 dumpLayerIDAsAttribute(aLayerID, xmlWriter);
1696 uno::Any anotherAny = xPropSet->getPropertyValue("LayerName");
1697 OUString sLayerName;
1698 if(anotherAny >>= sLayerName)
1699 dumpLayerNameAsAttribute(sLayerName, xmlWriter);
1702 uno::Any anotherAny = xPropSet->getPropertyValue("Visible");
1703 bool bVisible;
1704 if(anotherAny >>= bVisible)
1705 dumpVisibleAsAttribute(bVisible, xmlWriter);
1708 uno::Any anotherAny = xPropSet->getPropertyValue("Printable");
1709 bool bPrintable;
1710 if(anotherAny >>= bPrintable)
1711 dumpPrintableAsAttribute(bPrintable, xmlWriter);
1714 uno::Any anotherAny = xPropSet->getPropertyValue("MoveProtect");
1715 bool bMoveProtect;
1716 if(anotherAny >>= bMoveProtect)
1717 dumpMoveProtectAsAttribute(bMoveProtect, xmlWriter);
1720 uno::Any anotherAny = xPropSet->getPropertyValue("Name");
1721 OUString sName;
1722 if(anotherAny >>= sName)
1723 dumpNameAsAttribute(sName, xmlWriter);
1726 uno::Any anotherAny = xPropSet->getPropertyValue("SizeProtect");
1727 bool bSizeProtect;
1728 if(anotherAny >>= bSizeProtect)
1729 dumpSizeProtectAsAttribute(bSizeProtect, xmlWriter);
1732 uno::Any anotherAny = xPropSet->getPropertyValue("Transformation");
1733 drawing::HomogenMatrix3 aTransformation;
1734 if(anotherAny >>= aTransformation)
1735 dumpTransformationAsElement(aTransformation, xmlWriter);
1738 uno::Any anotherAny = xPropSet->getPropertyValue("NavigationOrder");
1739 sal_Int32 aNavigationOrder = sal_Int32();
1740 if(anotherAny >>= aNavigationOrder)
1741 dumpNavigationOrderAsAttribute(aNavigationOrder, xmlWriter);
1743 if(xInfo->hasPropertyByName("Hyperlink"))
1745 uno::Any anotherAny = xPropSet->getPropertyValue("Hyperlink");
1746 OUString sHyperlink;
1747 if(anotherAny >>= sHyperlink)
1748 dumpHyperlinkAsAttribute(sHyperlink, xmlWriter);
1750 if(xInfo->hasPropertyByName("InteropGrabBag") && bDumpInteropProperties)
1752 uno::Any anotherAny = xPropSet->getPropertyValue("InteropGrabBag");
1753 uno::Sequence< beans::PropertyValue> aInteropGrabBag;
1754 if(anotherAny >>= aInteropGrabBag)
1755 dumpInteropGrabBagAsElement(aInteropGrabBag, xmlWriter);
1759 void dumpPolyPolygonBezierDescriptorService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1762 uno::Any anotherAny = xPropSet->getPropertyValue("PolygonKind");
1763 drawing::PolygonKind ePolygonKind;
1764 if(anotherAny >>= ePolygonKind)
1765 dumpPolygonKindAsAttribute(ePolygonKind, xmlWriter);
1768 uno::Any anotherAny = xPropSet->getPropertyValue("PolyPolygonBezier");
1769 drawing::PolyPolygonBezierCoords aPolyPolygonBezier;
1770 if(anotherAny >>= aPolyPolygonBezier)
1771 dumpPolyPolygonBezierCoords(aPolyPolygonBezier, xmlWriter);
1774 uno::Any anotherAny = xPropSet->getPropertyValue("Geometry");
1775 drawing::PolyPolygonBezierCoords aGeometry;
1776 if(anotherAny >>= aGeometry)
1777 dumpPolyPolygonBezierCoords(aGeometry, xmlWriter);
1781 void dumpCustomShapeService(const uno::Reference< beans::XPropertySet >& xPropSet, xmlTextWriterPtr xmlWriter)
1783 uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
1785 uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeEngine");
1786 OUString sCustomShapeEngine;
1787 if(anotherAny >>= sCustomShapeEngine)
1788 dumpCustomShapeEngineAsAttribute(sCustomShapeEngine, xmlWriter);
1791 uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeData");
1792 OUString sCustomShapeData;
1793 if(anotherAny >>= sCustomShapeData)
1794 dumpCustomShapeDataAsAttribute(sCustomShapeData, xmlWriter);
1797 uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeGeometry");
1798 uno::Sequence< beans::PropertyValue> aCustomShapeGeometry;
1799 if(anotherAny >>= aCustomShapeGeometry)
1800 dumpCustomShapeGeometryAsElement(aCustomShapeGeometry, xmlWriter);
1802 if(xInfo->hasPropertyByName("CustomShapeReplacementURL"))
1804 uno::Any anotherAny = xPropSet->getPropertyValue("CustomShapeReplacementURL");
1805 OUString sCustomShapeReplacementURL;
1806 if(anotherAny >>= sCustomShapeReplacementURL)
1807 dumpCustomShapeReplacementURLAsAttribute(sCustomShapeReplacementURL, xmlWriter);
1811 void dumpXShape(const uno::Reference< drawing::XShape >& xShape, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties)
1813 (void)xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShape" ) );
1814 uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY_THROW);
1815 OUString aName;
1816 m_bNameDumped = false;
1818 dumpPositionAsAttribute(xShape->getPosition(), xmlWriter);
1819 dumpSizeAsAttribute(xShape->getSize(), xmlWriter);
1820 uno::Reference< drawing::XShapeDescriptor > xDescr(xShape, uno::UNO_QUERY_THROW);
1821 dumpShapeDescriptorAsAttribute(xDescr, xmlWriter);
1823 // uno::Sequence<beans::Property> aProperties = xPropSetInfo->getProperties();
1825 uno::Reference< lang::XServiceInfo > xServiceInfo( xShape, uno::UNO_QUERY_THROW );
1827 uno::Reference< beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo();
1828 if(xInfo->hasPropertyByName("Name"))
1830 uno::Any aAny = xPropSet->getPropertyValue("Name");
1831 if ((aAny >>= aName) && !aName.isEmpty())
1833 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("name"), "%s", OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
1834 m_bNameDumped = true;
1840 if (xServiceInfo->supportsService("com.sun.star.drawing.Text"))
1842 uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY_THROW);
1843 OUString aText = xText->getString();
1844 if(!aText.isEmpty())
1845 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("text"), "%s", OUStringToOString(aText, RTL_TEXTENCODING_UTF8).getStr());
1847 if(xServiceInfo->supportsService("com.sun.star.drawing.TextProperties"))
1848 dumpTextPropertiesService(xPropSet, xmlWriter);
1850 if(xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"))
1852 uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY_THROW);
1853 dumpXShapes(xShapes, xmlWriter, bDumpInteropProperties);
1855 if(xServiceInfo->supportsService("com.sun.star.drawing.FillProperties"))
1856 dumpFillPropertiesService(xPropSet, xmlWriter);
1858 if(xServiceInfo->supportsService("com.sun.star.drawing.LineProperties"))
1859 dumpLinePropertiesService(xPropSet, xmlWriter);
1861 if(xServiceInfo->supportsService("com.sun.star.drawing.PolyPolygonDescriptor"))
1862 dumpPolyPolygonDescriptorService(xPropSet, xmlWriter);
1864 if(xServiceInfo->supportsService("com.sun.star.drawing.ShadowProperties"))
1865 dumpShadowPropertiesService(xPropSet, xmlWriter);
1867 if(xServiceInfo->supportsService("com.sun.star.drawing.Shape"))
1868 dumpShapeService(xPropSet, xmlWriter, bDumpInteropProperties);
1870 if(xServiceInfo->supportsService("com.sun.star.drawing.PolyPolygonBezierDescriptor"))
1871 dumpPolyPolygonBezierDescriptorService(xPropSet, xmlWriter);
1873 if(xServiceInfo->supportsService("com.sun.star.drawing.CustomShape"))
1874 dumpCustomShapeService(xPropSet, xmlWriter);
1876 // EnhancedShapeDumper used
1878 if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeExtrusion"))
1880 EnhancedShapeDumper enhancedDumper(xmlWriter);
1881 enhancedDumper.dumpEnhancedCustomShapeExtrusionService(xPropSet);
1883 if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeGeometry"))
1885 EnhancedShapeDumper enhancedDumper(xmlWriter);
1886 enhancedDumper.dumpEnhancedCustomShapeGeometryService(xPropSet);
1888 if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeHandle"))
1890 EnhancedShapeDumper enhancedDumper(xmlWriter);
1891 enhancedDumper.dumpEnhancedCustomShapeHandleService(xPropSet);
1893 if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapePath"))
1895 EnhancedShapeDumper enhancedDumper(xmlWriter);
1896 enhancedDumper.dumpEnhancedCustomShapePathService(xPropSet);
1898 if(xServiceInfo->supportsService("com.sun.star.drawing.EnhancedCustomShapeTextPath"))
1900 EnhancedShapeDumper enhancedDumper(xmlWriter);
1901 enhancedDumper.dumpEnhancedCustomShapeTextPathService(xPropSet);
1903 } // end of the 'try' block
1904 catch (const beans::UnknownPropertyException& e)
1906 std::cout << "Exception caught in XShapeDumper.cxx: " << e.Message << std::endl;
1909 #if DEBUG_DUMPER
1910 uno::Sequence< OUString > aServiceNames = xServiceInfo->getSupportedServiceNames();
1911 sal_Int32 nServices = aServiceNames.getLength();
1912 for (sal_Int32 i = 0; i < nServices; ++i)
1914 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "ServiceName" ));
1915 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST( "name" ), "%s", OUStringToOString(aServiceNames[i], RTL_TEXTENCODING_UTF8).getStr());
1916 (void)xmlTextWriterEndElement( xmlWriter );
1918 #endif
1920 (void)xmlTextWriterEndElement( xmlWriter );
1923 void dumpXShapes( const uno::Reference< drawing::XShapes >& xShapes, xmlTextWriterPtr xmlWriter, bool bDumpInteropProperties )
1925 (void)xmlTextWriterStartElement( xmlWriter, BAD_CAST( "XShapes" ) );
1926 uno::Reference< container::XIndexAccess > xIA( xShapes, uno::UNO_QUERY_THROW);
1927 sal_Int32 nLength = xIA->getCount();
1928 for (sal_Int32 i = 0; i < nLength; ++i)
1930 uno::Reference< drawing::XShape > xShape( xIA->getByIndex( i ), uno::UNO_QUERY_THROW );
1931 dumpXShape( xShape, xmlWriter, bDumpInteropProperties );
1934 (void)xmlTextWriterEndElement( xmlWriter );
1936 } //end of namespace
1938 OUString XShapeDumper::dump(const uno::Reference<drawing::XShapes>& xPageShapes, bool bDumpInteropProperties)
1940 OStringBuffer aString;
1941 xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO( writeCallback, closeCallback, &aString, nullptr );
1942 xmlTextWriterPtr xmlWriter = xmlNewTextWriter( xmlOutBuffer );
1943 xmlTextWriterSetIndent( xmlWriter, 1 );
1945 (void)xmlTextWriterStartDocument( xmlWriter, nullptr, nullptr, nullptr );
1949 dumpXShapes( xPageShapes, xmlWriter, bDumpInteropProperties );
1951 catch (const beans::UnknownPropertyException& e)
1953 std::cout << "Exception caught in XShapeDumper: " << e.Message << std::endl;
1956 (void)xmlTextWriterEndDocument( xmlWriter );
1957 xmlFreeTextWriter( xmlWriter );
1959 return OUString::fromUtf8(aString);
1962 OUString XShapeDumper::dump(const uno::Reference<drawing::XShape>& xPageShapes, bool bDumpInteropProperties)
1964 OStringBuffer aString;
1965 xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO( writeCallback, closeCallback, &aString, nullptr );
1966 xmlTextWriterPtr xmlWriter = xmlNewTextWriter( xmlOutBuffer );
1967 xmlTextWriterSetIndent( xmlWriter, 1 );
1969 (void)xmlTextWriterStartDocument( xmlWriter, nullptr, nullptr, nullptr );
1973 dumpXShape( xPageShapes, xmlWriter, bDumpInteropProperties );
1975 catch (const beans::UnknownPropertyException& e)
1977 std::cout << "Exception caught in XShapeDumper: " << e.Message << std::endl;
1980 (void)xmlTextWriterEndDocument( xmlWriter );
1981 xmlFreeTextWriter( xmlWriter );
1983 return OUString::fromUtf8(aString);
1986 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */