Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : */
9 :
10 : #include <EnhancedShapeDumper.hxx>
11 : #include <rtl/strbuf.hxx>
12 : #include <com/sun/star/beans/XPropertySet.hpp>
13 :
14 : using namespace com::sun::star;
15 :
16 :
17 : // ---------- EnhancedCustomShapeExtrusion.idl ----------
18 :
19 :
20 0 : void EnhancedShapeDumper::dumpEnhancedCustomShapeExtrusionService(uno::Reference< beans::XPropertySet > xPropSet)
21 : {
22 : {
23 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Extrusion");
24 : bool bExtrusion;
25 0 : if(anotherAny >>= bExtrusion)
26 0 : dumpExtrusionAsAttribute(bExtrusion);
27 : }
28 : {
29 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Brightness");
30 0 : double aBrightness = double();
31 0 : if(anotherAny >>= aBrightness)
32 0 : dumpBrightnessAsAttribute(aBrightness);
33 : }
34 : {
35 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Depth");
36 0 : drawing::EnhancedCustomShapeParameterPair aDepth;
37 0 : if(anotherAny >>= aDepth)
38 0 : dumpDepthAsElement(aDepth);
39 : }
40 : {
41 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Diffusion");
42 0 : double aDiffusion = double();
43 0 : if(anotherAny >>= aDiffusion)
44 0 : dumpDiffusionAsAttribute(aDiffusion);
45 : }
46 : {
47 0 : uno::Any anotherAny = xPropSet->getPropertyValue("NumberOfLineSegments");
48 0 : sal_Int32 aNumberOfLineSegments = sal_Int32();
49 0 : if(anotherAny >>= aNumberOfLineSegments)
50 0 : dumpNumberOfLineSegmentsAsAttribute(aNumberOfLineSegments);
51 : }
52 : {
53 0 : uno::Any anotherAny = xPropSet->getPropertyValue("LightFace");
54 : bool bLightFace;
55 0 : if(anotherAny >>= bLightFace)
56 0 : dumpLightFaceAsAttribute(bLightFace);
57 : }
58 : {
59 0 : uno::Any anotherAny = xPropSet->getPropertyValue("FirstLightHarsh");
60 : bool bFirstLightHarsh;
61 0 : if(anotherAny >>= bFirstLightHarsh)
62 0 : dumpFirstLightHarshAsAttribute(bFirstLightHarsh);
63 : }
64 : {
65 0 : uno::Any anotherAny = xPropSet->getPropertyValue("SecondLightHarsh");
66 : bool bSecondLightHarsh;
67 0 : if(anotherAny >>= bSecondLightHarsh)
68 0 : dumpSecondLightHarshAsAttribute(bSecondLightHarsh);
69 : }
70 : {
71 0 : uno::Any anotherAny = xPropSet->getPropertyValue("FirstLightLevel");
72 0 : double aFirstLightLevel = double();
73 0 : if(anotherAny >>= aFirstLightLevel)
74 0 : dumpFirstLightLevelAsAttribute(aFirstLightLevel);
75 : }
76 : {
77 0 : uno::Any anotherAny = xPropSet->getPropertyValue("SecondLightLevel");
78 0 : double aSecondLightLevel = double();
79 0 : if(anotherAny >>= aSecondLightLevel)
80 0 : dumpSecondLightLevelAsAttribute(aSecondLightLevel);
81 : }
82 : {
83 0 : uno::Any anotherAny = xPropSet->getPropertyValue("FirstLightDirection");
84 0 : drawing::Direction3D aFirstLightDirection;
85 0 : if(anotherAny >>= aFirstLightDirection)
86 0 : dumpFirstLightDirectionAsElement(aFirstLightDirection);
87 : }
88 : {
89 0 : uno::Any anotherAny = xPropSet->getPropertyValue("SecondLightDirection");
90 0 : drawing::Direction3D aSecondLightDirection;
91 0 : if(anotherAny >>= aSecondLightDirection)
92 0 : dumpSecondLightDirectionAsElement(aSecondLightDirection);
93 : }
94 : {
95 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Metal");
96 : bool bMetal;
97 0 : if(anotherAny >>= bMetal)
98 0 : dumpMetalAsAttribute(bMetal);
99 : }
100 : {
101 0 : uno::Any anotherAny = xPropSet->getPropertyValue("ShadeMode");
102 : drawing::ShadeMode eShadeMode;
103 0 : if(anotherAny >>= eShadeMode)
104 0 : dumpShadeModeAsAttribute(eShadeMode);
105 : }
106 : {
107 0 : uno::Any anotherAny = xPropSet->getPropertyValue("RotateAngle");
108 0 : drawing::EnhancedCustomShapeParameterPair aRotateAngle;
109 0 : if(anotherAny >>= aRotateAngle)
110 0 : dumpRotateAngleAsElement(aRotateAngle);
111 : }
112 : {
113 0 : uno::Any anotherAny = xPropSet->getPropertyValue("RotationCenter");
114 0 : drawing::Direction3D aRotationCenter;
115 0 : if(anotherAny >>= aRotationCenter)
116 0 : dumpRotationCenterAsElement(aRotationCenter);
117 : }
118 : {
119 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Shininess");
120 0 : double aShininess = double();
121 0 : if(anotherAny >>= aShininess)
122 0 : dumpShininessAsAttribute(aShininess);
123 : }
124 : {
125 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Skew");
126 0 : drawing::EnhancedCustomShapeParameterPair aSkew;
127 0 : if(anotherAny >>= aSkew)
128 0 : dumpSkewAsElement(aSkew);
129 : }
130 : {
131 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Specularity");
132 0 : double aSpecularity = double();
133 0 : if(anotherAny >>= aSpecularity)
134 0 : dumpSpecularityAsAttribute(aSpecularity);
135 : }
136 : {
137 0 : uno::Any anotherAny = xPropSet->getPropertyValue("ProjectionMode");
138 : drawing::ProjectionMode eProjectionMode;
139 0 : if(anotherAny >>= eProjectionMode)
140 0 : dumpProjectionModeAsAttribute(eProjectionMode);
141 : }
142 : {
143 0 : uno::Any anotherAny = xPropSet->getPropertyValue("ViewPoint");
144 0 : drawing::Position3D aViewPoint;
145 0 : if(anotherAny >>= aViewPoint)
146 0 : dumpViewPointAsElement(aViewPoint);
147 : }
148 : {
149 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Origin");
150 0 : drawing::EnhancedCustomShapeParameterPair aOrigin;
151 0 : if(anotherAny >>= aOrigin)
152 0 : dumpOriginAsElement(aOrigin);
153 : }
154 : {
155 0 : uno::Any anotherAny = xPropSet->getPropertyValue("ExtrusionColor");
156 : bool bExtrusionColor;
157 0 : if(anotherAny >>= bExtrusionColor)
158 0 : dumpExtrusionColorAsAttribute(bExtrusionColor);
159 : }
160 0 : }
161 0 : void EnhancedShapeDumper::dumpExtrusionAsAttribute(bool bExtrusion)
162 : {
163 0 : if(bExtrusion)
164 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("extrusion"), "%s", "true");
165 : else
166 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("extrusion"), "%s", "false");
167 0 : }
168 :
169 0 : void EnhancedShapeDumper::dumpBrightnessAsAttribute(double aBrightness)
170 : {
171 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("brightness"), "%f", aBrightness);
172 0 : }
173 :
174 2236 : void EnhancedShapeDumper::dumpEnhancedCustomShapeParameterPair(drawing::EnhancedCustomShapeParameterPair aParameterPair)
175 : {
176 : {
177 2236 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "First" ));
178 2236 : dumpEnhancedCustomShapeParameter(aParameterPair.First);
179 2236 : xmlTextWriterEndElement( xmlWriter );
180 : }
181 : {
182 2236 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Second" ));
183 2236 : dumpEnhancedCustomShapeParameter(aParameterPair.Second);
184 2236 : xmlTextWriterEndElement( xmlWriter );
185 : }
186 2236 : }
187 :
188 0 : void EnhancedShapeDumper::dumpDepthAsElement(drawing::EnhancedCustomShapeParameterPair aDepth)
189 : {
190 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Depth" ));
191 0 : dumpEnhancedCustomShapeParameterPair(aDepth);
192 0 : xmlTextWriterEndElement( xmlWriter );
193 0 : }
194 :
195 0 : void EnhancedShapeDumper::dumpDiffusionAsAttribute(double aDiffusion)
196 : {
197 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("diffusion"), "%f", aDiffusion);
198 0 : }
199 :
200 0 : void EnhancedShapeDumper::dumpNumberOfLineSegmentsAsAttribute(sal_Int32 aNumberOfLineSegments)
201 : {
202 0 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("numberOfLineSegments"), "%" SAL_PRIdINT32, aNumberOfLineSegments);
203 0 : }
204 :
205 0 : void EnhancedShapeDumper::dumpLightFaceAsAttribute(bool bLightFace)
206 : {
207 0 : if(bLightFace)
208 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lightFace"), "%s", "true");
209 : else
210 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("lightFace"), "%s", "false");
211 0 : }
212 :
213 0 : void EnhancedShapeDumper::dumpFirstLightHarshAsAttribute(bool bFirstLightHarsh)
214 : {
215 0 : if(bFirstLightHarsh)
216 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("firstLightHarsh"), "%s", "true");
217 : else
218 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("firstLightHarsh"), "%s", "false");
219 0 : }
220 :
221 0 : void EnhancedShapeDumper::dumpSecondLightHarshAsAttribute(bool bSecondLightHarsh)
222 : {
223 0 : if(bSecondLightHarsh)
224 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("secondLightHarsh"), "%s", "true");
225 : else
226 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("secondLightHarsh"), "%s", "false");
227 0 : }
228 :
229 0 : void EnhancedShapeDumper::dumpFirstLightLevelAsAttribute(double aFirstLightLevel)
230 : {
231 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("firstLightLevel"), "%f", aFirstLightLevel);
232 0 : }
233 :
234 0 : void EnhancedShapeDumper::dumpSecondLightLevelAsAttribute(double aSecondLightLevel)
235 : {
236 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("secondLightLevel"), "%f", aSecondLightLevel);
237 0 : }
238 :
239 0 : void EnhancedShapeDumper::dumpDirection3D(drawing::Direction3D aDirection3D)
240 : {
241 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("directionX"), "%f", aDirection3D.DirectionX);
242 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("directionY"), "%f", aDirection3D.DirectionY);
243 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("directionZ"), "%f", aDirection3D.DirectionZ);
244 0 : }
245 :
246 0 : void EnhancedShapeDumper::dumpFirstLightDirectionAsElement(drawing::Direction3D aFirstLightDirection)
247 : {
248 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "FirstLightDirection" ));
249 0 : dumpDirection3D(aFirstLightDirection);
250 0 : xmlTextWriterEndElement( xmlWriter );
251 0 : }
252 :
253 0 : void EnhancedShapeDumper::dumpSecondLightDirectionAsElement(drawing::Direction3D aSecondLightDirection)
254 : {
255 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "SecondLightDirection" ));
256 0 : dumpDirection3D(aSecondLightDirection);
257 0 : xmlTextWriterEndElement( xmlWriter );
258 0 : }
259 :
260 0 : void EnhancedShapeDumper::dumpMetalAsAttribute(bool bMetal)
261 : {
262 0 : if(bMetal)
263 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("metal"), "%s", "true");
264 : else
265 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("metal"), "%s", "false");
266 0 : }
267 :
268 0 : void EnhancedShapeDumper::dumpShadeModeAsAttribute(drawing::ShadeMode eShadeMode)
269 : {
270 0 : switch(eShadeMode)
271 : {
272 : case drawing::ShadeMode_FLAT:
273 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadeMode"), "%s", "FLAT");
274 0 : break;
275 : case drawing::ShadeMode_PHONG:
276 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadeMode"), "%s", "PHONG");
277 0 : break;
278 : case drawing::ShadeMode_SMOOTH:
279 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadeMode"), "%s", "SMOOTH");
280 0 : break;
281 : case drawing::ShadeMode_DRAFT:
282 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shadeMode"), "%s", "DRAFT");
283 0 : break;
284 : default:
285 0 : break;
286 : }
287 0 : }
288 :
289 0 : void EnhancedShapeDumper::dumpRotateAngleAsElement(drawing::EnhancedCustomShapeParameterPair aRotateAngle)
290 : {
291 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "RotateAngle" ));
292 0 : dumpEnhancedCustomShapeParameterPair(aRotateAngle);
293 0 : xmlTextWriterEndElement( xmlWriter );
294 0 : }
295 :
296 0 : void EnhancedShapeDumper::dumpRotationCenterAsElement(drawing::Direction3D aRotationCenter)
297 : {
298 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "RotationCenter" ));
299 0 : dumpDirection3D(aRotationCenter);
300 0 : xmlTextWriterEndElement( xmlWriter );
301 0 : }
302 :
303 0 : void EnhancedShapeDumper::dumpShininessAsAttribute(double aShininess)
304 : {
305 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("shininess"), "%f", aShininess);
306 0 : }
307 :
308 0 : void EnhancedShapeDumper::dumpSkewAsElement(drawing::EnhancedCustomShapeParameterPair aSkew)
309 : {
310 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Skew" ));
311 0 : dumpEnhancedCustomShapeParameterPair(aSkew);
312 0 : xmlTextWriterEndElement( xmlWriter );
313 0 : }
314 :
315 0 : void EnhancedShapeDumper::dumpSpecularityAsAttribute(double aSpecularity)
316 : {
317 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("specularity"), "%f", aSpecularity);
318 0 : }
319 :
320 0 : void EnhancedShapeDumper::dumpProjectionModeAsAttribute(drawing::ProjectionMode eProjectionMode)
321 : {
322 0 : switch(eProjectionMode)
323 : {
324 : case drawing::ProjectionMode_PARALLEL:
325 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("projectionMode"), "%s", "PARALLEL");
326 0 : break;
327 : case drawing::ProjectionMode_PERSPECTIVE:
328 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("projectionMode"), "%s", "PERSPECTIVE");
329 0 : break;
330 : default:
331 0 : break;
332 : }
333 0 : }
334 :
335 0 : void EnhancedShapeDumper::dumpViewPointAsElement(drawing::Position3D aViewPoint)
336 : {
337 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "ViewPoint" ));
338 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("positionX"), "%f", aViewPoint.PositionX);
339 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("positionY"), "%f", aViewPoint.PositionY);
340 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("positionZ"), "%f", aViewPoint.PositionZ);
341 0 : xmlTextWriterEndElement( xmlWriter );
342 0 : }
343 :
344 0 : void EnhancedShapeDumper::dumpOriginAsElement(drawing::EnhancedCustomShapeParameterPair aOrigin)
345 : {
346 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Origin" ));
347 0 : dumpEnhancedCustomShapeParameterPair(aOrigin);
348 0 : xmlTextWriterEndElement( xmlWriter );
349 0 : }
350 :
351 0 : void EnhancedShapeDumper::dumpExtrusionColorAsAttribute(bool bExtrusionColor)
352 : {
353 0 : if(bExtrusionColor)
354 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("extrusionColor"), "%s", "true");
355 : else
356 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("extrusionColor"), "%s", "false");
357 0 : }
358 :
359 :
360 : // ---------- EnhancedCustomShapeGeometry.idl -----------
361 :
362 :
363 0 : void EnhancedShapeDumper::dumpEnhancedCustomShapeGeometryService(uno::Reference< beans::XPropertySet > xPropSet)
364 : {
365 : {
366 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Type");
367 0 : OUString sType;
368 0 : if(anotherAny >>= sType)
369 0 : dumpTypeAsAttribute(sType);
370 : }
371 : {
372 0 : uno::Any anotherAny = xPropSet->getPropertyValue("ViewBox");
373 0 : awt::Rectangle aViewBox;
374 0 : if(anotherAny >>= aViewBox)
375 0 : dumpViewBoxAsElement(aViewBox);
376 : }
377 : {
378 0 : uno::Any anotherAny = xPropSet->getPropertyValue("MirroredX");
379 : bool bMirroredX;
380 0 : if(anotherAny >>= bMirroredX)
381 0 : dumpMirroredXAsAttribute(bMirroredX);
382 : }
383 : {
384 0 : uno::Any anotherAny = xPropSet->getPropertyValue("MirroredY");
385 : bool bMirroredY;
386 0 : if(anotherAny >>= bMirroredY)
387 0 : dumpMirroredYAsAttribute(bMirroredY);
388 : }
389 : {
390 0 : uno::Any anotherAny = xPropSet->getPropertyValue("TextRotateAngle");
391 0 : double aTextRotateAngle = double();
392 0 : if(anotherAny >>= aTextRotateAngle)
393 0 : dumpTextRotateAngleAsAttribute(aTextRotateAngle);
394 : }
395 : {
396 0 : uno::Any anotherAny = xPropSet->getPropertyValue("AdjustmentValues");
397 0 : uno::Sequence< drawing::EnhancedCustomShapeAdjustmentValue> aAdjustmentValues;
398 0 : if(anotherAny >>= aAdjustmentValues)
399 0 : dumpAdjustmentValuesAsElement(aAdjustmentValues);
400 : }
401 : {
402 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Extrusion");
403 0 : uno::Sequence< beans::PropertyValue > aExtrusion;
404 0 : if(anotherAny >>= aExtrusion)
405 0 : dumpExtrusionAsElement(aExtrusion);
406 : }
407 : {
408 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Path");
409 0 : uno::Sequence< beans::PropertyValue > aPath;
410 0 : if(anotherAny >>= aPath)
411 0 : dumpPathAsElement(aPath);
412 : }
413 : {
414 0 : uno::Any anotherAny = xPropSet->getPropertyValue("TextPath");
415 0 : uno::Sequence< beans::PropertyValue > aTextPath;
416 0 : if(anotherAny >>= aTextPath)
417 0 : dumpTextPathAsElement(aTextPath);
418 : }
419 : {
420 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Equations");
421 0 : uno::Sequence< OUString > aEquations;
422 0 : if(anotherAny >>= aEquations)
423 0 : dumpEquationsAsElement(aEquations);
424 : }
425 : {
426 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Handles");
427 0 : uno::Sequence< beans::PropertyValues > aHandles;
428 0 : if(anotherAny >>= aHandles)
429 0 : dumpHandlesAsElement(aHandles);
430 : }
431 0 : }
432 0 : void EnhancedShapeDumper::dumpTypeAsAttribute(const OUString& sType)
433 : {
434 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("type"), "%s",
435 0 : OUStringToOString(sType, RTL_TEXTENCODING_UTF8).getStr());
436 0 : }
437 :
438 239 : void EnhancedShapeDumper::dumpViewBoxAsElement(awt::Rectangle aViewBox)
439 : {
440 239 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "ViewBox" ));
441 239 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("x"), "%" SAL_PRIdINT32, aViewBox.X);
442 239 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("y"), "%" SAL_PRIdINT32, aViewBox.Y);
443 239 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("width"), "%" SAL_PRIdINT32, aViewBox.Width);
444 239 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("height"), "%" SAL_PRIdINT32, aViewBox.Height);
445 239 : xmlTextWriterEndElement( xmlWriter );
446 239 : }
447 :
448 0 : void EnhancedShapeDumper::dumpMirroredXAsAttribute(bool bMirroredX)
449 : {
450 0 : if(bMirroredX)
451 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("mirroredX"), "%s", "true");
452 : else
453 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("mirroredX"), "%s", "false");
454 0 : }
455 :
456 0 : void EnhancedShapeDumper::dumpMirroredYAsAttribute(bool bMirroredY)
457 : {
458 0 : if(bMirroredY)
459 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("mirroredY"), "%s", "true");
460 : else
461 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("mirroredY"), "%s", "false");
462 0 : }
463 :
464 0 : void EnhancedShapeDumper::dumpTextRotateAngleAsAttribute(double aTextRotateAngle)
465 : {
466 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textRotateAngle"), "%f", aTextRotateAngle);
467 0 : }
468 :
469 240 : void EnhancedShapeDumper::dumpAdjustmentValuesAsElement(const uno::Sequence< drawing::EnhancedCustomShapeAdjustmentValue>& aAdjustmentValues)
470 : {
471 240 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "AdjustmentValues" ));
472 240 : sal_Int32 nLength = aAdjustmentValues.getLength();
473 304 : for (sal_Int32 i = 0; i < nLength; ++i)
474 : {
475 64 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "EnhancedCustomShapeAdjustmentValue" ));
476 64 : uno::Any aAny = aAdjustmentValues[i].Value;
477 128 : OUString sValue;
478 : float fValue;
479 : sal_Int32 nValue;
480 : bool bValue;
481 64 : if(aAny >>= sValue)
482 : {
483 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s",
484 0 : OUStringToOString(sValue, RTL_TEXTENCODING_UTF8).getStr());
485 : }
486 64 : else if(aAny >>= nValue)
487 : {
488 64 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%" SAL_PRIdINT32, nValue);
489 : }
490 0 : else if(aAny >>= fValue)
491 : {
492 0 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%f", fValue);
493 : }
494 0 : else if(aAny >>= bValue)
495 : {
496 0 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s", (bValue? "true": "false"));
497 : }
498 :
499 64 : switch(aAdjustmentValues[i].State)
500 : {
501 : case beans::PropertyState_DIRECT_VALUE:
502 64 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "DIRECT_VALUE");
503 64 : break;
504 : case beans::PropertyState_DEFAULT_VALUE:
505 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "DEFAULT_VALUE");
506 0 : break;
507 : case beans::PropertyState_AMBIGUOUS_VALUE:
508 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "AMBIGUOUS_VALUE");
509 0 : break;
510 : default:
511 0 : break;
512 : }
513 64 : xmlTextWriterEndElement( xmlWriter );
514 64 : }
515 240 : xmlTextWriterEndElement( xmlWriter );
516 240 : }
517 :
518 0 : void EnhancedShapeDumper::dumpPropertyValueAsElement(beans::PropertyValue aPropertyValue)
519 : {
520 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PropertyValue" ));
521 :
522 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s",
523 0 : OUStringToOString(aPropertyValue.Name, RTL_TEXTENCODING_UTF8).getStr());
524 0 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("handle"), "%" SAL_PRIdINT32, aPropertyValue.Handle);
525 :
526 0 : uno::Any aAny = aPropertyValue.Value;
527 0 : OUString sValue;
528 0 : if(aAny >>= sValue)
529 : {
530 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s",
531 0 : OUStringToOString(sValue, RTL_TEXTENCODING_UTF8).getStr());
532 : }
533 0 : switch(aPropertyValue.State)
534 : {
535 : case beans::PropertyState_DIRECT_VALUE:
536 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "DIRECT_VALUE");
537 0 : break;
538 : case beans::PropertyState_DEFAULT_VALUE:
539 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "DEFAULT_VALUE");
540 0 : break;
541 : case beans::PropertyState_AMBIGUOUS_VALUE:
542 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("propertyState"), "%s", "AMBIGUOUS_VALUE");
543 0 : break;
544 : default:
545 0 : break;
546 : }
547 0 : xmlTextWriterEndElement( xmlWriter );
548 0 : }
549 :
550 0 : void EnhancedShapeDumper::dumpExtrusionAsElement(const uno::Sequence< beans::PropertyValue >& aExtrusion)
551 : {
552 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Extrusion" ));
553 0 : sal_Int32 nLength = aExtrusion.getLength();
554 0 : for (sal_Int32 i = 0; i < nLength; ++i)
555 : {
556 0 : dumpPropertyValueAsElement(aExtrusion[i]);
557 : }
558 0 : xmlTextWriterEndElement( xmlWriter );
559 0 : }
560 :
561 0 : void EnhancedShapeDumper::dumpPathAsElement(const uno::Sequence< beans::PropertyValue >& aPath)
562 : {
563 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Path" ));
564 0 : sal_Int32 nLength = aPath.getLength();
565 0 : for (sal_Int32 i = 0; i < nLength; ++i)
566 : {
567 0 : dumpPropertyValueAsElement(aPath[i]);
568 : }
569 0 : xmlTextWriterEndElement( xmlWriter );
570 0 : }
571 :
572 0 : void EnhancedShapeDumper::dumpTextPathAsElement(const uno::Sequence< beans::PropertyValue >& aTextPath)
573 : {
574 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "TextPath" ));
575 0 : sal_Int32 nLength = aTextPath.getLength();
576 0 : for (sal_Int32 i = 0; i < nLength; ++i)
577 : {
578 0 : dumpPropertyValueAsElement(aTextPath[i]);
579 : }
580 0 : xmlTextWriterEndElement( xmlWriter );
581 0 : }
582 :
583 0 : void EnhancedShapeDumper::dumpEquationsAsElement(const uno::Sequence< OUString >& aEquations)
584 : {
585 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Equations" ));
586 0 : sal_Int32 nLength = aEquations.getLength();
587 0 : for (sal_Int32 i = 0; i < nLength; ++i)
588 : {
589 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s",
590 0 : OUStringToOString(aEquations[i], RTL_TEXTENCODING_UTF8).getStr());
591 : }
592 0 : xmlTextWriterEndElement( xmlWriter );
593 0 : }
594 :
595 : // PropertyValues specifies a sequence of PropertyValue instances.
596 : // so in this case it's a Sequence of a Sequence of a PropertyValue instances.
597 : // Welcome to Sequenception again.
598 0 : void EnhancedShapeDumper::dumpHandlesAsElement(const uno::Sequence< beans::PropertyValues >& aHandles)
599 : {
600 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Handles" ));
601 0 : sal_Int32 nSequenceLength = aHandles.getLength();
602 0 : for (sal_Int32 i = 0; i < nSequenceLength; ++i)
603 : {
604 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PropertyValues" ));
605 0 : uno::Sequence< beans::PropertyValue > propertyValueSequence = aHandles[i];
606 0 : sal_Int32 nLength = propertyValueSequence.getLength();
607 0 : for (sal_Int32 j = 0; j < nLength; ++j)
608 : {
609 0 : dumpPropertyValueAsElement(propertyValueSequence[j]);
610 : }
611 0 : xmlTextWriterEndElement( xmlWriter );
612 0 : }
613 0 : xmlTextWriterEndElement( xmlWriter );
614 0 : }
615 :
616 :
617 : // ---------- EnhancedCustomShapeHandle.idl -----------
618 :
619 :
620 0 : void EnhancedShapeDumper::dumpEnhancedCustomShapeHandleService(uno::Reference< beans::XPropertySet > xPropSet)
621 : {
622 : {
623 0 : uno::Any anotherAny = xPropSet->getPropertyValue("MirroredX");
624 : bool bMirroredX;
625 0 : if(anotherAny >>= bMirroredX)
626 0 : dumpMirroredXAsAttribute(bMirroredX);
627 : }
628 : {
629 0 : uno::Any anotherAny = xPropSet->getPropertyValue("MirroredY");
630 : bool bMirroredY;
631 0 : if(anotherAny >>= bMirroredY)
632 0 : dumpMirroredYAsAttribute(bMirroredY);
633 : }
634 : {
635 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Switched");
636 : bool bSwitched;
637 0 : if(anotherAny >>= bSwitched)
638 0 : dumpSwitchedAsAttribute(bSwitched);
639 : }
640 : {
641 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Position");
642 0 : drawing::EnhancedCustomShapeParameterPair aPosition;
643 0 : if(anotherAny >>= aPosition)
644 0 : dumpPositionAsElement(aPosition);
645 : }
646 : {
647 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Polar");
648 0 : drawing::EnhancedCustomShapeParameterPair aPolar;
649 0 : if(anotherAny >>= aPolar)
650 0 : dumpPolarAsElement(aPolar);
651 : }
652 : {
653 0 : uno::Any anotherAny = xPropSet->getPropertyValue("RefX");
654 0 : sal_Int32 aRefX = sal_Int32();
655 0 : if(anotherAny >>= aRefX)
656 0 : dumpRefXAsAttribute(aRefX);
657 : }
658 : {
659 0 : uno::Any anotherAny = xPropSet->getPropertyValue("RefY");
660 0 : sal_Int32 aRefY = sal_Int32();
661 0 : if(anotherAny >>= aRefY)
662 0 : dumpRefYAsAttribute(aRefY);
663 : }
664 : {
665 0 : uno::Any anotherAny = xPropSet->getPropertyValue("RefAngle");
666 0 : sal_Int32 aRefAngle = sal_Int32();
667 0 : if(anotherAny >>= aRefAngle)
668 0 : dumpRefAngleAsAttribute(aRefAngle);
669 : }
670 : {
671 0 : uno::Any anotherAny = xPropSet->getPropertyValue("RefR");
672 0 : sal_Int32 aRefR = sal_Int32();
673 0 : if(anotherAny >>= aRefR)
674 0 : dumpRefRAsAttribute(aRefR);
675 : }
676 : {
677 0 : uno::Any anotherAny = xPropSet->getPropertyValue("RangeXMinimum");
678 0 : drawing::EnhancedCustomShapeParameter aRangeXMinimum;
679 0 : if(anotherAny >>= aRangeXMinimum)
680 0 : dumpRangeXMinimumAsElement(aRangeXMinimum);
681 : }
682 : {
683 0 : uno::Any anotherAny = xPropSet->getPropertyValue("RangeXMaximum");
684 0 : drawing::EnhancedCustomShapeParameter aRangeXMaximum;
685 0 : if(anotherAny >>= aRangeXMaximum)
686 0 : dumpRangeXMaximumAsElement(aRangeXMaximum);
687 : }
688 : {
689 0 : uno::Any anotherAny = xPropSet->getPropertyValue("RangeYMinimum");
690 0 : drawing::EnhancedCustomShapeParameter aRangeYMinimum;
691 0 : if(anotherAny >>= aRangeYMinimum)
692 0 : dumpRangeYMinimumAsElement(aRangeYMinimum);
693 : }
694 : {
695 0 : uno::Any anotherAny = xPropSet->getPropertyValue("RangeYMaximum");
696 0 : drawing::EnhancedCustomShapeParameter aRangeYMaximum;
697 0 : if(anotherAny >>= aRangeYMaximum)
698 0 : dumpRangeYMaximumAsElement(aRangeYMaximum);
699 : }
700 : {
701 0 : uno::Any anotherAny = xPropSet->getPropertyValue("RadiusRangeMinimum");
702 0 : drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
703 0 : if(anotherAny >>= aRadiusRangeMinimum)
704 0 : dumpRadiusRangeMinimumAsElement(aRadiusRangeMinimum);
705 : }
706 : {
707 0 : uno::Any anotherAny = xPropSet->getPropertyValue("RadiusRangeMaximum");
708 0 : drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
709 0 : if(anotherAny >>= aRadiusRangeMaximum)
710 0 : dumpRadiusRangeMaximumAsElement(aRadiusRangeMaximum);
711 : }
712 0 : }
713 :
714 0 : void EnhancedShapeDumper::dumpSwitchedAsAttribute(bool bSwitched)
715 : {
716 0 : if(bSwitched)
717 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("switched"), "%s", "true");
718 : else
719 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("switched"), "%s", "false");
720 0 : }
721 :
722 0 : void EnhancedShapeDumper::dumpPositionAsElement(drawing::EnhancedCustomShapeParameterPair aPosition)
723 : {
724 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Position" ));
725 0 : dumpEnhancedCustomShapeParameterPair(aPosition);
726 0 : xmlTextWriterEndElement( xmlWriter );
727 0 : }
728 :
729 0 : void EnhancedShapeDumper::dumpPolarAsElement(drawing::EnhancedCustomShapeParameterPair aPolar)
730 : {
731 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Polar" ));
732 0 : dumpEnhancedCustomShapeParameterPair(aPolar);
733 0 : xmlTextWriterEndElement( xmlWriter );
734 0 : }
735 :
736 0 : void EnhancedShapeDumper::dumpRefXAsAttribute(sal_Int32 aRefX)
737 : {
738 0 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("refX"), "%" SAL_PRIdINT32, aRefX);
739 0 : }
740 :
741 0 : void EnhancedShapeDumper::dumpRefYAsAttribute(sal_Int32 aRefY)
742 : {
743 0 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("refY"), "%" SAL_PRIdINT32, aRefY);
744 0 : }
745 :
746 0 : void EnhancedShapeDumper::dumpRefAngleAsAttribute(sal_Int32 aRefAngle)
747 : {
748 0 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("refAngle"), "%" SAL_PRIdINT32, aRefAngle);
749 0 : }
750 :
751 0 : void EnhancedShapeDumper::dumpRefRAsAttribute(sal_Int32 aRefR)
752 : {
753 0 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("refR"), "%" SAL_PRIdINT32, aRefR);
754 0 : }
755 :
756 4472 : void EnhancedShapeDumper::dumpEnhancedCustomShapeParameter(drawing::EnhancedCustomShapeParameter aParameter)
757 : {
758 4472 : uno::Any aAny = aParameter.Value;
759 8944 : OUString sValue;
760 : float fValue;
761 : sal_Int32 nValue;
762 : bool bValue;
763 4472 : if(aAny >>= sValue)
764 : {
765 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s",
766 0 : OUStringToOString(sValue, RTL_TEXTENCODING_UTF8).getStr());
767 : }
768 4472 : else if(aAny >>= nValue)
769 : {
770 4472 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%" SAL_PRIdINT32, nValue);
771 : }
772 0 : else if(aAny >>= fValue)
773 : {
774 0 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%f", fValue);
775 : }
776 0 : else if(aAny >>= bValue)
777 : {
778 0 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), "%s", (bValue? "true": "false"));
779 : }
780 4472 : sal_Int32 aType = aParameter.Type;
781 8944 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("type"), "%" SAL_PRIdINT32, aType);
782 4472 : }
783 :
784 0 : void EnhancedShapeDumper::dumpRangeXMinimumAsElement(drawing::EnhancedCustomShapeParameter aRangeXMinimum)
785 : {
786 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "RangeXMinimum" ));
787 0 : dumpEnhancedCustomShapeParameter(aRangeXMinimum);
788 0 : xmlTextWriterEndElement( xmlWriter );
789 0 : }
790 :
791 0 : void EnhancedShapeDumper::dumpRangeXMaximumAsElement(drawing::EnhancedCustomShapeParameter aRangeXMaximum)
792 : {
793 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "RangeXMaximum" ));
794 0 : dumpEnhancedCustomShapeParameter(aRangeXMaximum);
795 0 : xmlTextWriterEndElement( xmlWriter );
796 0 : }
797 :
798 0 : void EnhancedShapeDumper::dumpRangeYMinimumAsElement(drawing::EnhancedCustomShapeParameter aRangeYMinimum)
799 : {
800 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "RangeYMinimum" ));
801 0 : dumpEnhancedCustomShapeParameter(aRangeYMinimum);
802 0 : xmlTextWriterEndElement( xmlWriter );
803 0 : }
804 :
805 0 : void EnhancedShapeDumper::dumpRangeYMaximumAsElement(drawing::EnhancedCustomShapeParameter aRangeYMaximum)
806 : {
807 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "RangeYMaximum" ));
808 0 : dumpEnhancedCustomShapeParameter(aRangeYMaximum);
809 0 : xmlTextWriterEndElement( xmlWriter );
810 0 : }
811 :
812 0 : void EnhancedShapeDumper::dumpRadiusRangeMinimumAsElement(drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum)
813 : {
814 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "RadiusRangeMinimum" ));
815 0 : dumpEnhancedCustomShapeParameter(aRadiusRangeMinimum);
816 0 : xmlTextWriterEndElement( xmlWriter );
817 0 : }
818 :
819 0 : void EnhancedShapeDumper::dumpRadiusRangeMaximumAsElement(drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum)
820 : {
821 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "RadiusRangeMaximum" ));
822 0 : dumpEnhancedCustomShapeParameter(aRadiusRangeMaximum);
823 0 : xmlTextWriterEndElement( xmlWriter );
824 0 : }
825 :
826 :
827 : // ---------- EnhancedCustomShapePath.idl ---------------
828 :
829 :
830 0 : void EnhancedShapeDumper::dumpEnhancedCustomShapePathService(uno::Reference< beans::XPropertySet > xPropSet)
831 : {
832 : {
833 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Coordinates");
834 0 : uno::Sequence< drawing::EnhancedCustomShapeParameterPair > aCoordinates;
835 0 : if(anotherAny >>= aCoordinates)
836 0 : dumpCoordinatesAsElement(aCoordinates);
837 : }
838 : {
839 0 : uno::Any anotherAny = xPropSet->getPropertyValue("Segments");
840 0 : uno::Sequence< drawing::EnhancedCustomShapeSegment > aSegments;
841 0 : if(anotherAny >>= aSegments)
842 0 : dumpSegmentsAsElement(aSegments);
843 : }
844 : {
845 0 : uno::Any anotherAny = xPropSet->getPropertyValue("StretchX");
846 0 : sal_Int32 aStretchX = sal_Int32();
847 0 : if(anotherAny >>= aStretchX)
848 0 : dumpStretchXAsAttribute(aStretchX);
849 : }
850 : {
851 0 : uno::Any anotherAny = xPropSet->getPropertyValue("StretchY");
852 0 : sal_Int32 aStretchY = sal_Int32();
853 0 : if(anotherAny >>= aStretchY)
854 0 : dumpStretchYAsAttribute(aStretchY);
855 : }
856 : {
857 0 : uno::Any anotherAny = xPropSet->getPropertyValue("TextFrames");
858 0 : uno::Sequence< drawing::EnhancedCustomShapeTextFrame > aTextFrames;
859 0 : if(anotherAny >>= aTextFrames)
860 0 : dumpTextFramesAsElement(aTextFrames);
861 : }
862 : {
863 0 : uno::Any anotherAny = xPropSet->getPropertyValue("GluePoints");
864 0 : uno::Sequence< drawing::EnhancedCustomShapeParameterPair > aGluePoints;
865 0 : if(anotherAny >>= aGluePoints)
866 0 : dumpGluePointsAsElement(aGluePoints);
867 : }
868 : {
869 0 : uno::Any anotherAny = xPropSet->getPropertyValue("GluePointLeavingDirections");
870 0 : uno::Sequence< double > aGluePointLeavingDirections;
871 0 : if(anotherAny >>= aGluePointLeavingDirections)
872 0 : dumpGluePointLeavingDirectionsAsElement(aGluePointLeavingDirections);
873 : }
874 : {
875 0 : uno::Any anotherAny = xPropSet->getPropertyValue("GluePointType");
876 0 : sal_Int32 aGluePointType = sal_Int32();
877 0 : if(anotherAny >>= aGluePointType)
878 0 : dumpGluePointTypeAsAttribute(aGluePointType);
879 : }
880 : {
881 0 : uno::Any anotherAny = xPropSet->getPropertyValue("ExtrusionAllowed");
882 : bool bExtrusionAllowed;
883 0 : if(anotherAny >>= bExtrusionAllowed)
884 0 : dumpExtrusionAllowedAsAttribute(bExtrusionAllowed);
885 : }
886 : {
887 0 : uno::Any anotherAny = xPropSet->getPropertyValue("ConcentricGradientFillAllowed");
888 : bool bConcentricGradientFillAllowed;
889 0 : if(anotherAny >>= bConcentricGradientFillAllowed)
890 0 : dumpConcentricGradientFillAllowedAsAttribute(bConcentricGradientFillAllowed);
891 : }
892 : {
893 0 : uno::Any anotherAny = xPropSet->getPropertyValue("TextPathAllowed");
894 : bool bTextPathAllowed;
895 0 : if(anotherAny >>= bTextPathAllowed)
896 0 : dumpTextPathAllowedAsAttribute(bTextPathAllowed);
897 : }
898 : {
899 0 : uno::Any anotherAny = xPropSet->getPropertyValue("SubViewSize");
900 0 : uno::Sequence< awt::Size > aSubViewSize;
901 0 : if(anotherAny >>= aSubViewSize)
902 0 : dumpSubViewSizeAsElement(aSubViewSize);
903 : }
904 0 : }
905 :
906 240 : void EnhancedShapeDumper::dumpCoordinatesAsElement(const uno::Sequence< drawing::EnhancedCustomShapeParameterPair >& aCoordinates)
907 : {
908 240 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Coordinates" ));
909 240 : sal_Int32 nLength = aCoordinates.getLength();
910 2476 : for (sal_Int32 i = 0; i < nLength; ++i)
911 : {
912 2236 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "EnhancedCustomShapeParameterPair" ));
913 2236 : dumpEnhancedCustomShapeParameterPair(aCoordinates[i]);
914 2236 : xmlTextWriterEndElement( xmlWriter );
915 : }
916 240 : xmlTextWriterEndElement( xmlWriter );
917 240 : }
918 :
919 240 : void EnhancedShapeDumper::dumpSegmentsAsElement(const uno::Sequence< drawing::EnhancedCustomShapeSegment >& aSegments)
920 : {
921 240 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Segments" ));
922 240 : sal_Int32 nLength = aSegments.getLength();
923 1607 : for (sal_Int32 i = 0; i < nLength; ++i)
924 : {
925 1367 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "EnhancedCustomShapeSegment" ));
926 1367 : sal_Int32 aCommand = aSegments[i].Command;
927 1367 : sal_Int32 aCount = aSegments[i].Count;
928 1367 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("command"), "%" SAL_PRIdINT32, aCommand);
929 1367 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("count"), "%" SAL_PRIdINT32, aCount);
930 1367 : xmlTextWriterEndElement( xmlWriter );
931 : }
932 240 : xmlTextWriterEndElement( xmlWriter );
933 240 : }
934 :
935 0 : void EnhancedShapeDumper::dumpStretchXAsAttribute(sal_Int32 aStretchX)
936 : {
937 0 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("stretchX"), "%" SAL_PRIdINT32, aStretchX);
938 0 : }
939 :
940 0 : void EnhancedShapeDumper::dumpStretchYAsAttribute(sal_Int32 aStretchY)
941 : {
942 0 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("stretchY"), "%" SAL_PRIdINT32, aStretchY);
943 0 : }
944 :
945 0 : void EnhancedShapeDumper::dumpTextFramesAsElement(const uno::Sequence< drawing::EnhancedCustomShapeTextFrame >& aTextFrames)
946 : {
947 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "TextFrames" ));
948 0 : sal_Int32 nLength = aTextFrames.getLength();
949 0 : for (sal_Int32 i = 0; i < nLength; ++i)
950 : {
951 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "EnhancedCustomShapeTextFrame" ));
952 : {
953 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "TopLeft" ));
954 0 : dumpEnhancedCustomShapeParameterPair(aTextFrames[i].TopLeft);
955 0 : xmlTextWriterEndElement( xmlWriter );
956 :
957 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "BottomRight" ));
958 0 : dumpEnhancedCustomShapeParameterPair(aTextFrames[i].BottomRight);
959 0 : xmlTextWriterEndElement( xmlWriter );
960 : }
961 0 : xmlTextWriterEndElement( xmlWriter );
962 : }
963 0 : xmlTextWriterEndElement( xmlWriter );
964 0 : }
965 :
966 0 : void EnhancedShapeDumper::dumpGluePointsAsElement(const uno::Sequence< drawing::EnhancedCustomShapeParameterPair >& aGluePoints)
967 : {
968 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "GluePoints" ));
969 0 : sal_Int32 nLength = aGluePoints.getLength();
970 0 : for (sal_Int32 i = 0; i < nLength; ++i)
971 : {
972 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "EnhancedCustomShapeParameterPair" ));
973 0 : dumpEnhancedCustomShapeParameterPair(aGluePoints[i]);
974 0 : xmlTextWriterEndElement( xmlWriter );
975 : }
976 0 : xmlTextWriterEndElement( xmlWriter );
977 0 : }
978 :
979 0 : void EnhancedShapeDumper::dumpGluePointLeavingDirectionsAsElement(const uno::Sequence< double >& aGluePointLeavingDirections)
980 : {
981 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "GluePointLeavingDirections" ));
982 0 : sal_Int32 nLength = aGluePointLeavingDirections.getLength();
983 0 : for (sal_Int32 i = 0; i < nLength; ++i)
984 : {
985 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("value"), "%f", aGluePointLeavingDirections[i]);
986 : }
987 0 : xmlTextWriterEndElement( xmlWriter );
988 0 : }
989 :
990 0 : void EnhancedShapeDumper::dumpGluePointTypeAsAttribute(sal_Int32 aGluePointType)
991 : {
992 0 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("gluePointType"), "%" SAL_PRIdINT32, aGluePointType);
993 0 : }
994 :
995 0 : void EnhancedShapeDumper::dumpExtrusionAllowedAsAttribute(bool bExtrusionAllowed)
996 : {
997 0 : if(bExtrusionAllowed)
998 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("extrusionAllowed"), "%s", "true");
999 : else
1000 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("extrusionAllowed"), "%s", "false");
1001 0 : }
1002 :
1003 0 : void EnhancedShapeDumper::dumpConcentricGradientFillAllowedAsAttribute(bool bConcentricGradientFillAllowed)
1004 : {
1005 0 : if(bConcentricGradientFillAllowed)
1006 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("concentricGradientFillAllowed"), "%s", "true");
1007 : else
1008 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("concentricGradientFillAllowed"), "%s", "false");
1009 0 : }
1010 :
1011 0 : void EnhancedShapeDumper::dumpTextPathAllowedAsAttribute(bool bTextPathAllowed)
1012 : {
1013 0 : if(bTextPathAllowed)
1014 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textPathAllowed"), "%s", "true");
1015 : else
1016 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textPathAllowed"), "%s", "false");
1017 0 : }
1018 :
1019 0 : void EnhancedShapeDumper::dumpSubViewSizeAsElement(const uno::Sequence< awt::Size >& aSubViewSize)
1020 : {
1021 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "SubViewSize" ));
1022 0 : sal_Int32 nLength = aSubViewSize.getLength();
1023 0 : for (sal_Int32 i = 0; i < nLength; ++i)
1024 : {
1025 0 : xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Size" ));
1026 0 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("width"), "%" SAL_PRIdINT32, aSubViewSize[i].Width);
1027 0 : xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("height"), "%" SAL_PRIdINT32, aSubViewSize[i].Height);
1028 0 : xmlTextWriterEndElement( xmlWriter );
1029 : }
1030 0 : xmlTextWriterEndElement( xmlWriter );
1031 0 : }
1032 :
1033 :
1034 : // ---------- EnhancedCustomShapeTextPath.idl ---------------
1035 :
1036 :
1037 0 : void EnhancedShapeDumper::dumpEnhancedCustomShapeTextPathService(uno::Reference< beans::XPropertySet > xPropSet)
1038 : {
1039 : {
1040 0 : uno::Any anotherAny = xPropSet->getPropertyValue("TextPath");
1041 : bool bTextPath;
1042 0 : if(anotherAny >>= bTextPath)
1043 0 : dumpTextPathAsAttribute(bTextPath);
1044 : }
1045 : {
1046 0 : uno::Any anotherAny = xPropSet->getPropertyValue("TextPathMode");
1047 : drawing::EnhancedCustomShapeTextPathMode eTextPathMode;
1048 0 : if(anotherAny >>= eTextPathMode)
1049 0 : dumpTextPathModeAsAttribute(eTextPathMode);
1050 : }
1051 : {
1052 0 : uno::Any anotherAny = xPropSet->getPropertyValue("ScaleX");
1053 : bool bScaleX;
1054 0 : if(anotherAny >>= bScaleX)
1055 0 : dumpScaleXAsAttribute(bScaleX);
1056 : }
1057 0 : }
1058 :
1059 0 : void EnhancedShapeDumper::dumpTextPathAsAttribute(bool bTextPath)
1060 : {
1061 0 : if(bTextPath)
1062 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textPath"), "%s", "true");
1063 : else
1064 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textPath"), "%s", "false");
1065 0 : }
1066 :
1067 0 : void EnhancedShapeDumper::dumpTextPathModeAsAttribute(drawing::EnhancedCustomShapeTextPathMode eTextPathMode)
1068 : {
1069 0 : switch(eTextPathMode)
1070 : {
1071 : case drawing::EnhancedCustomShapeTextPathMode_NORMAL:
1072 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textPathMode"), "%s", "NORMAL");
1073 0 : break;
1074 : case drawing::EnhancedCustomShapeTextPathMode_PATH:
1075 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textPathMode"), "%s", "PATH");
1076 0 : break;
1077 : case drawing::EnhancedCustomShapeTextPathMode_SHAPE:
1078 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("textPathMode"), "%s", "SHAPE");
1079 0 : break;
1080 : default:
1081 0 : break;
1082 : }
1083 0 : }
1084 :
1085 0 : void EnhancedShapeDumper::dumpScaleXAsAttribute(bool bScaleX)
1086 : {
1087 0 : if(bScaleX)
1088 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("scaleX"), "%s", "true");
1089 : else
1090 0 : xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("scaleX"), "%s", "false");
1091 0 : }
1092 :
1093 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|