20#include <config_features.h>
22#include <com/sun/star/document/EventObject.hpp>
23#include <com/sun/star/embed/XEmbeddedObject.hpp>
24#include <com/sun/star/lang/DisposedException.hpp>
25#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
27#include <osl/mutex.hxx>
38#include <svx/strings.hrc>
57using namespace ::
cppu;
69 ,mpModel(&pInPage->getSdrModelFromSdrPage())
79 assert(!
"SvxDrawPage must be disposed!");
88 OWeakAggObject::release();
111 uno::Reference< lang::XComponent > xSelf(
this );
115 bool bDoDispose =
false;
133 uno::Reference< uno::XInterface > xSource( uno::Reference< uno::XInterface >::query(
static_cast<lang::XComponent *
>(
this) ) );
134 css::document::EventObject aEvt;
135 aEvt.Source = xSource;
142 catch(
const css::uno::Exception&)
164 throw lang::DisposedException();
174 throw lang::DisposedException();
184 throw lang::DisposedException();
186 SvxShape* pShape = comphelper::getFromUnoTunnel<SvxShape>( xShape );
188 if(
nullptr == pShape )
190 assert(
false &&
"adding a non-SvxShape to a page?");
195 bool bNeededToClone(
false);
205 pObj->setUnoShape(
nullptr);
206 pClonedSdrShape->setUnoShape(pShape);
209 pObj = pClonedSdrShape;
210 bNeededToClone =
true;
218 else if ( !pObj->IsInserted() )
227 uno::Reference< drawing::XShape > xShapeCheck(pObj->getWeakUnoShape());
229 if( !xShapeCheck.is() )
231 pObj->setUnoShape(pShape);
236 pShape->
Create( pObj.get(),
this );
237 OSL_ENSURE( pShape->
GetSdrObject() == pObj.get(),
"SvxDrawPage::add: shape does not know about its newly created SdrObject!" );
239 if ( !pObj->IsInserted() )
257 throw lang::DisposedException();
259 SvxShape* pShape = comphelper::getFromUnoTunnel<SvxShape>( xShape );
261 if(
nullptr == pShape )
263 assert(
false &&
"adding a non-SvxShape to a page?");
274 else if ( !pObj->IsInserted() )
279 pShape->
Create( pObj.get(),
this );
280 OSL_ENSURE( pShape->
GetSdrObject() == pObj.get(),
"SvxDrawPage::add: shape does not know about its newly created SdrObject!" );
282 if ( !pObj->IsInserted() )
295 throw lang::DisposedException();
303 for(
size_t nNum = 0; nNum <
nCount; ++nNum )
334 throw lang::DisposedException();
336 auto newOrder = comphelper::sequenceToContainer<std::vector<sal_Int32>>(sortOrder);
346 throw lang::DisposedException();
356 throw lang::DisposedException(
"Model or Page was already disposed!");
359 throw lang::IndexOutOfBoundsException(
"Index (" + OUString::number(
Index)
360 +
") needs to be a positive integer smaller than the shape count ("
364 if( pObj ==
nullptr )
365 throw uno::RuntimeException(
"Runtime exception thrown while getting a ref to the SdrObject at index: "
366 + OUString::number(
Index));
369 return Any(Reference< drawing::XShape >( pObj->
getUnoShape(), uno::UNO_QUERY ));
383 throw lang::DisposedException();
390 void lcl_markSdrObjectOfShape(
const Reference< drawing::XShape >& _rxShape,
SdrView& _rView,
SdrPageView& _rPageView )
396 _rView.
MarkObj( pObj, &_rPageView );
404 SAL_WARN_IF(!pPageView,
"svx",
"SdrPageView is NULL!");
407 if(pPageView==
nullptr ||
mpView==
nullptr)
410 mpView->UnmarkAllObj( pPageView );
416 Reference< drawing::XShape > xShape;
417 if( aAny >>= xShape )
418 lcl_markSdrObjectOfShape( xShape, *
mpView, *pPageView );
426 SAL_WARN_IF(!pPageView,
"svx",
"SdrPageView is NULL!");
429 if(pPageView!=
nullptr &&
mpView !=
nullptr)
431 mpView->UnmarkAllObj( pPageView );
432 lcl_markSdrObjectOfShape( xShape, *
mpView, *pPageView );
436Reference< drawing::XShapeGroup > SAL_CALL
SvxDrawPage::group(
const Reference< drawing::XShapes >& xShapes )
441 throw lang::DisposedException();
446 Reference< css::drawing::XShapeGroup > xShapeGroup;
478 throw lang::DisposedException();
506 awt::Size aSize = xShape->getSize();
509 awt::Point aPos = xShape->getPosition();
523 auto pScene =
static_cast<E3dScene*
>(pNewObj.get());
526 double fW =
static_cast<double>(aSize.Width);
527 double fH =
static_cast<double>(aSize.Height);
536 pScene->SetCamera(aCam);
538 pScene->SetBoundAndSnapRectsDirty();
542 auto pObj =
static_cast<E3dExtrudeObj*
>(pNewObj.get());
555 auto pLatheObj =
static_cast<E3dLatheObj*
>(pNewObj.get());
576 if(
aName ==
"com.sun.star.drawing.TableShape" ||
577 aName ==
"com.sun.star.presentation.TableShape" )
582#if HAVE_FEATURE_AVMEDIA
583 else if (
aName ==
"com.sun.star.presentation.MediaShape" )
642 assert(
false &&
"the IsInventor3D function must be wrong");
718 GetEmbeddedObject(
static_cast< SdrOle2Obj*
>( pObj )->GetPersistName() );
729 if( aPluginClassId == aClassId )
734 else if( aAppletClassId == aClassId )
739 else if( aIFrameClassId == aClassId )
748 if( pRet ==
nullptr )
786 assert(
false &&
"Not implemented Starone-Shape created");
794 assert(
false &&
"Unknown Inventor in SvxDrawPage::CreateShape()");
818 pRet->setShapeKind(nObjId);
838 if ( !pObj->IsInserted() && !pObj->IsDoNotInsertIntoPageAutomatically() )
841 mpPage->InsertObject( pObj.get(), 0 );
843 mpPage->InsertObject( pObj.get() );
853 return "SvxDrawPage";
863 uno::Sequence<OUString>
aSeq {
"com.sun.star.drawing.ShapeCollection" };
877 uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
882 return uno::Reference< drawing::XDrawPage >();
890 SvxDrawPage* pDrawPage = comphelper::getFromUnoTunnel<SvxDrawPage>( xDrawPage );
896 assert(
false &&
"non-SvxDrawPage?");
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)
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
SdrObject * GetMarkedSdrObj() const
::comphelper::IEmbeddedHelper * GetPersist() const
virtual void SetChanged(bool bFlg=true)
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
SdrUndoFactory & GetSdrUndoFactory() const
returns the models undo factory.
bool IsUndoEnabled() const
returns true if undo is currently enabled This returns false if undo was disabled using EnableUndo( f...
static rtl::Reference< SdrObject > MakeNewObject(SdrModel &rSdrModel, SdrInventor nInventor, SdrObjKind nObjIdentifier, const tools::Rectangle *pSnapRect=nullptr)
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
void sort(std::vector< sal_Int32 > &sortOrder)
virtual rtl::Reference< SdrObject > RemoveObject(size_t nObjNum)
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
static SdrItemPool & GetGlobalDrawObjectItemPool()
virtual SdrInventor GetObjInventor() const
virtual css::uno::Reference< css::drawing::XShape > getUnoShape()
bool IsEmptyPresObj() const
virtual SdrObjKind GetObjIdentifier() const
virtual OUString TakeObjNameSingul() const
void SetMergedItem(const SfxPoolItem &rItem)
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
SdrModel & getSdrModelFromSdrPage() const
virtual std::unique_ptr< SdrUndoAction > CreateUndoDeleteObject(SdrObject &rObject, bool bOrdNumDirect=false)
std::unique_ptr< SdrView > mpView
SvxDrawPage(SdrPage *pPage)
rtl::Reference< SdrObject > CreateSdrObject(const css::uno::Reference< css::drawing::XShape > &xShape, bool bBeginning=false) noexcept
virtual css::uno::Reference< css::drawing::XShape > CreateShape(SdrObject *pObj) const
virtual void SAL_CALL add(const css::uno::Reference< css::drawing::XShape > &xShape) override
virtual void SAL_CALL addBottom(const css::uno::Reference< css::drawing::XShape > &xShape) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
cppu::OBroadcastHelper mrBHelper
virtual sal_Int32 SAL_CALL getCount() override
virtual void SAL_CALL ungroup(const css::uno::Reference< css::drawing::XShapeGroup > &aGroup) override
virtual void SAL_CALL remove(const css::uno::Reference< css::drawing::XShape > &xShape) override
virtual sal_Bool SAL_CALL hasElements() override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
void SelectObjectsInView(const css::uno::Reference< css::drawing::XShapes > &aShapes, SdrPageView *pPageView) noexcept
virtual void SAL_CALL release() noexcept override
static void GetTypeAndInventor(SdrObjKind &rType, SdrInventor &rInventor, const OUString &aName) noexcept
virtual void SAL_CALL addTop(const css::uno::Reference< css::drawing::XShape > &xShape) override
virtual void disposing() noexcept
virtual void SAL_CALL sort(const css::uno::Sequence< sal_Int32 > &sortOrder) override
SdrPage * GetSdrPage() const
virtual css::uno::Reference< css::drawing::XShapeGroup > SAL_CALL group(const css::uno::Reference< css::drawing::XShapes > &xShapes) override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
static rtl::Reference< SvxShape > CreateShapeByTypeAndInventor(SdrObjKind nType, SdrInventor nInventor, SdrObject *pObj, SvxDrawPage *pPage=nullptr, OUString const &referer=OUString())
virtual rtl::Reference< SdrObject > CreateSdrObject_(const css::uno::Reference< css::drawing::XShape > &xShape)
virtual ~SvxDrawPage() noexcept override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual css::uno::Type SAL_CALL getElementType() override
void SelectObjectInView(const css::uno::Reference< css::drawing::XShape > &xShape, SdrPageView *pPageView) noexcept
virtual void SAL_CALL dispose() override
virtual void Create(SdrObject *pNewOpj, SvxDrawPage *pNewPage)
SdrObject * GetSdrObject() const
SvxUnoPropertyMapProvider.
const SvxItemPropertySet * GetPropertySet(sal_uInt16 nPropertyId, SfxItemPool &rPool)
o3tl::span< const SfxItemPropertyMapEntry > GetMap(sal_uInt16 nPropertyId)
static std::optional< SdrObjKind > getId(const OUString &rCompareString)
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void setClosed(bool bNew)
virtual EmbeddedObjectContainer & getEmbeddedObjectContainer() const=0
css::uno::Type const & get()
virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
#define SO3_PLUGIN_CLASSID
#define SO3_IFRAME_CLASSID
#define SO3_APPLET_CLASSID
#define ENSURE_OR_RETURN_VOID(c, m)
OUString SvxResId(TranslateId aId)
Sequence< sal_Int8 > aSeq
#define SAL_WARN_IF(condition, area, stream)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
SvxUnoPropertyMapProvider & getSvxMapProvider()
void addListener(const keyType &key, const css::uno::Reference< css::uno::XInterface > &r)
void removeListener(const keyType &key, const css::uno::Reference< css::uno::XInterface > &r)
constexpr bool IsInventorE3D(SdrObjKind e)
@ Group
abstract object (SdrObject)
@ Measure
object that represents a SdrPage
@ Page
Polyline represented by SdrPathObj.
@ Caption
connector object
@ PathFill
open Bezier-curve
@ FreehandLine
closed Bezier-curve
@ UNO
continuously activated OLE (PlugIn-Frame or similar)
@ CustomShape
Universal Network Object packed into SvDraw object.
@ CircleOrEllipse
rectangle (round corners optional)
@ Text
closed free-hand line
@ OLE2
foreign graphic (StarView Graphic)
@ OLEPluginFrame
measurement object
@ Graphic
OutlineText, special text object for StarDraw.
@ PathPolyLine
Polygon/PolyPolygon represented by SdrPathObj.
@ CircleSection
circle, ellipse
@ OutlineText
TitleText, special text object for StarDraw.
@ CircleArc
circle section
@ PolyLine
polygon, PolyPolygon
@ FreehandFill
open free-hand line
UNO3_GETIMPLEMENTATION_IMPL(SvxDrawPage)
uno::Reference< drawing::XDrawPage > GetXDrawPageForSdrPage(SdrPage *pPage) noexcept
returns a StarOffice API wrapper for the given SdrPage
SdrPage * GetSdrPageFromXDrawPage(const uno::Reference< drawing::XDrawPage > &xDrawPage) noexcept
returns the SdrObject from the given StarOffice API wrapper
rtl::Reference< SvxShape > CreateSvxShapeByTypeAndInventor(SdrObjKind nType, SdrInventor nInventor, OUString const &referer)
Creates a StarOffice API wrapper with the given type and inventor Deprecated: This will be replaced w...