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 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <com/sun/star/drawing/HomogenMatrix.hpp>
21 : #include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
22 : #include <com/sun/star/drawing/ProjectionMode.hpp>
23 : #include <com/sun/star/drawing/ShadeMode.hpp>
24 : #include <com/sun/star/drawing/Direction3D.hpp>
25 : #include <com/sun/star/drawing/Position3D.hpp>
26 : #include <com/sun/star/drawing/CameraGeometry.hpp>
27 : #include <com/sun/star/drawing/DoubleSequence.hpp>
28 : #include <tools/helpers.hxx>
29 :
30 : #include <sax/tools/converter.hxx>
31 :
32 : #include <xmloff/shapeexport.hxx>
33 : #include "sdpropls.hxx"
34 : #include <tools/debug.hxx>
35 : #include <rtl/ustrbuf.hxx>
36 : #include <xmloff/xmlexp.hxx>
37 : #include <xmloff/xmluconv.hxx>
38 : #include "xexptran.hxx"
39 : #include <xmloff/xmltoken.hxx>
40 : #include <basegfx/vector/b3dvector.hxx>
41 :
42 : #include "xmloff/xmlnmspe.hxx"
43 :
44 : using ::rtl::OUString;
45 : using ::rtl::OUStringBuffer;
46 :
47 : using namespace ::com::sun::star;
48 : using namespace ::xmloff::token;
49 :
50 :
51 : //////////////////////////////////////////////////////////////////////////////
52 :
53 0 : void XMLShapeExport::ImpExport3DSceneShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
54 : {
55 0 : uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY);
56 0 : if(xShapes.is() && xShapes->getCount())
57 : {
58 0 : uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
59 : DBG_ASSERT( xPropSet.is(), "XMLShapeExport::ImpExport3DSceneShape can't export a scene without a propertyset" );
60 0 : if( xPropSet.is() )
61 : {
62 : // Transformation
63 0 : ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
64 :
65 : // 3d attributes
66 0 : export3DSceneAttributes( xPropSet );
67 :
68 : // write 3DScene shape
69 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
70 0 : SvXMLElementExport aOBJ( mrExport, XML_NAMESPACE_DR3D, XML_SCENE, bCreateNewline, sal_True);
71 :
72 0 : ImpExportDescription( xShape ); // #i68101#
73 0 : ImpExportEvents( xShape );
74 :
75 : // write 3DSceneLights
76 0 : export3DLamps( xPropSet );
77 :
78 : // #89764# if export of position is supressed for group shape,
79 : // positions of contained objects should be written relative to
80 : // the upper left edge of the group.
81 0 : awt::Point aUpperLeft;
82 :
83 0 : if(!(nFeatures & SEF_EXPORT_POSITION))
84 : {
85 0 : nFeatures |= SEF_EXPORT_POSITION;
86 0 : aUpperLeft = xShape->getPosition();
87 0 : pRefPoint = &aUpperLeft;
88 : }
89 :
90 : // write members
91 0 : exportShapes( xShapes, nFeatures, pRefPoint );
92 0 : }
93 0 : }
94 0 : }
95 :
96 : //////////////////////////////////////////////////////////////////////////////
97 :
98 0 : void XMLShapeExport::ImpExport3DShape(
99 : const uno::Reference< drawing::XShape >& xShape,
100 : XmlShapeType eShapeType, sal_Int32 /* nFeatures = SEF_DEFAULT */, awt::Point* /*pRefPoint = NULL */)
101 : {
102 0 : const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
103 0 : if(xPropSet.is())
104 : {
105 0 : OUString aStr;
106 0 : OUStringBuffer sStringBuffer;
107 :
108 : // transformation (UNO_NAME_3D_TRANSFORM_MATRIX == "D3DTransformMatrix")
109 0 : uno::Any aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DTransformMatrix")));
110 0 : drawing::HomogenMatrix xHomMat;
111 0 : aAny >>= xHomMat;
112 0 : SdXMLImExTransform3D aTransform;
113 0 : aTransform.AddHomogenMatrix(xHomMat);
114 0 : if(aTransform.NeedsAction())
115 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_TRANSFORM, aTransform.GetExportString(mrExport.GetMM100UnitConverter()));
116 :
117 0 : switch(eShapeType)
118 : {
119 : case XmlShapeTypeDraw3DCubeObject:
120 : {
121 : // write 3DCube shape
122 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_CUBE, sal_True, sal_True);
123 :
124 : // minEdge
125 0 : aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")));
126 0 : drawing::Position3D aPosition3D;
127 0 : aAny >>= aPosition3D;
128 0 : ::basegfx::B3DVector aPos3D(aPosition3D.PositionX, aPosition3D.PositionY, aPosition3D.PositionZ);
129 :
130 : // maxEdge
131 0 : aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSize")));
132 0 : drawing::Direction3D aDirection3D;
133 0 : aAny >>= aDirection3D;
134 0 : ::basegfx::B3DVector aDir3D(aDirection3D.DirectionX, aDirection3D.DirectionY, aDirection3D.DirectionZ);
135 :
136 : // transform maxEdge from distance to pos
137 0 : aDir3D = aPos3D + aDir3D;
138 :
139 : // write minEdge
140 0 : if(aPos3D != ::basegfx::B3DVector(-2500.0, -2500.0, -2500.0)) // write only when not default
141 : {
142 0 : mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aPos3D);
143 0 : aStr = sStringBuffer.makeStringAndClear();
144 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_MIN_EDGE, aStr);
145 : }
146 :
147 : // write maxEdge
148 0 : if(aDir3D != ::basegfx::B3DVector(2500.0, 2500.0, 2500.0)) // write only when not default
149 : {
150 0 : mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aDir3D);
151 0 : aStr = sStringBuffer.makeStringAndClear();
152 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_MAX_EDGE, aStr);
153 : }
154 :
155 0 : break;
156 : }
157 : case XmlShapeTypeDraw3DSphereObject:
158 : {
159 : // write 3DSphere shape
160 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_SPHERE, sal_True, sal_True);
161 :
162 : // Center
163 0 : aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")));
164 0 : drawing::Position3D aPosition3D;
165 0 : aAny >>= aPosition3D;
166 0 : ::basegfx::B3DVector aPos3D(aPosition3D.PositionX, aPosition3D.PositionY, aPosition3D.PositionZ);
167 :
168 : // Size
169 0 : aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSize")));
170 0 : drawing::Direction3D aDirection3D;
171 0 : aAny >>= aDirection3D;
172 0 : ::basegfx::B3DVector aDir3D(aDirection3D.DirectionX, aDirection3D.DirectionY, aDirection3D.DirectionZ);
173 :
174 : // write Center
175 0 : if(aPos3D != ::basegfx::B3DVector(0.0, 0.0, 0.0)) // write only when not default
176 : {
177 0 : mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aPos3D);
178 0 : aStr = sStringBuffer.makeStringAndClear();
179 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_CENTER, aStr);
180 : }
181 :
182 : // write Size
183 0 : if(aDir3D != ::basegfx::B3DVector(5000.0, 5000.0, 5000.0)) // write only when not default
184 : {
185 0 : mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aDir3D);
186 0 : aStr = sStringBuffer.makeStringAndClear();
187 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SIZE, aStr);
188 : }
189 :
190 0 : break;
191 : }
192 : case XmlShapeTypeDraw3DLatheObject:
193 : case XmlShapeTypeDraw3DExtrudeObject:
194 : {
195 : // write special 3DLathe/3DExtrude attributes
196 0 : aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPolyPolygon3D")));
197 0 : drawing::PolyPolygonShape3D xPolyPolygon3D;
198 0 : aAny >>= xPolyPolygon3D;
199 :
200 : // look for maximal values
201 0 : double fXMin = 0;
202 0 : double fXMax = 0;
203 0 : double fYMin = 0;
204 0 : double fYMax = 0;
205 0 : sal_Bool bInit(sal_False);
206 0 : sal_Int32 nOuterSequenceCount(xPolyPolygon3D.SequenceX.getLength());
207 0 : drawing::DoubleSequence* pInnerSequenceX = xPolyPolygon3D.SequenceX.getArray();
208 0 : drawing::DoubleSequence* pInnerSequenceY = xPolyPolygon3D.SequenceY.getArray();
209 :
210 : sal_Int32 a;
211 0 : for (a = 0; a < nOuterSequenceCount; a++)
212 : {
213 0 : sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength());
214 0 : double* pArrayX = pInnerSequenceX->getArray();
215 0 : double* pArrayY = pInnerSequenceY->getArray();
216 :
217 0 : for(sal_Int32 b(0L); b < nInnerSequenceCount; b++)
218 : {
219 0 : double fX = *pArrayX++;
220 0 : double fY = *pArrayY++;
221 :
222 0 : if(bInit)
223 : {
224 0 : if(fX > fXMax)
225 0 : fXMax = fX;
226 :
227 0 : if(fX < fXMin)
228 0 : fXMin = fX;
229 :
230 0 : if(fY > fYMax)
231 0 : fYMax = fY;
232 :
233 0 : if(fY < fYMin)
234 0 : fYMin = fY;
235 : }
236 : else
237 : {
238 0 : fXMin = fXMax = fX;
239 0 : fYMin = fYMax = fY;
240 0 : bInit = sal_True;
241 : }
242 : }
243 :
244 0 : pInnerSequenceX++;
245 0 : pInnerSequenceY++;
246 : }
247 :
248 : // export ViewBox
249 0 : awt::Point aMinPoint(FRound(fXMin), FRound(fYMin));
250 0 : awt::Size aMaxSize(FRound(fXMax) - aMinPoint.X, FRound(fYMax) - aMinPoint.Y);
251 : SdXMLImExViewBox aViewBox(
252 0 : aMinPoint.X, aMinPoint.Y, aMaxSize.Width, aMaxSize.Height);
253 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX,
254 0 : aViewBox.GetExportString());
255 :
256 : // prepare svx:d element export
257 0 : SdXMLImExSvgDElement aSvgDElement(aViewBox, GetExport());
258 0 : pInnerSequenceX = xPolyPolygon3D.SequenceX.getArray();
259 0 : pInnerSequenceY = xPolyPolygon3D.SequenceY.getArray();
260 :
261 0 : for (a = 0; a < nOuterSequenceCount; a++)
262 : {
263 0 : sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength());
264 0 : double* pArrayX = pInnerSequenceX->getArray();
265 0 : double* pArrayY = pInnerSequenceY->getArray();
266 0 : drawing::PointSequence aPoly(nInnerSequenceCount);
267 0 : awt::Point* pInnerSequence = aPoly.getArray();
268 :
269 0 : for(sal_Int32 b(0L); b < nInnerSequenceCount; b++)
270 : {
271 0 : double fX = *pArrayX++;
272 0 : double fY = *pArrayY++;
273 :
274 0 : *pInnerSequence = awt::Point(FRound(fX), FRound(fY));
275 0 : pInnerSequence++;
276 : }
277 :
278 : // calculate closed flag
279 0 : awt::Point* pFirst = aPoly.getArray();
280 0 : awt::Point* pLast = pFirst + (nInnerSequenceCount - 1);
281 0 : sal_Bool bClosed = (pFirst->X == pLast->X && pFirst->Y == pLast->Y);
282 :
283 : aSvgDElement.AddPolygon(&aPoly, 0L, aMinPoint,
284 0 : aMaxSize, bClosed);
285 :
286 : // #80594# corrected error in PolyPolygon3D export for 3D XML
287 0 : pInnerSequenceX++;
288 0 : pInnerSequenceY++;
289 0 : }
290 :
291 : // write point array
292 0 : mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
293 :
294 0 : if(eShapeType == XmlShapeTypeDraw3DLatheObject)
295 : {
296 : // write 3DLathe shape
297 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_ROTATE, sal_True, sal_True);
298 : }
299 : else
300 : {
301 : // write 3DExtrude shape
302 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_EXTRUDE, sal_True, sal_True);
303 : }
304 0 : break;
305 : }
306 : default:
307 0 : break;
308 0 : }
309 0 : }
310 0 : }
311 :
312 : //////////////////////////////////////////////////////////////////////////////
313 :
314 : /** helper for chart that adds all attributes of a 3d scene element to the export */
315 0 : void XMLShapeExport::export3DSceneAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet )
316 : {
317 0 : OUString aStr;
318 0 : OUStringBuffer sStringBuffer;
319 :
320 : // world transformation (UNO_NAME_3D_TRANSFORM_MATRIX == "D3DTransformMatrix")
321 0 : uno::Any aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DTransformMatrix")));
322 0 : drawing::HomogenMatrix xHomMat;
323 0 : aAny >>= xHomMat;
324 0 : SdXMLImExTransform3D aTransform;
325 0 : aTransform.AddHomogenMatrix(xHomMat);
326 0 : if(aTransform.NeedsAction())
327 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_TRANSFORM, aTransform.GetExportString(mrExport.GetMM100UnitConverter()));
328 :
329 : // VRP, VPN, VUP
330 0 : aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DCameraGeometry")));
331 0 : drawing::CameraGeometry aCamGeo;
332 0 : aAny >>= aCamGeo;
333 :
334 0 : ::basegfx::B3DVector aVRP(aCamGeo.vrp.PositionX, aCamGeo.vrp.PositionY, aCamGeo.vrp.PositionZ);
335 0 : if(aVRP != ::basegfx::B3DVector(0.0, 0.0, 1.0)) // write only when not default
336 : {
337 0 : mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aVRP);
338 0 : aStr = sStringBuffer.makeStringAndClear();
339 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_VRP, aStr);
340 : }
341 :
342 0 : ::basegfx::B3DVector aVPN(aCamGeo.vpn.DirectionX, aCamGeo.vpn.DirectionY, aCamGeo.vpn.DirectionZ);
343 0 : if(aVPN != ::basegfx::B3DVector(0.0, 0.0, 1.0)) // write only when not default
344 : {
345 0 : mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aVPN);
346 0 : aStr = sStringBuffer.makeStringAndClear();
347 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_VPN, aStr);
348 : }
349 :
350 0 : ::basegfx::B3DVector aVUP(aCamGeo.vup.DirectionX, aCamGeo.vup.DirectionY, aCamGeo.vup.DirectionZ);
351 0 : if(aVUP != ::basegfx::B3DVector(0.0, 1.0, 0.0)) // write only when not default
352 : {
353 0 : mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aVUP);
354 0 : aStr = sStringBuffer.makeStringAndClear();
355 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_VUP, aStr);
356 : }
357 :
358 : // projection "D3DScenePerspective" drawing::ProjectionMode
359 0 : aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DScenePerspective")));
360 : drawing::ProjectionMode xPrjMode;
361 0 : aAny >>= xPrjMode;
362 0 : if(xPrjMode == drawing::ProjectionMode_PARALLEL)
363 0 : aStr = GetXMLToken(XML_PARALLEL);
364 : else
365 0 : aStr = GetXMLToken(XML_PERSPECTIVE);
366 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_PROJECTION, aStr);
367 :
368 : // distance
369 0 : aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneDistance")));
370 0 : sal_Int32 nDistance = 0;
371 0 : aAny >>= nDistance;
372 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
373 0 : nDistance);
374 0 : aStr = sStringBuffer.makeStringAndClear();
375 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DISTANCE, aStr);
376 :
377 : // focalLength
378 0 : aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneFocalLength")));
379 0 : sal_Int32 nFocalLength = 0;
380 0 : aAny >>= nFocalLength;
381 0 : mrExport.GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
382 0 : nFocalLength);
383 0 : aStr = sStringBuffer.makeStringAndClear();
384 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_FOCAL_LENGTH, aStr);
385 :
386 : // shadowSlant
387 0 : aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadowSlant")));
388 0 : sal_Int16 nShadowSlant = 0;
389 0 : aAny >>= nShadowSlant;
390 0 : ::sax::Converter::convertNumber(sStringBuffer, (sal_Int32)nShadowSlant);
391 0 : aStr = sStringBuffer.makeStringAndClear();
392 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SHADOW_SLANT, aStr);
393 :
394 : // shadeMode
395 0 : aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadeMode")));
396 : drawing::ShadeMode xShadeMode;
397 0 : if(aAny >>= xShadeMode)
398 : {
399 0 : if(xShadeMode == drawing::ShadeMode_FLAT)
400 0 : aStr = GetXMLToken(XML_FLAT);
401 0 : else if(xShadeMode == drawing::ShadeMode_PHONG)
402 0 : aStr = GetXMLToken(XML_PHONG);
403 0 : else if(xShadeMode == drawing::ShadeMode_SMOOTH)
404 0 : aStr = GetXMLToken(XML_GOURAUD);
405 : else
406 0 : aStr = GetXMLToken(XML_DRAFT);
407 : }
408 : else
409 : {
410 : // ShadeMode enum not there, write default
411 0 : aStr = GetXMLToken(XML_GOURAUD);
412 : }
413 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SHADE_MODE, aStr);
414 :
415 : // ambientColor
416 0 : aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneAmbientColor")));
417 0 : sal_Int32 nAmbientColor = 0;
418 0 : aAny >>= nAmbientColor;
419 0 : ::sax::Converter::convertColor(sStringBuffer, nAmbientColor);
420 0 : aStr = sStringBuffer.makeStringAndClear();
421 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_AMBIENT_COLOR, aStr);
422 :
423 : // lightingMode
424 0 : aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneTwoSidedLighting")));
425 0 : sal_Bool bTwoSidedLighting = false;
426 0 : aAny >>= bTwoSidedLighting;
427 0 : ::sax::Converter::convertBool(sStringBuffer, bTwoSidedLighting);
428 0 : aStr = sStringBuffer.makeStringAndClear();
429 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_LIGHTING_MODE, aStr);
430 0 : }
431 :
432 : /** helper for chart that exports all lamps from the propertyset */
433 0 : void XMLShapeExport::export3DLamps( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet )
434 : {
435 : // write lamps 1..8 as content
436 0 : OUString aStr;
437 0 : OUStringBuffer sStringBuffer;
438 :
439 0 : const OUString aColorPropName(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor") );
440 0 : const OUString aDirectionPropName(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection") );
441 0 : const OUString aLightOnPropName(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn") );
442 :
443 0 : OUString aPropName;
444 0 : OUString aIndexStr;
445 0 : ::basegfx::B3DVector aLightDirection;
446 0 : drawing::Direction3D xLightDir;
447 0 : sal_Bool bLightOnOff = false;
448 0 : for(sal_Int32 nLamp = 1; nLamp <= 8; nLamp++)
449 : {
450 0 : aIndexStr = OUString::valueOf( nLamp );
451 :
452 : // lightcolor
453 0 : aPropName = aColorPropName;
454 0 : aPropName += aIndexStr;
455 0 : sal_Int32 nLightColor = 0;
456 0 : xPropSet->getPropertyValue( aPropName ) >>= nLightColor;
457 0 : ::sax::Converter::convertColor(sStringBuffer, nLightColor);
458 0 : aStr = sStringBuffer.makeStringAndClear();
459 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DIFFUSE_COLOR, aStr);
460 :
461 : // lightdirection
462 0 : aPropName = aDirectionPropName;
463 0 : aPropName += aIndexStr;
464 0 : xPropSet->getPropertyValue(aPropName) >>= xLightDir;
465 0 : aLightDirection = ::basegfx::B3DVector(xLightDir.DirectionX, xLightDir.DirectionY, xLightDir.DirectionZ);
466 0 : mrExport.GetMM100UnitConverter().convertB3DVector(sStringBuffer, aLightDirection);
467 0 : aStr = sStringBuffer.makeStringAndClear();
468 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_DIRECTION, aStr);
469 :
470 : // lighton
471 0 : aPropName = aLightOnPropName;
472 0 : aPropName += aIndexStr;
473 0 : xPropSet->getPropertyValue(aPropName) >>= bLightOnOff;
474 0 : ::sax::Converter::convertBool(sStringBuffer, bLightOnOff);
475 0 : aStr = sStringBuffer.makeStringAndClear();
476 0 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_ENABLED, aStr);
477 :
478 : // specular
479 : mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SPECULAR,
480 0 : nLamp == 1 ? XML_TRUE : XML_FALSE);
481 :
482 : // write light entry
483 0 : SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_LIGHT, sal_True, sal_True);
484 0 : }
485 0 : }
486 :
487 : //////////////////////////////////////////////////////////////////////////////
488 :
489 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|