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

Generated by: LCOV version 1.10