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