summaryrefslogtreecommitdiff
path: root/svx/source/unodraw/unoshap3.cxx
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de (CIB)>2018-03-01 15:54:32 +0100
committerArmin Le Grand <Armin.Le.Grand@cib.de>2018-04-06 22:29:02 +0200
commit6c14c27c75a03e2363f2b363ddf0a6f2f46cfa91 (patch)
treee66f50adb222dbc1490b4df2d3c63541dad999ac /svx/source/unodraw/unoshap3.cxx
parente1b247a843c5eb850fe0079819239d9883412d38 (diff)
SOSAW080: Added first bunch of basic changes to helpers
SOSAW080: Make SdrModel& prerequisite to SdrObjects Added need for SdrModel& in constructors of SdrModel, SdrPage, SdrView and SdrObjList. Builds, not finished. SOSAW080: removed and replaced old SdrModel Removed and replaced GetModel()/SetModel() in all using classes (SdrObject, SdrPage, SdrView), added accessors to new referenced SdrModel, adapted all accessing places. Refactored/Extended ::Clone and ::operator== for these classes to allow cloning objects to a target SdrModel. Adapted places where this is done AFAP. Added quite some comments (tagged with 'TTTT') where possible further work is needed. Builds completely, thus checking in. This does not mean that this change is done yet. SOSAW080: Adapted SdrPage/SdrModel relationship Also needed to work on copy-construction of SdrPage and hierarchy, quite some stuff removed, no copy-constructor anymore, no MigrateItemPool stuff. Builds well, test stuck, will need some cleanup/finetunung SOSAW080: Smaller corrections/includes adapted SOSAW080: Smaller corrections/includes adapted SOSAW080: Debugging/Stabilizing/MakeUnitTestWork SOSAW080: Stabilized for UnitTests, cleanups SOSAW080: Adapted GetObjGraphic to just take a const SdrObject& SOSAW080: Removed ChangeModel from classes Classes SvxTextEditSource and SvxDrawPage (including TextEditSource stuff) do not need change of SdrModel anymore. SOSAW080: Adapted some comments to make more readable SOSAW080: Corrected constructor SOSAW080: getSdrModelFromUnoModel added override marks SOSAW080: Added missing includes SOSAW080: Corrected SdrPage constructor SOSAW080: Corrected some SdrObject::Clone scenarios Especially when cloning to another SdrModel and taking the sdr::properties into account. SOSAW080: Added include for Mac-Build SOSAW080: Added Scale to DefaultProperties If a SdrModel change happens in DefaultProperties copy constructor (used from Clone()), potentially a Scale for the SfxItems has to be done. SOSAW080: Added missing include for MacBuild SOSAW080: Corrected CppunitTest_sc_anchor_test An adaption of a SdrPathObj instantiation was missing, added that. Seems as if that test is no tpart of the usual 'make' scenario, but used/executed in gerrit builds SOSAW080: Reworked SvxShape to use SdrObject's SdrModel SOSAW080: Reworked SvxShape to use SdrObject's SdrModel SOSAW080: Free SdrObjects when SdrModel goes down In an UNO API test problem is that SvxShapes reference SdrShapes, but these are not added to a SdrPage and not 'owned' by the SvxShape. Thus these do not get deleted at all (same in master, memory leak). I extended SvxShape::Notify the case for ModelCleared to also Free the SdrObject when not owner and it's not added to a SdrPage (in that case it gets deleted with deleting the SdrModel) SOSAW080: Solve UNO API calls that move SvxShapes to other Model Due to UNO API tests I got a call to insert an xShape to a xDrawPage which was constructed in another Model, this has now to be done by Cloning the SdrObject to the new SdrModel, getting rid of the old one and getting all the UNO implementation stuff right (referemces SdrObject <-> xShape). Change-Id: Iaf53535de0502a481466be74a1768bbb39f0e78c 1cb7d573d323e98a89761fe662c10c4a654fdec0 24617494a0ef79f6e33dfcb02782a833a81c6434 763f39094b6a48b529a6952d01468f8776c97679 242b9e228a9a042c3a5bdd38b1ea6600144276d5 242b9e228a9a042c3a5bdd38b1ea6600144276d5 33a6f3f306b70c223171aef796dd5ee041ad14df 6878b33f8b05738a44c0910e40a60a0f0d1d58ed 0a636caf3cb36c2f9c6cd11aa22cb9bc435dc8f2 8c4626274a5cc531dad27f27c0c45d4c528fb2fb 446685a49a6d67aedd01cfbbd5e87b07f97a4d7b c1b5ed3c99bc7219a0061e4ece24ea42afd2889a 22de9a1c8af7c25be5c108671ddc548ba323ed47 4caf6b6fbbe6e8130741d793dffb560fd01d4ed5 488b9601735ec1822433f82f633990063951fe08 c366d60299f239e3df856ddffedb19e743e4be0c c5137ba8c597c7b5f90318df50e87b93a39a28dc f9e646242cf89f6fde1315046952252a2c429779 f830fbc5fadd89d04be5edd2a5abf9b0d4bf0410 1694b54903df784385abaa8452e1201e12344238 17bcb44d2e29920c0c74430c2d9c703b36cfa0ad 17bcb44d2e29920c0c74430c2d9c703b36cfa0ad 7b5c241faec7488924e5935ae8b19f785846b5e4 bf097ee7467895823fbd158a2a9543da3b5a5078
Diffstat (limited to 'svx/source/unodraw/unoshap3.cxx')
-rw-r--r--svx/source/unodraw/unoshap3.cxx182
1 files changed, 57 insertions, 125 deletions
diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx
index 66ac52b876db..663dcc9f6bd9 100644
--- a/svx/source/unodraw/unoshap3.cxx
+++ b/svx/source/unodraw/unoshap3.cxx
@@ -45,6 +45,7 @@
#include <basegfx/polygon/b3dpolygontools.hxx>
#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/matrix/b3dhommatrixtools.hxx>
#include "shapeimpl.hxx"
using namespace ::cppu;
@@ -118,13 +119,13 @@ void SAL_CALL Svx3DSceneObject::add( const Reference< drawing::XShape >& xShape
SvxShape* pShape = SvxShape::getImplementation( xShape );
- if(!mpObj.is() || !mxPage.is() || pShape == nullptr || nullptr != pShape->GetSdrObject() )
+ if(!HasSdrObject() || !mxPage.is() || pShape == nullptr || nullptr != pShape->GetSdrObject() )
throw uno::RuntimeException();
SdrObject* pSdrShape = mxPage->CreateSdrObject_( xShape );
if( dynamic_cast<const E3dObject* >(pSdrShape) != nullptr )
{
- mpObj->GetSubList()->NbcInsertObject( pSdrShape );
+ GetSdrObject()->GetSubList()->NbcInsertObject( pSdrShape );
if(pShape)
pShape->Create( pSdrShape, mxPage.get() );
@@ -135,8 +136,7 @@ void SAL_CALL Svx3DSceneObject::add( const Reference< drawing::XShape >& xShape
throw uno::RuntimeException();
}
- if( mpModel )
- mpModel->SetChanged();
+ GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
}
@@ -146,11 +146,11 @@ void SAL_CALL Svx3DSceneObject::remove( const Reference< drawing::XShape >& xSha
SvxShape* pShape = SvxShape::getImplementation( xShape );
- if(!mpObj.is() || pShape == nullptr)
+ if(!HasSdrObject() || pShape == nullptr)
throw uno::RuntimeException();
SdrObject* pSdrShape = pShape->GetSdrObject();
- if(pSdrShape == nullptr || pSdrShape->GetObjList()->GetOwnerObj() != mpObj.get())
+ if(pSdrShape == nullptr || pSdrShape->GetObjList()->GetOwnerObj() != GetSdrObject())
{
throw uno::RuntimeException();
}
@@ -184,8 +184,8 @@ sal_Int32 SAL_CALL Svx3DSceneObject::getCount()
sal_Int32 nRetval = 0;
- if(mpObj.is() && dynamic_cast<const E3dScene* >(mpObj.get()) != nullptr && mpObj->GetSubList())
- nRetval = mpObj->GetSubList()->GetObjCount();
+ if(HasSdrObject() && dynamic_cast<const E3dScene* >(GetSdrObject()) != nullptr && GetSdrObject()->GetSubList())
+ nRetval = GetSdrObject()->GetSubList()->GetObjCount();
return nRetval;
}
@@ -194,13 +194,13 @@ uno::Any SAL_CALL Svx3DSceneObject::getByIndex( sal_Int32 Index )
{
SolarMutexGuard aGuard;
- if( !mpObj.is() || mpObj->GetSubList() == nullptr )
+ if( !HasSdrObject() || GetSdrObject()->GetSubList() == nullptr )
throw uno::RuntimeException();
- if( Index<0 || mpObj->GetSubList()->GetObjCount() <= static_cast<size_t>(Index) )
+ if( Index<0 || GetSdrObject()->GetSubList()->GetObjCount() <= static_cast<size_t>(Index) )
throw lang::IndexOutOfBoundsException();
- SdrObject* pDestObj = mpObj->GetSubList()->GetObj( Index );
+ SdrObject* pDestObj = GetSdrObject()->GetSubList()->GetObj( Index );
if(pDestObj == nullptr)
throw lang::IndexOutOfBoundsException();
@@ -221,33 +221,16 @@ sal_Bool SAL_CALL Svx3DSceneObject::hasElements()
{
SolarMutexGuard aGuard;
- return mpObj.is() && mpObj->GetSubList() && (mpObj->GetSubList()->GetObjCount() > 0);
+ return HasSdrObject() && GetSdrObject()->GetSubList() && (GetSdrObject()->GetSubList()->GetObjCount() > 0);
}
static bool ConvertHomogenMatrixToObject( E3dObject* pObject, const Any& rValue )
{
- drawing::HomogenMatrix m;
- if( rValue >>= m )
+ drawing::HomogenMatrix aMat;
+ if( rValue >>= aMat )
{
- basegfx::B3DHomMatrix aMat;
- aMat.set(0, 0, m.Line1.Column1);
- aMat.set(0, 1, m.Line1.Column2);
- aMat.set(0, 2, m.Line1.Column3);
- aMat.set(0, 3, m.Line1.Column4);
- aMat.set(1, 0, m.Line2.Column1);
- aMat.set(1, 1, m.Line2.Column2);
- aMat.set(1, 2, m.Line2.Column3);
- aMat.set(1, 3, m.Line2.Column4);
- aMat.set(2, 0, m.Line3.Column1);
- aMat.set(2, 1, m.Line3.Column2);
- aMat.set(2, 2, m.Line3.Column3);
- aMat.set(2, 3, m.Line3.Column4);
- aMat.set(3, 0, m.Line4.Column1);
- aMat.set(3, 1, m.Line4.Column2);
- aMat.set(3, 2, m.Line4.Column3);
- aMat.set(3, 3, m.Line4.Column4);
- pObject->SetTransform(aMat);
+ pObject->SetTransform(basegfx::utils::UnoHomogenMatrixToB3DHomMatrix(aMat));
return true;
}
return false;
@@ -257,22 +240,7 @@ static void ConvertObjectToHomogenMatric( E3dObject const * pObject, Any& rValue
{
drawing::HomogenMatrix aHomMat;
const basegfx::B3DHomMatrix& rMat = pObject->GetTransform();
- aHomMat.Line1.Column1 = rMat.get(0, 0);
- aHomMat.Line1.Column2 = rMat.get(0, 1);
- aHomMat.Line1.Column3 = rMat.get(0, 2);
- aHomMat.Line1.Column4 = rMat.get(0, 3);
- aHomMat.Line2.Column1 = rMat.get(1, 0);
- aHomMat.Line2.Column2 = rMat.get(1, 1);
- aHomMat.Line2.Column3 = rMat.get(1, 2);
- aHomMat.Line2.Column4 = rMat.get(1, 3);
- aHomMat.Line3.Column1 = rMat.get(2, 0);
- aHomMat.Line3.Column2 = rMat.get(2, 1);
- aHomMat.Line3.Column3 = rMat.get(2, 2);
- aHomMat.Line3.Column4 = rMat.get(2, 3);
- aHomMat.Line4.Column1 = rMat.get(3, 0);
- aHomMat.Line4.Column2 = rMat.get(3, 1);
- aHomMat.Line4.Column3 = rMat.get(3, 2);
- aHomMat.Line4.Column4 = rMat.get(3, 3);
+ basegfx::utils::B3DHomMatrixToUnoHomogenMatrix(rMat, aHomMat);
rValue <<= aHomMat;
}
@@ -290,14 +258,14 @@ bool Svx3DSceneObject::setPropertyValueImpl( const OUString& rName, const SfxIte
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// patch transformation matrix to the object
- if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( GetSdrObject() ), rValue ) )
return true;
break;
}
case OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY:
{
// set CameraGeometry at scene
- E3dScene* pScene = static_cast< E3dScene* >( mpObj.get() );
+ E3dScene* pScene = static_cast< E3dScene* >( GetSdrObject() );
drawing::CameraGeometry aCamGeo;
if(rValue >>= aCamGeo)
@@ -402,13 +370,13 @@ bool Svx3DSceneObject::getPropertyValueImpl(const OUString& rName, const SfxItem
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// patch object to a homogeneous 4x4 matrix
- ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
+ ConvertObjectToHomogenMatric( static_cast< E3dObject* >( GetSdrObject() ), rValue );
break;
}
case OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY:
{
// get CameraGeometry from scene
- E3dScene* pScene = static_cast< E3dScene* >( mpObj.get() );
+ E3dScene* pScene = static_cast< E3dScene* >( GetSdrObject() );
drawing::CameraGeometry aCamGeo;
// fill Vectors from scene camera
@@ -464,7 +432,7 @@ bool Svx3DCubeObject::setPropertyValueImpl( const OUString& rName, const SfxItem
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// pack transformationmatrix to the object
- if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( GetSdrObject() ), rValue ) )
return true;
break;
}
@@ -475,7 +443,7 @@ bool Svx3DCubeObject::setPropertyValueImpl( const OUString& rName, const SfxItem
if( rValue >>= aUnoPos )
{
basegfx::B3DPoint aPos(aUnoPos.PositionX, aUnoPos.PositionY, aUnoPos.PositionZ);
- static_cast< E3dCubeObj* >( mpObj.get() )->SetCubePos(aPos);
+ static_cast< E3dCubeObj* >( GetSdrObject() )->SetCubePos(aPos);
return true;
}
break;
@@ -487,7 +455,7 @@ bool Svx3DCubeObject::setPropertyValueImpl( const OUString& rName, const SfxItem
if( rValue >>= aDirection )
{
basegfx::B3DVector aSize(aDirection.DirectionX, aDirection.DirectionY, aDirection.DirectionZ);
- static_cast< E3dCubeObj* >( mpObj.get() )->SetCubeSize(aSize);
+ static_cast< E3dCubeObj* >( GetSdrObject() )->SetCubeSize(aSize);
return true;
}
break;
@@ -498,7 +466,7 @@ bool Svx3DCubeObject::setPropertyValueImpl( const OUString& rName, const SfxItem
// pack sal_Bool bPosIsCenter to the object
if( rValue >>= bNew )
{
- static_cast< E3dCubeObj* >( mpObj.get() )->SetPosIsCenter(bNew);
+ static_cast< E3dCubeObj* >( GetSdrObject() )->SetPosIsCenter(bNew);
return true;
}
break;
@@ -517,13 +485,13 @@ bool Svx3DCubeObject::getPropertyValueImpl( const OUString& rName, const SfxItem
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// pack transformation to a homogeneous matrix
- ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
+ ConvertObjectToHomogenMatric( static_cast< E3dObject* >( GetSdrObject() ), rValue );
break;
}
case OWN_ATTR_3D_VALUE_POSITION:
{
// pack position
- const basegfx::B3DPoint& rPos = static_cast<E3dCubeObj*>(mpObj.get())->GetCubePos();
+ const basegfx::B3DPoint& rPos = static_cast<E3dCubeObj*>(GetSdrObject())->GetCubePos();
drawing::Position3D aPos;
aPos.PositionX = rPos.getX();
@@ -536,7 +504,7 @@ bool Svx3DCubeObject::getPropertyValueImpl( const OUString& rName, const SfxItem
case OWN_ATTR_3D_VALUE_SIZE:
{
// pack size
- const basegfx::B3DVector& rSize = static_cast<E3dCubeObj*>(mpObj.get())->GetCubeSize();
+ const basegfx::B3DVector& rSize = static_cast<E3dCubeObj*>(GetSdrObject())->GetCubeSize();
drawing::Direction3D aDir;
aDir.DirectionX = rSize.getX();
@@ -548,7 +516,7 @@ bool Svx3DCubeObject::getPropertyValueImpl( const OUString& rName, const SfxItem
}
case OWN_ATTR_3D_VALUE_POS_IS_CENTER:
{
- rValue <<= static_cast<E3dCubeObj*>(mpObj.get())->GetPosIsCenter();
+ rValue <<= static_cast<E3dCubeObj*>(GetSdrObject())->GetPosIsCenter();
break;
}
default:
@@ -583,7 +551,7 @@ bool Svx3DSphereObject::setPropertyValueImpl( const OUString& rName, const SfxIt
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// pack transformation matrix to the object
- if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( GetSdrObject() ), rValue ) )
return true;
break;
}
@@ -595,7 +563,7 @@ bool Svx3DSphereObject::setPropertyValueImpl( const OUString& rName, const SfxIt
if( rValue >>= aUnoPos )
{
basegfx::B3DPoint aPos(aUnoPos.PositionX, aUnoPos.PositionY, aUnoPos.PositionZ);
- static_cast<E3dSphereObj*>(mpObj.get())->SetCenter(aPos);
+ static_cast<E3dSphereObj*>(GetSdrObject())->SetCenter(aPos);
return true;
}
break;
@@ -608,7 +576,7 @@ bool Svx3DSphereObject::setPropertyValueImpl( const OUString& rName, const SfxIt
if( rValue >>= aDir )
{
basegfx::B3DVector aPos(aDir.DirectionX, aDir.DirectionY, aDir.DirectionZ);
- static_cast<E3dSphereObj*>(mpObj.get())->SetSize(aPos);
+ static_cast<E3dSphereObj*>(GetSdrObject())->SetSize(aPos);
return true;
}
break;
@@ -627,13 +595,13 @@ bool Svx3DSphereObject::getPropertyValueImpl( const OUString& rName, const SfxIt
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// pack transformation to a homogeneous matrix
- ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
+ ConvertObjectToHomogenMatric( static_cast< E3dObject* >( GetSdrObject() ), rValue );
break;
}
case OWN_ATTR_3D_VALUE_POSITION:
{
// pack position
- const basegfx::B3DPoint& rPos = static_cast<E3dSphereObj*>(mpObj.get())->Center();
+ const basegfx::B3DPoint& rPos = static_cast<E3dSphereObj*>(GetSdrObject())->Center();
drawing::Position3D aPos;
aPos.PositionX = rPos.getX();
@@ -646,7 +614,7 @@ bool Svx3DSphereObject::getPropertyValueImpl( const OUString& rName, const SfxIt
case OWN_ATTR_3D_VALUE_SIZE:
{
// pack size
- const basegfx::B3DVector& rSize = static_cast<E3dSphereObj*>(mpObj.get())->Size();
+ const basegfx::B3DVector& rSize = static_cast<E3dSphereObj*>(GetSdrObject())->Size();
drawing::Direction3D aDir;
aDir.DirectionX = rSize.getX();
@@ -776,7 +744,7 @@ bool Svx3DLatheObject::setPropertyValueImpl( const OUString& rName, const SfxIte
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// pack transformation matrix to the object
- if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( GetSdrObject() ), rValue ) )
return true;
break;
}
@@ -791,18 +759,18 @@ bool Svx3DLatheObject::setPropertyValueImpl( const OUString& rName, const SfxIte
// #105127# SetPolyPoly3D sets the Svx3DVerticalSegmentsItem to the number
// of points of the polygon. Thus, value gets lost. To avoid this, rescue
// item here and re-set after setting the polygon.
- const sal_uInt32 nPrevVerticalSegs(static_cast<E3dLatheObj*>(mpObj.get())->GetVerticalSegments());
+ const sal_uInt32 nPrevVerticalSegs(static_cast<E3dLatheObj*>(GetSdrObject())->GetVerticalSegments());
// set polygon
const basegfx::B3DHomMatrix aIdentity;
const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::utils::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
- static_cast<E3dLatheObj*>(mpObj.get())->SetPolyPoly2D(aB2DPolyPolygon);
- const sal_uInt32 nPostVerticalSegs(static_cast<E3dLatheObj*>(mpObj.get())->GetVerticalSegments());
+ static_cast<E3dLatheObj*>(GetSdrObject())->SetPolyPoly2D(aB2DPolyPolygon);
+ const sal_uInt32 nPostVerticalSegs(static_cast<E3dLatheObj*>(GetSdrObject())->GetVerticalSegments());
if(nPrevVerticalSegs != nPostVerticalSegs)
{
// restore the vertical segment count
- static_cast<E3dLatheObj*>(mpObj.get())->SetMergedItem(makeSvx3DVerticalSegmentsItem(nPrevVerticalSegs));
+ static_cast<E3dLatheObj*>(GetSdrObject())->SetMergedItem(makeSvx3DVerticalSegmentsItem(nPrevVerticalSegs));
}
return true;
}
@@ -823,32 +791,14 @@ bool Svx3DLatheObject::getPropertyValueImpl( const OUString& rName, const SfxIte
{
// pack transformation to a homogeneous matrix
drawing::HomogenMatrix aHomMat;
- basegfx::B3DHomMatrix aMat = static_cast<E3dObject*>(mpObj.get())->GetTransform();
-
- // pack evtl. transformed matrix to output
- aHomMat.Line1.Column1 = aMat.get(0, 0);
- aHomMat.Line1.Column2 = aMat.get(0, 1);
- aHomMat.Line1.Column3 = aMat.get(0, 2);
- aHomMat.Line1.Column4 = aMat.get(0, 3);
- aHomMat.Line2.Column1 = aMat.get(1, 0);
- aHomMat.Line2.Column2 = aMat.get(1, 1);
- aHomMat.Line2.Column3 = aMat.get(1, 2);
- aHomMat.Line2.Column4 = aMat.get(1, 3);
- aHomMat.Line3.Column1 = aMat.get(2, 0);
- aHomMat.Line3.Column2 = aMat.get(2, 1);
- aHomMat.Line3.Column3 = aMat.get(2, 2);
- aHomMat.Line3.Column4 = aMat.get(2, 3);
- aHomMat.Line4.Column1 = aMat.get(3, 0);
- aHomMat.Line4.Column2 = aMat.get(3, 1);
- aHomMat.Line4.Column3 = aMat.get(3, 2);
- aHomMat.Line4.Column4 = aMat.get(3, 3);
-
+ basegfx::B3DHomMatrix aMat = static_cast<E3dObject*>(GetSdrObject())->GetTransform();
+ basegfx::utils::B3DHomMatrixToUnoHomogenMatrix(aMat, aHomMat);
rValue <<= aHomMat;
break;
}
case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
{
- const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dLatheObj*>(mpObj.get())->GetPolyPoly2D();
+ const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dLatheObj*>(GetSdrObject())->GetPolyPoly2D();
const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::utils::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon, rValue);
@@ -886,7 +836,7 @@ bool Svx3DExtrudeObject::setPropertyValueImpl( const OUString& rName, const SfxI
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// pack transformation matrix to the object
- if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( GetSdrObject() ), rValue ) )
return true;
break;
}
@@ -902,7 +852,7 @@ bool Svx3DExtrudeObject::setPropertyValueImpl( const OUString& rName, const SfxI
// set polygon
const basegfx::B3DHomMatrix aIdentity;
const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::utils::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
- static_cast<E3dExtrudeObj*>(mpObj.get())->SetExtrudePolygon(aB2DPolyPolygon);
+ static_cast<E3dExtrudeObj*>(GetSdrObject())->SetExtrudePolygon(aB2DPolyPolygon);
return true;
}
break;
@@ -922,26 +872,8 @@ bool Svx3DExtrudeObject::getPropertyValueImpl( const OUString& rName, const SfxI
{
// pack transformation to a homogeneous matrix
drawing::HomogenMatrix aHomMat;
- basegfx::B3DHomMatrix aMat = static_cast<E3dObject*>(mpObj.get())->GetTransform();
-
- // pack evtl. transformed matrix to output
- aHomMat.Line1.Column1 = aMat.get(0, 0);
- aHomMat.Line1.Column2 = aMat.get(0, 1);
- aHomMat.Line1.Column3 = aMat.get(0, 2);
- aHomMat.Line1.Column4 = aMat.get(0, 3);
- aHomMat.Line2.Column1 = aMat.get(1, 0);
- aHomMat.Line2.Column2 = aMat.get(1, 1);
- aHomMat.Line2.Column3 = aMat.get(1, 2);
- aHomMat.Line2.Column4 = aMat.get(1, 3);
- aHomMat.Line3.Column1 = aMat.get(2, 0);
- aHomMat.Line3.Column2 = aMat.get(2, 1);
- aHomMat.Line3.Column3 = aMat.get(2, 2);
- aHomMat.Line3.Column4 = aMat.get(2, 3);
- aHomMat.Line4.Column1 = aMat.get(3, 0);
- aHomMat.Line4.Column2 = aMat.get(3, 1);
- aHomMat.Line4.Column3 = aMat.get(3, 2);
- aHomMat.Line4.Column4 = aMat.get(3, 3);
-
+ basegfx::B3DHomMatrix aMat = static_cast<E3dObject*>(GetSdrObject())->GetTransform();
+ basegfx::utils::B3DHomMatrixToUnoHomogenMatrix(aMat, aHomMat);
rValue <<= aHomMat;
break;
}
@@ -949,7 +881,7 @@ bool Svx3DExtrudeObject::getPropertyValueImpl( const OUString& rName, const SfxI
case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
{
// pack polygon definition
- const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dExtrudeObj*>(mpObj.get())->GetExtrudePolygon();
+ const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dExtrudeObj*>(GetSdrObject())->GetExtrudePolygon();
const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::utils::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon, rValue);
@@ -987,7 +919,7 @@ bool Svx3DPolygonObject::setPropertyValueImpl( const OUString& rName, const SfxI
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// pack transformation matrix to the object
- if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( GetSdrObject() ), rValue ) )
return true;
break;
}
@@ -1001,7 +933,7 @@ bool Svx3DPolygonObject::setPropertyValueImpl( const OUString& rName, const SfxI
if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) )
{
// set polygon
- static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyPolygon3D(aNewB3DPolyPolygon);
+ static_cast<E3dPolygonObj*>(GetSdrObject())->SetPolyPolygon3D(aNewB3DPolyPolygon);
return true;
}
break;
@@ -1015,7 +947,7 @@ bool Svx3DPolygonObject::setPropertyValueImpl( const OUString& rName, const SfxI
if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) )
{
// set polygon
- static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyNormals3D(aNewB3DPolyPolygon);
+ static_cast<E3dPolygonObj*>(GetSdrObject())->SetPolyNormals3D(aNewB3DPolyPolygon);
return true;
}
break;
@@ -1031,7 +963,7 @@ bool Svx3DPolygonObject::setPropertyValueImpl( const OUString& rName, const SfxI
// set polygon
const basegfx::B3DHomMatrix aIdentity;
const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::utils::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
- static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyTexture2D(aB2DPolyPolygon);
+ static_cast<E3dPolygonObj*>(GetSdrObject())->SetPolyTexture2D(aB2DPolyPolygon);
return true;
}
break;
@@ -1041,7 +973,7 @@ bool Svx3DPolygonObject::setPropertyValueImpl( const OUString& rName, const SfxI
bool bNew = false;
if( rValue >>= bNew )
{
- static_cast<E3dPolygonObj*>(mpObj.get())->SetLineOnly(bNew);
+ static_cast<E3dPolygonObj*>(GetSdrObject())->SetLineOnly(bNew);
return true;
}
break;
@@ -1059,26 +991,26 @@ bool Svx3DPolygonObject::getPropertyValueImpl( const OUString& rName, const SfxI
{
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
- ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
+ ConvertObjectToHomogenMatric( static_cast< E3dObject* >( GetSdrObject() ), rValue );
break;
}
case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
{
- B3dPolyPolygon_to_PolyPolygonShape3D(static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyPolygon3D(),rValue);
+ B3dPolyPolygon_to_PolyPolygonShape3D(static_cast<E3dPolygonObj*>(GetSdrObject())->GetPolyPolygon3D(),rValue);
break;
}
case OWN_ATTR_3D_VALUE_NORMALSPOLYGON3D:
{
- B3dPolyPolygon_to_PolyPolygonShape3D(static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyNormals3D(),rValue);
+ B3dPolyPolygon_to_PolyPolygonShape3D(static_cast<E3dPolygonObj*>(GetSdrObject())->GetPolyNormals3D(),rValue);
break;
}
case OWN_ATTR_3D_VALUE_TEXTUREPOLYGON3D:
{
// pack texture definition
- const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyTexture2D();
+ const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dPolygonObj*>(GetSdrObject())->GetPolyTexture2D();
const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::utils::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon,rValue);
@@ -1087,7 +1019,7 @@ bool Svx3DPolygonObject::getPropertyValueImpl( const OUString& rName, const SfxI
case OWN_ATTR_3D_VALUE_LINEONLY:
{
- rValue <<= static_cast<E3dPolygonObj*>(mpObj.get())->GetLineOnly();
+ rValue <<= static_cast<E3dPolygonObj*>(GetSdrObject())->GetLineOnly();
break;
}