bump product version to 4.1.6.2
[LibreOffice.git] / svx / source / unodraw / unoshap3.cxx
blobd94b7bc1e97cf0654b71c7a9717f6f0e0fbdfffa
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <com/sun/star/drawing/HomogenMatrix.hpp>
21 #include <com/sun/star/drawing/Position3D.hpp>
22 #include <com/sun/star/drawing/Direction3D.hpp>
23 #include <com/sun/star/drawing/DoubleSequence.hpp>
24 #include <com/sun/star/drawing/CameraGeometry.hpp>
25 #include <vcl/svapp.hxx>
26 #include <osl/mutex.hxx>
27 #include <comphelper/servicehelper.hxx>
28 #include <comphelper/serviceinfohelper.hxx>
30 #include <svx/svdpool.hxx>
31 #include <svx/unoshape.hxx>
32 #include <svx/unopage.hxx>
33 #include <editeng/unoprnms.hxx>
34 #include <svx/polysc3d.hxx>
35 #include "svx/globl3d.hxx"
36 #include <svx/cube3d.hxx>
37 #include <svx/sphere3d.hxx>
38 #include <svx/lathe3d.hxx>
39 #include <svx/extrud3d.hxx>
40 #include <svx/polygn3d.hxx>
41 #include "svx/unoshprp.hxx"
42 #include "svx/svdmodel.hxx"
43 #include <basegfx/polygon/b3dpolygon.hxx>
44 #include <basegfx/polygon/b3dpolygontools.hxx>
45 #include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
46 #include <basegfx/polygon/b2dpolypolygontools.hxx>
47 #include "shapeimpl.hxx"
49 using namespace ::cppu;
50 using namespace ::com::sun::star;
51 using namespace ::com::sun::star::uno;
52 using namespace ::com::sun::star::lang;
53 using namespace ::com::sun::star::container;
55 #define QUERYINT( xint ) \
56 if( rType == ::getCppuType((const Reference< xint >*)0) ) \
57 aAny <<= Reference< xint >(this)
59 /***********************************************************************
60 * class Svx3DSceneObject *
61 ***********************************************************************/
63 //----------------------------------------------------------------------
64 Svx3DSceneObject::Svx3DSceneObject( SdrObject* pObj, SvxDrawPage* pDrawPage ) throw()
65 : SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_3DSCENEOBJECT), getSvxMapProvider().GetPropertySet(SVXMAP_3DSCENEOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
66 , mxPage( pDrawPage )
70 //----------------------------------------------------------------------
71 Svx3DSceneObject::~Svx3DSceneObject() throw()
75 //----------------------------------------------------------------------
76 void Svx3DSceneObject::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
78 SvxShape::Create( pNewObj, pNewPage );
79 mxPage = pNewPage;
82 //----------------------------------------------------------------------
83 uno::Any SAL_CALL Svx3DSceneObject::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
85 uno::Any aAny;
87 QUERYINT( drawing::XShapes );
88 else QUERYINT( container::XIndexAccess );
89 else QUERYINT( container::XElementAccess );
90 else
91 return SvxShape::queryAggregation( rType );
93 return aAny;
96 uno::Any SAL_CALL Svx3DSceneObject::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException )
98 return SvxShape::queryInterface( rType );
101 void SAL_CALL Svx3DSceneObject::acquire() throw ( )
103 SvxShape::acquire();
106 void SAL_CALL Svx3DSceneObject::release() throw ( )
108 SvxShape::release();
111 // XTypeProvider
113 uno::Sequence< uno::Type > SAL_CALL Svx3DSceneObject::getTypes()
114 throw (uno::RuntimeException)
117 return SvxShape::getTypes();
120 namespace
122 class theSvx3DSceneObjectImplementationId : public rtl::Static< UnoTunnelIdInit, theSvx3DSceneObjectImplementationId > {};
125 uno::Sequence< sal_Int8 > SAL_CALL Svx3DSceneObject::getImplementationId()
126 throw (uno::RuntimeException)
128 return theSvx3DSceneObjectImplementationId::get().getSeq();
131 //----------------------------------------------------------------------
132 void SAL_CALL Svx3DSceneObject::add( const Reference< drawing::XShape >& xShape )
133 throw( uno::RuntimeException)
135 SolarMutexGuard aGuard;
137 SvxShape* pShape = SvxShape::getImplementation( xShape );
139 if(!mpObj.is() || !mxPage.is() || pShape == NULL || NULL != pShape->GetSdrObject() )
140 throw uno::RuntimeException();
142 SdrObject* pSdrShape = mxPage->_CreateSdrObject( xShape );
143 if( pSdrShape->ISA(E3dObject) )
145 mpObj->GetSubList()->NbcInsertObject( pSdrShape );
147 if(pShape)
148 pShape->Create( pSdrShape, mxPage.get() );
150 else
152 SdrObject::Free( pSdrShape );
153 throw uno::RuntimeException();
156 if( mpModel )
157 mpModel->SetChanged();
160 //----------------------------------------------------------------------
161 void SAL_CALL Svx3DSceneObject::remove( const Reference< drawing::XShape >& xShape )
162 throw( uno::RuntimeException )
164 SolarMutexGuard aGuard;
166 SvxShape* pShape = SvxShape::getImplementation( xShape );
168 if(!mpObj.is() || pShape == NULL)
169 throw uno::RuntimeException();
171 SdrObject* pSdrShape = pShape->GetSdrObject();
172 if(pSdrShape == NULL || pSdrShape->GetObjList()->GetOwnerObj() != mpObj.get())
174 throw uno::RuntimeException();
176 else
178 SdrObjList& rList = *pSdrShape->GetObjList();
180 const sal_uInt32 nObjCount = rList.GetObjCount();
181 sal_uInt32 nObjNum = 0;
182 while( nObjNum < nObjCount )
184 if(rList.GetObj( nObjNum ) == pSdrShape )
185 break;
186 nObjNum++;
189 if( nObjNum < nObjCount )
191 SdrObject* pObject = rList.NbcRemoveObject( nObjNum );
192 SdrObject::Free( pObject );
194 else
196 DBG_ASSERT( 0, "Fatality! SdrObject is not belonging to its SdrObjList! [CL]" );
201 //----------------------------------------------------------------------
202 sal_Int32 SAL_CALL Svx3DSceneObject::getCount()
203 throw( uno::RuntimeException )
205 SolarMutexGuard aGuard;
207 sal_Int32 nRetval = 0;
209 if(mpObj.is() && mpObj->ISA(E3dPolyScene) && mpObj->GetSubList())
210 nRetval = mpObj->GetSubList()->GetObjCount();
211 return nRetval;
214 //----------------------------------------------------------------------
216 uno::Any SAL_CALL Svx3DSceneObject::getByIndex( sal_Int32 Index )
217 throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
219 SolarMutexGuard aGuard;
221 if( !mpObj.is() || mpObj->GetSubList() == NULL )
222 throw uno::RuntimeException();
224 if( mpObj->GetSubList()->GetObjCount() <= (sal_uInt32)Index )
225 throw lang::IndexOutOfBoundsException();
227 SdrObject* pDestObj = mpObj->GetSubList()->GetObj( Index );
228 if(pDestObj == NULL)
229 throw lang::IndexOutOfBoundsException();
231 Reference< drawing::XShape > xShape( pDestObj->getUnoShape(), uno::UNO_QUERY );
232 uno::Any aAny;
233 aAny <<= xShape;
234 return aAny;
237 //----------------------------------------------------------------------
238 // ::com::sun::star::container::XElementAccess
240 uno::Type SAL_CALL Svx3DSceneObject::getElementType()
241 throw( uno::RuntimeException )
243 return ::getCppuType(( const Reference< drawing::XShape>*)0);
246 //----------------------------------------------------------------------
247 sal_Bool SAL_CALL Svx3DSceneObject::hasElements()
248 throw( uno::RuntimeException )
250 SolarMutexGuard aGuard;
252 return mpObj.is() && mpObj->GetSubList() && (mpObj->GetSubList()->GetObjCount() > 0);
255 //----------------------------------------------------------------------
257 static bool ConvertHomogenMatrixToObject( E3dObject* pObject, const Any& rValue )
259 drawing::HomogenMatrix m;
260 if( rValue >>= m )
262 basegfx::B3DHomMatrix aMat;
263 aMat.set(0, 0, m.Line1.Column1);
264 aMat.set(0, 1, m.Line1.Column2);
265 aMat.set(0, 2, m.Line1.Column3);
266 aMat.set(0, 3, m.Line1.Column4);
267 aMat.set(1, 0, m.Line2.Column1);
268 aMat.set(1, 1, m.Line2.Column2);
269 aMat.set(1, 2, m.Line2.Column3);
270 aMat.set(1, 3, m.Line2.Column4);
271 aMat.set(2, 0, m.Line3.Column1);
272 aMat.set(2, 1, m.Line3.Column2);
273 aMat.set(2, 2, m.Line3.Column3);
274 aMat.set(2, 3, m.Line3.Column4);
275 aMat.set(3, 0, m.Line4.Column1);
276 aMat.set(3, 1, m.Line4.Column2);
277 aMat.set(3, 2, m.Line4.Column3);
278 aMat.set(3, 3, m.Line4.Column4);
279 pObject->SetTransform(aMat);
280 return true;
282 return false;
285 static void ConvertObjectToHomogenMatric( E3dObject* pObject, Any& rValue )
287 drawing::HomogenMatrix aHomMat;
288 const basegfx::B3DHomMatrix& rMat = pObject->GetTransform();
289 aHomMat.Line1.Column1 = rMat.get(0, 0);
290 aHomMat.Line1.Column2 = rMat.get(0, 1);
291 aHomMat.Line1.Column3 = rMat.get(0, 2);
292 aHomMat.Line1.Column4 = rMat.get(0, 3);
293 aHomMat.Line2.Column1 = rMat.get(1, 0);
294 aHomMat.Line2.Column2 = rMat.get(1, 1);
295 aHomMat.Line2.Column3 = rMat.get(1, 2);
296 aHomMat.Line2.Column4 = rMat.get(1, 3);
297 aHomMat.Line3.Column1 = rMat.get(2, 0);
298 aHomMat.Line3.Column2 = rMat.get(2, 1);
299 aHomMat.Line3.Column3 = rMat.get(2, 2);
300 aHomMat.Line3.Column4 = rMat.get(2, 3);
301 aHomMat.Line4.Column1 = rMat.get(3, 0);
302 aHomMat.Line4.Column2 = rMat.get(3, 1);
303 aHomMat.Line4.Column3 = rMat.get(3, 2);
304 aHomMat.Line4.Column4 = rMat.get(3, 3);
305 rValue <<= aHomMat;
308 //----------------------------------------------------------------------
309 #include <svx/svditer.hxx>
311 struct ImpRememberTransAndRect
313 basegfx::B3DHomMatrix maMat;
314 Rectangle maRect;
317 bool Svx3DSceneObject::setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
319 switch( pProperty->nWID )
321 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
323 // Transformationsmatrix in das Objekt packen
324 if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
325 return true;
326 break;
328 case OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY:
330 // set CameraGeometry at scene
331 E3dScene* pScene = static_cast< E3dScene* >( mpObj.get() );
332 drawing::CameraGeometry aCamGeo;
334 if(rValue >>= aCamGeo)
336 basegfx::B3DPoint aVRP(aCamGeo.vrp.PositionX, aCamGeo.vrp.PositionY, aCamGeo.vrp.PositionZ);
337 basegfx::B3DVector aVPN(aCamGeo.vpn.DirectionX, aCamGeo.vpn.DirectionY, aCamGeo.vpn.DirectionZ);
338 basegfx::B3DVector aVUP(aCamGeo.vup.DirectionX, aCamGeo.vup.DirectionY, aCamGeo.vup.DirectionZ);
340 // rescue scene transformation
341 ImpRememberTransAndRect aSceneTAR;
342 aSceneTAR.maMat = pScene->GetTransform();
343 aSceneTAR.maRect = pScene->GetSnapRect();
345 // rescue object transformations
346 SdrObjListIter aIter(*pScene->GetSubList(), IM_DEEPWITHGROUPS);
347 std::vector<basegfx::B3DHomMatrix*> aObjTrans;
348 while(aIter.IsMore())
350 E3dObject* p3DObj = (E3dObject*)aIter.Next();
351 basegfx::B3DHomMatrix* pNew = new basegfx::B3DHomMatrix;
352 *pNew = p3DObj->GetTransform();
353 aObjTrans.push_back(pNew);
356 // reset object transformations
357 aIter.Reset();
358 while(aIter.IsMore())
360 E3dObject* p3DObj = (E3dObject*)aIter.Next();
361 p3DObj->NbcSetTransform(basegfx::B3DHomMatrix());
364 // reset scene transformation and make a complete recalc
365 pScene->NbcSetTransform(basegfx::B3DHomMatrix());
367 // fill old camera from new parameters
368 Camera3D aCam(pScene->GetCamera());
369 const basegfx::B3DRange& rVolume = pScene->GetBoundVolume();
370 double fW = rVolume.getWidth();
371 double fH = rVolume.getHeight();
373 const SfxItemSet& rSceneSet = pScene->GetMergedItemSet();
374 double fCamPosZ =
375 (double)((const SfxUInt32Item&)rSceneSet.Get(SDRATTR_3DSCENE_DISTANCE)).GetValue();
376 double fCamFocal =
377 (double)((const SfxUInt32Item&)rSceneSet.Get(SDRATTR_3DSCENE_FOCAL_LENGTH)).GetValue();
379 aCam.SetAutoAdjustProjection(sal_False);
380 aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
381 basegfx::B3DPoint aLookAt;
382 basegfx::B3DPoint aCamPos(0.0, 0.0, fCamPosZ);
383 aCam.SetPosAndLookAt(aCamPos, aLookAt);
384 aCam.SetFocalLength(fCamFocal / 100.0);
385 aCam.SetDefaults(basegfx::B3DPoint(0.0, 0.0, fCamPosZ), aLookAt, fCamFocal / 100.0);
386 aCam.SetDeviceWindow(Rectangle(0, 0, (long)fW, (long)fH));
388 // set at scene
389 pScene->SetCamera(aCam);
391 // #91047# use imported VRP, VPN and VUP (if used)
392 bool bVRPUsed(!aVRP.equal(basegfx::B3DPoint(0.0, 0.0, 1.0)));
393 bool bVPNUsed(!aVPN.equal(basegfx::B3DVector(0.0, 0.0, 1.0)));
394 bool bVUPUsed(!aVUP.equal(basegfx::B3DVector(0.0, 1.0, 0.0)));
396 if(bVRPUsed || bVPNUsed || bVUPUsed)
398 pScene->GetCameraSet().SetViewportValues(aVRP, aVPN, aVUP);
401 // set object transformations again at objects
402 aIter.Reset();
403 sal_uInt32 nIndex(0L);
404 while(aIter.IsMore())
406 E3dObject* p3DObj = (E3dObject*)aIter.Next();
407 basegfx::B3DHomMatrix* pMat = aObjTrans[nIndex++];
408 p3DObj->NbcSetTransform(*pMat);
409 delete pMat;
412 // set scene transformation again at scene
413 pScene->NbcSetTransform(aSceneTAR.maMat);
414 pScene->NbcSetSnapRect(aSceneTAR.maRect);
416 return true;
418 break;
420 default:
421 return SvxShape::setPropertyValueImpl(rName, pProperty, rValue);
424 throw IllegalArgumentException();
427 //----------------------------------------------------------------------
429 bool Svx3DSceneObject::getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
431 switch( pProperty->nWID )
433 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
435 // Objekt in eine homogene 4x4 Matrix packen
436 ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
437 break;
439 case OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY:
441 // get CameraGeometry from scene
442 E3dScene* pScene = static_cast< E3dScene* >( mpObj.get() );
443 drawing::CameraGeometry aCamGeo;
445 // fill Vectors from scene camera
446 B3dCamera& aCameraSet = pScene->GetCameraSet();
447 basegfx::B3DPoint aVRP(aCameraSet.GetVRP());
448 basegfx::B3DVector aVPN(aCameraSet.GetVPN());
449 basegfx::B3DVector aVUP(aCameraSet.GetVUV());
451 // transfer to structure
452 aCamGeo.vrp.PositionX = aVRP.getX();
453 aCamGeo.vrp.PositionY = aVRP.getY();
454 aCamGeo.vrp.PositionZ = aVRP.getZ();
455 aCamGeo.vpn.DirectionX = aVPN.getX();
456 aCamGeo.vpn.DirectionY = aVPN.getY();
457 aCamGeo.vpn.DirectionZ = aVPN.getZ();
458 aCamGeo.vup.DirectionX = aVUP.getX();
459 aCamGeo.vup.DirectionY = aVUP.getY();
460 aCamGeo.vup.DirectionZ = aVUP.getZ();
462 rValue <<= aCamGeo;
463 break;
465 default:
466 return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
469 return true;
472 // ::com::sun::star::lang::XServiceInfo
473 uno::Sequence< OUString > SAL_CALL Svx3DSceneObject::getSupportedServiceNames()
474 throw(uno::RuntimeException)
476 uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
477 comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.Shape3DScene" );
478 return aSeq;
481 /***********************************************************************
483 ***********************************************************************/
485 //----------------------------------------------------------------------
486 Svx3DCubeObject::Svx3DCubeObject( SdrObject* pObj ) throw()
487 : SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_3DCUBEOBJEKT), getSvxMapProvider().GetPropertySet(SVXMAP_3DCUBEOBJEKT, SdrObject::GetGlobalDrawObjectItemPool()) )
491 //----------------------------------------------------------------------
492 Svx3DCubeObject::~Svx3DCubeObject() throw()
496 //----------------------------------------------------------------------
497 bool Svx3DCubeObject::setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
499 SolarMutexGuard aGuard;
501 switch( pProperty->nWID )
503 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
505 // Transformationsmatrix in das Objekt packen
506 if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
507 return true;
508 break;
510 case OWN_ATTR_3D_VALUE_POSITION:
512 // Position in das Objekt packen
513 drawing::Position3D aUnoPos;
514 if( rValue >>= aUnoPos )
516 basegfx::B3DPoint aPos(aUnoPos.PositionX, aUnoPos.PositionY, aUnoPos.PositionZ);
517 static_cast< E3dCubeObj* >( mpObj.get() )->SetCubePos(aPos);
518 return true;
520 break;
522 case OWN_ATTR_3D_VALUE_SIZE:
524 // Groesse in das Objekt packen
525 drawing::Direction3D aDirection;
526 if( rValue >>= aDirection )
528 basegfx::B3DVector aSize(aDirection.DirectionX, aDirection.DirectionY, aDirection.DirectionZ);
529 static_cast< E3dCubeObj* >( mpObj.get() )->SetCubeSize(aSize);
530 return true;
532 break;
534 case OWN_ATTR_3D_VALUE_POS_IS_CENTER:
536 sal_Bool bNew = sal_False;
537 // sal_Bool bPosIsCenter in das Objekt packen
538 if( rValue >>= bNew )
540 static_cast< E3dCubeObj* >( mpObj.get() )->SetPosIsCenter(bNew);
541 return true;
543 break;
545 default:
546 return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
549 throw IllegalArgumentException();
552 //----------------------------------------------------------------------
554 bool Svx3DCubeObject::getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
556 switch( pProperty->nWID )
558 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
560 // Transformation in eine homogene Matrix packen
561 ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
562 break;
564 case OWN_ATTR_3D_VALUE_POSITION:
566 // Position packen
567 const basegfx::B3DPoint& rPos = ((E3dCubeObj*)mpObj.get())->GetCubePos();
568 drawing::Position3D aPos;
570 aPos.PositionX = rPos.getX();
571 aPos.PositionY = rPos.getY();
572 aPos.PositionZ = rPos.getZ();
574 rValue <<= aPos;
575 break;
577 case OWN_ATTR_3D_VALUE_SIZE:
579 // Groesse packen
580 const basegfx::B3DVector& rSize = static_cast<E3dCubeObj*>(mpObj.get())->GetCubeSize();
581 drawing::Direction3D aDir;
583 aDir.DirectionX = rSize.getX();
584 aDir.DirectionY = rSize.getY();
585 aDir.DirectionZ = rSize.getZ();
587 rValue <<= aDir;
588 break;
590 case OWN_ATTR_3D_VALUE_POS_IS_CENTER:
592 rValue <<= static_cast<E3dCubeObj*>(mpObj.get())->GetPosIsCenter();
593 break;
595 default:
596 return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
599 return true;
602 // ::com::sun::star::lang::XServiceInfo
603 uno::Sequence< OUString > SAL_CALL Svx3DCubeObject::getSupportedServiceNames()
604 throw(uno::RuntimeException)
606 uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
607 comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
608 "com.sun.star.drawing.Shape3DCube");
609 return aSeq;
612 /***********************************************************************
614 ***********************************************************************/
616 //----------------------------------------------------------------------
617 Svx3DSphereObject::Svx3DSphereObject( SdrObject* pObj ) throw()
618 : SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_3DSPHEREOBJECT), getSvxMapProvider().GetPropertySet(SVXMAP_3DSPHEREOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
622 //----------------------------------------------------------------------
623 Svx3DSphereObject::~Svx3DSphereObject() throw()
627 //----------------------------------------------------------------------
629 bool Svx3DSphereObject::setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
631 switch( pProperty->nWID )
633 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
635 // Transformationsmatrix in das Objekt packen
636 if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
637 return true;
638 break;
641 case OWN_ATTR_3D_VALUE_POSITION:
643 // Position in das Objekt packen
644 drawing::Position3D aUnoPos;
645 if( rValue >>= aUnoPos )
647 basegfx::B3DPoint aPos(aUnoPos.PositionX, aUnoPos.PositionY, aUnoPos.PositionZ);
648 static_cast<E3dSphereObj*>(mpObj.get())->SetCenter(aPos);
649 return true;
651 break;
654 case OWN_ATTR_3D_VALUE_SIZE:
656 // Groesse in das Objekt packen
657 drawing::Direction3D aDir;
658 if( rValue >>= aDir )
660 basegfx::B3DVector aPos(aDir.DirectionX, aDir.DirectionY, aDir.DirectionZ);
661 static_cast<E3dSphereObj*>(mpObj.get())->SetSize(aPos);
662 return true;
664 break;
666 default:
667 return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
670 throw IllegalArgumentException();
673 //----------------------------------------------------------------------
675 bool Svx3DSphereObject::getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
677 switch( pProperty->nWID )
679 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
681 // Transformation in eine homogene Matrix packen
682 ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
683 break;
685 case OWN_ATTR_3D_VALUE_POSITION:
687 // Position packen
688 const basegfx::B3DPoint& rPos = ((E3dSphereObj*)mpObj.get())->Center();
689 drawing::Position3D aPos;
691 aPos.PositionX = rPos.getX();
692 aPos.PositionY = rPos.getY();
693 aPos.PositionZ = rPos.getZ();
695 rValue <<= aPos;
696 break;
698 case OWN_ATTR_3D_VALUE_SIZE:
700 // Groesse packen
701 const basegfx::B3DVector& rSize = ((E3dSphereObj*)mpObj.get())->Size();
702 drawing::Direction3D aDir;
704 aDir.DirectionX = rSize.getX();
705 aDir.DirectionY = rSize.getY();
706 aDir.DirectionZ = rSize.getZ();
708 rValue <<= aDir;
709 break;
711 default:
712 return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
715 return true;
718 // ::com::sun::star::lang::XServiceInfo
719 uno::Sequence< OUString > SAL_CALL Svx3DSphereObject::getSupportedServiceNames()
720 throw(uno::RuntimeException)
722 uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
723 comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
724 "com.sun.star.drawing.Shape3DSphere");
725 return aSeq;
728 /***********************************************************************
730 ***********************************************************************/
732 //----------------------------------------------------------------------
733 Svx3DLatheObject::Svx3DLatheObject( SdrObject* pObj ) throw()
734 : SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_3DLATHEOBJECT), getSvxMapProvider().GetPropertySet(SVXMAP_3DLATHEOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
738 //----------------------------------------------------------------------
739 Svx3DLatheObject::~Svx3DLatheObject() throw()
743 bool PolyPolygonShape3D_to_B3dPolyPolygon(
744 const Any& rValue,
745 basegfx::B3DPolyPolygon& rResultPolygon,
746 bool bCorrectPolygon)
748 drawing::PolyPolygonShape3D aSourcePolyPolygon;
749 if( !(rValue >>= aSourcePolyPolygon) )
750 return false;
752 sal_Int32 nOuterSequenceCount = aSourcePolyPolygon.SequenceX.getLength();
753 if(nOuterSequenceCount != aSourcePolyPolygon.SequenceY.getLength() || nOuterSequenceCount != aSourcePolyPolygon.SequenceZ.getLength())
754 return false;
756 drawing::DoubleSequence* pInnerSequenceX = aSourcePolyPolygon.SequenceX.getArray();
757 drawing::DoubleSequence* pInnerSequenceY = aSourcePolyPolygon.SequenceY.getArray();
758 drawing::DoubleSequence* pInnerSequenceZ = aSourcePolyPolygon.SequenceZ.getArray();
759 for(sal_Int32 a(0L);a<nOuterSequenceCount;a++)
761 sal_Int32 nInnerSequenceCount = pInnerSequenceX->getLength();
762 if(nInnerSequenceCount != pInnerSequenceY->getLength() || nInnerSequenceCount != pInnerSequenceZ->getLength())
764 return false;
766 basegfx::B3DPolygon aNewPolygon;
767 double* pArrayX = pInnerSequenceX->getArray();
768 double* pArrayY = pInnerSequenceY->getArray();
769 double* pArrayZ = pInnerSequenceZ->getArray();
770 for(sal_Int32 b(0L);b<nInnerSequenceCount;b++)
772 aNewPolygon.append(basegfx::B3DPoint(*pArrayX++,*pArrayY++,*pArrayZ++));
774 pInnerSequenceX++;
775 pInnerSequenceY++;
776 pInnerSequenceZ++;
778 // #i101520# correction is needed for imported polygons of old format,
779 // see callers
780 if(bCorrectPolygon)
782 basegfx::tools::checkClosed(aNewPolygon);
785 rResultPolygon.append(aNewPolygon);
787 return true;
790 static void B3dPolyPolygon_to_PolyPolygonShape3D( const basegfx::B3DPolyPolygon& rSourcePolyPolygon, Any& rValue )
792 drawing::PolyPolygonShape3D aRetval;
793 aRetval.SequenceX.realloc(rSourcePolyPolygon.count());
794 aRetval.SequenceY.realloc(rSourcePolyPolygon.count());
795 aRetval.SequenceZ.realloc(rSourcePolyPolygon.count());
796 drawing::DoubleSequence* pOuterSequenceX = aRetval.SequenceX.getArray();
797 drawing::DoubleSequence* pOuterSequenceY = aRetval.SequenceY.getArray();
798 drawing::DoubleSequence* pOuterSequenceZ = aRetval.SequenceZ.getArray();
799 for(sal_uInt32 a(0L);a<rSourcePolyPolygon.count();a++)
801 const basegfx::B3DPolygon aPoly(rSourcePolyPolygon.getB3DPolygon(a));
802 sal_Int32 nPointCount(aPoly.count());
803 if(aPoly.isClosed()) nPointCount++;
804 pOuterSequenceX->realloc(nPointCount);
805 pOuterSequenceY->realloc(nPointCount);
806 pOuterSequenceZ->realloc(nPointCount);
807 double* pInnerSequenceX = pOuterSequenceX->getArray();
808 double* pInnerSequenceY = pOuterSequenceY->getArray();
809 double* pInnerSequenceZ = pOuterSequenceZ->getArray();
810 for(sal_uInt32 b(0L);b<aPoly.count();b++)
812 const basegfx::B3DPoint aPoint(aPoly.getB3DPoint(b));
813 *pInnerSequenceX++ = aPoint.getX();
814 *pInnerSequenceY++ = aPoint.getY();
815 *pInnerSequenceZ++ = aPoint.getZ();
817 if(aPoly.isClosed())
819 const basegfx::B3DPoint aPoint(aPoly.getB3DPoint(0L));
820 *pInnerSequenceX++ = aPoint.getX();
821 *pInnerSequenceY++ = aPoint.getY();
822 *pInnerSequenceZ++ = aPoint.getZ();
824 pOuterSequenceX++;
825 pOuterSequenceY++;
826 pOuterSequenceZ++;
828 rValue <<= aRetval;
831 //----------------------------------------------------------------------
833 bool Svx3DLatheObject::setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
835 switch( pProperty->nWID )
837 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
839 // Transformationsmatrix in das Objekt packen
840 if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
841 return true;
842 break;
844 case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
846 // Polygondefinition in das Objekt packen
847 basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
849 // #i101520# Probably imported
850 if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, true ) )
852 // #105127# SetPolyPoly3D sets the Svx3DVerticalSegmentsItem to the number
853 // of points of the polygon. Thus, value gets lost. To avoid this, rescue
854 // item here and re-set after setting the polygon.
855 const sal_uInt32 nPrevVerticalSegs(static_cast<E3dLatheObj*>(mpObj.get())->GetVerticalSegments());
857 // Polygon setzen
858 const basegfx::B3DHomMatrix aIdentity;
859 const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
860 static_cast<E3dLatheObj*>(mpObj.get())->SetPolyPoly2D(aB2DPolyPolygon);
861 const sal_uInt32 nPostVerticalSegs(static_cast<E3dLatheObj*>(mpObj.get())->GetVerticalSegments());
863 if(nPrevVerticalSegs != nPostVerticalSegs)
865 // restore the vertical segment count
866 static_cast<E3dLatheObj*>(mpObj.get())->SetMergedItem(Svx3DVerticalSegmentsItem(nPrevVerticalSegs));
868 return true;
870 break;
872 default:
873 return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
876 throw IllegalArgumentException();
879 //----------------------------------------------------------------------
880 bool Svx3DLatheObject::getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
882 switch( pProperty->nWID )
884 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
886 // Transformation in eine homogene Matrix packen
887 drawing::HomogenMatrix aHomMat;
888 basegfx::B3DHomMatrix aMat = static_cast<E3dObject*>(mpObj.get())->GetTransform();
890 // pack evtl. transformed matrix to output
891 aHomMat.Line1.Column1 = aMat.get(0, 0);
892 aHomMat.Line1.Column2 = aMat.get(0, 1);
893 aHomMat.Line1.Column3 = aMat.get(0, 2);
894 aHomMat.Line1.Column4 = aMat.get(0, 3);
895 aHomMat.Line2.Column1 = aMat.get(1, 0);
896 aHomMat.Line2.Column2 = aMat.get(1, 1);
897 aHomMat.Line2.Column3 = aMat.get(1, 2);
898 aHomMat.Line2.Column4 = aMat.get(1, 3);
899 aHomMat.Line3.Column1 = aMat.get(2, 0);
900 aHomMat.Line3.Column2 = aMat.get(2, 1);
901 aHomMat.Line3.Column3 = aMat.get(2, 2);
902 aHomMat.Line3.Column4 = aMat.get(2, 3);
903 aHomMat.Line4.Column1 = aMat.get(3, 0);
904 aHomMat.Line4.Column2 = aMat.get(3, 1);
905 aHomMat.Line4.Column3 = aMat.get(3, 2);
906 aHomMat.Line4.Column4 = aMat.get(3, 3);
908 rValue <<= aHomMat;
909 break;
911 case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
913 const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dLatheObj*>(mpObj.get())->GetPolyPoly2D();
914 const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
916 B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon, rValue);
917 break;
919 default:
920 return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
923 return true;
926 // ::com::sun::star::lang::XServiceInfo
927 uno::Sequence< OUString > SAL_CALL Svx3DLatheObject::getSupportedServiceNames()
928 throw(uno::RuntimeException)
930 uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
931 comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
932 "com.sun.star.drawing.Shape3DLathe");
933 return aSeq;
936 /***********************************************************************
938 ***********************************************************************/
940 Svx3DExtrudeObject::Svx3DExtrudeObject( SdrObject* pObj ) throw()
941 : SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_3DEXTRUDEOBJECT), getSvxMapProvider().GetPropertySet(SVXMAP_3DEXTRUDEOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
945 //----------------------------------------------------------------------
946 Svx3DExtrudeObject::~Svx3DExtrudeObject() throw()
950 //----------------------------------------------------------------------
952 bool Svx3DExtrudeObject::setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
954 switch( pProperty->nWID )
956 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
958 // Transformationsmatrix in das Objekt packen
959 if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
960 return true;
961 break;
964 case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
966 // Polygondefinition in das Objekt packen
967 basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
969 // #i101520# Probably imported
970 if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, true ) )
972 // Polygon setzen
973 const basegfx::B3DHomMatrix aIdentity;
974 const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
975 static_cast<E3dExtrudeObj*>(mpObj.get())->SetExtrudePolygon(aB2DPolyPolygon);
976 return true;
978 break;
980 default:
981 return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
984 throw IllegalArgumentException();
987 //----------------------------------------------------------------------
989 bool Svx3DExtrudeObject::getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
991 switch( pProperty->nWID )
993 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
995 // Transformation in eine homogene Matrix packen
996 drawing::HomogenMatrix aHomMat;
997 basegfx::B3DHomMatrix aMat = ((E3dObject*)mpObj.get())->GetTransform();
999 // pack evtl. transformed matrix to output
1000 aHomMat.Line1.Column1 = aMat.get(0, 0);
1001 aHomMat.Line1.Column2 = aMat.get(0, 1);
1002 aHomMat.Line1.Column3 = aMat.get(0, 2);
1003 aHomMat.Line1.Column4 = aMat.get(0, 3);
1004 aHomMat.Line2.Column1 = aMat.get(1, 0);
1005 aHomMat.Line2.Column2 = aMat.get(1, 1);
1006 aHomMat.Line2.Column3 = aMat.get(1, 2);
1007 aHomMat.Line2.Column4 = aMat.get(1, 3);
1008 aHomMat.Line3.Column1 = aMat.get(2, 0);
1009 aHomMat.Line3.Column2 = aMat.get(2, 1);
1010 aHomMat.Line3.Column3 = aMat.get(2, 2);
1011 aHomMat.Line3.Column4 = aMat.get(2, 3);
1012 aHomMat.Line4.Column1 = aMat.get(3, 0);
1013 aHomMat.Line4.Column2 = aMat.get(3, 1);
1014 aHomMat.Line4.Column3 = aMat.get(3, 2);
1015 aHomMat.Line4.Column4 = aMat.get(3, 3);
1017 rValue <<= aHomMat;
1018 break;
1021 case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
1023 // Polygondefinition packen
1024 const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dExtrudeObj*>(mpObj.get())->GetExtrudePolygon();
1025 const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
1027 B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon, rValue);
1028 break;
1030 default:
1031 return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
1034 return true;
1037 // ::com::sun::star::lang::XServiceInfo
1038 uno::Sequence< OUString > SAL_CALL Svx3DExtrudeObject::getSupportedServiceNames()
1039 throw(uno::RuntimeException)
1041 uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
1042 comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
1043 "com.sun.star.drawing.Shape3DExtrude");
1044 return aSeq;
1047 /***********************************************************************
1049 ***********************************************************************/
1051 //----------------------------------------------------------------------
1052 Svx3DPolygonObject::Svx3DPolygonObject( SdrObject* pObj ) throw()
1053 : SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_3DPOLYGONOBJECT), getSvxMapProvider().GetPropertySet(SVXMAP_3DPOLYGONOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
1057 //----------------------------------------------------------------------
1058 Svx3DPolygonObject::~Svx3DPolygonObject() throw()
1062 //----------------------------------------------------------------------
1063 bool Svx3DPolygonObject::setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
1065 switch( pProperty->nWID )
1067 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
1069 // Transformationsmatrix in das Objekt packen
1070 if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
1071 return true;
1072 break;
1075 case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
1077 // Polygondefinition in das Objekt packen
1078 basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
1080 // #i101520# Direct API data (e.g. from chart)
1081 if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) )
1083 // Polygon setzen
1084 static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyPolygon3D(aNewB3DPolyPolygon);
1085 return true;
1087 break;
1089 case OWN_ATTR_3D_VALUE_NORMALSPOLYGON3D:
1091 // Normalendefinition in das Objekt packen
1092 basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
1094 // #i101520# Direct API data (e.g. from chart)
1095 if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) )
1097 // Polygon setzen
1098 static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyNormals3D(aNewB3DPolyPolygon);
1099 return true;
1101 break;
1103 case OWN_ATTR_3D_VALUE_TEXTUREPOLYGON3D:
1105 // Texturdefinition in das Objekt packen
1106 basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
1108 // #i101520# Direct API data (e.g. from chart)
1109 if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) )
1111 // Polygon setzen
1112 const basegfx::B3DHomMatrix aIdentity;
1113 const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
1114 static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyTexture2D(aB2DPolyPolygon);
1115 return true;
1117 break;
1119 case OWN_ATTR_3D_VALUE_LINEONLY:
1121 sal_Bool bNew = sal_False;
1122 if( rValue >>= bNew )
1124 static_cast<E3dPolygonObj*>(mpObj.get())->SetLineOnly(bNew);
1125 return true;
1127 break;
1129 default:
1130 return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
1133 throw IllegalArgumentException();
1136 //----------------------------------------------------------------------
1137 bool Svx3DPolygonObject::getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
1139 switch( pProperty->nWID )
1141 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
1143 ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
1144 break;
1147 case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
1149 B3dPolyPolygon_to_PolyPolygonShape3D(static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyPolygon3D(),rValue);
1150 break;
1153 case OWN_ATTR_3D_VALUE_NORMALSPOLYGON3D:
1155 B3dPolyPolygon_to_PolyPolygonShape3D(static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyNormals3D(),rValue);
1156 break;
1159 case OWN_ATTR_3D_VALUE_TEXTUREPOLYGON3D:
1161 // Texturdefinition packen
1162 const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyTexture2D();
1163 const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
1165 B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon,rValue);
1166 break;
1169 case OWN_ATTR_3D_VALUE_LINEONLY:
1171 rValue <<= (sal_Bool)static_cast<E3dPolygonObj*>(mpObj.get())->GetLineOnly();
1172 break;
1175 default:
1176 return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
1179 return true;
1182 // ::com::sun::star::lang::XServiceInfo
1183 uno::Sequence< OUString > SAL_CALL Svx3DPolygonObject::getSupportedServiceNames()
1184 throw(uno::RuntimeException)
1186 Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
1187 comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
1188 "com.sun.star.drawing.Shape3DPolygon");
1189 return aSeq;
1192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */