22#include <initializer_list>
25#include <com/sun/star/drawing/HomogenMatrix.hpp>
26#include <com/sun/star/drawing/Position3D.hpp>
27#include <com/sun/star/drawing/Direction3D.hpp>
28#include <com/sun/star/drawing/DoubleSequence.hpp>
29#include <com/sun/star/drawing/CameraGeometry.hpp>
30#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
50#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
55using namespace ::
cppu;
61#define QUERYINT( xint ) \
62 if( rType == cppu::UnoType<xint>::get() ) \
63 aAny <<= Reference< xint >(this)
89 else QUERYINT( container::XIndexAccess );
90 else QUERYINT( container::XElementAccess );
106 return css::uno::Sequence<sal_Int8>();
114 SvxShape* pShape = comphelper::getFromUnoTunnel<SvxShape>( xShape );
117 throw uno::RuntimeException();
128 throw uno::RuntimeException();
139 throw uno::RuntimeException();
150 throw uno::RuntimeException();
164 throw uno::RuntimeException();
170 while( nObjNum < nObjCount )
172 if(rList.
GetObj( nObjNum ) == pSdrShape )
177 if( nObjNum < nObjCount )
183 SAL_WARN(
"svx",
"Fatality! SdrObject is not belonging to its SdrObjList! [CL]" );
192 sal_Int32 nRetval = 0;
205 throw uno::RuntimeException();
208 throw lang::IndexOutOfBoundsException();
211 if(pDestObj ==
nullptr)
212 throw lang::IndexOutOfBoundsException();
214 Reference< drawing::XShape > xShape( pDestObj->
getUnoShape(), uno::UNO_QUERY );
237 drawing::HomogenMatrix aMat;
238 if( rValue >>= aMat )
248 drawing::HomogenMatrix aHomMat;
256struct ImpRememberTransAndRect
266 switch( pProperty->
nWID )
279 drawing::CameraGeometry aCamGeo;
281 if(rValue >>= aCamGeo)
283 basegfx::B3DPoint aVRP(aCamGeo.vrp.PositionX, aCamGeo.vrp.PositionY, aCamGeo.vrp.PositionZ);
284 basegfx::B3DVector aVPN(aCamGeo.vpn.DirectionX, aCamGeo.vpn.DirectionY, aCamGeo.vpn.DirectionZ);
285 basegfx::B3DVector aVUP(aCamGeo.vup.DirectionX, aCamGeo.vup.DirectionY, aCamGeo.vup.DirectionZ);
288 ImpRememberTransAndRect aSceneTAR;
294 std::vector<basegfx::B3DHomMatrix*> aObjTrans;
300 aObjTrans.push_back(pNew);
342 if(bVRPUsed || bVPNUsed || bVUPUsed)
370 throw IllegalArgumentException();
375 css::uno::Any& rValue)
377 switch( pProperty->
nWID )
389 drawing::CameraGeometry aCamGeo;
398 aCamGeo.vrp.PositionX = aVRP.
getX();
399 aCamGeo.vrp.PositionY = aVRP.
getY();
400 aCamGeo.vrp.PositionZ = aVRP.
getZ();
401 aCamGeo.vpn.DirectionX = aVPN.
getX();
402 aCamGeo.vpn.DirectionY = aVPN.
getY();
403 aCamGeo.vpn.DirectionZ = aVPN.
getZ();
404 aCamGeo.vup.DirectionX = aVUP.
getX();
405 aCamGeo.vup.DirectionY = aVUP.
getY();
406 aCamGeo.vup.DirectionZ = aVUP.
getZ();
423 std::initializer_list<std::u16string_view>{
u"com.sun.star.drawing.Shape3DScene" });
439 switch( pProperty->
nWID )
451 drawing::Position3D aUnoPos;
452 if( rValue >>= aUnoPos )
476 if( rValue >>= bNew )
487 throw IllegalArgumentException();
492 switch( pProperty->
nWID )
504 drawing::Position3D aPos;
506 aPos.PositionX = rPos.
getX();
507 aPos.PositionY = rPos.
getY();
508 aPos.PositionZ = rPos.
getZ();
517 drawing::Direction3D aDir;
519 aDir.DirectionX = rSize.
getX();
520 aDir.DirectionY = rSize.
getY();
521 aDir.DirectionZ = rSize.
getZ();
528 rValue <<= static_cast<E3dCubeObj*>(
GetSdrObject())->GetPosIsCenter();
543 std::initializer_list<std::u16string_view>{
u"com.sun.star.drawing.Shape3D",
544 u"com.sun.star.drawing.Shape3DCube" });
558 switch( pProperty->
nWID )
571 drawing::Position3D aUnoPos;
572 if( rValue >>= aUnoPos )
584 drawing::Direction3D aDir;
585 if( rValue >>= aDir )
597 throw IllegalArgumentException();
602 switch( pProperty->
nWID )
614 drawing::Position3D aPos;
616 aPos.PositionX = rPos.
getX();
617 aPos.PositionY = rPos.
getY();
618 aPos.PositionZ = rPos.
getZ();
627 drawing::Direction3D aDir;
629 aDir.DirectionX = rSize.
getX();
630 aDir.DirectionY = rSize.
getY();
631 aDir.DirectionZ = rSize.
getZ();
648 std::initializer_list<std::u16string_view>{
u"com.sun.star.drawing.Shape3D",
649 u"com.sun.star.drawing.Shape3DSphere" });
664 bool bCorrectPolygon)
666 drawing::PolyPolygonShape3D aSourcePolyPolygon;
667 if( !(rValue >>= aSourcePolyPolygon) )
670 sal_Int32 nOuterSequenceCount = aSourcePolyPolygon.SequenceX.getLength();
671 if(nOuterSequenceCount != aSourcePolyPolygon.SequenceY.getLength() || nOuterSequenceCount != aSourcePolyPolygon.SequenceZ.getLength())
674 const drawing::DoubleSequence* pInnerSequenceX = aSourcePolyPolygon.SequenceX.getConstArray();
675 const drawing::DoubleSequence* pInnerSequenceY = aSourcePolyPolygon.SequenceY.getConstArray();
676 const drawing::DoubleSequence* pInnerSequenceZ = aSourcePolyPolygon.SequenceZ.getConstArray();
677 for(sal_Int32
a(0);
a<nOuterSequenceCount;
a++)
679 sal_Int32 nInnerSequenceCount = pInnerSequenceX->getLength();
680 if(nInnerSequenceCount != pInnerSequenceY->getLength() || nInnerSequenceCount != pInnerSequenceZ->getLength())
685 const double* pArrayX = pInnerSequenceX->getConstArray();
686 const double* pArrayY = pInnerSequenceY->getConstArray();
687 const double* pArrayZ = pInnerSequenceZ->getConstArray();
688 for(sal_Int32 b(0);b<nInnerSequenceCount;b++)
703 rResultPolygon.
append(aNewPolygon);
710 drawing::PolyPolygonShape3D aRetval;
711 aRetval.SequenceX.realloc(rSourcePolyPolygon.
count());
712 aRetval.SequenceY.realloc(rSourcePolyPolygon.
count());
713 aRetval.SequenceZ.realloc(rSourcePolyPolygon.
count());
714 drawing::DoubleSequence* pOuterSequenceX = aRetval.SequenceX.getArray();
715 drawing::DoubleSequence* pOuterSequenceY = aRetval.SequenceY.getArray();
716 drawing::DoubleSequence* pOuterSequenceZ = aRetval.SequenceZ.getArray();
717 for(sal_uInt32
a(0);
a<rSourcePolyPolygon.
count();
a++)
720 sal_Int32 nPointCount(aPoly.
count());
722 pOuterSequenceX->realloc(nPointCount);
723 pOuterSequenceY->realloc(nPointCount);
724 pOuterSequenceZ->realloc(nPointCount);
725 double* pInnerSequenceX = pOuterSequenceX->getArray();
726 double* pInnerSequenceY = pOuterSequenceY->getArray();
727 double* pInnerSequenceZ = pOuterSequenceZ->getArray();
728 for(sal_uInt32 b(0);b<aPoly.
count();b++)
731 *pInnerSequenceX++ = aPoint.
getX();
732 *pInnerSequenceY++ = aPoint.
getY();
733 *pInnerSequenceZ++ = aPoint.
getZ();
738 *pInnerSequenceX++ = aPoint.
getX();
739 *pInnerSequenceY++ = aPoint.
getY();
740 *pInnerSequenceZ++ = aPoint.
getZ();
751 switch( pProperty->
nWID )
779 if(nPrevVerticalSegs != nPostVerticalSegs)
792 throw IllegalArgumentException();
797 switch( pProperty->
nWID )
802 drawing::HomogenMatrix aHomMat;
828 std::initializer_list<std::u16string_view>{
u"com.sun.star.drawing.Shape3D",
829 u"com.sun.star.drawing.Shape3DLathe" });
843 switch( pProperty->
nWID )
864 static_cast<E3dExtrudeObj*
>(
GetSdrObject())->SetExtrudePolygon(aB2DPolyPolygon);
873 throw IllegalArgumentException();
878 switch( pProperty->
nWID )
883 drawing::HomogenMatrix aHomMat;
911 std::initializer_list<std::u16string_view>{
u"com.sun.star.drawing.Shape3D",
912 u"com.sun.star.drawing.Shape3DExtrude" });
926 switch( pProperty->
nWID )
945 static_cast<E3dPolygonObj*
>(
GetSdrObject())->SetPolyPolygon3D(aNewB3DPolyPolygon);
959 static_cast<E3dPolygonObj*
>(
GetSdrObject())->SetPolyNormals3D(aNewB3DPolyPolygon);
975 static_cast<E3dPolygonObj*
>(
GetSdrObject())->SetPolyTexture2D(aB2DPolyPolygon);
983 if( rValue >>= bNew )
985 static_cast<E3dPolygonObj*
>(
GetSdrObject())->SetLineOnly(bNew);
994 throw IllegalArgumentException();
999 switch( pProperty->
nWID )
1031 rValue <<= static_cast<E3dPolygonObj*>(
GetSdrObject())->GetLineOnly();
1047 std::initializer_list<std::u16string_view>{
u"com.sun.star.drawing.Shape3D",
1048 u"com.sun.star.drawing.Shape3DPolygon" });
void SetViewportValues(const basegfx::B3DPoint &rNewVRP, const basegfx::B3DVector &rNewVPN, const basegfx::B3DVector &rNewVUV)
const basegfx::B3DPoint & GetVRP() const
const basegfx::B3DVector & GetVPN() const
const basegfx::B3DVector & GetVUV() const
void SetAutoAdjustProjection(bool bAdjust)
void SetFocalLength(double fLen)
void SetPosAndLookAt(const basegfx::B3DPoint &rNewPos, const basegfx::B3DPoint &rNewLookAt)
void SetViewWindow(double fX, double fY, double fW, double fH)
const basegfx::B3DRange & GetBoundVolume() const
const basegfx::B3DHomMatrix & GetTransform() const
virtual void NbcSetTransform(const basegfx::B3DHomMatrix &rMatrix)
B3dCamera & GetCameraSet()
virtual void NbcSetTransform(const basegfx::B3DHomMatrix &rMatrix) override
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
virtual SdrObjList * GetSubList() const override
void SetCamera(const Camera3D &rNewCamera)
const Camera3D & GetCamera() const
SphereObject with diameter r3DSize.
virtual const tools::Rectangle & GetSnapRect() const override
virtual void SetChanged(bool bFlg=true)
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
virtual void NbcInsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
virtual rtl::Reference< SdrObject > NbcRemoveObject(size_t nObjNum)
remove from list without delete
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
virtual css::uno::Reference< css::drawing::XShape > getUnoShape()
virtual SdrObjList * GetSubList() const
SdrObjList * getParentSdrObjListFromSdrObject() const
SdrModel & getSdrModelFromSdrObject() const
const SfxItemSet & GetMergedItemSet() const
SdrObject * getParentSdrObjectFromSdrObject() const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual ~Svx3DCubeObject() noexcept override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, const css::uno::Any &rValue) override
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue) override
Svx3DCubeObject(SdrObject *pObj)
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, const css::uno::Any &rValue) override
virtual ~Svx3DExtrudeObject() noexcept override
SVXCORE_DLLPUBLIC Svx3DExtrudeObject(SdrObject *pObj)
SVXCORE_DLLPUBLIC Svx3DLatheObject(SdrObject *pObj)
virtual ~Svx3DLatheObject() noexcept override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue) override
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, const css::uno::Any &rValue) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual ~Svx3DPolygonObject() noexcept override
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue) override
SVXCORE_DLLPUBLIC Svx3DPolygonObject(SdrObject *pObj)
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, const css::uno::Any &rValue) override
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue) override
virtual void addShape(SvxShape &rShape) override final
rtl::Reference< SvxDrawPage > mxPage
virtual ~Svx3DSceneObject() noexcept override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL add(const css::uno::Reference< css::drawing::XShape > &xShape) override
virtual void Create(SdrObject *pNewOpj, SvxDrawPage *pNewPage) override
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
SVXCORE_DLLPUBLIC Svx3DSceneObject(SdrObject *pObj, SvxDrawPage *pDrawPage)
virtual void SAL_CALL remove(const css::uno::Reference< css::drawing::XShape > &xShape) override
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, const css::uno::Any &rValue) override
virtual sal_Int32 SAL_CALL getCount() override
virtual sal_Bool SAL_CALL hasElements() override
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &rType) override
virtual css::uno::Type SAL_CALL getElementType() override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, const css::uno::Any &rValue) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue) override
Svx3DSphereObject(SdrObject *pObj)
virtual ~Svx3DSphereObject() noexcept override
This only exists so I have a common base class for SvxShapeGroup and Svx3DSceneObject.
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue)
virtual void Create(SdrObject *pNewOpj, SvxDrawPage *pNewPage)
bool HasSdrObject() const
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
SdrObject * GetSdrObject() const
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, const css::uno::Any &rValue)
virtual css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &aType) override
void SetDeviceWindow(const tools::Rectangle &rRect)
void append(const B3DPolygon &rPolygon, sal_uInt32 nCount=1)
B3DPolygon const & getB3DPolygon(sal_uInt32 nIndex) const
void append(const B3DPoint &rPoint, sal_uInt32 nCount=1)
B3DPoint const & getB3DPoint(sal_uInt32 nIndex) const
bool equal(const B3DTuple &rTup) const
css::uno::Type const & get()
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
EmbeddedObjectRef * pObject
#define SAL_WARN(area, stream)
void B3DHomMatrixToUnoHomogenMatrix(const B3DHomMatrix &rMatrixIn, com::sun::star::drawing::HomogenMatrix &rMatrixOut)
B3DPolyPolygon createB3DPolyPolygonFromB2DPolyPolygon(const B2DPolyPolygon &rCandidate, double fZCoordinate)
B2DPolyPolygon createB2DPolyPolygonFromB3DPolyPolygon(const B3DPolyPolygon &rCandidate, const B3DHomMatrix &rMat)
B3DHomMatrix UnoHomogenMatrixToB3DHomMatrix(const com::sun::star::drawing::HomogenMatrix &rMatrixIn)
void checkClosed(B2DPolygon &rCandidate)
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &... rSn)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
SvxUnoPropertyMapProvider & getSvxMapProvider()
constexpr TypedWhichId< SfxUInt32Item > SDRATTR_3DSCENE_FOCAL_LENGTH(SDRATTR_3DSCENE_FIRST+2)
constexpr TypedWhichId< SfxUInt32Item > SDRATTR_3DSCENE_DISTANCE(SDRATTR_3DSCENE_FIRST+1)
E3dObject * DynCastE3dObject(SdrObject *pObj)
E3dScene * DynCastE3dScene(SdrObject *pObj)
SfxUInt32Item makeSvx3DVerticalSegmentsItem(sal_uInt32 nVal)
css::drawing::Direction3D aDirection
#define SVXMAP_3DEXTRUDEOBJECT
#define SVXMAP_3DCUBEOBJECT
#define SVXMAP_3DLATHEOBJECT
#define SVXMAP_3DSPHEREOBJECT
#define SVXMAP_3DPOLYGONOBJECT
#define SVXMAP_3DSCENEOBJECT
static bool ConvertHomogenMatrixToObject(E3dObject *pObject, const Any &rValue)
static void ConvertObjectToHomogenMatric(E3dObject const *pObject, Any &rValue)
static void B3dPolyPolygon_to_PolyPolygonShape3D(const basegfx::B3DPolyPolygon &rSourcePolyPolygon, Any &rValue)
static bool PolyPolygonShape3D_to_B3dPolyPolygon(const Any &rValue, basegfx::B3DPolyPolygon &rResultPolygon, bool bCorrectPolygon)
#define OWN_ATTR_3D_VALUE_SIZE
#define OWN_ATTR_3D_VALUE_TEXTUREPOLYGON3D
#define OWN_ATTR_3D_VALUE_POLYPOLYGON3D
#define OWN_ATTR_3D_VALUE_NORMALSPOLYGON3D
#define OWN_ATTR_3D_VALUE_POSITION
#define OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY
#define OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX
#define OWN_ATTR_3D_VALUE_LINEONLY
#define OWN_ATTR_3D_VALUE_POS_IS_CENTER