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>
56 using namespace ::
cppu;
68 ,mpModel(&pInPage->getSdrModelFromSdrPage())
78 assert(!
"SvxDrawPage must be disposed!");
87 OWeakAggObject::release();
110 uno::Reference< lang::XComponent > xSelf(
this );
114 bool bDoDispose =
false;
132 uno::Reference< uno::XInterface > xSource( uno::Reference< uno::XInterface >::query( static_cast<lang::XComponent *>(
this) ) );
133 css::document::EventObject aEvt;
134 aEvt.Source = xSource;
141 catch(
const css::uno::Exception&)
163 throw lang::DisposedException();
173 throw lang::DisposedException();
183 throw lang::DisposedException();
185 SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
187 if(
nullptr == pShape )
191 bool bNeededToClone(
false);
206 pObj = pClonedSdrShape;
207 bNeededToClone =
true;
224 uno::Reference< uno::XInterface > xShapeCheck(pObj->
getWeakUnoShape());
226 if( !xShapeCheck.is() )
233 pShape->
Create( pObj,
this );
234 OSL_ENSURE( pShape->
GetSdrObject() == pObj,
"SvxDrawPage::add: shape does not know about its newly created SdrObject!" );
254 throw lang::DisposedException();
256 SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape );
258 if(
nullptr == pShape )
273 pShape->
Create( pObj,
this );
274 OSL_ENSURE( pShape->
GetSdrObject() == pObj,
"SvxDrawPage::add: shape does not know about its newly created SdrObject!" );
289 throw lang::DisposedException();
297 for(
size_t nNum = 0; nNum < nCount; ++nNum )
331 throw lang::DisposedException();
333 auto newOrder = comphelper::sequenceToContainer<std::vector<sal_Int32>>(sortOrder);
343 throw lang::DisposedException();
353 throw lang::DisposedException(
"Model or Page was already disposed!");
356 throw lang::IndexOutOfBoundsException(
"Index (" + OUString::number(Index)
357 +
") needs to be a positive integer smaller than the shape count ("
361 if( pObj ==
nullptr )
362 throw uno::RuntimeException(
"Runtime exception thrown while getting a ref to the SdrObject at index: "
363 + OUString::number(Index));
380 throw lang::DisposedException();
387 void lcl_markSdrObjectOfShape(
const Reference< drawing::XShape >& _rxShape,
SdrView& _rView,
SdrPageView& _rPageView )
393 _rView.
MarkObj( pObj, &_rPageView );
401 SAL_WARN_IF(!pPageView,
"svx",
"SdrPageView is NULL!");
404 if(pPageView==
nullptr ||
mpView==
nullptr)
407 mpView->UnmarkAllObj( pPageView );
413 Reference< drawing::XShape > xShape;
414 if( aAny >>= xShape )
415 lcl_markSdrObjectOfShape( xShape, *
mpView, *pPageView );
423 SAL_WARN_IF(!pPageView,
"svx",
"SdrPageView is NULL!");
426 if(pPageView!=
nullptr &&
mpView !=
nullptr)
428 mpView->UnmarkAllObj( pPageView );
429 lcl_markSdrObjectOfShape( xShape, *
mpView, *pPageView );
433 Reference< drawing::XShapeGroup > SAL_CALL
SvxDrawPage::group(
const Reference< drawing::XShapes >& xShapes )
438 throw lang::DisposedException();
443 Reference< css::drawing::XShapeGroup > xShapeGroup;
475 throw lang::DisposedException();
503 awt::Size aSize = xShape->getSize();
506 awt::Point aPos = xShape->getPosition();
518 if(
auto pScene = dynamic_cast<E3dScene* >(pNewObj) )
522 double fW =
static_cast<double>(aSize.Width);
523 double fH =
static_cast<double>(aSize.Height);
527 aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
530 aCam.SetPosAndLookAt(aCamPos, aLookAt);
531 aCam.SetFocalLength(100.0);
532 pScene->SetCamera(aCam);
534 pScene->SetRectsDirty();
536 else if(
auto pObj = dynamic_cast<E3dExtrudeObj* >(pNewObj))
548 else if(
auto pLatheObj = dynamic_cast<E3dLatheObj* >(pNewObj))
570 if(
aName ==
"com.sun.star.drawing.TableShape" ||
571 aName ==
"com.sun.star.presentation.TableShape" )
576 #if HAVE_FEATURE_AVMEDIA
577 else if (
aName ==
"com.sun.star.presentation.MediaShape" )
587 rType =
static_cast<SdrObjKind>(nTempType & ~E3D_INVENTOR_FLAG);
713 GetEmbeddedObject( static_cast< SdrOle2Obj* >( pObj )->GetPersistName() );
724 if( aPluginClassId == aClassId )
729 else if( aAppletClassId == aClassId )
734 else if( aIFrameClassId == aClassId )
743 if( pRet ==
nullptr )
781 assert(
false &&
"Not implemented Starone-Shape created");
789 assert(
false &&
"Unknown Inventor in SvxDrawPage::CreateShape()");
796 sal_uInt32 nObjId = nType;
815 pRet->setShapeKind(nObjId);
832 SdrObject* pObj = CreateSdrObject_( xShape );
838 mpPage->InsertObject( pObj, 0 );
840 mpPage->InsertObject( pObj );
850 return "SvxDrawPage";
860 uno::Sequence<OUString>
aSeq {
"com.sun.star.drawing.ShapeCollection" };
874 uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY );
879 return uno::Reference< drawing::XDrawPage >();
887 SvxDrawPage* pDrawPage = comphelper::getUnoTunnelImplementation<SvxDrawPage>( xDrawPage );
void SetAutoAdjustProjection(bool bAdjust)
virtual css::uno::Type SAL_CALL getElementType() override
#define ENSURE_OR_RETURN_VOID(c, m)
void SelectObjectsInView(const css::uno::Reference< css::drawing::XShapes > &aShapes, SdrPageView *pPageView)
const css::uno::WeakReference< css::uno::XInterface > & getWeakUnoShape() const
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
size_t GetMarkCount() const
virtual void SAL_CALL addBottom(const css::uno::Reference< css::drawing::XShape > &xShape) override
Polygon/PolyPolygon represented by SdrPathObj.
UNO3_GETIMPLEMENTATION_IMPL(SvxDrawPage)
abstract object (SdrObject)
rectangle (round corners optional)
SdrPage * GetSdrPageFromXDrawPage(const uno::Reference< drawing::XDrawPage > &xDrawPage)
returns the SdrObject from the given StarOffice API wrapper
#define SO3_IFRAME_CLASSID
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
virtual void SAL_CALL remove(const css::uno::Reference< css::drawing::XShape > &xShape) override
SdrObject * CreateSdrObject(const css::uno::Reference< css::drawing::XShape > &xShape, bool bBeginning=false)
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
void setUnoShape(const css::uno::Reference< css::uno::XInterface > &_rxUnoShape)
static SdrObject * MakeNewObject(SdrModel &rSdrModel, SdrInventor nInventor, SdrObjKind nObjIdentifier, const tools::Rectangle *pSnapRect=nullptr)
static rtl::Reference< SvxShape > CreateShapeByTypeAndInventor(sal_uInt16 nType, SdrInventor nInventor, SdrObject *pObj, SvxDrawPage *pPage=nullptr, OUString const &referer=OUString())
virtual OUString TakeObjNameSingul() const
SdrMark * GetMark(size_t nNum) const
static void Free(SdrObject *&_rpObject)
virtual SdrObjKind GetObjIdentifier() const
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
virtual SdrObject * CreateSdrObject_(const css::uno::Reference< css::drawing::XShape > &xShape)
virtual std::unique_ptr< SdrUndoAction > CreateUndoDeleteObject(SdrObject &rObject, bool bOrdNumDirect=false)
virtual css::uno::Reference< css::uno::XInterface > getUnoShape()
OUString SvxResId(const char *pId)
virtual void Create(SdrObject *pNewOpj, SvxDrawPage *pNewPage)
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
virtual EmbeddedObjectContainer & getEmbeddedObjectContainer() const =0
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual void SetChanged(bool bFlg=true)
void addListener(const keyType &key, const css::uno::Reference< css::uno::XInterface > &r)
Polyline represented by SdrPathObj.
SdrObject * GetMarkedSdrObj() const
virtual void SAL_CALL ungroup(const css::uno::Reference< css::drawing::XShapeGroup > &aGroup) override
SdrPage * GetSdrPage() const
bool IsDoNotInsertIntoPageAutomatically() const
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL add(const css::uno::Reference< css::drawing::XShape > &xShape) override
void removeListener(const keyType &key, const css::uno::Reference< css::uno::XInterface > &r)
bool IsUndoEnabled() const
returns true if undo is currently enabled This returns false if undo was disabled using EnableUndo( f...
void SelectObjectInView(const css::uno::Reference< css::drawing::XShape > &xShape, SdrPageView *pPageView)
virtual void SAL_CALL dispose() override
std::unique_ptr< SdrView > mpView
OutlineText, special text object for StarDraw.
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
virtual sal_Int32 SAL_CALL getCount() override
SvxDrawPage(SdrPage *pPage)
const SfxItemPropertyMapEntry * GetMap(sal_uInt16 nPropertyId)
SdrModel & getSdrModelFromSdrObject() const
virtual void SAL_CALL addTop(const css::uno::Reference< css::drawing::XShape > &xShape) override
css::uno::Type const & get()
void SetMergedItem(const SfxPoolItem &rItem)
#define SO3_APPLET_CLASSID
virtual css::uno::Reference< css::drawing::XShape > CreateShape(SdrObject *pObj) const
virtual SdrObject * RemoveObject(size_t nObjNum)
cppu::OBroadcastHelper mrBHelper
SdrUndoFactory & GetSdrUndoFactory() const
returns the models undo factory.
virtual void SAL_CALL acquire() SAL_OVERRIDE
virtual SdrInventor GetObjInventor() const
natural cubic Spline (ni)
SdrModel & getSdrModelFromSdrPage() const
#define E3D_INVENTOR_FLAG
Globals.
void setClosed(bool bNew)
void sort(std::vector< sal_Int32 > &sortOrder)
static sal_uInt32 getId(const OUString &rCompareString)
virtual css::uno::Reference< css::drawing::XShapeGroup > SAL_CALL group(const css::uno::Reference< css::drawing::XShapes > &xShapes) override
virtual sal_Bool SAL_CALL hasElements() override
virtual void SAL_CALL release() override
static SdrItemPool & GetGlobalDrawObjectItemPool()
#define SAL_WARN_IF(condition, area, stream)
SvxUnoPropertyMapProvider.
object that represents a SdrPage
virtual ~SvxDrawPage() override
virtual SdrObject * CloneSdrObject(SdrModel &rTargetModel) const
SdrObject * GetSdrObject() const
#define UHASHMAP_NOTFOUND
class UHashMap
uno::Reference< drawing::XDrawPage > GetXDrawPageForSdrPage(SdrPage *pPage)
returns a StarOffice API wrapper for the given SdrPage
Sequence< sal_Int8 > aSeq
virtual OUString SAL_CALL getImplementationName() override
static void GetTypeAndInventor(SdrObjKind &rType, SdrInventor &rInventor, const OUString &aName)
Universal Network Object packed into SvDraw object.
const SvxItemPropertySet * GetPropertySet(sal_uInt16 nPropertyId, SfxItemPool &rPool)
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
continuously activated OLE (PlugIn-Frame or similar)
SvxUnoPropertyMapProvider & getSvxMapProvider()
TitleText, special text object for StarDraw.
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
periodic cubic Spline (ni)
foreign graphic (StarView Graphic)
#define SO3_PLUGIN_CLASSID
virtual void SAL_CALL sort(const css::uno::Sequence< sal_Int32 > &sortOrder) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
rtl::Reference< SvxShape > CreateSvxShapeByTypeAndInventor(sal_uInt16 nType, SdrInventor nInventor, OUString const &referer)
Creates a StarOffice API wrapper with the given type and inventor Deprecated: This will be replaced w...
bool IsEmptyPresObj() const
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)