update dev300-m58
[ooovba.git] / svx / source / unodraw / unoshap3.cxx
blobcb59ca37e4a7aa4b390a83cde14679804b005464
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unoshap3.cxx,v $
10 * $Revision: 1.32.226.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #define _SVX_USE_UNOGLOBALS_
35 #include <com/sun/star/drawing/HomogenMatrix.hpp>
36 #include <com/sun/star/drawing/Position3D.hpp>
37 #include <com/sun/star/drawing/Direction3D.hpp>
38 #include <com/sun/star/drawing/DoubleSequence.hpp>
39 #include <com/sun/star/drawing/CameraGeometry.hpp>
40 #include <vcl/svapp.hxx>
41 #include <vos/mutex.hxx>
43 #include <rtl/uuid.h>
44 #include <rtl/memory.h>
46 #include <svx/unoshape.hxx>
47 #include <svx/unopage.hxx>
48 #include <svx/unoprnms.hxx>
49 #include <svx/polysc3d.hxx>
50 #include "globl3d.hxx"
51 #include <svx/cube3d.hxx>
52 #include <svx/sphere3d.hxx>
53 #include <svx/lathe3d.hxx>
54 #include <svx/extrud3d.hxx>
55 #include <svx/polygn3d.hxx>
56 #include "svx/unoshprp.hxx"
57 #include "svx/svdmodel.hxx"
58 #include <basegfx/polygon/b3dpolygon.hxx>
59 #include <basegfx/polygon/b3dpolygontools.hxx>
60 #include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
61 #include <basegfx/polygon/b2dpolypolygontools.hxx>
63 using ::rtl::OUString;
64 using namespace ::vos;
65 using namespace ::cppu;
66 using namespace ::com::sun::star;
67 using namespace ::com::sun::star::uno;
68 using namespace ::com::sun::star::lang;
69 using namespace ::com::sun::star::container;
71 #define INTERFACE_TYPE( xint ) \
72 ::getCppuType((const Reference< xint >*)0)
74 #define QUERYINT( xint ) \
75 if( rType == ::getCppuType((const Reference< xint >*)0) ) \
76 aAny <<= Reference< xint >(this)
78 /***********************************************************************
79 * class Svx3DSceneObject *
80 ***********************************************************************/
82 //----------------------------------------------------------------------
83 Svx3DSceneObject::Svx3DSceneObject( SdrObject* pObj, SvxDrawPage* pDrawPage ) throw()
84 : SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_3DSCENEOBJECT), aSvxMapProvider.GetPropertySet(SVXMAP_3DSCENEOBJECT) )
85 , mxPage( pDrawPage )
89 //----------------------------------------------------------------------
90 Svx3DSceneObject::~Svx3DSceneObject() throw()
94 //----------------------------------------------------------------------
95 void Svx3DSceneObject::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
97 SvxShape::Create( pNewObj, pNewPage );
98 mxPage = pNewPage;
101 //----------------------------------------------------------------------
102 uno::Any SAL_CALL Svx3DSceneObject::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
104 uno::Any aAny;
106 QUERYINT( drawing::XShapes );
107 else QUERYINT( container::XIndexAccess );
108 else QUERYINT( container::XElementAccess );
109 else
110 return SvxShape::queryAggregation( rType );
112 return aAny;
115 uno::Any SAL_CALL Svx3DSceneObject::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException )
117 return SvxShape::queryInterface( rType );
120 void SAL_CALL Svx3DSceneObject::acquire() throw ( )
122 SvxShape::acquire();
125 void SAL_CALL Svx3DSceneObject::release() throw ( )
127 SvxShape::release();
130 // XTypeProvider
132 uno::Sequence< uno::Type > SAL_CALL Svx3DSceneObject::getTypes()
133 throw (uno::RuntimeException)
136 return SvxShape::getTypes();
139 uno::Sequence< sal_Int8 > SAL_CALL Svx3DSceneObject::getImplementationId()
140 throw (uno::RuntimeException)
142 static uno::Sequence< sal_Int8 > aId;
143 if( aId.getLength() == 0 )
145 aId.realloc( 16 );
146 rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
148 return aId;
151 //----------------------------------------------------------------------
152 void SAL_CALL Svx3DSceneObject::add( const Reference< drawing::XShape >& xShape )
153 throw( uno::RuntimeException)
155 OGuard aGuard( Application::GetSolarMutex() );
157 SvxShape* pShape = SvxShape::getImplementation( xShape );
159 if(!mpObj.is() || !mxPage.is() || pShape == NULL || NULL != pShape->GetSdrObject() )
160 throw uno::RuntimeException();
162 SdrObject* pSdrShape = mxPage->_CreateSdrObject( xShape );
163 if( pSdrShape->ISA(E3dObject) )
165 mpObj->GetSubList()->NbcInsertObject( pSdrShape );
167 if(pShape)
168 pShape->Create( pSdrShape, mxPage.get() );
170 else
172 SdrObject::Free( pSdrShape );
173 throw uno::RuntimeException();
176 if( mpModel )
177 mpModel->SetChanged();
180 //----------------------------------------------------------------------
181 void SAL_CALL Svx3DSceneObject::remove( const Reference< drawing::XShape >& xShape )
182 throw( uno::RuntimeException )
184 OGuard aGuard( Application::GetSolarMutex() );
186 SvxShape* pShape = SvxShape::getImplementation( xShape );
188 if(!mpObj.is() || pShape == NULL)
189 throw uno::RuntimeException();
191 SdrObject* pSdrShape = pShape->GetSdrObject();
192 if(pSdrShape == NULL || pSdrShape->GetObjList()->GetOwnerObj() != mpObj.get())
194 throw uno::RuntimeException();
196 else
198 SdrObjList& rList = *pSdrShape->GetObjList();
200 const sal_uInt32 nObjCount = rList.GetObjCount();
201 sal_uInt32 nObjNum = 0;
202 while( nObjNum < nObjCount )
204 if(rList.GetObj( nObjNum ) == pSdrShape )
205 break;
206 nObjNum++;
209 if( nObjNum < nObjCount )
211 SdrObject* pObject = rList.NbcRemoveObject( nObjNum );
212 SdrObject::Free( pObject );
214 else
216 DBG_ASSERT( 0, "Fatality! SdrObject is not belonging to its SdrObjList! [CL]" );
221 //----------------------------------------------------------------------
222 sal_Int32 SAL_CALL Svx3DSceneObject::getCount()
223 throw( uno::RuntimeException )
225 OGuard aGuard( Application::GetSolarMutex() );
227 sal_Int32 nRetval = 0;
229 if(mpObj.is() && mpObj->ISA(E3dPolyScene) && mpObj->GetSubList())
230 nRetval = mpObj->GetSubList()->GetObjCount();
231 return nRetval;
234 //----------------------------------------------------------------------
236 uno::Any SAL_CALL Svx3DSceneObject::getByIndex( sal_Int32 Index )
237 throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
239 OGuard aGuard( Application::GetSolarMutex() );
241 if( !mpObj.is() || mpObj->GetSubList() == NULL )
242 throw uno::RuntimeException();
244 if( mpObj->GetSubList()->GetObjCount() <= (sal_uInt32)Index )
245 throw lang::IndexOutOfBoundsException();
247 SdrObject* pDestObj = mpObj->GetSubList()->GetObj( Index );
248 if(pDestObj == NULL)
249 throw lang::IndexOutOfBoundsException();
251 Reference< drawing::XShape > xShape( pDestObj->getUnoShape(), uno::UNO_QUERY );
252 uno::Any aAny;
253 aAny <<= xShape;
254 return aAny;
257 //----------------------------------------------------------------------
258 // ::com::sun::star::container::XElementAccess
260 uno::Type SAL_CALL Svx3DSceneObject::getElementType()
261 throw( uno::RuntimeException )
263 return ::getCppuType(( const Reference< drawing::XShape>*)0);
266 //----------------------------------------------------------------------
267 sal_Bool SAL_CALL Svx3DSceneObject::hasElements()
268 throw( uno::RuntimeException )
270 OGuard aGuard( Application::GetSolarMutex() );
272 return mpObj.is() && mpObj->GetSubList() && (mpObj->GetSubList()->GetObjCount() > 0);
275 //----------------------------------------------------------------------
277 static bool ConvertHomogenMatrixToObject( E3dObject* pObject, const Any& rValue )
279 drawing::HomogenMatrix m;
280 if( rValue >>= m )
282 basegfx::B3DHomMatrix aMat;
283 aMat.set(0, 0, m.Line1.Column1);
284 aMat.set(0, 1, m.Line1.Column2);
285 aMat.set(0, 2, m.Line1.Column3);
286 aMat.set(0, 3, m.Line1.Column4);
287 aMat.set(1, 0, m.Line2.Column1);
288 aMat.set(1, 1, m.Line2.Column2);
289 aMat.set(1, 2, m.Line2.Column3);
290 aMat.set(1, 3, m.Line2.Column4);
291 aMat.set(2, 0, m.Line3.Column1);
292 aMat.set(2, 1, m.Line3.Column2);
293 aMat.set(2, 2, m.Line3.Column3);
294 aMat.set(2, 3, m.Line3.Column4);
295 aMat.set(3, 0, m.Line4.Column1);
296 aMat.set(3, 1, m.Line4.Column2);
297 aMat.set(3, 2, m.Line4.Column3);
298 aMat.set(3, 3, m.Line4.Column4);
299 pObject->SetTransform(aMat);
300 return true;
302 return false;
305 static void ConvertObjectToHomogenMatric( E3dObject* pObject, Any& rValue )
307 drawing::HomogenMatrix aHomMat;
308 const basegfx::B3DHomMatrix& rMat = pObject->GetTransform();
309 aHomMat.Line1.Column1 = rMat.get(0, 0);
310 aHomMat.Line1.Column2 = rMat.get(0, 1);
311 aHomMat.Line1.Column3 = rMat.get(0, 2);
312 aHomMat.Line1.Column4 = rMat.get(0, 3);
313 aHomMat.Line2.Column1 = rMat.get(1, 0);
314 aHomMat.Line2.Column2 = rMat.get(1, 1);
315 aHomMat.Line2.Column3 = rMat.get(1, 2);
316 aHomMat.Line2.Column4 = rMat.get(1, 3);
317 aHomMat.Line3.Column1 = rMat.get(2, 0);
318 aHomMat.Line3.Column2 = rMat.get(2, 1);
319 aHomMat.Line3.Column3 = rMat.get(2, 2);
320 aHomMat.Line3.Column4 = rMat.get(2, 3);
321 aHomMat.Line4.Column1 = rMat.get(3, 0);
322 aHomMat.Line4.Column2 = rMat.get(3, 1);
323 aHomMat.Line4.Column3 = rMat.get(3, 2);
324 aHomMat.Line4.Column4 = rMat.get(3, 3);
325 rValue <<= aHomMat;
328 //----------------------------------------------------------------------
329 #include <svditer.hxx>
331 struct ImpRememberTransAndRect
333 basegfx::B3DHomMatrix maMat;
334 Rectangle maRect;
337 bool Svx3DSceneObject::setPropertyValueImpl( const ::rtl::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)
339 switch( pProperty->nWID )
341 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
343 // Transformationsmatrix in das Objekt packen
344 if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
345 return true;
346 break;
348 case OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY:
350 // set CameraGeometry at scene
351 E3dScene* pScene = static_cast< E3dScene* >( mpObj.get() );
352 drawing::CameraGeometry aCamGeo;
354 if(rValue >>= aCamGeo)
356 basegfx::B3DPoint aVRP(aCamGeo.vrp.PositionX, aCamGeo.vrp.PositionY, aCamGeo.vrp.PositionZ);
357 basegfx::B3DVector aVPN(aCamGeo.vpn.DirectionX, aCamGeo.vpn.DirectionY, aCamGeo.vpn.DirectionZ);
358 basegfx::B3DVector aVUP(aCamGeo.vup.DirectionX, aCamGeo.vup.DirectionY, aCamGeo.vup.DirectionZ);
360 // rescue scene transformation
361 ImpRememberTransAndRect aSceneTAR;
362 aSceneTAR.maMat = pScene->GetTransform();
363 aSceneTAR.maRect = pScene->GetSnapRect();
365 // rescue object transformations
366 SdrObjListIter aIter(*pScene->GetSubList(), IM_DEEPWITHGROUPS);
367 List aObjTrans;
368 while(aIter.IsMore())
370 E3dObject* p3DObj = (E3dObject*)aIter.Next();
371 basegfx::B3DHomMatrix* pNew = new basegfx::B3DHomMatrix;
372 *pNew = p3DObj->GetTransform();
373 aObjTrans.Insert(pNew, LIST_APPEND);
376 // reset object transformations
377 aIter.Reset();
378 while(aIter.IsMore())
380 E3dObject* p3DObj = (E3dObject*)aIter.Next();
381 p3DObj->NbcSetTransform(basegfx::B3DHomMatrix());
384 // reset scene transformation and make a complete recalc
385 pScene->NbcSetTransform(basegfx::B3DHomMatrix());
387 // fill old camera from new parameters
388 Camera3D aCam(pScene->GetCamera());
389 const basegfx::B3DRange& rVolume = pScene->GetBoundVolume();
390 double fW = rVolume.getWidth();
391 double fH = rVolume.getHeight();
393 const SfxItemSet& rSceneSet = pScene->GetMergedItemSet();
394 double fCamPosZ =
395 (double)((const SfxUInt32Item&)rSceneSet.Get(SDRATTR_3DSCENE_DISTANCE)).GetValue();
396 double fCamFocal =
397 (double)((const SfxUInt32Item&)rSceneSet.Get(SDRATTR_3DSCENE_FOCAL_LENGTH)).GetValue();
399 aCam.SetAutoAdjustProjection(FALSE);
400 aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
401 basegfx::B3DPoint aLookAt;
402 basegfx::B3DPoint aCamPos(0.0, 0.0, fCamPosZ);
403 aCam.SetPosAndLookAt(aCamPos, aLookAt);
404 aCam.SetFocalLength(fCamFocal / 100.0);
405 aCam.SetDefaults(basegfx::B3DPoint(0.0, 0.0, fCamPosZ), aLookAt, fCamFocal / 100.0);
406 aCam.SetDeviceWindow(Rectangle(0, 0, (long)fW, (long)fH));
408 // set at scene
409 pScene->SetCamera(aCam);
411 // #91047# use imported VRP, VPN and VUP (if used)
412 sal_Bool bVRPUsed(!aVRP.equal(basegfx::B3DPoint(0.0, 0.0, 1.0)));
413 sal_Bool bVPNUsed(!aVPN.equal(basegfx::B3DVector(0.0, 0.0, 1.0)));
414 sal_Bool bVUPUsed(!aVUP.equal(basegfx::B3DVector(0.0, 1.0, 0.0)));
416 if(bVRPUsed || bVPNUsed || bVUPUsed)
418 pScene->GetCameraSet().SetViewportValues(aVRP, aVPN, aVUP);
421 // set object transformations again at objects
422 aIter.Reset();
423 sal_uInt32 nIndex(0L);
424 while(aIter.IsMore())
426 E3dObject* p3DObj = (E3dObject*)aIter.Next();
427 basegfx::B3DHomMatrix* pMat = (basegfx::B3DHomMatrix*)aObjTrans.GetObject(nIndex++);
428 p3DObj->NbcSetTransform(*pMat);
429 delete pMat;
432 // set scene transformation again at scene
433 pScene->NbcSetTransform(aSceneTAR.maMat);
434 pScene->NbcSetSnapRect(aSceneTAR.maRect);
436 return true;
438 break;
440 default:
441 return SvxShape::setPropertyValueImpl(rName, pProperty, rValue);
444 throw IllegalArgumentException();
447 //----------------------------------------------------------------------
449 bool Svx3DSceneObject::getPropertyValueImpl( const ::rtl::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)
451 switch( pProperty->nWID )
453 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
455 // Objekt in eine homogene 4x4 Matrix packen
456 ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
457 break;
459 case OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY:
461 // get CameraGeometry from scene
462 E3dScene* pScene = static_cast< E3dScene* >( mpObj.get() );
463 drawing::CameraGeometry aCamGeo;
465 // fill Vectors from scene camera
466 B3dCamera& aCameraSet = pScene->GetCameraSet();
467 basegfx::B3DPoint aVRP(aCameraSet.GetVRP());
468 basegfx::B3DVector aVPN(aCameraSet.GetVPN());
469 basegfx::B3DVector aVUP(aCameraSet.GetVUV());
471 // transfer to structure
472 aCamGeo.vrp.PositionX = aVRP.getX();
473 aCamGeo.vrp.PositionY = aVRP.getY();
474 aCamGeo.vrp.PositionZ = aVRP.getZ();
475 aCamGeo.vpn.DirectionX = aVPN.getX();
476 aCamGeo.vpn.DirectionY = aVPN.getY();
477 aCamGeo.vpn.DirectionZ = aVPN.getZ();
478 aCamGeo.vup.DirectionX = aVUP.getX();
479 aCamGeo.vup.DirectionY = aVUP.getY();
480 aCamGeo.vup.DirectionZ = aVUP.getZ();
482 rValue <<= aCamGeo;
483 break;
485 default:
486 return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
489 return true;
492 // ::com::sun::star::lang::XServiceInfo
493 uno::Sequence< OUString > SAL_CALL Svx3DSceneObject::getSupportedServiceNames()
494 throw(uno::RuntimeException)
496 uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
497 SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.Shape3DScene" );
498 return aSeq;
501 /***********************************************************************
503 ***********************************************************************/
505 //----------------------------------------------------------------------
506 Svx3DCubeObject::Svx3DCubeObject( SdrObject* pObj ) throw()
507 : SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_3DCUBEOBJEKT), aSvxMapProvider.GetPropertySet(SVXMAP_3DCUBEOBJEKT) )
511 //----------------------------------------------------------------------
512 Svx3DCubeObject::~Svx3DCubeObject() throw()
516 //----------------------------------------------------------------------
517 bool Svx3DCubeObject::setPropertyValueImpl( const ::rtl::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)
519 OGuard aGuard( Application::GetSolarMutex() );
521 switch( pProperty->nWID )
523 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
525 // Transformationsmatrix in das Objekt packen
526 if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
527 return true;
528 break;
530 case OWN_ATTR_3D_VALUE_POSITION:
532 // Position in das Objekt packen
533 drawing::Position3D aUnoPos;
534 if( rValue >>= aUnoPos )
536 basegfx::B3DPoint aPos(aUnoPos.PositionX, aUnoPos.PositionY, aUnoPos.PositionZ);
537 static_cast< E3dCubeObj* >( mpObj.get() )->SetCubePos(aPos);
538 return true;
540 break;
542 case OWN_ATTR_3D_VALUE_SIZE:
544 // Groesse in das Objekt packen
545 drawing::Direction3D aDirection;
546 if( rValue >>= aDirection )
548 basegfx::B3DVector aSize(aDirection.DirectionX, aDirection.DirectionY, aDirection.DirectionZ);
549 static_cast< E3dCubeObj* >( mpObj.get() )->SetCubeSize(aSize);
550 return true;
552 break;
554 case OWN_ATTR_3D_VALUE_POS_IS_CENTER:
556 sal_Bool bNew = sal_False;
557 // sal_Bool bPosIsCenter in das Objekt packen
558 if( rValue >>= bNew )
560 static_cast< E3dCubeObj* >( mpObj.get() )->SetPosIsCenter(bNew);
561 return true;
563 break;
565 default:
566 return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
569 throw IllegalArgumentException();
572 //----------------------------------------------------------------------
574 bool Svx3DCubeObject::getPropertyValueImpl( const ::rtl::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)
576 switch( pProperty->nWID )
578 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
580 // Transformation in eine homogene Matrix packen
581 ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
582 break;
584 case OWN_ATTR_3D_VALUE_POSITION:
586 // Position packen
587 const basegfx::B3DPoint& rPos = ((E3dCubeObj*)mpObj.get())->GetCubePos();
588 drawing::Position3D aPos;
590 aPos.PositionX = rPos.getX();
591 aPos.PositionY = rPos.getY();
592 aPos.PositionZ = rPos.getZ();
594 rValue <<= aPos;
595 break;
597 case OWN_ATTR_3D_VALUE_SIZE:
599 // Groesse packen
600 const basegfx::B3DVector& rSize = static_cast<E3dCubeObj*>(mpObj.get())->GetCubeSize();
601 drawing::Direction3D aDir;
603 aDir.DirectionX = rSize.getX();
604 aDir.DirectionY = rSize.getY();
605 aDir.DirectionZ = rSize.getZ();
607 rValue <<= aDir;
608 break;
610 case OWN_ATTR_3D_VALUE_POS_IS_CENTER:
612 rValue <<= static_cast<E3dCubeObj*>(mpObj.get())->GetPosIsCenter();
613 break;
615 default:
616 return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
619 return true;
622 // ::com::sun::star::lang::XServiceInfo
623 uno::Sequence< OUString > SAL_CALL Svx3DCubeObject::getSupportedServiceNames()
624 throw(uno::RuntimeException)
626 uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
627 SvxServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
628 "com.sun.star.drawing.Shape3DCube");
629 return aSeq;
632 /***********************************************************************
634 ***********************************************************************/
636 //----------------------------------------------------------------------
637 Svx3DSphereObject::Svx3DSphereObject( SdrObject* pObj ) throw()
638 : SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_3DSPHEREOBJECT), aSvxMapProvider.GetPropertySet(SVXMAP_3DSPHEREOBJECT) )
642 //----------------------------------------------------------------------
643 Svx3DSphereObject::~Svx3DSphereObject() throw()
647 //----------------------------------------------------------------------
649 bool Svx3DSphereObject::setPropertyValueImpl( const ::rtl::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)
651 switch( pProperty->nWID )
653 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
655 // Transformationsmatrix in das Objekt packen
656 if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
657 return true;
658 break;
661 case OWN_ATTR_3D_VALUE_POSITION:
663 // Position in das Objekt packen
664 drawing::Position3D aUnoPos;
665 if( rValue >>= aUnoPos )
667 basegfx::B3DPoint aPos(aUnoPos.PositionX, aUnoPos.PositionY, aUnoPos.PositionZ);
668 static_cast<E3dSphereObj*>(mpObj.get())->SetCenter(aPos);
669 return true;
671 break;
674 case OWN_ATTR_3D_VALUE_SIZE:
676 // Groesse in das Objekt packen
677 drawing::Direction3D aDir;
678 if( rValue >>= aDir )
680 basegfx::B3DVector aPos(aDir.DirectionX, aDir.DirectionY, aDir.DirectionZ);
681 static_cast<E3dSphereObj*>(mpObj.get())->SetSize(aPos);
682 return true;
684 break;
686 default:
687 return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
690 throw IllegalArgumentException();
693 //----------------------------------------------------------------------
695 bool Svx3DSphereObject::getPropertyValueImpl( const ::rtl::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)
697 switch( pProperty->nWID )
699 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
701 // Transformation in eine homogene Matrix packen
702 ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
703 break;
705 case OWN_ATTR_3D_VALUE_POSITION:
707 // Position packen
708 const basegfx::B3DPoint& rPos = ((E3dSphereObj*)mpObj.get())->Center();
709 drawing::Position3D aPos;
711 aPos.PositionX = rPos.getX();
712 aPos.PositionY = rPos.getY();
713 aPos.PositionZ = rPos.getZ();
715 rValue <<= aPos;
716 break;
718 case OWN_ATTR_3D_VALUE_SIZE:
720 // Groesse packen
721 const basegfx::B3DVector& rSize = ((E3dSphereObj*)mpObj.get())->Size();
722 drawing::Direction3D aDir;
724 aDir.DirectionX = rSize.getX();
725 aDir.DirectionY = rSize.getY();
726 aDir.DirectionZ = rSize.getZ();
728 rValue <<= aDir;
729 break;
731 default:
732 return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
735 return true;
738 // ::com::sun::star::lang::XServiceInfo
739 uno::Sequence< OUString > SAL_CALL Svx3DSphereObject::getSupportedServiceNames()
740 throw(uno::RuntimeException)
742 uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
743 SvxServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
744 "com.sun.star.drawing.Shape3DSphere");
745 return aSeq;
748 /***********************************************************************
750 ***********************************************************************/
752 //----------------------------------------------------------------------
753 Svx3DLatheObject::Svx3DLatheObject( SdrObject* pObj ) throw()
754 : SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_3DLATHEOBJECT), aSvxMapProvider.GetPropertySet(SVXMAP_3DLATHEOBJECT) )
758 //----------------------------------------------------------------------
759 Svx3DLatheObject::~Svx3DLatheObject() throw()
763 bool PolyPolygonShape3D_to_B3dPolyPolygon(
764 const Any& rValue,
765 basegfx::B3DPolyPolygon& rResultPolygon,
766 bool bCorrectPolygon)
768 drawing::PolyPolygonShape3D aSourcePolyPolygon;
769 if( !(rValue >>= aSourcePolyPolygon) )
770 return false;
772 sal_Int32 nOuterSequenceCount = aSourcePolyPolygon.SequenceX.getLength();
773 if(nOuterSequenceCount != aSourcePolyPolygon.SequenceY.getLength() || nOuterSequenceCount != aSourcePolyPolygon.SequenceZ.getLength())
774 return false;
776 drawing::DoubleSequence* pInnerSequenceX = aSourcePolyPolygon.SequenceX.getArray();
777 drawing::DoubleSequence* pInnerSequenceY = aSourcePolyPolygon.SequenceY.getArray();
778 drawing::DoubleSequence* pInnerSequenceZ = aSourcePolyPolygon.SequenceZ.getArray();
779 for(sal_Int32 a(0L);a<nOuterSequenceCount;a++)
781 sal_Int32 nInnerSequenceCount = pInnerSequenceX->getLength();
782 if(nInnerSequenceCount != pInnerSequenceY->getLength() || nInnerSequenceCount != pInnerSequenceZ->getLength())
784 return false;
786 basegfx::B3DPolygon aNewPolygon;
787 double* pArrayX = pInnerSequenceX->getArray();
788 double* pArrayY = pInnerSequenceY->getArray();
789 double* pArrayZ = pInnerSequenceZ->getArray();
790 for(sal_Int32 b(0L);b<nInnerSequenceCount;b++)
792 aNewPolygon.append(basegfx::B3DPoint(*pArrayX++,*pArrayY++,*pArrayZ++));
794 pInnerSequenceX++;
795 pInnerSequenceY++;
796 pInnerSequenceZ++;
798 // #i101520# correction is needed for imported polygons of old format,
799 // see callers
800 if(bCorrectPolygon)
802 basegfx::tools::checkClosed(aNewPolygon);
805 rResultPolygon.append(aNewPolygon);
807 return true;
810 static void B3dPolyPolygon_to_PolyPolygonShape3D( const basegfx::B3DPolyPolygon& rSourcePolyPolygon, Any& rValue )
812 drawing::PolyPolygonShape3D aRetval;
813 aRetval.SequenceX.realloc(rSourcePolyPolygon.count());
814 aRetval.SequenceY.realloc(rSourcePolyPolygon.count());
815 aRetval.SequenceZ.realloc(rSourcePolyPolygon.count());
816 drawing::DoubleSequence* pOuterSequenceX = aRetval.SequenceX.getArray();
817 drawing::DoubleSequence* pOuterSequenceY = aRetval.SequenceY.getArray();
818 drawing::DoubleSequence* pOuterSequenceZ = aRetval.SequenceZ.getArray();
819 for(sal_uInt32 a(0L);a<rSourcePolyPolygon.count();a++)
821 const basegfx::B3DPolygon aPoly(rSourcePolyPolygon.getB3DPolygon(a));
822 sal_Int32 nPointCount(aPoly.count());
823 if(aPoly.isClosed()) nPointCount++;
824 pOuterSequenceX->realloc(nPointCount);
825 pOuterSequenceY->realloc(nPointCount);
826 pOuterSequenceZ->realloc(nPointCount);
827 double* pInnerSequenceX = pOuterSequenceX->getArray();
828 double* pInnerSequenceY = pOuterSequenceY->getArray();
829 double* pInnerSequenceZ = pOuterSequenceZ->getArray();
830 for(sal_uInt32 b(0L);b<aPoly.count();b++)
832 const basegfx::B3DPoint aPoint(aPoly.getB3DPoint(b));
833 *pInnerSequenceX++ = aPoint.getX();
834 *pInnerSequenceY++ = aPoint.getY();
835 *pInnerSequenceZ++ = aPoint.getZ();
837 if(aPoly.isClosed())
839 const basegfx::B3DPoint aPoint(aPoly.getB3DPoint(0L));
840 *pInnerSequenceX++ = aPoint.getX();
841 *pInnerSequenceY++ = aPoint.getY();
842 *pInnerSequenceZ++ = aPoint.getZ();
844 pOuterSequenceX++;
845 pOuterSequenceY++;
846 pOuterSequenceZ++;
848 rValue <<= aRetval;
851 //----------------------------------------------------------------------
853 bool Svx3DLatheObject::setPropertyValueImpl( const ::rtl::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)
855 switch( pProperty->nWID )
857 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
859 // Transformationsmatrix in das Objekt packen
860 if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
861 return true;
862 break;
864 case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
866 // Polygondefinition in das Objekt packen
867 basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
869 // #i101520# Probably imported
870 if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, true ) )
872 // #105127# SetPolyPoly3D sets the Svx3DVerticalSegmentsItem to the number
873 // of points of the polygon. Thus, value gets lost. To avoid this, rescue
874 // item here and re-set after setting the polygon.
875 const sal_uInt32 nPrevVerticalSegs(static_cast<E3dLatheObj*>(mpObj.get())->GetVerticalSegments());
877 // Polygon setzen
878 const basegfx::B3DHomMatrix aIdentity;
879 const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
880 static_cast<E3dLatheObj*>(mpObj.get())->SetPolyPoly2D(aB2DPolyPolygon);
881 const sal_uInt32 nPostVerticalSegs(static_cast<E3dLatheObj*>(mpObj.get())->GetVerticalSegments());
883 if(nPrevVerticalSegs != nPostVerticalSegs)
885 // restore the vertical segment count
886 static_cast<E3dLatheObj*>(mpObj.get())->SetMergedItem(Svx3DVerticalSegmentsItem(nPrevVerticalSegs));
888 return true;
890 break;
892 default:
893 return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
896 throw IllegalArgumentException();
899 //----------------------------------------------------------------------
900 bool Svx3DLatheObject::getPropertyValueImpl( const ::rtl::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)
902 switch( pProperty->nWID )
904 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
906 // Transformation in eine homogene Matrix packen
907 drawing::HomogenMatrix aHomMat;
908 basegfx::B3DHomMatrix aMat = static_cast<E3dObject*>(mpObj.get())->GetTransform();
910 // pack evtl. transformed matrix to output
911 aHomMat.Line1.Column1 = aMat.get(0, 0);
912 aHomMat.Line1.Column2 = aMat.get(0, 1);
913 aHomMat.Line1.Column3 = aMat.get(0, 2);
914 aHomMat.Line1.Column4 = aMat.get(0, 3);
915 aHomMat.Line2.Column1 = aMat.get(1, 0);
916 aHomMat.Line2.Column2 = aMat.get(1, 1);
917 aHomMat.Line2.Column3 = aMat.get(1, 2);
918 aHomMat.Line2.Column4 = aMat.get(1, 3);
919 aHomMat.Line3.Column1 = aMat.get(2, 0);
920 aHomMat.Line3.Column2 = aMat.get(2, 1);
921 aHomMat.Line3.Column3 = aMat.get(2, 2);
922 aHomMat.Line3.Column4 = aMat.get(2, 3);
923 aHomMat.Line4.Column1 = aMat.get(3, 0);
924 aHomMat.Line4.Column2 = aMat.get(3, 1);
925 aHomMat.Line4.Column3 = aMat.get(3, 2);
926 aHomMat.Line4.Column4 = aMat.get(3, 3);
928 rValue <<= aHomMat;
929 break;
931 case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
933 const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dLatheObj*>(mpObj.get())->GetPolyPoly2D();
934 const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
936 B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon, rValue);
937 break;
939 default:
940 return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
943 return true;
946 // ::com::sun::star::lang::XServiceInfo
947 uno::Sequence< OUString > SAL_CALL Svx3DLatheObject::getSupportedServiceNames()
948 throw(uno::RuntimeException)
950 uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
951 SvxServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
952 "com.sun.star.drawing.Shape3DLathe");
953 return aSeq;
956 /***********************************************************************
958 ***********************************************************************/
960 Svx3DExtrudeObject::Svx3DExtrudeObject( SdrObject* pObj ) throw()
961 : SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_3DEXTRUDEOBJECT), aSvxMapProvider.GetPropertySet(SVXMAP_3DEXTRUDEOBJECT) )
965 //----------------------------------------------------------------------
966 Svx3DExtrudeObject::~Svx3DExtrudeObject() throw()
970 //----------------------------------------------------------------------
972 bool Svx3DExtrudeObject::setPropertyValueImpl( const ::rtl::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)
974 switch( pProperty->nWID )
976 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
978 // Transformationsmatrix in das Objekt packen
979 if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
980 return true;
981 break;
984 case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
986 // Polygondefinition in das Objekt packen
987 basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
989 // #i101520# Probably imported
990 if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, true ) )
992 // Polygon setzen
993 const basegfx::B3DHomMatrix aIdentity;
994 const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
995 static_cast<E3dExtrudeObj*>(mpObj.get())->SetExtrudePolygon(aB2DPolyPolygon);
996 return true;
998 break;
1000 default:
1001 return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
1004 throw IllegalArgumentException();
1007 //----------------------------------------------------------------------
1009 bool Svx3DExtrudeObject::getPropertyValueImpl( const ::rtl::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)
1011 switch( pProperty->nWID )
1013 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
1015 // Transformation in eine homogene Matrix packen
1016 drawing::HomogenMatrix aHomMat;
1017 basegfx::B3DHomMatrix aMat = ((E3dObject*)mpObj.get())->GetTransform();
1019 // pack evtl. transformed matrix to output
1020 aHomMat.Line1.Column1 = aMat.get(0, 0);
1021 aHomMat.Line1.Column2 = aMat.get(0, 1);
1022 aHomMat.Line1.Column3 = aMat.get(0, 2);
1023 aHomMat.Line1.Column4 = aMat.get(0, 3);
1024 aHomMat.Line2.Column1 = aMat.get(1, 0);
1025 aHomMat.Line2.Column2 = aMat.get(1, 1);
1026 aHomMat.Line2.Column3 = aMat.get(1, 2);
1027 aHomMat.Line2.Column4 = aMat.get(1, 3);
1028 aHomMat.Line3.Column1 = aMat.get(2, 0);
1029 aHomMat.Line3.Column2 = aMat.get(2, 1);
1030 aHomMat.Line3.Column3 = aMat.get(2, 2);
1031 aHomMat.Line3.Column4 = aMat.get(2, 3);
1032 aHomMat.Line4.Column1 = aMat.get(3, 0);
1033 aHomMat.Line4.Column2 = aMat.get(3, 1);
1034 aHomMat.Line4.Column3 = aMat.get(3, 2);
1035 aHomMat.Line4.Column4 = aMat.get(3, 3);
1037 rValue <<= aHomMat;
1038 break;
1041 case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
1043 // Polygondefinition packen
1044 const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dExtrudeObj*>(mpObj.get())->GetExtrudePolygon();
1045 const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
1047 B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon, rValue);
1048 break;
1050 default:
1051 return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
1054 return true;
1057 // ::com::sun::star::lang::XServiceInfo
1058 uno::Sequence< OUString > SAL_CALL Svx3DExtrudeObject::getSupportedServiceNames()
1059 throw(uno::RuntimeException)
1061 uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
1062 SvxServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
1063 "com.sun.star.drawing.Shape3DExtrude");
1064 return aSeq;
1067 /***********************************************************************
1069 ***********************************************************************/
1071 //----------------------------------------------------------------------
1072 Svx3DPolygonObject::Svx3DPolygonObject( SdrObject* pObj ) throw()
1073 : SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_3DPOLYGONOBJECT), aSvxMapProvider.GetPropertySet(SVXMAP_3DPOLYGONOBJECT) )
1077 //----------------------------------------------------------------------
1078 Svx3DPolygonObject::~Svx3DPolygonObject() throw()
1082 //----------------------------------------------------------------------
1083 bool Svx3DPolygonObject::setPropertyValueImpl( const ::rtl::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)
1085 switch( pProperty->nWID )
1087 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
1089 // Transformationsmatrix in das Objekt packen
1090 if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
1091 return true;
1092 break;
1095 case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
1097 // Polygondefinition in das Objekt packen
1098 basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
1100 // #i101520# Direct API data (e.g. from chart)
1101 if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) )
1103 // Polygon setzen
1104 static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyPolygon3D(aNewB3DPolyPolygon);
1105 return true;
1107 break;
1109 case OWN_ATTR_3D_VALUE_NORMALSPOLYGON3D:
1111 // Normalendefinition in das Objekt packen
1112 basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
1114 // #i101520# Direct API data (e.g. from chart)
1115 if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) )
1117 // Polygon setzen
1118 static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyNormals3D(aNewB3DPolyPolygon);
1119 return true;
1121 break;
1123 case OWN_ATTR_3D_VALUE_TEXTUREPOLYGON3D:
1125 // Texturdefinition in das Objekt packen
1126 basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
1128 // #i101520# Direct API data (e.g. from chart)
1129 if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) )
1131 // Polygon setzen
1132 const basegfx::B3DHomMatrix aIdentity;
1133 const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
1134 static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyTexture2D(aB2DPolyPolygon);
1135 return true;
1137 break;
1139 case OWN_ATTR_3D_VALUE_LINEONLY:
1141 sal_Bool bNew = sal_False;
1142 if( rValue >>= bNew )
1144 static_cast<E3dPolygonObj*>(mpObj.get())->SetLineOnly(bNew);
1145 return true;
1147 break;
1149 default:
1150 return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
1153 throw IllegalArgumentException();
1156 //----------------------------------------------------------------------
1157 bool Svx3DPolygonObject::getPropertyValueImpl( const ::rtl::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)
1159 switch( pProperty->nWID )
1161 case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
1163 ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
1164 break;
1167 case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
1169 B3dPolyPolygon_to_PolyPolygonShape3D(static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyPolygon3D(),rValue);
1170 break;
1173 case OWN_ATTR_3D_VALUE_NORMALSPOLYGON3D:
1175 B3dPolyPolygon_to_PolyPolygonShape3D(static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyNormals3D(),rValue);
1176 break;
1179 case OWN_ATTR_3D_VALUE_TEXTUREPOLYGON3D:
1181 // Texturdefinition packen
1182 const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyTexture2D();
1183 const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
1185 B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon,rValue);
1186 break;
1189 case OWN_ATTR_3D_VALUE_LINEONLY:
1191 rValue <<= (sal_Bool)static_cast<E3dPolygonObj*>(mpObj.get())->GetLineOnly();
1192 break;
1195 default:
1196 return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
1199 return true;
1202 // ::com::sun::star::lang::XServiceInfo
1203 uno::Sequence< OUString > SAL_CALL Svx3DPolygonObject::getSupportedServiceNames()
1204 throw(uno::RuntimeException)
1206 Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
1207 SvxServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
1208 "com.sun.star.drawing.Shape3DPolygon");
1209 return aSeq;
1212 // eof