LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/svx/source/unodraw - unoshap3.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 171 548 31.2 %
Date: 2013-07-09 Functions: 33 57 57.9 %
Legend: Lines: hit not hit

          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/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>
      29             : 
      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"
      48             : 
      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;
      54             : 
      55             : #define QUERYINT( xint ) \
      56             :     if( rType == ::getCppuType((const Reference< xint >*)0) ) \
      57             :         aAny <<= Reference< xint >(this)
      58             : 
      59             : /***********************************************************************
      60             : * class Svx3DSceneObject                                               *
      61             : ***********************************************************************/
      62             : 
      63             : //----------------------------------------------------------------------
      64         417 : Svx3DSceneObject::Svx3DSceneObject( SdrObject* pObj, SvxDrawPage* pDrawPage ) throw()
      65        1251 : :   SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_3DSCENEOBJECT), getSvxMapProvider().GetPropertySet(SVXMAP_3DSCENEOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
      66        1668 : ,   mxPage( pDrawPage )
      67             : {
      68         417 : }
      69             : 
      70             : //----------------------------------------------------------------------
      71         834 : Svx3DSceneObject::~Svx3DSceneObject() throw()
      72             : {
      73         834 : }
      74             : 
      75             : //----------------------------------------------------------------------
      76         408 : void Svx3DSceneObject::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
      77             : {
      78         408 :     SvxShape::Create( pNewObj, pNewPage );
      79         408 :     mxPage = pNewPage;
      80         408 : }
      81             : 
      82             : //----------------------------------------------------------------------
      83        5497 : uno::Any SAL_CALL Svx3DSceneObject::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
      84             : {
      85        5497 :     uno::Any aAny;
      86             : 
      87        5497 :     QUERYINT( drawing::XShapes );
      88        5073 :     else QUERYINT( container::XIndexAccess );
      89        5073 :     else QUERYINT( container::XElementAccess );
      90             :     else
      91        5073 :         return SvxShape::queryAggregation( rType );
      92             : 
      93         424 :     return aAny;
      94             : }
      95             : 
      96        5498 : uno::Any SAL_CALL Svx3DSceneObject::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException )
      97             : {
      98        5498 :     return SvxShape::queryInterface( rType );
      99             : }
     100             : 
     101       12536 : void SAL_CALL Svx3DSceneObject::acquire() throw ( )
     102             : {
     103       12536 :     SvxShape::acquire();
     104       12536 : }
     105             : 
     106       12536 : void SAL_CALL Svx3DSceneObject::release() throw ( )
     107             : {
     108       12536 :     SvxShape::release();
     109       12536 : }
     110             : 
     111             : // XTypeProvider
     112             : 
     113           0 : uno::Sequence< uno::Type > SAL_CALL Svx3DSceneObject::getTypes()
     114             :     throw (uno::RuntimeException)
     115             : {
     116             : 
     117           0 :     return SvxShape::getTypes();
     118             : }
     119             : 
     120             : namespace
     121             : {
     122             :     class theSvx3DSceneObjectImplementationId : public rtl::Static< UnoTunnelIdInit, theSvx3DSceneObjectImplementationId > {};
     123             : }
     124             : 
     125           0 : uno::Sequence< sal_Int8 > SAL_CALL Svx3DSceneObject::getImplementationId()
     126             :     throw (uno::RuntimeException)
     127             : {
     128           0 :     return theSvx3DSceneObjectImplementationId::get().getSeq();
     129             : }
     130             : 
     131             : //----------------------------------------------------------------------
     132        1482 : void SAL_CALL Svx3DSceneObject::add( const Reference< drawing::XShape >& xShape )
     133             :     throw( uno::RuntimeException)
     134             : {
     135        1482 :     SolarMutexGuard aGuard;
     136             : 
     137        1482 :     SvxShape* pShape = SvxShape::getImplementation( xShape );
     138             : 
     139        1482 :     if(!mpObj.is() || !mxPage.is() || pShape == NULL || NULL != pShape->GetSdrObject() )
     140           0 :         throw uno::RuntimeException();
     141             : 
     142        1482 :     SdrObject* pSdrShape = mxPage->_CreateSdrObject( xShape );
     143        1482 :     if( pSdrShape->ISA(E3dObject) )
     144             :     {
     145        1482 :         mpObj->GetSubList()->NbcInsertObject( pSdrShape );
     146             : 
     147        1482 :         if(pShape)
     148        1482 :             pShape->Create( pSdrShape, mxPage.get()  );
     149             :     }
     150             :     else
     151             :     {
     152           0 :         SdrObject::Free( pSdrShape );
     153           0 :         throw uno::RuntimeException();
     154             :     }
     155             : 
     156        1482 :     if( mpModel )
     157        1482 :         mpModel->SetChanged();
     158        1482 : }
     159             : 
     160             : //----------------------------------------------------------------------
     161        1052 : void SAL_CALL Svx3DSceneObject::remove( const Reference< drawing::XShape >& xShape )
     162             :     throw( uno::RuntimeException )
     163             : {
     164        1052 :     SolarMutexGuard aGuard;
     165             : 
     166        1052 :     SvxShape* pShape = SvxShape::getImplementation( xShape );
     167             : 
     168        1052 :     if(!mpObj.is() || pShape == NULL)
     169           0 :         throw uno::RuntimeException();
     170             : 
     171        1052 :     SdrObject* pSdrShape = pShape->GetSdrObject();
     172        1052 :     if(pSdrShape == NULL || pSdrShape->GetObjList()->GetOwnerObj() != mpObj.get())
     173             :     {
     174           0 :         throw uno::RuntimeException();
     175             :     }
     176             :     else
     177             :     {
     178        1052 :         SdrObjList& rList = *pSdrShape->GetObjList();
     179             : 
     180        1052 :         const sal_uInt32 nObjCount = rList.GetObjCount();
     181        1052 :         sal_uInt32 nObjNum = 0;
     182        4504 :         while( nObjNum < nObjCount )
     183             :         {
     184        3452 :             if(rList.GetObj( nObjNum ) == pSdrShape )
     185        1052 :                 break;
     186        2400 :             nObjNum++;
     187             :         }
     188             : 
     189        1052 :         if( nObjNum < nObjCount )
     190             :         {
     191        1052 :             SdrObject* pObject = rList.NbcRemoveObject( nObjNum );
     192        1052 :             SdrObject::Free( pObject );
     193             :         }
     194             :         else
     195             :         {
     196             :             DBG_ASSERT( 0, "Fatality! SdrObject is not belonging to its SdrObjList! [CL]" );
     197             :         }
     198        1052 :     }
     199        1052 : }
     200             : 
     201             : //----------------------------------------------------------------------
     202         242 : sal_Int32 SAL_CALL Svx3DSceneObject::getCount()
     203             :     throw( uno::RuntimeException )
     204             : {
     205         242 :     SolarMutexGuard aGuard;
     206             : 
     207         242 :     sal_Int32 nRetval = 0;
     208             : 
     209         242 :     if(mpObj.is() && mpObj->ISA(E3dPolyScene) && mpObj->GetSubList())
     210         242 :         nRetval = mpObj->GetSubList()->GetObjCount();
     211         242 :     return nRetval;
     212             : }
     213             : 
     214             : //----------------------------------------------------------------------
     215             : 
     216           0 : uno::Any SAL_CALL Svx3DSceneObject::getByIndex( sal_Int32 Index )
     217             :     throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
     218             : {
     219           0 :     SolarMutexGuard aGuard;
     220             : 
     221           0 :     if( !mpObj.is() || mpObj->GetSubList() == NULL )
     222           0 :         throw uno::RuntimeException();
     223             : 
     224           0 :     if( mpObj->GetSubList()->GetObjCount() <= (sal_uInt32)Index )
     225           0 :         throw lang::IndexOutOfBoundsException();
     226             : 
     227           0 :     SdrObject* pDestObj = mpObj->GetSubList()->GetObj( Index );
     228           0 :     if(pDestObj == NULL)
     229           0 :         throw lang::IndexOutOfBoundsException();
     230             : 
     231           0 :     Reference< drawing::XShape > xShape( pDestObj->getUnoShape(), uno::UNO_QUERY );
     232           0 :     uno::Any aAny;
     233           0 :     aAny <<= xShape;
     234           0 :     return aAny;
     235             : }
     236             : 
     237             : //----------------------------------------------------------------------
     238             : // ::com::sun::star::container::XElementAccess
     239             : 
     240           0 : uno::Type SAL_CALL Svx3DSceneObject::getElementType()
     241             :     throw( uno::RuntimeException )
     242             : {
     243           0 :     return ::getCppuType(( const Reference< drawing::XShape>*)0);
     244             : }
     245             : 
     246             : //----------------------------------------------------------------------
     247           0 : sal_Bool SAL_CALL Svx3DSceneObject::hasElements()
     248             :     throw( uno::RuntimeException )
     249             : {
     250           0 :     SolarMutexGuard aGuard;
     251             : 
     252           0 :     return mpObj.is() && mpObj->GetSubList() && (mpObj->GetSubList()->GetObjCount() > 0);
     253             : }
     254             : 
     255             : //----------------------------------------------------------------------
     256             : 
     257        1284 : static bool ConvertHomogenMatrixToObject( E3dObject* pObject, const Any& rValue )
     258             : {
     259        1284 :     drawing::HomogenMatrix m;
     260        1284 :     if( rValue >>= m )
     261             :     {
     262        1284 :         basegfx::B3DHomMatrix aMat;
     263        1284 :         aMat.set(0, 0, m.Line1.Column1);
     264        1284 :         aMat.set(0, 1, m.Line1.Column2);
     265        1284 :         aMat.set(0, 2, m.Line1.Column3);
     266        1284 :         aMat.set(0, 3, m.Line1.Column4);
     267        1284 :         aMat.set(1, 0, m.Line2.Column1);
     268        1284 :         aMat.set(1, 1, m.Line2.Column2);
     269        1284 :         aMat.set(1, 2, m.Line2.Column3);
     270        1284 :         aMat.set(1, 3, m.Line2.Column4);
     271        1284 :         aMat.set(2, 0, m.Line3.Column1);
     272        1284 :         aMat.set(2, 1, m.Line3.Column2);
     273        1284 :         aMat.set(2, 2, m.Line3.Column3);
     274        1284 :         aMat.set(2, 3, m.Line3.Column4);
     275        1284 :         aMat.set(3, 0, m.Line4.Column1);
     276        1284 :         aMat.set(3, 1, m.Line4.Column2);
     277        1284 :         aMat.set(3, 2, m.Line4.Column3);
     278        1284 :         aMat.set(3, 3, m.Line4.Column4);
     279        1284 :         pObject->SetTransform(aMat);
     280        1284 :         return true;
     281             :     }
     282           0 :     return false;
     283             : }
     284             : 
     285           0 : static void ConvertObjectToHomogenMatric( E3dObject* pObject, Any& rValue )
     286             : {
     287           0 :     drawing::HomogenMatrix aHomMat;
     288           0 :     const basegfx::B3DHomMatrix& rMat = pObject->GetTransform();
     289           0 :     aHomMat.Line1.Column1 = rMat.get(0, 0);
     290           0 :     aHomMat.Line1.Column2 = rMat.get(0, 1);
     291           0 :     aHomMat.Line1.Column3 = rMat.get(0, 2);
     292           0 :     aHomMat.Line1.Column4 = rMat.get(0, 3);
     293           0 :     aHomMat.Line2.Column1 = rMat.get(1, 0);
     294           0 :     aHomMat.Line2.Column2 = rMat.get(1, 1);
     295           0 :     aHomMat.Line2.Column3 = rMat.get(1, 2);
     296           0 :     aHomMat.Line2.Column4 = rMat.get(1, 3);
     297           0 :     aHomMat.Line3.Column1 = rMat.get(2, 0);
     298           0 :     aHomMat.Line3.Column2 = rMat.get(2, 1);
     299           0 :     aHomMat.Line3.Column3 = rMat.get(2, 2);
     300           0 :     aHomMat.Line3.Column4 = rMat.get(2, 3);
     301           0 :     aHomMat.Line4.Column1 = rMat.get(3, 0);
     302           0 :     aHomMat.Line4.Column2 = rMat.get(3, 1);
     303           0 :     aHomMat.Line4.Column3 = rMat.get(3, 2);
     304           0 :     aHomMat.Line4.Column4 = rMat.get(3, 3);
     305           0 :     rValue <<= aHomMat;
     306           0 : }
     307             : 
     308             : //----------------------------------------------------------------------
     309             : #include <svx/svditer.hxx>
     310             : 
     311           0 : struct ImpRememberTransAndRect
     312             : {
     313             :     basegfx::B3DHomMatrix                   maMat;
     314             :     Rectangle                   maRect;
     315             : };
     316             : 
     317         972 : 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)
     318             : {
     319         972 :     switch( pProperty->nWID )
     320             :     {
     321             :     case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
     322             :     {
     323             :         // Transformationsmatrix in das Objekt packen
     324         442 :         if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
     325         442 :             return true;
     326           0 :         break;
     327             :     }
     328             :     case OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY:
     329             :     {
     330             :         // set CameraGeometry at scene
     331           0 :         E3dScene* pScene = static_cast< E3dScene* >( mpObj.get() );
     332           0 :         drawing::CameraGeometry aCamGeo;
     333             : 
     334           0 :         if(rValue >>= aCamGeo)
     335             :         {
     336           0 :             basegfx::B3DPoint aVRP(aCamGeo.vrp.PositionX, aCamGeo.vrp.PositionY, aCamGeo.vrp.PositionZ);
     337           0 :             basegfx::B3DVector aVPN(aCamGeo.vpn.DirectionX, aCamGeo.vpn.DirectionY, aCamGeo.vpn.DirectionZ);
     338           0 :             basegfx::B3DVector aVUP(aCamGeo.vup.DirectionX, aCamGeo.vup.DirectionY, aCamGeo.vup.DirectionZ);
     339             : 
     340             :             // rescue scene transformation
     341           0 :             ImpRememberTransAndRect aSceneTAR;
     342           0 :             aSceneTAR.maMat = pScene->GetTransform();
     343           0 :             aSceneTAR.maRect = pScene->GetSnapRect();
     344             : 
     345             :             // rescue object transformations
     346           0 :             SdrObjListIter aIter(*pScene->GetSubList(), IM_DEEPWITHGROUPS);
     347           0 :             std::vector<basegfx::B3DHomMatrix*> aObjTrans;
     348           0 :             while(aIter.IsMore())
     349             :             {
     350           0 :                 E3dObject* p3DObj = (E3dObject*)aIter.Next();
     351           0 :                 basegfx::B3DHomMatrix* pNew = new basegfx::B3DHomMatrix;
     352           0 :                 *pNew = p3DObj->GetTransform();
     353           0 :                 aObjTrans.push_back(pNew);
     354             :             }
     355             : 
     356             :             // reset object transformations
     357           0 :             aIter.Reset();
     358           0 :             while(aIter.IsMore())
     359             :             {
     360           0 :                 E3dObject* p3DObj = (E3dObject*)aIter.Next();
     361           0 :                 p3DObj->NbcSetTransform(basegfx::B3DHomMatrix());
     362             :             }
     363             : 
     364             :             // reset scene transformation and make a complete recalc
     365           0 :             pScene->NbcSetTransform(basegfx::B3DHomMatrix());
     366             : 
     367             :             // fill old camera from new parameters
     368           0 :             Camera3D aCam(pScene->GetCamera());
     369           0 :             const basegfx::B3DRange& rVolume = pScene->GetBoundVolume();
     370           0 :             double fW = rVolume.getWidth();
     371           0 :             double fH = rVolume.getHeight();
     372             : 
     373           0 :             const SfxItemSet& rSceneSet = pScene->GetMergedItemSet();
     374             :             double fCamPosZ =
     375           0 :                 (double)((const SfxUInt32Item&)rSceneSet.Get(SDRATTR_3DSCENE_DISTANCE)).GetValue();
     376             :             double fCamFocal =
     377           0 :                 (double)((const SfxUInt32Item&)rSceneSet.Get(SDRATTR_3DSCENE_FOCAL_LENGTH)).GetValue();
     378             : 
     379           0 :             aCam.SetAutoAdjustProjection(sal_False);
     380           0 :             aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
     381           0 :             basegfx::B3DPoint aLookAt;
     382           0 :             basegfx::B3DPoint aCamPos(0.0, 0.0, fCamPosZ);
     383           0 :             aCam.SetPosAndLookAt(aCamPos, aLookAt);
     384           0 :             aCam.SetFocalLength(fCamFocal / 100.0);
     385           0 :             aCam.SetDefaults(basegfx::B3DPoint(0.0, 0.0, fCamPosZ), aLookAt, fCamFocal / 100.0);
     386           0 :             aCam.SetDeviceWindow(Rectangle(0, 0, (long)fW, (long)fH));
     387             : 
     388             :             // set at scene
     389           0 :             pScene->SetCamera(aCam);
     390             : 
     391             :             // #91047# use imported VRP, VPN and VUP (if used)
     392           0 :             bool bVRPUsed(!aVRP.equal(basegfx::B3DPoint(0.0, 0.0, 1.0)));
     393           0 :             bool bVPNUsed(!aVPN.equal(basegfx::B3DVector(0.0, 0.0, 1.0)));
     394           0 :             bool bVUPUsed(!aVUP.equal(basegfx::B3DVector(0.0, 1.0, 0.0)));
     395             : 
     396           0 :             if(bVRPUsed || bVPNUsed || bVUPUsed)
     397             :             {
     398           0 :                 pScene->GetCameraSet().SetViewportValues(aVRP, aVPN, aVUP);
     399             :             }
     400             : 
     401             :             // set object transformations again at objects
     402           0 :             aIter.Reset();
     403           0 :             sal_uInt32 nIndex(0L);
     404           0 :             while(aIter.IsMore())
     405             :             {
     406           0 :                 E3dObject* p3DObj = (E3dObject*)aIter.Next();
     407           0 :                 basegfx::B3DHomMatrix* pMat = aObjTrans[nIndex++];
     408           0 :                 p3DObj->NbcSetTransform(*pMat);
     409           0 :                 delete pMat;
     410             :             }
     411             : 
     412             :             // set scene transformation again at scene
     413           0 :             pScene->NbcSetTransform(aSceneTAR.maMat);
     414           0 :             pScene->NbcSetSnapRect(aSceneTAR.maRect);
     415             : 
     416           0 :             return true;
     417             :         }
     418           0 :         break;
     419             :     }
     420             :     default:
     421         530 :         return SvxShape::setPropertyValueImpl(rName, pProperty, rValue);
     422             :     }
     423             : 
     424           0 :     throw IllegalArgumentException();
     425             : }
     426             : 
     427             : //----------------------------------------------------------------------
     428             : 
     429           0 : 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)
     430             : {
     431           0 :     switch( pProperty->nWID )
     432             :     {
     433             :     case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
     434             :     {
     435             :         // Objekt in eine homogene 4x4 Matrix packen
     436           0 :         ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
     437           0 :         break;
     438             :     }
     439             :     case OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY:
     440             :     {
     441             :         // get CameraGeometry from scene
     442           0 :         E3dScene* pScene = static_cast< E3dScene* >( mpObj.get() );
     443           0 :         drawing::CameraGeometry aCamGeo;
     444             : 
     445             :         // fill Vectors from scene camera
     446           0 :         B3dCamera& aCameraSet = pScene->GetCameraSet();
     447           0 :         basegfx::B3DPoint aVRP(aCameraSet.GetVRP());
     448           0 :         basegfx::B3DVector aVPN(aCameraSet.GetVPN());
     449           0 :         basegfx::B3DVector aVUP(aCameraSet.GetVUV());
     450             : 
     451             :         // transfer to structure
     452           0 :         aCamGeo.vrp.PositionX = aVRP.getX();
     453           0 :         aCamGeo.vrp.PositionY = aVRP.getY();
     454           0 :         aCamGeo.vrp.PositionZ = aVRP.getZ();
     455           0 :         aCamGeo.vpn.DirectionX = aVPN.getX();
     456           0 :         aCamGeo.vpn.DirectionY = aVPN.getY();
     457           0 :         aCamGeo.vpn.DirectionZ = aVPN.getZ();
     458           0 :         aCamGeo.vup.DirectionX = aVUP.getX();
     459           0 :         aCamGeo.vup.DirectionY = aVUP.getY();
     460           0 :         aCamGeo.vup.DirectionZ = aVUP.getZ();
     461             : 
     462           0 :         rValue <<= aCamGeo;
     463           0 :         break;
     464             :     }
     465             :     default:
     466           0 :         return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
     467             :     }
     468             : 
     469           0 :     return true;
     470             : }
     471             : 
     472             : // ::com::sun::star::lang::XServiceInfo
     473           0 : uno::Sequence< OUString > SAL_CALL Svx3DSceneObject::getSupportedServiceNames()
     474             :     throw(uno::RuntimeException)
     475             : {
     476           0 :     uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
     477           0 :     comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.Shape3DScene" );
     478           0 :     return aSeq;
     479             : }
     480             : 
     481             : /***********************************************************************
     482             : *                                                                      *
     483             : ***********************************************************************/
     484             : 
     485             : //----------------------------------------------------------------------
     486           1 : Svx3DCubeObject::Svx3DCubeObject( SdrObject* pObj ) throw()
     487           1 : :   SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_3DCUBEOBJEKT), getSvxMapProvider().GetPropertySet(SVXMAP_3DCUBEOBJEKT, SdrObject::GetGlobalDrawObjectItemPool()) )
     488             : {
     489           1 : }
     490             : 
     491             : //----------------------------------------------------------------------
     492           2 : Svx3DCubeObject::~Svx3DCubeObject() throw()
     493             : {
     494           2 : }
     495             : 
     496             : //----------------------------------------------------------------------
     497           0 : 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)
     498             : {
     499           0 :     SolarMutexGuard aGuard;
     500             : 
     501           0 :     switch( pProperty->nWID )
     502             :     {
     503             :     case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
     504             :     {
     505             :         // Transformationsmatrix in das Objekt packen
     506           0 :         if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
     507           0 :             return true;
     508           0 :         break;
     509             :     }
     510             :     case OWN_ATTR_3D_VALUE_POSITION:
     511             :     {
     512             :         // Position in das Objekt packen
     513           0 :         drawing::Position3D aUnoPos;
     514           0 :         if( rValue >>= aUnoPos )
     515             :         {
     516           0 :             basegfx::B3DPoint aPos(aUnoPos.PositionX, aUnoPos.PositionY, aUnoPos.PositionZ);
     517           0 :             static_cast< E3dCubeObj* >( mpObj.get() )->SetCubePos(aPos);
     518           0 :             return true;
     519             :         }
     520           0 :         break;
     521             :     }
     522             :     case OWN_ATTR_3D_VALUE_SIZE:
     523             :     {
     524             :         // Groesse in das Objekt packen
     525           0 :         drawing::Direction3D aDirection;
     526           0 :         if( rValue >>= aDirection )
     527             :         {
     528           0 :             basegfx::B3DVector aSize(aDirection.DirectionX, aDirection.DirectionY, aDirection.DirectionZ);
     529           0 :             static_cast< E3dCubeObj* >( mpObj.get() )->SetCubeSize(aSize);
     530           0 :             return true;
     531             :         }
     532           0 :         break;
     533             :     }
     534             :     case OWN_ATTR_3D_VALUE_POS_IS_CENTER:
     535             :     {
     536           0 :         sal_Bool bNew = sal_False;
     537             :         // sal_Bool bPosIsCenter in das Objekt packen
     538           0 :         if( rValue >>= bNew )
     539             :         {
     540           0 :             static_cast< E3dCubeObj* >( mpObj.get() )->SetPosIsCenter(bNew);
     541           0 :             return true;
     542             :         }
     543           0 :         break;
     544             :     }
     545             :     default:
     546           0 :         return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
     547             :     }
     548             : 
     549           0 :     throw IllegalArgumentException();
     550             : }
     551             : 
     552             : //----------------------------------------------------------------------
     553             : 
     554           0 : 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)
     555             : {
     556           0 :     switch( pProperty->nWID )
     557             :     {
     558             :     case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
     559             :     {
     560             :         // Transformation in eine homogene Matrix packen
     561           0 :         ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
     562           0 :         break;
     563             :     }
     564             :     case OWN_ATTR_3D_VALUE_POSITION:
     565             :     {
     566             :         // Position packen
     567           0 :         const basegfx::B3DPoint& rPos = ((E3dCubeObj*)mpObj.get())->GetCubePos();
     568           0 :         drawing::Position3D aPos;
     569             : 
     570           0 :         aPos.PositionX = rPos.getX();
     571           0 :         aPos.PositionY = rPos.getY();
     572           0 :         aPos.PositionZ = rPos.getZ();
     573             : 
     574           0 :         rValue <<= aPos;
     575           0 :         break;
     576             :     }
     577             :     case OWN_ATTR_3D_VALUE_SIZE:
     578             :     {
     579             :         // Groesse packen
     580           0 :         const basegfx::B3DVector& rSize = static_cast<E3dCubeObj*>(mpObj.get())->GetCubeSize();
     581           0 :         drawing::Direction3D aDir;
     582             : 
     583           0 :         aDir.DirectionX = rSize.getX();
     584           0 :         aDir.DirectionY = rSize.getY();
     585           0 :         aDir.DirectionZ = rSize.getZ();
     586             : 
     587           0 :         rValue <<= aDir;
     588           0 :         break;
     589             :     }
     590             :     case OWN_ATTR_3D_VALUE_POS_IS_CENTER:
     591             :     {
     592           0 :         rValue <<= static_cast<E3dCubeObj*>(mpObj.get())->GetPosIsCenter();
     593           0 :         break;
     594             :     }
     595             :     default:
     596           0 :         return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
     597             :     }
     598             : 
     599           0 :     return true;
     600             : }
     601             : 
     602             : // ::com::sun::star::lang::XServiceInfo
     603           0 : uno::Sequence< OUString > SAL_CALL Svx3DCubeObject::getSupportedServiceNames()
     604             :     throw(uno::RuntimeException)
     605             : {
     606           0 :     uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
     607             :     comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
     608           0 :                             "com.sun.star.drawing.Shape3DCube");
     609           0 :     return aSeq;
     610             : }
     611             : 
     612             : /***********************************************************************
     613             : *                                                                      *
     614             : ***********************************************************************/
     615             : 
     616             : //----------------------------------------------------------------------
     617           1 : Svx3DSphereObject::Svx3DSphereObject( SdrObject* pObj ) throw()
     618           1 : :   SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_3DSPHEREOBJECT), getSvxMapProvider().GetPropertySet(SVXMAP_3DSPHEREOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
     619             : {
     620           1 : }
     621             : 
     622             : //----------------------------------------------------------------------
     623           2 : Svx3DSphereObject::~Svx3DSphereObject() throw()
     624             : {
     625           2 : }
     626             : 
     627             : //----------------------------------------------------------------------
     628             : 
     629           0 : 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)
     630             : {
     631           0 :     switch( pProperty->nWID )
     632             :     {
     633             :     case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
     634             :     {
     635             :         // Transformationsmatrix in das Objekt packen
     636           0 :         if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
     637           0 :             return true;
     638           0 :         break;
     639             :     }
     640             : 
     641             :     case OWN_ATTR_3D_VALUE_POSITION:
     642             :     {
     643             :         // Position in das Objekt packen
     644           0 :         drawing::Position3D aUnoPos;
     645           0 :         if( rValue >>= aUnoPos )
     646             :         {
     647           0 :             basegfx::B3DPoint aPos(aUnoPos.PositionX, aUnoPos.PositionY, aUnoPos.PositionZ);
     648           0 :             static_cast<E3dSphereObj*>(mpObj.get())->SetCenter(aPos);
     649           0 :             return true;
     650             :         }
     651           0 :         break;
     652             :     }
     653             : 
     654             :     case OWN_ATTR_3D_VALUE_SIZE:
     655             :     {
     656             :         // Groesse in das Objekt packen
     657           0 :         drawing::Direction3D aDir;
     658           0 :         if( rValue >>= aDir )
     659             :         {
     660           0 :             basegfx::B3DVector aPos(aDir.DirectionX, aDir.DirectionY, aDir.DirectionZ);
     661           0 :             static_cast<E3dSphereObj*>(mpObj.get())->SetSize(aPos);
     662           0 :             return true;
     663             :         }
     664           0 :         break;
     665             :     }
     666             :     default:
     667           0 :         return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
     668             :     }
     669             : 
     670           0 :     throw IllegalArgumentException();
     671             : }
     672             : 
     673             : //----------------------------------------------------------------------
     674             : 
     675           0 : 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)
     676             : {
     677           0 :     switch( pProperty->nWID )
     678             :     {
     679             :     case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
     680             :     {
     681             :         // Transformation in eine homogene Matrix packen
     682           0 :         ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
     683           0 :         break;
     684             :     }
     685             :     case OWN_ATTR_3D_VALUE_POSITION:
     686             :     {
     687             :         // Position packen
     688           0 :         const basegfx::B3DPoint& rPos = ((E3dSphereObj*)mpObj.get())->Center();
     689           0 :         drawing::Position3D aPos;
     690             : 
     691           0 :         aPos.PositionX = rPos.getX();
     692           0 :         aPos.PositionY = rPos.getY();
     693           0 :         aPos.PositionZ = rPos.getZ();
     694             : 
     695           0 :         rValue <<= aPos;
     696           0 :         break;
     697             :     }
     698             :     case OWN_ATTR_3D_VALUE_SIZE:
     699             :     {
     700             :         // Groesse packen
     701           0 :         const basegfx::B3DVector& rSize = ((E3dSphereObj*)mpObj.get())->Size();
     702           0 :         drawing::Direction3D aDir;
     703             : 
     704           0 :         aDir.DirectionX = rSize.getX();
     705           0 :         aDir.DirectionY = rSize.getY();
     706           0 :         aDir.DirectionZ = rSize.getZ();
     707             : 
     708           0 :         rValue <<= aDir;
     709           0 :         break;
     710             :     }
     711             :     default:
     712           0 :         return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
     713             :     }
     714             : 
     715           0 :     return true;
     716             : }
     717             : 
     718             : // ::com::sun::star::lang::XServiceInfo
     719           0 : uno::Sequence< OUString > SAL_CALL Svx3DSphereObject::getSupportedServiceNames()
     720             :     throw(uno::RuntimeException)
     721             : {
     722           0 :     uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
     723             :     comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
     724           0 :                             "com.sun.star.drawing.Shape3DSphere");
     725           0 :     return aSeq;
     726             : }
     727             : 
     728             : /***********************************************************************
     729             : *                                                                      *
     730             : ***********************************************************************/
     731             : 
     732             : //----------------------------------------------------------------------
     733           1 : Svx3DLatheObject::Svx3DLatheObject( SdrObject* pObj ) throw()
     734           1 : :   SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_3DLATHEOBJECT), getSvxMapProvider().GetPropertySet(SVXMAP_3DLATHEOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
     735             : {
     736           1 : }
     737             : 
     738             : //----------------------------------------------------------------------
     739           2 : Svx3DLatheObject::~Svx3DLatheObject() throw()
     740             : {
     741           2 : }
     742             : 
     743        1562 : bool PolyPolygonShape3D_to_B3dPolyPolygon(
     744             :     const Any& rValue,
     745             :     basegfx::B3DPolyPolygon& rResultPolygon,
     746             :     bool bCorrectPolygon)
     747             : {
     748        1562 :     drawing::PolyPolygonShape3D aSourcePolyPolygon;
     749        1562 :     if( !(rValue >>= aSourcePolyPolygon) )
     750           0 :         return false;
     751             : 
     752        1562 :     sal_Int32 nOuterSequenceCount = aSourcePolyPolygon.SequenceX.getLength();
     753        1562 :     if(nOuterSequenceCount != aSourcePolyPolygon.SequenceY.getLength() || nOuterSequenceCount != aSourcePolyPolygon.SequenceZ.getLength())
     754           0 :         return false;
     755             : 
     756        1562 :     drawing::DoubleSequence* pInnerSequenceX = aSourcePolyPolygon.SequenceX.getArray();
     757        1562 :     drawing::DoubleSequence* pInnerSequenceY = aSourcePolyPolygon.SequenceY.getArray();
     758        1562 :     drawing::DoubleSequence* pInnerSequenceZ = aSourcePolyPolygon.SequenceZ.getArray();
     759        3124 :     for(sal_Int32 a(0L);a<nOuterSequenceCount;a++)
     760             :     {
     761        1562 :         sal_Int32 nInnerSequenceCount = pInnerSequenceX->getLength();
     762        1562 :         if(nInnerSequenceCount != pInnerSequenceY->getLength() || nInnerSequenceCount != pInnerSequenceZ->getLength())
     763             :         {
     764           0 :             return false;
     765             :         }
     766        1562 :         basegfx::B3DPolygon aNewPolygon;
     767        1562 :         double* pArrayX = pInnerSequenceX->getArray();
     768        1562 :         double* pArrayY = pInnerSequenceY->getArray();
     769        1562 :         double* pArrayZ = pInnerSequenceZ->getArray();
     770        8652 :         for(sal_Int32 b(0L);b<nInnerSequenceCount;b++)
     771             :         {
     772        7090 :             aNewPolygon.append(basegfx::B3DPoint(*pArrayX++,*pArrayY++,*pArrayZ++));
     773             :         }
     774        1562 :         pInnerSequenceX++;
     775        1562 :         pInnerSequenceY++;
     776        1562 :         pInnerSequenceZ++;
     777             : 
     778             :         // #i101520# correction is needed for imported polygons of old format,
     779             :         // see callers
     780        1562 :         if(bCorrectPolygon)
     781             :         {
     782         842 :             basegfx::tools::checkClosed(aNewPolygon);
     783             :         }
     784             : 
     785        1562 :         rResultPolygon.append(aNewPolygon);
     786        1562 :     }
     787        1562 :     return true;
     788             : }
     789             : 
     790           0 : static void B3dPolyPolygon_to_PolyPolygonShape3D( const basegfx::B3DPolyPolygon& rSourcePolyPolygon, Any& rValue )
     791             : {
     792           0 :     drawing::PolyPolygonShape3D aRetval;
     793           0 :     aRetval.SequenceX.realloc(rSourcePolyPolygon.count());
     794           0 :     aRetval.SequenceY.realloc(rSourcePolyPolygon.count());
     795           0 :     aRetval.SequenceZ.realloc(rSourcePolyPolygon.count());
     796           0 :     drawing::DoubleSequence* pOuterSequenceX = aRetval.SequenceX.getArray();
     797           0 :     drawing::DoubleSequence* pOuterSequenceY = aRetval.SequenceY.getArray();
     798           0 :     drawing::DoubleSequence* pOuterSequenceZ = aRetval.SequenceZ.getArray();
     799           0 :     for(sal_uInt32 a(0L);a<rSourcePolyPolygon.count();a++)
     800             :     {
     801           0 :         const basegfx::B3DPolygon aPoly(rSourcePolyPolygon.getB3DPolygon(a));
     802           0 :         sal_Int32 nPointCount(aPoly.count());
     803           0 :         if(aPoly.isClosed()) nPointCount++;
     804           0 :         pOuterSequenceX->realloc(nPointCount);
     805           0 :         pOuterSequenceY->realloc(nPointCount);
     806           0 :         pOuterSequenceZ->realloc(nPointCount);
     807           0 :         double* pInnerSequenceX = pOuterSequenceX->getArray();
     808           0 :         double* pInnerSequenceY = pOuterSequenceY->getArray();
     809           0 :         double* pInnerSequenceZ = pOuterSequenceZ->getArray();
     810           0 :         for(sal_uInt32 b(0L);b<aPoly.count();b++)
     811             :         {
     812           0 :             const basegfx::B3DPoint aPoint(aPoly.getB3DPoint(b));
     813           0 :             *pInnerSequenceX++ = aPoint.getX();
     814           0 :             *pInnerSequenceY++ = aPoint.getY();
     815           0 :             *pInnerSequenceZ++ = aPoint.getZ();
     816           0 :         }
     817           0 :         if(aPoly.isClosed())
     818             :         {
     819           0 :             const basegfx::B3DPoint aPoint(aPoly.getB3DPoint(0L));
     820           0 :             *pInnerSequenceX++ = aPoint.getX();
     821           0 :             *pInnerSequenceY++ = aPoint.getY();
     822           0 :             *pInnerSequenceZ++ = aPoint.getZ();
     823             :         }
     824           0 :         pOuterSequenceX++;
     825           0 :         pOuterSequenceY++;
     826           0 :         pOuterSequenceZ++;
     827           0 :     }
     828           0 :     rValue <<= aRetval;
     829           0 : }
     830             : 
     831             : //----------------------------------------------------------------------
     832             : 
     833           0 : 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)
     834             : {
     835           0 :     switch( pProperty->nWID )
     836             :     {
     837             :     case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
     838             :     {
     839             :         // Transformationsmatrix in das Objekt packen
     840           0 :         if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
     841           0 :             return true;
     842           0 :         break;
     843             :     }
     844             :     case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
     845             :     {
     846             :         // Polygondefinition in das Objekt packen
     847           0 :         basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
     848             : 
     849             :         // #i101520# Probably imported
     850           0 :         if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, true ) )
     851             :         {
     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           0 :             const sal_uInt32 nPrevVerticalSegs(static_cast<E3dLatheObj*>(mpObj.get())->GetVerticalSegments());
     856             : 
     857             :             // Polygon setzen
     858           0 :             const basegfx::B3DHomMatrix aIdentity;
     859           0 :             const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
     860           0 :             static_cast<E3dLatheObj*>(mpObj.get())->SetPolyPoly2D(aB2DPolyPolygon);
     861           0 :             const sal_uInt32 nPostVerticalSegs(static_cast<E3dLatheObj*>(mpObj.get())->GetVerticalSegments());
     862             : 
     863           0 :             if(nPrevVerticalSegs != nPostVerticalSegs)
     864             :             {
     865             :                 // restore the vertical segment count
     866           0 :                 static_cast<E3dLatheObj*>(mpObj.get())->SetMergedItem(Svx3DVerticalSegmentsItem(nPrevVerticalSegs));
     867             :             }
     868           0 :             return true;
     869             :         }
     870           0 :         break;
     871             :     }
     872             :     default:
     873           0 :         return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
     874             :     }
     875             : 
     876           0 :     throw IllegalArgumentException();
     877             : }
     878             : 
     879             : //----------------------------------------------------------------------
     880           0 : 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)
     881             : {
     882           0 :     switch( pProperty->nWID )
     883             :     {
     884             :     case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
     885             :     {
     886             :         // Transformation in eine homogene Matrix packen
     887           0 :         drawing::HomogenMatrix aHomMat;
     888           0 :         basegfx::B3DHomMatrix aMat = static_cast<E3dObject*>(mpObj.get())->GetTransform();
     889             : 
     890             :         // pack evtl. transformed matrix to output
     891           0 :         aHomMat.Line1.Column1 = aMat.get(0, 0);
     892           0 :         aHomMat.Line1.Column2 = aMat.get(0, 1);
     893           0 :         aHomMat.Line1.Column3 = aMat.get(0, 2);
     894           0 :         aHomMat.Line1.Column4 = aMat.get(0, 3);
     895           0 :         aHomMat.Line2.Column1 = aMat.get(1, 0);
     896           0 :         aHomMat.Line2.Column2 = aMat.get(1, 1);
     897           0 :         aHomMat.Line2.Column3 = aMat.get(1, 2);
     898           0 :         aHomMat.Line2.Column4 = aMat.get(1, 3);
     899           0 :         aHomMat.Line3.Column1 = aMat.get(2, 0);
     900           0 :         aHomMat.Line3.Column2 = aMat.get(2, 1);
     901           0 :         aHomMat.Line3.Column3 = aMat.get(2, 2);
     902           0 :         aHomMat.Line3.Column4 = aMat.get(2, 3);
     903           0 :         aHomMat.Line4.Column1 = aMat.get(3, 0);
     904           0 :         aHomMat.Line4.Column2 = aMat.get(3, 1);
     905           0 :         aHomMat.Line4.Column3 = aMat.get(3, 2);
     906           0 :         aHomMat.Line4.Column4 = aMat.get(3, 3);
     907             : 
     908           0 :         rValue <<= aHomMat;
     909           0 :         break;
     910             :     }
     911             :     case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
     912             :     {
     913           0 :         const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dLatheObj*>(mpObj.get())->GetPolyPoly2D();
     914           0 :         const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
     915             : 
     916           0 :         B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon, rValue);
     917           0 :         break;
     918             :     }
     919             :     default:
     920           0 :         return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
     921             :     }
     922             : 
     923           0 :     return true;
     924             : }
     925             : 
     926             : // ::com::sun::star::lang::XServiceInfo
     927           0 : uno::Sequence< OUString > SAL_CALL Svx3DLatheObject::getSupportedServiceNames()
     928             :     throw(uno::RuntimeException)
     929             : {
     930           0 :     uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
     931             :     comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
     932           0 :                             "com.sun.star.drawing.Shape3DLathe");
     933           0 :     return aSeq;
     934             : }
     935             : 
     936             : /***********************************************************************
     937             : *                                                                      *
     938             : ***********************************************************************/
     939             : 
     940         843 : Svx3DExtrudeObject::Svx3DExtrudeObject( SdrObject* pObj ) throw()
     941         843 : :   SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_3DEXTRUDEOBJECT), getSvxMapProvider().GetPropertySet(SVXMAP_3DEXTRUDEOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
     942             : {
     943         843 : }
     944             : 
     945             : //----------------------------------------------------------------------
     946        1686 : Svx3DExtrudeObject::~Svx3DExtrudeObject() throw()
     947             : {
     948        1686 : }
     949             : 
     950             : //----------------------------------------------------------------------
     951             : 
     952        3840 : 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)
     953             : {
     954        3840 :     switch( pProperty->nWID )
     955             :     {
     956             :     case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
     957             :     {
     958             :         // Transformationsmatrix in das Objekt packen
     959         842 :         if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
     960         842 :             return true;
     961           0 :         break;
     962             :     }
     963             : 
     964             :     case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
     965             :     {
     966             :         // Polygondefinition in das Objekt packen
     967         842 :         basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
     968             : 
     969             :         // #i101520# Probably imported
     970         842 :         if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, true ) )
     971             :         {
     972             :             // Polygon setzen
     973         842 :             const basegfx::B3DHomMatrix aIdentity;
     974        1684 :             const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
     975         842 :             static_cast<E3dExtrudeObj*>(mpObj.get())->SetExtrudePolygon(aB2DPolyPolygon);
     976        1684 :             return true;
     977             :         }
     978           0 :         break;
     979             :     }
     980             :     default:
     981        2156 :         return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
     982             :     }
     983             : 
     984           0 :     throw IllegalArgumentException();
     985             : }
     986             : 
     987             : //----------------------------------------------------------------------
     988             : 
     989           0 : 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)
     990             : {
     991           0 :     switch( pProperty->nWID )
     992             :     {
     993             :     case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
     994             :     {
     995             :         // Transformation in eine homogene Matrix packen
     996           0 :         drawing::HomogenMatrix aHomMat;
     997           0 :         basegfx::B3DHomMatrix aMat = ((E3dObject*)mpObj.get())->GetTransform();
     998             : 
     999             :         // pack evtl. transformed matrix to output
    1000           0 :         aHomMat.Line1.Column1 = aMat.get(0, 0);
    1001           0 :         aHomMat.Line1.Column2 = aMat.get(0, 1);
    1002           0 :         aHomMat.Line1.Column3 = aMat.get(0, 2);
    1003           0 :         aHomMat.Line1.Column4 = aMat.get(0, 3);
    1004           0 :         aHomMat.Line2.Column1 = aMat.get(1, 0);
    1005           0 :         aHomMat.Line2.Column2 = aMat.get(1, 1);
    1006           0 :         aHomMat.Line2.Column3 = aMat.get(1, 2);
    1007           0 :         aHomMat.Line2.Column4 = aMat.get(1, 3);
    1008           0 :         aHomMat.Line3.Column1 = aMat.get(2, 0);
    1009           0 :         aHomMat.Line3.Column2 = aMat.get(2, 1);
    1010           0 :         aHomMat.Line3.Column3 = aMat.get(2, 2);
    1011           0 :         aHomMat.Line3.Column4 = aMat.get(2, 3);
    1012           0 :         aHomMat.Line4.Column1 = aMat.get(3, 0);
    1013           0 :         aHomMat.Line4.Column2 = aMat.get(3, 1);
    1014           0 :         aHomMat.Line4.Column3 = aMat.get(3, 2);
    1015           0 :         aHomMat.Line4.Column4 = aMat.get(3, 3);
    1016             : 
    1017           0 :         rValue <<= aHomMat;
    1018           0 :         break;
    1019             :     }
    1020             : 
    1021             :     case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
    1022             :     {
    1023             :         // Polygondefinition packen
    1024           0 :         const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dExtrudeObj*>(mpObj.get())->GetExtrudePolygon();
    1025           0 :         const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
    1026             : 
    1027           0 :         B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon, rValue);
    1028           0 :         break;
    1029             :     }
    1030             :     default:
    1031           0 :         return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
    1032             :     }
    1033             : 
    1034           0 :     return true;
    1035             : }
    1036             : 
    1037             : // ::com::sun::star::lang::XServiceInfo
    1038           0 : uno::Sequence< OUString > SAL_CALL Svx3DExtrudeObject::getSupportedServiceNames()
    1039             :     throw(uno::RuntimeException)
    1040             : {
    1041           0 :     uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
    1042             :     comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
    1043           0 :                             "com.sun.star.drawing.Shape3DExtrude");
    1044           0 :     return aSeq;
    1045             : }
    1046             : 
    1047             : /***********************************************************************
    1048             : *                                                                      *
    1049             : ***********************************************************************/
    1050             : 
    1051             : //----------------------------------------------------------------------
    1052         241 : Svx3DPolygonObject::Svx3DPolygonObject( SdrObject* pObj ) throw()
    1053         241 : :   SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_3DPOLYGONOBJECT), getSvxMapProvider().GetPropertySet(SVXMAP_3DPOLYGONOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
    1054             : {
    1055         241 : }
    1056             : 
    1057             : //----------------------------------------------------------------------
    1058         482 : Svx3DPolygonObject::~Svx3DPolygonObject() throw()
    1059             : {
    1060         482 : }
    1061             : 
    1062             : //----------------------------------------------------------------------
    1063        5560 : 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)
    1064             : {
    1065        5560 :     switch( pProperty->nWID )
    1066             :     {
    1067             :     case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
    1068             :     {
    1069             :         // Transformationsmatrix in das Objekt packen
    1070           0 :         if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
    1071           0 :             return true;
    1072           0 :         break;
    1073             :     }
    1074             : 
    1075             :     case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
    1076             :     {
    1077             :         // Polygondefinition in das Objekt packen
    1078         240 :         basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
    1079             : 
    1080             :         // #i101520# Direct API data (e.g. from chart)
    1081         240 :         if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) )
    1082             :         {
    1083             :             // Polygon setzen
    1084         240 :             static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyPolygon3D(aNewB3DPolyPolygon);
    1085         240 :             return true;
    1086             :         }
    1087           0 :         break;
    1088             :     }
    1089             :     case OWN_ATTR_3D_VALUE_NORMALSPOLYGON3D:
    1090             :     {
    1091             :         // Normalendefinition in das Objekt packen
    1092         240 :         basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
    1093             : 
    1094             :         // #i101520# Direct API data (e.g. from chart)
    1095         240 :         if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) )
    1096             :         {
    1097             :             // Polygon setzen
    1098         240 :             static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyNormals3D(aNewB3DPolyPolygon);
    1099         240 :             return true;
    1100             :         }
    1101           0 :         break;
    1102             :     }
    1103             :     case OWN_ATTR_3D_VALUE_TEXTUREPOLYGON3D:
    1104             :     {
    1105             :         // Texturdefinition in das Objekt packen
    1106         240 :         basegfx::B3DPolyPolygon aNewB3DPolyPolygon;
    1107             : 
    1108             :         // #i101520# Direct API data (e.g. from chart)
    1109         240 :         if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) )
    1110             :         {
    1111             :             // Polygon setzen
    1112         240 :             const basegfx::B3DHomMatrix aIdentity;
    1113         480 :             const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
    1114         240 :             static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyTexture2D(aB2DPolyPolygon);
    1115         480 :             return true;
    1116             :         }
    1117           0 :         break;
    1118             :     }
    1119             :     case OWN_ATTR_3D_VALUE_LINEONLY:
    1120             :     {
    1121         240 :         sal_Bool bNew = sal_False;
    1122         240 :         if( rValue >>= bNew )
    1123             :         {
    1124         240 :             static_cast<E3dPolygonObj*>(mpObj.get())->SetLineOnly(bNew);
    1125         240 :             return true;
    1126             :         }
    1127           0 :         break;
    1128             :     }
    1129             :     default:
    1130        4600 :         return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
    1131             :     }
    1132             : 
    1133           0 :     throw IllegalArgumentException();
    1134             : }
    1135             : 
    1136             : //----------------------------------------------------------------------
    1137           0 : 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)
    1138             : {
    1139           0 :     switch( pProperty->nWID )
    1140             :     {
    1141             :     case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
    1142             :     {
    1143           0 :         ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
    1144           0 :         break;
    1145             :     }
    1146             : 
    1147             :     case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
    1148             :     {
    1149           0 :         B3dPolyPolygon_to_PolyPolygonShape3D(static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyPolygon3D(),rValue);
    1150           0 :         break;
    1151             :     }
    1152             : 
    1153             :     case OWN_ATTR_3D_VALUE_NORMALSPOLYGON3D:
    1154             :     {
    1155           0 :         B3dPolyPolygon_to_PolyPolygonShape3D(static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyNormals3D(),rValue);
    1156           0 :         break;
    1157             :     }
    1158             : 
    1159             :     case OWN_ATTR_3D_VALUE_TEXTUREPOLYGON3D:
    1160             :     {
    1161             :         // Texturdefinition packen
    1162           0 :         const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyTexture2D();
    1163           0 :         const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
    1164             : 
    1165           0 :         B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon,rValue);
    1166           0 :         break;
    1167             :     }
    1168             : 
    1169             :     case OWN_ATTR_3D_VALUE_LINEONLY:
    1170             :     {
    1171           0 :         rValue <<= (sal_Bool)static_cast<E3dPolygonObj*>(mpObj.get())->GetLineOnly();
    1172           0 :         break;
    1173             :     }
    1174             : 
    1175             :     default:
    1176           0 :         return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
    1177             :     }
    1178             : 
    1179           0 :     return true;
    1180             : }
    1181             : 
    1182             : // ::com::sun::star::lang::XServiceInfo
    1183           0 : uno::Sequence< OUString > SAL_CALL Svx3DPolygonObject::getSupportedServiceNames()
    1184             :     throw(uno::RuntimeException)
    1185             : {
    1186           0 :     Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
    1187             :     comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.drawing.Shape3D",
    1188           0 :                             "com.sun.star.drawing.Shape3DPolygon");
    1189           0 :     return aSeq;
    1190         258 : }
    1191             : 
    1192             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10