diff options
Diffstat (limited to 'include/svx')
56 files changed, 310 insertions, 549 deletions
diff --git a/include/svx/connctrl.hxx b/include/svx/connctrl.hxx index 106140dfa374..360ff38522da 100644 --- a/include/svx/connctrl.hxx +++ b/include/svx/connctrl.hxx @@ -32,7 +32,7 @@ namespace vcl { class Window; } class SfxItemSet; class SdrEdgeObj; class SdrView; -class SdrPage; +class SdrObjList; /************************************************************************* |* @@ -45,7 +45,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxXConnectionPreview : public Control private: SdrEdgeObj* pEdgeObj; - SdrPage* pSdrPage; + SdrObjList* pObjList; const SdrView* pView; SVX_DLLPRIVATE void SetStyles(); diff --git a/include/svx/cube3d.hxx b/include/svx/cube3d.hxx index 95acaab386cd..4a74777e0cff 100644 --- a/include/svx/cube3d.hxx +++ b/include/svx/cube3d.hxx @@ -54,23 +54,17 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC E3dCubeObj final : public E3dCompoundObject // BOOLeans bool bPosIsCenter : 1; - void SetDefaultAttributes(const E3dDefaultAttributes& rDefault); + void SetDefaultAttributes(E3dDefaultAttributes& rDefault); virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; public: - E3dCubeObj(SdrModel& rSdrModel, - const E3dDefaultAttributes& rDefault, - const basegfx::B3DPoint& aPos, - const basegfx::B3DVector& r3DSize); - E3dCubeObj(SdrModel& rSdrModel); + E3dCubeObj(E3dDefaultAttributes& rDefault, const basegfx::B3DPoint& aPos, const basegfx::B3DVector& r3DSize); + E3dCubeObj(); virtual sal_uInt16 GetObjIdentifier() const override; virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override; - virtual E3dCubeObj* Clone(SdrModel* pTargetModel = nullptr) const override; - - // implemented mainly for the purposes of Clone() - E3dCubeObj& operator=(const E3dCubeObj& rObj); + virtual E3dCubeObj* Clone() const override; // Set local parameters with geometry recreation void SetCubePos(const basegfx::B3DPoint& rNew); diff --git a/include/svx/deflt3d.hxx b/include/svx/deflt3d.hxx index e08e9945fa96..e69a62a1625e 100644 --- a/include/svx/deflt3d.hxx +++ b/include/svx/deflt3d.hxx @@ -65,13 +65,13 @@ public: void Reset(); // Cube object - const basegfx::B3DPoint& GetDefaultCubePos() const { return aDefaultCubePos; } - const basegfx::B3DVector& GetDefaultCubeSize() const { return aDefaultCubeSize; } + const basegfx::B3DPoint& GetDefaultCubePos() { return aDefaultCubePos; } + const basegfx::B3DVector& GetDefaultCubeSize() { return aDefaultCubeSize; } bool GetDefaultCubePosIsCenter() const { return bDefaultCubePosIsCenter; } // Sphere object - const basegfx::B3DPoint& GetDefaultSphereCenter() const { return aDefaultSphereCenter; } - const basegfx::B3DVector& GetDefaultSphereSize() const { return aDefaultSphereSize; } + const basegfx::B3DPoint& GetDefaultSphereCenter() { return aDefaultSphereCenter; } + const basegfx::B3DVector& GetDefaultSphereSize() { return aDefaultSphereSize; } // Lathe object bool GetDefaultLatheSmoothed() const { return bDefaultLatheSmoothed; } diff --git a/include/svx/e3dsceneupdater.hxx b/include/svx/e3dsceneupdater.hxx index e6800e845e01..ad01d667b4f5 100644 --- a/include/svx/e3dsceneupdater.hxx +++ b/include/svx/e3dsceneupdater.hxx @@ -50,7 +50,7 @@ class SVX_DLLPUBLIC E3DModifySceneSnapRectUpdater // of the to-be-changed 3D object when the scene has a 3d transformation // stack at construction time. In all other cases it's set to zero and // no action needs to be taken - E3dScene* mpScene; + E3dScene* mpScene; // the 3d transformation stack at the time of construction, valid when // mpScene is not zero @@ -58,7 +58,7 @@ class SVX_DLLPUBLIC E3DModifySceneSnapRectUpdater public: // the constructor evaluates and sets the members at construction time - E3DModifySceneSnapRectUpdater(const SdrObject* mpObject); + E3DModifySceneSnapRectUpdater(const SdrObject* pObject); // the destructor will take action if mpScene is not zero and modify the // 2D geomeztry of the target scene diff --git a/include/svx/e3dundo.hxx b/include/svx/e3dundo.hxx index 17335ea1e8e0..8be61b7b9e0e 100644 --- a/include/svx/e3dundo.hxx +++ b/include/svx/e3dundo.hxx @@ -31,15 +31,17 @@ \************************************************************************/ class SAL_WARN_UNUSED E3dUndoAction : public SdrUndoAction { + protected: - E3dObject& mrMy3DObj; + E3dObject *pMy3DObj; public: - E3dUndoAction(E3dObject &r3DObj) - : SdrUndoAction(r3DObj.getSdrModelFromSdrObject()), - mrMy3DObj(r3DObj) - { - } + E3dUndoAction (SdrModel *pModel, + E3dObject *p3DObj) : + SdrUndoAction (*pModel), + pMy3DObj (p3DObj) + { + } virtual ~E3dUndoAction () override; @@ -53,25 +55,25 @@ class SAL_WARN_UNUSED E3dUndoAction : public SdrUndoAction \************************************************************************/ class SAL_WARN_UNUSED E3dRotateUndoAction : public E3dUndoAction { -private: - basegfx::B3DHomMatrix maMyOldRotation; - basegfx::B3DHomMatrix maMyNewRotation; - -public: - E3dRotateUndoAction( - E3dObject& r3DObj, - const basegfx::B3DHomMatrix &aOldRotation, - const basegfx::B3DHomMatrix &aNewRotation) - : E3dUndoAction(r3DObj), - maMyOldRotation(aOldRotation), - maMyNewRotation(aNewRotation) - { - } - - virtual ~E3dRotateUndoAction () override; - - virtual void Undo() override; - virtual void Redo() override; + basegfx::B3DHomMatrix aMyOldRotation; + basegfx::B3DHomMatrix aMyNewRotation; + + public: + E3dRotateUndoAction (SdrModel *pModel, + E3dObject *p3DObj, + const basegfx::B3DHomMatrix &aOldRotation, + const basegfx::B3DHomMatrix &aNewRotation) : + E3dUndoAction (pModel, p3DObj), + aMyOldRotation (aOldRotation), + aMyNewRotation (aNewRotation) + { + } + + virtual ~E3dRotateUndoAction () override; + + virtual void Undo() override; + virtual void Redo() override; + }; /************************************************************************\ @@ -81,16 +83,16 @@ public: \************************************************************************/ class SAL_WARN_UNUSED SVX_DLLPUBLIC E3dAttributesUndoAction : public SdrUndoAction { -private: using SdrUndoAction::Repeat; - SdrObject& mrObject; - const SfxItemSet maNewSet; - const SfxItemSet maOldSet; + SdrObject* pObject; + + const SfxItemSet aNewSet; + const SfxItemSet aOldSet; public: - E3dAttributesUndoAction( - E3dObject& rInObject, + E3dAttributesUndoAction( SdrModel &rModel, + E3dObject* pInObject, const SfxItemSet& rNewSet, const SfxItemSet& rOldSet); diff --git a/include/svx/extedit.hxx b/include/svx/extedit.hxx index 82afea29c83f..5ee2864a94a2 100644 --- a/include/svx/extedit.hxx +++ b/include/svx/extedit.hxx @@ -43,20 +43,18 @@ class FmFormView; class SdrObject; class SAL_WARN_UNUSED SVX_DLLPUBLIC SdrExternalToolEdit -: public ExternalToolEdit - ,public SfxListener + : public ExternalToolEdit + , public SfxListener { private: - FmFormView* m_pView; - SdrObject* m_pObj; + FmFormView * m_pView; + SdrObject * m_pObj; SAL_DLLPRIVATE virtual void Update(Graphic&) override; SAL_DLLPRIVATE virtual void Notify(SfxBroadcaster&, const SfxHint&) override; public: - SdrExternalToolEdit( - FmFormView* pView, - SdrObject* pObj); + SdrExternalToolEdit(FmFormView * pView, SdrObject * pObj); }; #endif diff --git a/include/svx/extrud3d.hxx b/include/svx/extrud3d.hxx index 5c121343af4d..1b78d4547740 100644 --- a/include/svx/extrud3d.hxx +++ b/include/svx/extrud3d.hxx @@ -40,15 +40,12 @@ private: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override; - void SetDefaultAttributes(const E3dDefaultAttributes& rDefault); + void SetDefaultAttributes(E3dDefaultAttributes const & rDefault); public: - E3dExtrudeObj( - SdrModel& rSdrModel, - const E3dDefaultAttributes& rDefault, - const basegfx::B2DPolyPolygon& rPP, - double fDepth); - E3dExtrudeObj(SdrModel& rSdrModel); + + E3dExtrudeObj(E3dDefaultAttributes const & rDefault, const basegfx::B2DPolyPolygon& rPP, double fDepth); + E3dExtrudeObj(); // PercentDiagonal: 0..100, before 0.0..0.5 sal_uInt16 GetPercentDiagonal() const @@ -84,10 +81,7 @@ public: virtual sal_uInt16 GetObjIdentifier() const override; - virtual E3dExtrudeObj* Clone(SdrModel* pTargetModel = nullptr) const override; - - // implemented mainly for the purposes of Clone() - E3dExtrudeObj& operator=(const E3dExtrudeObj& rObj); + virtual E3dExtrudeObj* Clone() const override; // TakeObjName...() is for the display in the UI (for example "3 frames selected") virtual OUString TakeObjNameSingul() const override; diff --git a/include/svx/fmpage.hxx b/include/svx/fmpage.hxx index 2605a6067517..808d814452b1 100644 --- a/include/svx/fmpage.hxx +++ b/include/svx/fmpage.hxx @@ -42,7 +42,6 @@ class HelpEvent; class SVX_DLLPUBLIC FmFormPage : public SdrPage { FmFormPage& operator=(const FmFormPage&) = delete; - FmFormPage(const FmFormPage&) = delete; friend class FmFormObj; std::unique_ptr<FmFormPageImpl> m_pImpl; @@ -53,7 +52,10 @@ public: explicit FmFormPage(FmFormModel& rModel, bool bMasterPage=false); virtual ~FmFormPage() override; - virtual SdrPage* Clone(SdrModel* pNewModel = nullptr) const override; + virtual void SetModel(SdrModel* pNewModel) override; + + virtual SdrPage* Clone() const override; + virtual SdrPage* Clone(SdrModel* pNewModel) const override; virtual void InsertObject(SdrObject* pObj, size_t nPos = SAL_MAX_SIZE) override; @@ -73,8 +75,9 @@ public: const HelpEvent& rEvt ); protected: - // lateInit -> copyValuesToClonedInstance (?) - void lateInit(const FmFormPage& rPage); + FmFormPage(const FmFormPage& rPage); + + void lateInit(const FmFormPage& rPage, FmFormModel* pNewModel = nullptr); }; #endif // INCLUDED_SVX_FMPAGE_HXX diff --git a/include/svx/fmview.hxx b/include/svx/fmview.hxx index d0a7eb79836f..a4245150337a 100644 --- a/include/svx/fmview.hxx +++ b/include/svx/fmview.hxx @@ -61,10 +61,8 @@ class SVX_DLLPUBLIC FmFormView : public E3dView void Init(); public: - FmFormView( - SdrModel& rSdrModel, - OutputDevice* pOut); + FmFormView(FmFormModel* pModel, OutputDevice* pOut); virtual ~FmFormView() override; /** create a control pair (label/bound control) for the database field description given. diff --git a/include/svx/graphctl.hxx b/include/svx/graphctl.hxx index f32454a56ae4..85ecc62e904f 100644 --- a/include/svx/graphctl.hxx +++ b/include/svx/graphctl.hxx @@ -141,13 +141,10 @@ protected: } public: - GraphCtrlView( - SdrModel& rSdrModel, - GraphCtrl* pWindow) - : SdrView(rSdrModel, pWindow) - ,rGraphCtrl(*pWindow) - { - } + GraphCtrlView(SdrModel* pModel, GraphCtrl* pWindow) + : SdrView(pModel, pWindow) + , rGraphCtrl(*pWindow) + {} }; #endif // INCLUDED_SVX_GRAPHCTL_HXX diff --git a/include/svx/lathe3d.hxx b/include/svx/lathe3d.hxx index 89df10369045..3c5a0e23b015 100644 --- a/include/svx/lathe3d.hxx +++ b/include/svx/lathe3d.hxx @@ -39,14 +39,11 @@ class SVX_DLLPUBLIC E3dLatheObj final : public E3dCompoundObject virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override; - void SetDefaultAttributes(const E3dDefaultAttributes& rDefault); + void SetDefaultAttributes(E3dDefaultAttributes const & rDefault); public: - E3dLatheObj( - SdrModel& rSdrModel, - const E3dDefaultAttributes& rDefault, - const basegfx::B2DPolyPolygon& rPoly2D); - E3dLatheObj(SdrModel& rSdrModel); + E3dLatheObj(E3dDefaultAttributes const & rDefault, const basegfx::B2DPolyPolygon& rPoly2D); + E3dLatheObj(); // HorizontalSegments: sal_uInt32 GetHorizontalSegments() const @@ -90,10 +87,7 @@ public: virtual sal_uInt16 GetObjIdentifier() const override; - virtual E3dLatheObj* Clone(SdrModel* pTargetModel = nullptr) const override; - - // implemented mainly for the purposes of Clone() - E3dLatheObj& operator=(const E3dLatheObj& rObj); + virtual E3dLatheObj* Clone() const override; virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override; diff --git a/include/svx/obj3d.hxx b/include/svx/obj3d.hxx index 7ad18848d4cd..87117cc5d203 100644 --- a/include/svx/obj3d.hxx +++ b/include/svx/obj3d.hxx @@ -81,8 +81,6 @@ public: E3dObjList(); SVX_DLLPUBLIC virtual ~E3dObjList() override; - virtual E3dObjList* CloneSdrObjList(SdrModel* pNewModel = nullptr) const override; - virtual void NbcInsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE) override; virtual void InsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE) override; virtual SdrObject* NbcRemoveObject(size_t nObjNum) override; @@ -90,7 +88,8 @@ public: private: E3dObjList &operator=(const E3dObjList& rSrcList) = delete; - E3dObjList(const E3dObjList& rSrcList) = delete; + + SVX_DLLPUBLIC E3dObjList(const E3dObjList& rSrcList); }; /************************************************************************* @@ -132,7 +131,7 @@ protected: // E3dObject is only a helper class (for E3DScene and E3DCompoundObject) // and no instances should be created from anyone, so i move the constructors // to protected area - E3dObject(SdrModel& rSdrModel); + E3dObject(); public: virtual void RecalcSnapRect() override; @@ -149,6 +148,7 @@ public: virtual void SetObjList(SdrObjList* pNewObjList) override; virtual void SetPage(SdrPage* pNewPage) override; + virtual void SetModel(SdrModel* pNewModel) override; virtual void NbcMove(const Size& rSize) override; virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override; virtual SdrObjList* GetSubList() const override; @@ -183,7 +183,7 @@ public: // TakeObjName...() is for the display in the UI, for example "3 frames selected". virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual E3dObject* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual E3dObject* Clone() const override; E3dObject& operator=( const E3dObject& rObj ); virtual SdrObjGeoData *NewGeoData() const override; @@ -232,7 +232,7 @@ protected: public: - E3dCompoundObject(SdrModel& rSdrModel); + E3dCompoundObject(); virtual ~E3dCompoundObject() override; virtual basegfx::B2DPolyPolygon TakeXorPoly() const override; @@ -242,10 +242,7 @@ public: virtual sal_uInt16 GetObjIdentifier() const override; virtual void RecalcSnapRect() override; - virtual E3dCompoundObject* Clone(SdrModel* pTargetModel = nullptr) const override; - - // implemented mainly for the purposes of Clone() - E3dCompoundObject& operator=(const E3dCompoundObject& rObj); + virtual E3dCompoundObject* Clone() const override; bool IsAOrdNumRemapCandidate(E3dScene*& prScene) const; }; diff --git a/include/svx/polygn3d.hxx b/include/svx/polygn3d.hxx index 9f5acca38ce2..98778dd493e3 100644 --- a/include/svx/polygn3d.hxx +++ b/include/svx/polygn3d.hxx @@ -43,11 +43,10 @@ public: void SetPolyNormals3D(const basegfx::B3DPolyPolygon& rNewPolyPoly3D); void SetPolyTexture2D(const basegfx::B2DPolyPolygon& rNewPolyPoly2D); - E3dPolygonObj( - SdrModel& rSdrModel, - const basegfx::B3DPolyPolygon& rPolyPoly3D); - E3dPolygonObj(SdrModel& rSdrModel); + E3dPolygonObj(const basegfx::B3DPolyPolygon& rPolyPoly3D); + + E3dPolygonObj(); virtual ~E3dPolygonObj() override; const basegfx::B3DPolyPolygon& GetPolyPolygon3D() const { return aPolyPoly3D; } @@ -57,10 +56,7 @@ public: virtual sal_uInt16 GetObjIdentifier() const override; virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override; - virtual E3dPolygonObj* Clone(SdrModel* pTargetModel = nullptr) const override; - - // implemented mainly for the purposes of Clone() - E3dPolygonObj& operator=(const E3dPolygonObj& rObj); + virtual E3dPolygonObj* Clone() const override; // LineOnly? bool GetLineOnly() const { return bLineOnly; } diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx index eef2c0422ba9..b6562093a6f1 100644 --- a/include/svx/scene3d.hxx +++ b/include/svx/scene3d.hxx @@ -90,7 +90,7 @@ protected: void ImpCleanup3DDepthMapper(); public: - E3dScene(SdrModel& rSdrModel); + E3dScene(); virtual ~E3dScene() override; virtual void SetBoundRectDirty() override; @@ -130,7 +130,7 @@ public: const Camera3D& GetCamera() const { return aCamera; } void removeAllNonSelectedObjects(); - virtual E3dScene* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual E3dScene* Clone() const override; E3dScene& operator=(const E3dScene&); virtual SdrObjGeoData *NewGeoData() const override; diff --git a/include/svx/sdr/properties/defaultproperties.hxx b/include/svx/sdr/properties/defaultproperties.hxx index b3395386f833..fec5963d4e7d 100644 --- a/include/svx/sdr/properties/defaultproperties.hxx +++ b/include/svx/sdr/properties/defaultproperties.hxx @@ -54,9 +54,6 @@ namespace sdr // react on ItemSet changes virtual void ItemSetChanged(const SfxItemSet& rSet) override; - // check if SfxItemSet exists - bool HasSfxItemSet() const { return bool(mpItemSet); } - public: // basic constructor explicit DefaultProperties(SdrObject& rObj); diff --git a/include/svx/sdr/properties/properties.hxx b/include/svx/sdr/properties/properties.hxx index 3bfca7630efe..71dad7f567fb 100644 --- a/include/svx/sdr/properties/properties.hxx +++ b/include/svx/sdr/properties/properties.hxx @@ -44,32 +44,6 @@ namespace sdr } } -//////////////////////////////////////////////////////////////////////////////////////////////////// -// -// BaseProperties -// DefaultProperties ->SfxItemSet -// AttributeProperties ->SfxStyleSheet -// E3dProperties -// E3dCompoundProperties -// E3dExtrudeProperties -// E3dLatheProperties -// E3dSphereProperties -// E3dSceneProperties -// TextProperties ->maVersion -// ConnectorProperties -// CustomShapeProperties -// MeasureProperties -// RectangleProperties -// CaptionProperties -// CircleProperties -// GraphicProperties -// OleProperties -// CellProperties -// TableProperties -// GroupProperties -// EmptyProperties -// PageProperties - namespace sdr { namespace properties @@ -167,6 +141,13 @@ namespace sdr // Get the installed StyleSheet. virtual SfxStyleSheet* GetStyleSheet() const = 0; + // Move local items to a new ItemPool. + // Override this to do it for hierarchical objects like e.g. groups. + virtual void MoveToItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel); + + // Set new model. + virtual void SetModel(SdrModel* pOldModel, SdrModel* pNewModel); + // force all attributes which come from styles to hard attributes // to be able to live without the style. virtual void ForceStyleToHardAttributes(); diff --git a/include/svx/sdr/table/tablecontroller.hxx b/include/svx/sdr/table/tablecontroller.hxx index fe03d7353a2b..6a999a78b344 100644 --- a/include/svx/sdr/table/tablecontroller.hxx +++ b/include/svx/sdr/table/tablecontroller.hxx @@ -29,7 +29,7 @@ #include <svx/svdotable.hxx> #include <svx/svdview.hxx> -class SdrView; +class SdrObjEditView; class SdrObject; class SfxItemSet; class SvxBoxInfoItem; @@ -39,12 +39,10 @@ namespace sdr { namespace table { class TableModel; -class SVX_DLLPUBLIC SvxTableController : public sdr::SelectionController +class SVX_DLLPUBLIC SvxTableController: public sdr::SelectionController { public: - SVX_DLLPRIVATE SvxTableController( - SdrView& rView, - const SdrTableObj& rObj); + SVX_DLLPRIVATE SvxTableController( SdrObjEditView* pView, const SdrTableObj* pObj ); SVX_DLLPRIVATE virtual ~SvxTableController() override; // from sdr::SelectionController @@ -78,10 +76,7 @@ public: SVX_DLLPRIVATE void DistributeRows(); SVX_DLLPRIVATE void SetVertical( sal_uInt16 nSId ); - SVX_DLLPRIVATE static rtl::Reference< sdr::SelectionController > create( - SdrView& rView, - const SdrTableObj& rObj, - const rtl::Reference< sdr::SelectionController >& xRefController); + SVX_DLLPRIVATE static rtl::Reference< sdr::SelectionController > create( SdrObjEditView* pView, const SdrTableObj* pObj, const rtl::Reference< sdr::SelectionController >& xRefController ); SVX_DLLPRIVATE void MergeAttrFromSelectedCells(SfxItemSet& rAttr, bool bOnlyHardAttr) const; SVX_DLLPRIVATE void SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bReplaceAll); @@ -98,7 +93,7 @@ public: SVX_DLLPRIVATE virtual bool GetMarkedObjModel( SdrPage* pNewPage ) override; SVX_DLLPRIVATE virtual bool PasteObjModel( const SdrModel& rModel ) override; - SVX_DLLPRIVATE virtual bool hasSelectedCells() const override { return mbCellSelectionMode || mrView.IsTextEdit(); } + SVX_DLLPRIVATE virtual bool hasSelectedCells() const override { return mbCellSelectionMode || mpView->IsTextEdit(); } /// @see sdr::SelectionController::setCursorLogicPosition(). SVX_DLLPRIVATE virtual bool setCursorLogicPosition(const Point& rPosition, bool bPoint) override; @@ -179,16 +174,17 @@ private: CellPos maMouseDownPos; bool mbLeftButtonDown; sdr::overlay::OverlayObjectList* mpSelectionOverlay; - SdrView& mrView; + + SdrView* mpView; tools::WeakReference<SdrTableObj> mxTableObj; + SdrModel* mpModel; + css::uno::Reference< css::util::XModifyListener > mxModifyListener; + ImplSVEvent * mnUpdateEvent; }; -rtl::Reference< sdr::SelectionController > CreateTableController( - SdrView& rView, - const SdrTableObj& rObj, - const rtl::Reference< sdr::SelectionController >& xRefController ); +rtl::Reference< sdr::SelectionController > CreateTableController( SdrObjEditView* pView, const SdrTableObj* pObj, const rtl::Reference< sdr::SelectionController >& xRefController ); } } diff --git a/include/svx/sphere3d.hxx b/include/svx/sphere3d.hxx index e5534e528fa9..9c4bc5d21468 100644 --- a/include/svx/sphere3d.hxx +++ b/include/svx/sphere3d.hxx @@ -35,19 +35,16 @@ private: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override; - void SetDefaultAttributes(const E3dDefaultAttributes& rDefault); + void SetDefaultAttributes(E3dDefaultAttributes& rDefault); public: - E3dSphereObj( - SdrModel& rSdrModel, - const E3dDefaultAttributes& rDefault, - const basegfx::B3DPoint& rCenter, - const basegfx::B3DVector& r3DSize); + E3dSphereObj(E3dDefaultAttributes& rDefault, const basegfx::B3DPoint& rCenter, const basegfx::B3DVector& r3DSize); // FG: This constructor is only called from MakeObject from the 3d-Objectfactory // when a document with a sphere is loaded. This constructor does not call // CreateSphere, or create any spheres. - E3dSphereObj(SdrModel& rSdrModel); + enum Dummy { DUMMY }; + E3dSphereObj(Dummy dummy); // horizontal segments: sal_uInt32 GetHorizontalSegments() const @@ -60,10 +57,7 @@ public: virtual sal_uInt16 GetObjIdentifier() const override; virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override; - virtual E3dSphereObj* Clone(SdrModel* pTargetModel = nullptr) const override; - - // implemented mainly for the purposes of Clone() - E3dSphereObj& operator=(const E3dSphereObj& rObj); + virtual E3dSphereObj* Clone() const override; const basegfx::B3DPoint& Center() const { return aCenter; } const basegfx::B3DVector& Size() const { return aSize; } diff --git a/include/svx/svdcrtv.hxx b/include/svx/svdcrtv.hxx index 47858b29cf4e..3b71a5088510 100644 --- a/include/svx/svdcrtv.hxx +++ b/include/svx/svdcrtv.hxx @@ -31,7 +31,7 @@ class SdrObjConnection; class ImplConnectMarkerOverlay; class ImpSdrCreateViewExtraData; -class SVX_DLLPUBLIC SdrCreateView : public SdrDragView +class SVX_DLLPUBLIC SdrCreateView: public SdrDragView { friend class SdrPageView; @@ -69,10 +69,7 @@ protected: protected: // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView - SdrCreateView( - SdrModel& rSdrModel, - OutputDevice* pOut); - + SdrCreateView(SdrModel* pModel1, OutputDevice* pOut); virtual ~SdrCreateView() override; public: diff --git a/include/svx/svddrgv.hxx b/include/svx/svddrgv.hxx index 180d8cc09269..19b56414e9b0 100644 --- a/include/svx/svddrgv.hxx +++ b/include/svx/svddrgv.hxx @@ -25,7 +25,7 @@ class SdrUndoGeoObj; -class SVX_DLLPUBLIC SdrDragView : public SdrExchangeView +class SVX_DLLPUBLIC SdrDragView: public SdrExchangeView { friend class SdrPageView; friend class SdrDragMethod; @@ -69,10 +69,7 @@ protected: protected: // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView - SdrDragView( - SdrModel& rSdrModel, - OutputDevice* pOut); - + SdrDragView(SdrModel* pModel1, OutputDevice* pOut); virtual ~SdrDragView() override; public: diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx index 51dbb4872e51..0c1e2f6a9dc1 100644 --- a/include/svx/svdedtv.hxx +++ b/include/svx/svdedtv.hxx @@ -68,7 +68,7 @@ namespace o3tl template<> struct typed_flags<SdrInsertFlags> : is_typed_flags<SdrInsertFlags, 0x1f> {}; } -class SVX_DLLPUBLIC SdrEditView : public SdrMarkView +class SVX_DLLPUBLIC SdrEditView: public SdrMarkView { friend class SdrPageView; friend class SdrDragDistort; @@ -163,10 +163,7 @@ protected: protected: // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView - SdrEditView( - SdrModel& rSdrModel, - OutputDevice* pOut); - + SdrEditView(SdrModel* pModel1, OutputDevice* pOut); virtual ~SdrEditView() override; public: diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx index 70472aab20b2..324a611d96eb 100644 --- a/include/svx/svdedxv.hxx +++ b/include/svx/svdedxv.hxx @@ -58,7 +58,7 @@ enum class SdrEndTextEditKind // - macromod -class SVX_DLLPUBLIC SdrObjEditView : public SdrGlueEditView, public EditViewCallbacks +class SVX_DLLPUBLIC SdrObjEditView: public SdrGlueEditView, public EditViewCallbacks { friend class SdrPageView; friend class ImpSdrEditPara; @@ -150,10 +150,7 @@ protected: protected: // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView - SdrObjEditView( - SdrModel& rSdrModel, - OutputDevice* pOut); - + SdrObjEditView(SdrModel* pModel1, OutputDevice* pOut); virtual ~SdrObjEditView() override; public: diff --git a/include/svx/svdglev.hxx b/include/svx/svdglev.hxx index be365e368c7e..10645f0a5aaa 100644 --- a/include/svx/svdglev.hxx +++ b/include/svx/svdglev.hxx @@ -29,7 +29,7 @@ class SdrGluePoint; // Edit GluePoints at the objects (GluePoints for connector) -class SVX_DLLPUBLIC SdrGlueEditView : public SdrPolyEditView +class SVX_DLLPUBLIC SdrGlueEditView: public SdrPolyEditView { // copy marked GluePoints and mark instead of the old ones void ImpCopyMarkedGluePoints(); @@ -40,10 +40,7 @@ class SVX_DLLPUBLIC SdrGlueEditView : public SdrPolyEditView protected: // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView - SdrGlueEditView( - SdrModel& rSdrModel, - OutputDevice* pOut); - + SdrGlueEditView(SdrModel* pModel1, OutputDevice* pOut); virtual ~SdrGlueEditView() override; public: diff --git a/include/svx/svdmrkv.hxx b/include/svx/svdmrkv.hxx index 36e80416087b..981b1e29e5d1 100644 --- a/include/svx/svdmrkv.hxx +++ b/include/svx/svdmrkv.hxx @@ -166,10 +166,7 @@ protected: protected: // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView - SdrMarkView( - SdrModel& rSdrModel, - OutputDevice* pOut); - + SdrMarkView(SdrModel* pModel1, OutputDevice* pOut); virtual ~SdrMarkView() override; public: diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx index 3ce7833ca8c8..85f5e9dc68ca 100644 --- a/include/svx/svdoashp.hxx +++ b/include/svx/svdoashp.hxx @@ -98,8 +98,15 @@ public: css::uno::Reference< css::drawing::XCustomShapeEngine > const & GetCustomShapeEngine() const; +// SVX_DLLPRIVATE css::uno::Sequence< css::uno::Reference< css::drawing::XCustomShapeHandle > > +// SdrObjCustomShape::GetInteraction( const SdrObjCustomShape* pCustomShape ) const; +// #i47293# +// SVX_DLLPRIVATE std::vector< css::uno::Reference< css::drawing::XCustomShapeHandle > > GetFixedInteractionHandle() const; + SVX_DLLPRIVATE std::vector< SdrCustomShapeInteraction > GetInteractionHandles() const; + SVX_DLLPRIVATE void DragCreateObject( SdrDragStat& rDrag ); + SVX_DLLPRIVATE void DragResizeCustomShape( const tools::Rectangle& rNewRect ); SVX_DLLPRIVATE void DragMoveCustomShapeHdl( const Point& rDestination, const sal_uInt16 nCustomShapeHdlNum, bool bMoveCalloutRectangle ); @@ -140,7 +147,7 @@ public: double GetObjectRotation() const { return fObjectRotation;} double GetExtraTextRotation( const bool bPreRotation = false ) const; - SdrObjCustomShape(SdrModel& rSdrModel); + SdrObjCustomShape(); virtual ~SdrObjCustomShape() override; /* is merging default attributes from type-shape into the SdrCustomShapeGeometryItem. If pType @@ -165,6 +172,8 @@ public: virtual sal_uInt16 GetObjIdentifier() const override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; + virtual void SetModel(SdrModel* pNewModel) override; + virtual void Move(const Size& rSiz) override; virtual void Shear(const Point& rRef, long nAngle, double tn, bool bVShear) override; virtual void SetSnapRect(const tools::Rectangle& rRect) override; @@ -207,7 +216,7 @@ public: virtual void TakeTextAnchorRect( tools::Rectangle& rAnchorRect ) const override; virtual void TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRect, bool bNoEditText, tools::Rectangle* pAnchorRect, bool bLineWidth = true ) const override; - virtual SdrObjCustomShape* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrObjCustomShape* Clone() const override; SdrObjCustomShape& operator=(const SdrObjCustomShape& rObj); virtual OUString TakeObjNameSingul() const override; diff --git a/include/svx/svdoattr.hxx b/include/svx/svdoattr.hxx index a39a91957841..10c163b3b9b0 100644 --- a/include/svx/svdoattr.hxx +++ b/include/svx/svdoattr.hxx @@ -28,14 +28,20 @@ #include <svx/svdattr.hxx> #include <svx/svxdllapi.h> + // Initial Declarations + + class SfxPoolItem; class SfxSetItem; class SdrOutliner; class SfxItemSet; class SfxItemPool; + // SdrAttrObj + + class SVX_DLLPUBLIC SdrAttrObj : public SdrObject { private: @@ -53,7 +59,7 @@ protected: /// Detects when a stylesheet is changed virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; - SdrAttrObj(SdrModel& rSdrModel); + SdrAttrObj(); virtual ~SdrAttrObj() override; public: @@ -65,6 +71,8 @@ public: bool HasLine() const; virtual const tools::Rectangle& GetSnapRect() const override; + + virtual void SetModel(SdrModel* pNewModel) override; }; diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 7d033605933a..3f01cbb82ff6 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -74,11 +74,10 @@ class SdrLayerIDSet; class OutputDevice; class Fraction; -namespace basegfx -{ - class B2DPoint; - class B2DPolyPolygon; - class B2DHomMatrix; +namespace basegfx { +class B2DPoint; +class B2DPolyPolygon; +class B2DHomMatrix; } namespace sdr @@ -104,8 +103,6 @@ namespace svx class PropertyChangeNotifier; } -class SvxShape; - enum SdrObjKind { OBJ_NONE = 0, /// abstract object (SdrObject) OBJ_GRUP = 1, /// object group @@ -268,45 +265,9 @@ public: SdrObjTransformInfoRec(); }; -//////////////////////////////////////////////////////////////////////////////////////////////////// -// -// SdrObject -// SdrAttrObj -// E3dObject -// E3dCompoundObject -// E3dCubeObj -// E3dExtrudeObj -// E3dLatheObj -// E3dPolygonObj -// E3dSphereObj -// E3dScene -// SdrTextObj -// SdrObjCustomShape -// OCustomShape -// SdrEdgeObj -// SdrMeasureObj -// SdrPathObj -// SdrRectObj -// SdrCaptionObj -// SdrCircObj -// SdrGrafObj -// SdrMediaObj -// SdrOle2Obj -// OOle2Obj -// SdrUnoObj -// DlgEdObj -// DlgEdForm -// OUnoObject -// FmFormObj -// SdrTableObj -// SdrObjGroup -// SdrPageObj -// SdrVirtObj -// SwDrawVirtObj -// SwVirtFlyDrawObj -// SwFlyDrawObj - /// Abstract DrawObject + +class SvxShape; class SVX_DLLPUBLIC SdrObject: public SfxListener, public virtual tools::WeakBase { private: @@ -335,16 +296,8 @@ private: public: const SdrObject* getFillGeometryDefiningShape() const { return mpFillGeometryDefiningShape; } -private: - // the SdrModel this objects was created with, unchanged during SdrObject lifetime - SdrModel& mrSdrModelFromSdrObject; - public: - // A SdrObject always needs a SdrModel for lifetime (Pool, ...) - SdrObject(SdrModel& rSdrModel); - - // SdrModel access on SdrObject level - SdrModel& getSdrModelFromSdrObject() const { return mrSdrModelFromSdrObject; } + SdrObject(); void AddObjectUser(sdr::ObjectUser& rNewUser); void RemoveObjectUser(sdr::ObjectUser& rOldUser); @@ -388,6 +341,9 @@ public: virtual void SetPage(SdrPage* pNewPage); SdrPage* GetPage() const { return pPage;} + + virtual void SetModel(SdrModel* pNewModel); + SdrModel* GetModel() const { return pModel;} SfxItemPool & GetObjectItemPool() const; void AddListener(SfxListener& rListener); @@ -482,7 +438,7 @@ public: // Returns a copy of the object. Every inherited class must reimplement this (in class Foo // it should be sufficient to do "virtual Foo* Clone() const { return CloneHelper< Foo >(); }". // Note that this function uses operator= internally. - virtual SdrObject* Clone(SdrModel* pTargetModel = nullptr) const; + virtual SdrObject* Clone() const; // implemented mainly for the purposes of Clone() SdrObject& operator=(const SdrObject& rObj); @@ -768,9 +724,7 @@ public: // when there is no filled new polygon created from line-to-polygon conversion, // specially used for XLINE_DASH and 3D conversion SdrObject* ConvertToContourObj(SdrObject* pRet, bool bForceLineDash = false) const; -private: - SdrObject* ImpConvertToContourObj(bool bForceLineDash); -public: + static SdrObject* ImpConvertToContourObj(SdrObject* pRet, bool bForceLineDash); // if true, reference onto an object bool IsVirtualObj() const { return bVirtObj;} @@ -808,6 +762,9 @@ public: // removes the record from the list and performs delete (FreeMem+Dtor). void DeleteUserData(sal_uInt16 nNum); + // switch ItemPool for this object + void MigrateItemPool(SfxItemPool* pSrcPool, SfxItemPool* pDestPool, SdrModel* pNewModel); + // access to the UNO representation of the shape virtual css::uno::Reference< css::uno::XInterface > getUnoShape(); @@ -910,6 +867,7 @@ protected: tools::Rectangle aOutRect; // surrounding rectangle for Paint (incl. LineWdt, ...) Point aAnchor; // anchor position (Writer) SdrPage* pPage; + SdrModel* pModel; SdrObjUserCall* pUserCall; std::unique_ptr<SdrObjPlusData> pPlusData; // Broadcaster, UserData, connectors, ... (this is the Bitsack) @@ -951,6 +909,7 @@ protected: void ImpForcePlusData(); + OUString GetAngleStr(long nAngle) const; OUString GetMetrStr(long nVal) const; /// A derived class must override these 3 methods if it has own geometric @@ -986,7 +945,7 @@ protected: virtual void impl_setUnoShape( const css::uno::Reference< css::uno::XInterface >& _rxUnoShape ); // helper function for reimplementing Clone(). - template< typename T > T* CloneHelper(SdrModel* pTargetModel) const; + template< typename T > T* CloneHelper() const; private: struct Impl; @@ -1047,7 +1006,6 @@ struct SdrObjCreatorParams { SdrInventor nInventor; sal_uInt16 nObjIdentifier; - SdrModel& rSdrModel; }; /** @@ -1061,40 +1019,23 @@ struct SdrObjCreatorParams class SVX_DLLPUBLIC SdrObjFactory { public: - static SdrObject* MakeNewObject( - SdrModel& rSdrModel, - SdrInventor nInventor, - sal_uInt16 nObjIdentifier, - SdrPage* pPage = nullptr, - const tools::Rectangle* pSnapRect = nullptr); - + static SdrObject* MakeNewObject(SdrInventor nInventor, sal_uInt16 nObjIdentifier, SdrPage* pPage, SdrModel* pModel=nullptr); + static SdrObject* MakeNewObject(SdrInventor nInventor, sal_uInt16 nObjIdentifier, const tools::Rectangle& rSnapRect, SdrPage* pPage); static void InsertMakeObjectHdl(Link<SdrObjCreatorParams, SdrObject*> const & rLink); static void RemoveMakeObjectHdl(Link<SdrObjCreatorParams, SdrObject*> const & rLink); private: - static SVX_DLLPRIVATE SdrObject* CreateObjectFromFactory( - SdrModel& rSdrModel, - SdrInventor nInventor, - sal_uInt16 nIdentifier); + static SVX_DLLPRIVATE SdrObject* CreateObjectFromFactory( SdrInventor nInventor, sal_uInt16 nIdentifier ); SdrObjFactory() = delete; }; -template< typename T > T* SdrObject::CloneHelper(SdrModel* pTargetModel) const +template< typename T > T* SdrObject::CloneHelper() const { OSL_ASSERT( typeid( T ) == typeid( *this )); - T* pObj = dynamic_cast< T* >( - SdrObjFactory::MakeNewObject( - nullptr == pTargetModel ? getSdrModelFromSdrObject() : *pTargetModel, - GetObjInventor(), - GetObjIdentifier())); - - if(nullptr != pObj) - { - // use ::operator=() - *pObj = *static_cast< const T* >( this ); - } - + T* pObj = dynamic_cast< T* >( SdrObjFactory::MakeNewObject(GetObjInventor(),GetObjIdentifier(),nullptr)); + if (pObj!=nullptr) + *pObj=*static_cast< const T* >( this ); return pObj; } diff --git a/include/svx/svdocapt.hxx b/include/svx/svdocapt.hxx index baa0e0390bd6..3dd68293708a 100644 --- a/include/svx/svdocapt.hxx +++ b/include/svx/svdocapt.hxx @@ -25,20 +25,28 @@ // Forward Declarations + + class ImpCaptParams; namespace sdr { namespace properties { class CaptionProperties; }} + // Helper Class SdrCaptObjGeoData + + class SdrCaptObjGeoData : public SdrTextObjGeoData { public: tools::Polygon aTailPoly; }; + // SdrCaptionObj + + class SVX_DLLPUBLIC SdrCaptionObj : public SdrRectObj { private: @@ -65,20 +73,13 @@ private: SVX_DLLPRIVATE void ImpRecalcTail(); public: - SdrCaptionObj(SdrModel& rSdrModel); - SdrCaptionObj( - SdrModel& rSdrModel, - const tools::Rectangle& rRect, - const Point& rTail); - + SdrCaptionObj(); + SdrCaptionObj(const tools::Rectangle& rRect, const Point& rTail); virtual ~SdrCaptionObj() override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual sal_uInt16 GetObjIdentifier() const override; - virtual SdrCaptionObj* Clone(SdrModel* pTargetModel = nullptr) const override; - - // implemented mainly for the purposes of Clone() - SdrCaptionObj& operator=(const SdrCaptionObj& rObj); + virtual SdrCaptionObj* Clone() const override; // for calc: special shadow only for text box void SetSpecialTextBoxShadow() { mbSpecialTextBoxShadow = true; } @@ -91,6 +92,7 @@ public: virtual OUString TakeObjNamePlural() const override; virtual basegfx::B2DPolyPolygon TakeXorPoly() const override; + virtual void SetModel(SdrModel* pNewModel) override; virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; virtual sal_uInt32 GetHdlCount() const override; diff --git a/include/svx/svdocirc.hxx b/include/svx/svdocirc.hxx index fc3045585aa6..d3bc9c2116f5 100644 --- a/include/svx/svdocirc.hxx +++ b/include/svx/svdocirc.hxx @@ -66,25 +66,14 @@ private: virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; public: - SdrCircObj( - SdrModel& rSdrModel, - SdrObjKind eNewKind); // Circ, CArc, Sect or CCut - SdrCircObj( - SdrModel& rSdrModel, - SdrObjKind eNewKind, - const tools::Rectangle& rRect); + SdrCircObj(SdrObjKind eNewKind); // Circ, CArc, Sect or CCut + SdrCircObj(SdrObjKind eNewKind, const tools::Rectangle& rRect); // 0=0.00Deg=3h 9000=90.00Deg=12h 18000=180.00Deg=9h 27000=270.00Deg=6h // The circle is build up from StartAngle to EndWink anti-clockwise. // If nNewStartAngle==nNewEndWink, then arc has an angle of 0 degrees. // If nNewStartAngle+36000==nNewEndWink, then the arc has angle of 360 degrees. - SdrCircObj( - SdrModel& rSdrModel, - SdrObjKind eNewKind, - const tools::Rectangle& rRect, - long nNewStartAngle, - long nNewEndWink); - + SdrCircObj(SdrObjKind eNewKind, const tools::Rectangle& rRect, long nNewStartAngle, long nNewEndWink); virtual ~SdrCircObj() override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; @@ -94,11 +83,7 @@ public: virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual SdrCircObj* Clone(SdrModel* pTargetModel = nullptr) const override; - - // implemented mainly for the purposes of Clone() - SdrCircObj& operator=(const SdrCircObj& rObj); - + virtual SdrCircObj* Clone() const override; virtual void RecalcSnapRect() override; virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override; virtual basegfx::B2DPolyPolygon TakeXorPoly() const override; diff --git a/include/svx/svdoedge.hxx b/include/svx/svdoedge.hxx index ae28ad7103be..5b11da0feaef 100644 --- a/include/svx/svdoedge.hxx +++ b/include/svx/svdoedge.hxx @@ -187,7 +187,8 @@ protected: void ImpSetEdgeInfoToAttr(); // copying values from the aEdgeInfo to the pool public: - SdrEdgeObj(SdrModel& rSdrModel); + + SdrEdgeObj(); virtual ~SdrEdgeObj() override; SdrObjConnection& GetConnection(bool bTail1) { return *(bTail1 ? &aCon1 : &aCon2); } @@ -213,7 +214,7 @@ public: virtual void RecalcSnapRect() override; virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override; - virtual SdrEdgeObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrEdgeObj* Clone() const override; SdrEdgeObj& operator=(const SdrEdgeObj& rObj); virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx index d11a289060f8..65b934847489 100644 --- a/include/svx/svdograf.hxx +++ b/include/svx/svdograf.hxx @@ -129,16 +129,10 @@ private: public: - SdrGrafObj(SdrModel& rSdrModel); - SdrGrafObj( - SdrModel& rSdrModel, - const Graphic& rGrf); - SdrGrafObj( - SdrModel& rSdrModel, - const Graphic& rGrf, - const tools::Rectangle& rRect); - - virtual ~SdrGrafObj() override; + SdrGrafObj(); + SdrGrafObj(const Graphic& rGrf); + SdrGrafObj(const Graphic& rGrf, const tools::Rectangle& rRect); + virtual ~SdrGrafObj() override; void SetGraphicObject( const GraphicObject& rGrfObj ); const GraphicObject& GetGraphicObject(bool bForceSwapIn = false) const; @@ -149,7 +143,9 @@ public: const Graphic& GetGraphic() const; Graphic GetTransformedGraphic( SdrGrafObjTransformsAttrs nTransformFlags = SdrGrafObjTransformsAttrs::ALL ) const; + GraphicType GetGraphicType() const; + GraphicAttr GetGraphicAttr( SdrGrafObjTransformsAttrs nTransformFlags = SdrGrafObjTransformsAttrs::ALL ) const; // Keep ATM for SD. @@ -186,7 +182,7 @@ public: // #i25616# virtual basegfx::B2DPolyPolygon TakeXorPoly() const override; - virtual SdrGrafObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrGrafObj* Clone() const override; SdrGrafObj& operator=(const SdrGrafObj& rObj); virtual sal_uInt32 GetHdlCount() const override; @@ -201,6 +197,7 @@ public: bool HasGDIMetaFile() const; virtual void SetPage(SdrPage* pNewPage) override; + virtual void SetModel(SdrModel* pNewModel) override; bool isEmbeddedVectorGraphicData() const; GDIMetaFile getMetafileFromEmbeddedVectorGraphicData() const; diff --git a/include/svx/svdogrp.hxx b/include/svx/svdogrp.hxx index 7f0fb234f972..f15a9b92fb47 100644 --- a/include/svx/svdogrp.hxx +++ b/include/svx/svdogrp.hxx @@ -23,23 +23,30 @@ #include <memory> #include <svx/svdobj.hxx> #include <svx/svxdllapi.h> -#include <svx/svdpage.hxx> + // Forward declarations + + +class SdrObjList; +class SdrObjListIter; class SfxItemSet; + // SdrObjGroup + + class SVX_DLLPUBLIC SdrObjGroup final : public SdrObject { private: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override; - SdrObjList maSdrObjList; // sub list (children) - Point aRefPoint; // Reference point inside the object group + std::unique_ptr<SdrObjList> pSub; // sub list (children) + Point aRefPoint; // Reference point inside the object group public: - SdrObjGroup(SdrModel& rSdrModel); + SdrObjGroup(); virtual ~SdrObjGroup() override; virtual void SetBoundRectDirty() override; @@ -49,12 +56,13 @@ public: virtual void NbcSetLayer(SdrLayerID nLayer) override; virtual void SetObjList(SdrObjList* pNewObjList) override; virtual void SetPage(SdrPage* pNewPage) override; + virtual void SetModel(SdrModel* pNewModel) override; virtual SdrObjList* GetSubList() const override; virtual const tools::Rectangle& GetCurrentBoundRect() const override; virtual const tools::Rectangle& GetSnapRect() const override; - virtual SdrObjGroup* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrObjGroup* Clone() const override; SdrObjGroup& operator=(const SdrObjGroup& rObj); virtual OUString TakeObjNameSingul() const override; diff --git a/include/svx/svdomeas.hxx b/include/svx/svdomeas.hxx index 00a4a9567546..be2ce849890b 100644 --- a/include/svx/svdomeas.hxx +++ b/include/svx/svdomeas.hxx @@ -85,20 +85,14 @@ protected: virtual void RestGeoData(const SdrObjGeoData& rGeo) override; public: - SdrMeasureObj(SdrModel& rSdrModel); - SdrMeasureObj( - SdrModel& rSdrModel, - const Point& rPt1, - const Point& rPt2); + SdrMeasureObj(); + SdrMeasureObj(const Point& rPt1, const Point& rPt2); virtual ~SdrMeasureObj() override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual sal_uInt16 GetObjIdentifier() const override; virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override; - virtual SdrMeasureObj* Clone(SdrModel* pTargetModel = nullptr) const override; - - // implemented mainly for the purposes of Clone() - SdrMeasureObj& operator=(const SdrMeasureObj& rObj); + virtual SdrMeasureObj* Clone() const override; virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; diff --git a/include/svx/svdomedia.hxx b/include/svx/svdomedia.hxx index a45410f76bdf..43356da4e302 100644 --- a/include/svx/svdomedia.hxx +++ b/include/svx/svdomedia.hxx @@ -37,12 +37,10 @@ class SVX_DLLPUBLIC SdrMediaObj final : public SdrRectObj public: - SdrMediaObj(SdrModel& rSdrModel); - SdrMediaObj( - SdrModel& rSdrModel, - const tools::Rectangle& rRect); + SdrMediaObj(); + SdrMediaObj( const tools::Rectangle& rRect ); - virtual ~SdrMediaObj() override; + virtual ~SdrMediaObj() override; virtual bool HasTextEdit() const override; @@ -52,7 +50,7 @@ public: virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual SdrMediaObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrMediaObj* Clone() const override; SdrMediaObj& operator=(const SdrMediaObj& rObj); virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false ) override; diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx index b170f6ac6d03..edeccfa5984a 100644 --- a/include/svx/svdoole2.hxx +++ b/include/svx/svdoole2.hxx @@ -60,8 +60,6 @@ private: SVX_DLLPRIVATE SdrObject* createSdrGrafObjReplacement(bool bAddText) const; SVX_DLLPRIVATE void ImpSetVisAreaSize(); - SVX_DLLPRIVATE void Init(); - protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override; @@ -69,15 +67,8 @@ protected: public: OUString GetStyleString(); - SdrOle2Obj( - SdrModel& rSdrModel, - bool bFrame_ = false); - SdrOle2Obj( - SdrModel& rSdrModel, - const svt::EmbeddedObjectRef& rNewObjRef, - const OUString& rNewObjName, - const tools::Rectangle& rNewRect); - + SdrOle2Obj( bool bFrame_ = false ); + SdrOle2Obj( const svt::EmbeddedObjectRef& rNewObjRef, const OUString& rNewObjName, const tools::Rectangle& rNewRect ); virtual ~SdrOle2Obj() override; const svt::EmbeddedObjectRef& getEmbeddedObjectRef() const; @@ -121,6 +112,7 @@ public: void AbandonObject(); virtual void SetPage(SdrPage* pNewPage) override; + virtual void SetModel(SdrModel* pModel) override; /** Change the IsClosedObj attribute @@ -137,7 +129,7 @@ public: virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual SdrOle2Obj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrOle2Obj* Clone() const override; SdrOle2Obj& assignFrom(const SdrOle2Obj& rObj); SdrOle2Obj& operator=(const SdrOle2Obj& rObj); diff --git a/include/svx/svdopage.hxx b/include/svx/svdopage.hxx index 1f349a9a38ad..8893e812d783 100644 --- a/include/svx/svdopage.hxx +++ b/include/svx/svdopage.hxx @@ -41,14 +41,8 @@ protected: virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override; public: - SdrPageObj( - SdrModel& rSdrModel, - SdrPage* pNewPage = nullptr); - SdrPageObj( - SdrModel& rSdrModel, - const tools::Rectangle& rRect, - SdrPage* pNewPage = nullptr); - + SdrPageObj(SdrPage* pNewPage = nullptr); + SdrPageObj(const tools::Rectangle& rRect, SdrPage* pNewPage = nullptr); virtual ~SdrPageObj() override; SdrPage* GetReferencedPage() const { return mpShownPage;} @@ -59,7 +53,7 @@ public: virtual sal_uInt16 GetObjIdentifier() const override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; - virtual SdrPageObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrPageObj* Clone() const override; SdrPageObj& operator=(const SdrPageObj& rObj); virtual OUString TakeObjNameSingul() const override; diff --git a/include/svx/svdopath.hxx b/include/svx/svdopath.hxx index 6c21fd06571a..e32ccf5116df 100644 --- a/include/svx/svdopath.hxx +++ b/include/svx/svdopath.hxx @@ -62,20 +62,14 @@ private: ImpPathForDragAndCreate& impGetDAC() const; public: - SdrPathObj( - SdrModel& rSdrModel, - SdrObjKind eNewKind); - SdrPathObj( - SdrModel& rSdrModel, - SdrObjKind eNewKind, - const basegfx::B2DPolyPolygon& rPathPoly); - + SdrPathObj(SdrObjKind eNewKind); + SdrPathObj(SdrObjKind eNewKind, const basegfx::B2DPolyPolygon& rPathPoly); virtual ~SdrPathObj() override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual sal_uInt16 GetObjIdentifier() const override; virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override; - virtual SdrPathObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrPathObj* Clone() const override; SdrPathObj& operator=(const SdrPathObj& rObj); virtual OUString TakeObjNameSingul() const override; diff --git a/include/svx/svdorect.hxx b/include/svx/svdorect.hxx index f9c1c34fd145..729d3f221a05 100644 --- a/include/svx/svdorect.hxx +++ b/include/svx/svdorect.hxx @@ -66,22 +66,14 @@ public: * * Constructor of a rectangular drawing object */ - SdrRectObj(SdrModel& rSdrModel); - SdrRectObj( - SdrModel& rSdrModel, - const tools::Rectangle& rRect); + SdrRectObj(); + SdrRectObj(const tools::Rectangle& rRect); SdrRectObj& operator=(const SdrRectObj& rCopy); // Constructor of a text frame - SdrRectObj( - SdrModel& rSdrModel, - SdrObjKind eNewTextKind); - SdrRectObj( - SdrModel& rSdrModel, - SdrObjKind eNewTextKind, - const tools::Rectangle& rRect); - + SdrRectObj(SdrObjKind eNewTextKind); + SdrRectObj(SdrObjKind eNewTextKind, const tools::Rectangle& rRect); virtual ~SdrRectObj() override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; @@ -91,7 +83,7 @@ public: virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual SdrRectObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrRectObj* Clone() const override; virtual void RecalcSnapRect() override; virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override; virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override; diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx index 7c5e30ec4e8d..c33551cccac7 100644 --- a/include/svx/svdotable.hxx +++ b/include/svx/svdotable.hxx @@ -98,20 +98,13 @@ class SVX_DLLPUBLIC SdrTableObj : public ::SdrTextObj friend class SdrTableObjImpl; public: - SdrTableObj(SdrModel& rSdrModel); - SdrTableObj( - SdrModel& rSdrModel, - const ::tools::Rectangle& rNewRect, - sal_Int32 nColumns, - sal_Int32 nRows); - + SdrTableObj(SdrModel* _pModel); + SdrTableObj(SdrModel* _pModel, const ::tools::Rectangle& rNewRect, sal_Int32 nColumns, sal_Int32 nRows); virtual ~SdrTableObj() override; + // Table stuff - SdrTableObj* CloneRange( - const CellPos& rStartPos, - const CellPos& rEndPos, - SdrModel& rTargetModel); + SdrTableObj* CloneRange( const CellPos& rStartPos, const CellPos& rEndPos ); void DistributeColumns( sal_Int32 nFirstColumn, sal_Int32 nLastColumn ); void DistributeRows( sal_Int32 nFirstRow, sal_Int32 nLastRow ); @@ -191,6 +184,7 @@ public: virtual bool IsFontwork() const override; + virtual void SetModel(SdrModel* pNewModel) override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual sal_uInt16 GetObjIdentifier() const override; virtual void SetChanged() override; @@ -199,7 +193,7 @@ public: virtual bool AdjustTextFrameWidthAndHeight() override; virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual SdrTableObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrTableObj* Clone() const override; SdrTableObj& operator=(const SdrTableObj& rObj); virtual void RecalcSnapRect() override; virtual const tools::Rectangle& GetSnapRect() const override; diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx index 13ff8940d0c1..277f51ebba2c 100644 --- a/include/svx/svdotext.hxx +++ b/include/svx/svdotext.hxx @@ -136,13 +136,16 @@ class SVX_DLLPUBLIC SdrTextObj : public SdrAttrObj, public svx::ITextProvider { private: // Cell needs access to ImpGetDrawOutliner(); + friend class sdr::table::Cell; friend class sdr::table::SdrTableRtfExporter; friend class sdr::table::SdrTableRTFParser; + friend class TextChain; friend class TextChainFlow; friend class EditingTextChainFlow; + // CustomShapeproperties need to access the "bTextFrame" member: friend class sdr::properties::CustomShapeProperties; @@ -269,6 +272,7 @@ private: SVX_DLLPRIVATE void ImpRegisterLink(); SVX_DLLPRIVATE void ImpDeregisterLink(); SVX_DLLPRIVATE ImpSdrObjTextLinkUserData* GetLinkUserData() const; +// void ImpCheckItemSetChanges(const SfxItemSet& rAttr); /** Appends the style family to a provided style name */ static void AppendFamilyToStyleName(OUString& styleName, SfxStyleFamily family); @@ -302,19 +306,12 @@ protected: virtual void AdaptTextMinSize(); // constructors for labeled graphical objects - SdrTextObj(SdrModel& rSdrModel); - SdrTextObj( - SdrModel& rSdrModel, - const tools::Rectangle& rNewRect); + SdrTextObj(); + SdrTextObj(const tools::Rectangle& rNewRect); // constructors for text frames - SdrTextObj( - SdrModel& rSdrModel, - SdrObjKind eNewTextKind); - SdrTextObj( - SdrModel& rSdrModel, - SdrObjKind eNewTextKind, - const tools::Rectangle& rNewRect); + SdrTextObj(SdrObjKind eNewTextKind); + SdrTextObj(SdrObjKind eNewTextKind, const tools::Rectangle& rNewRect); virtual ~SdrTextObj() override; @@ -437,6 +434,7 @@ public: SdrTextAniDirection GetTextAniDirection() const; virtual void SetPage(SdrPage* pNewPage) override; + virtual void SetModel(SdrModel* pNewModel) override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual sal_uInt16 GetObjIdentifier() const override; @@ -444,7 +442,7 @@ public: virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const; virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; - virtual SdrTextObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrTextObj* Clone() const override; SdrTextObj& operator=(const SdrTextObj& rObj); virtual basegfx::B2DPolyPolygon TakeXorPoly() const override; virtual basegfx::B2DPolyPolygon TakeContour() const override; diff --git a/include/svx/svdouno.hxx b/include/svx/svdouno.hxx index d9dfb5d6acd2..48098ae65b37 100644 --- a/include/svx/svdouno.hxx +++ b/include/svx/svdouno.hxx @@ -61,19 +61,15 @@ private: public: - explicit SdrUnoObj( - SdrModel& rSdrModel, - const OUString& rModelName); - SdrUnoObj( - SdrModel& rSdrModel, - const OUString& rModelName, + explicit SdrUnoObj(const OUString& rModelName); + SdrUnoObj(const OUString& rModelName, const css::uno::Reference< css::lang::XMultiServiceFactory >& rxSFac); virtual ~SdrUnoObj() override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual sal_uInt16 GetObjIdentifier() const override; - virtual SdrUnoObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrUnoObj* Clone() const override; SdrUnoObj& operator= (const SdrUnoObj& rObj); virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override; virtual void NbcSetLayer(SdrLayerID nLayer) override; @@ -81,6 +77,10 @@ public: // SpecialDrag support virtual bool hasSpecialDrag() const override; + // FullDrag support + virtual bool supportsFullDrag() const override; + virtual SdrObject* getFullDragClone() const override; + virtual OUString TakeObjNameSingul() const override; virtual OUString TakeObjNamePlural() const override; diff --git a/include/svx/svdovirt.hxx b/include/svx/svdovirt.hxx index 9e4e6d9ed179..c6d626e1305f 100644 --- a/include/svx/svdovirt.hxx +++ b/include/svx/svdovirt.hxx @@ -37,7 +37,7 @@ protected: virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; SdrObject& rRefObj; // Referenced drawing object - tools::Rectangle aSnapRect; + tools::Rectangle aSnapRect; protected: virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; @@ -47,14 +47,12 @@ protected: virtual void RestGeoData(const SdrObjGeoData& rGeo) override; public: - SdrVirtObj( - SdrModel& rSdrModel, - SdrObject& rNewObj); + SdrVirtObj(SdrObject& rNewObj); virtual ~SdrVirtObj() override; - SdrObject& ReferencedObj(); const SdrObject& GetReferencedObj() const; virtual void NbcSetAnchorPos(const Point& rAnchorPos) override; + virtual void SetModel(SdrModel* pNewModel) override; virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual SdrInventor GetObjInventor() const override; @@ -64,7 +62,7 @@ public: virtual const tools::Rectangle& GetCurrentBoundRect() const override; virtual const tools::Rectangle& GetLastBoundRect() const override; virtual void RecalcBoundRect() override; - virtual SdrVirtObj* Clone(SdrModel* pTargetModel = nullptr) const override; + virtual SdrVirtObj* Clone() const override; SdrVirtObj& operator=(const SdrVirtObj& rObj); virtual OUString TakeObjNameSingul() const override; diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx index 1ea8f1f57358..1a7fdb59a7fa 100644 --- a/include/svx/svdpage.hxx +++ b/include/svx/svdpage.hxx @@ -53,26 +53,21 @@ class Color; class SfxStyleSheet; class SvxUnoDrawPagesAccess; -//////////////////////////////////////////////////////////////////////////////////////////////////// -// -// SdrObjList -// E3dObjList -// SdrPage -> see continuation there - // class SdrObjList + class SVX_DLLPUBLIC SdrObjList { -private: SdrObjList(const SdrObjList& rSrcList) = delete; SdrObjList &operator=(const SdrObjList& rSrcList) = delete; private: - ::std::vector<SdrObject*> maList; + ::std::vector<SdrObject*> maList; protected: friend class SdrObjListIter; friend class SdrEditView; SdrObjList* pUpList; /// parent list + SdrModel* pModel; /// model to which the list belongs (Layer,ItemPool,Storage) SdrPage* pPage; /// Page containing the list, may be "this". SdrObject* pOwnerObj; /// OwnerObject, if it's list of a Group object. tools::Rectangle aOutRect; @@ -80,20 +75,20 @@ friend class SdrEditView; SdrObjListKind eListKind; bool bObjOrdNumsDirty; bool bRectsDirty; - protected: void RecalcRects(); - void lateInitSdrObjList(const SdrObjList& rSrcList, SdrModel* pNewModel = nullptr); + + SdrObjList(); + void lateInit(const SdrObjList& rSrcList); private: /// simple ActionChildInserted forwarder to have it on a central place static void impChildInserted(SdrObject const & rChild); public: - SdrObjList(SdrPage* pNewPage = nullptr); + SdrObjList(SdrModel* pNewModel, SdrPage* pNewPage); virtual ~SdrObjList(); - virtual SdrObjList* CloneSdrObjList(SdrModel* pNewModel = nullptr) const; - void CopyObjects(const SdrObjList& rSrcList, SdrModel* pNewModel = nullptr); + void CopyObjects(const SdrObjList& rSrcList); /// clean up everything (without Undo) void Clear(); SdrObjListKind GetListKind() const { return eListKind; } @@ -104,7 +99,8 @@ public: void SetOwnerObj(SdrObject* pNewOwner) { pOwnerObj=pNewOwner; } SdrPage* GetPage() const; void SetPage(SdrPage* pNewPage); - + SdrModel* GetModel() const; + virtual void SetModel(SdrModel* pNewModel); /// recalculate order numbers / ZIndex void RecalcObjOrdNums(); bool IsObjOrdNumsDirty() const { return bObjOrdNumsDirty; } @@ -352,17 +348,6 @@ public: Also it's possible to request and directly set the order number (ZOrder) of SdrObjects. */ - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// -// SdrPage -// DlgEdPage -// FmFormPage -// ScDrawPage -// SdPage -// SwDPage -// OReportPage - class SVX_DLLPUBLIC SdrPage : public SdrObjList, public virtual tools::WeakBase { // #i9076# @@ -373,8 +358,7 @@ class SVX_DLLPUBLIC SdrPage : public SdrObjList, public virtual tools::WeakBase // and thus has to set mxUnoPage (it also relies on mxUnoPage not being WeakRef) friend class reportdesign::OSection; - SdrPage& operator=(const SdrPage&) = delete; - SdrPage(const SdrPage&) = delete; + SdrPage& operator=(const SdrPage& rSrcPage) = delete; // start PageUser section private: @@ -387,9 +371,6 @@ public: void AddPageUser(sdr::PageUser& rNewUser); void RemovePageUser(sdr::PageUser& rOldUser); - // SdrModel access on SdrPage level - SdrModel& getSdrModelFromSdrPage() const { return mrSdrModelFromSdrPage; } - protected: sdr::contact::ViewContact* CreateObjectSpecificViewContact(); public: @@ -400,10 +381,6 @@ public: void ActionChanged(); private: - // the SdrModel this page was created with, unchanged during SdrPage lifetime - SdrModel& mrSdrModelFromSdrPage; - -private: sal_Int32 mnWidth; // Seitengroesse sal_Int32 mnHeight; // Seitengroesse sal_Int32 mnBorderLeft; // Seitenrand links @@ -443,13 +420,14 @@ protected: // to call lateInit() after copy-construction of a new object. Any initialization in derived // classes that needs access to the page objects must be deferred to lateInit. And it must // call lateInit() of its parent class. - void lateInit(const SdrPage& rSrcPage); + SdrPage(const SdrPage& rSrcPage); + void lateInit(const SdrPage& rSrcPage, SdrModel* pNewModel = nullptr); public: - explicit SdrPage(SdrModel& rModel, bool bMasterPage=false); + explicit SdrPage(SdrModel& rNewModel, bool bMasterPage=false); virtual ~SdrPage() override; - - virtual SdrPage* Clone(SdrModel* pNewModel = nullptr) const; + virtual SdrPage* Clone() const; + virtual SdrPage* Clone(SdrModel* pNewModel) const; bool IsMasterPage() const { return mbMaster; } void SetInserted(bool bNew = true); bool IsInserted() const { return mbInserted; } @@ -480,6 +458,8 @@ public: sal_Int32 GetRightBorder() const; sal_Int32 GetLowerBorder() const; + virtual void SetModel(SdrModel* pNewModel) override; + // New MasterPage interface bool TRG_HasMasterPage() const { return (nullptr != mpMasterPageDescriptor); } void TRG_SetMasterPage(SdrPage& rNew); @@ -525,6 +505,9 @@ public: const sdr::contact::ViewObjectContact& rOriginal, const sdr::contact::DisplayInfo& rDisplayInfo, bool bEdit ); + +private: + void impl_setModelForLayerAdmin(SdrModel* pNewModel); }; diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx index 2405ad9ca4b5..eb48416af426 100644 --- a/include/svx/svdpntv.hxx +++ b/include/svx/svdpntv.hxx @@ -100,39 +100,12 @@ BitmapEx SVX_DLLPUBLIC convertMetafileToBitmapEx( const basegfx::B2DRange& rTargetRange, const sal_uInt32 nMaximumQuadraticPixels); -//////////////////////////////////////////////////////////////////////////////////////////////////// -// -// SdrPaintView -// SdrSnapView -// SdrMarkView -// SdrEditView -// SdrPolyEditView -// SdrGlueEditView -// SdrObjEditView -// SdrExchangeView -// SdrDragView -// SdrCreateView -// SdrView -// DlgEdView -// GraphCtrlView -// E3dView -// DrawViewWrapper -// FmFormView -// ScDrawView -// sd::View (may have more?) -// sd::DrawView -// SwDrawView -// OSectionView class SVX_DLLPUBLIC SdrPaintView : public SfxListener, public SfxRepeatTarget, public SfxBroadcaster, public ::utl::ConfigurationListener { -private: friend class SdrPageView; friend class SdrGrafObj; - // the SdrModel this view was created with, unchanged during lifetime - SdrModel& mrSdrModelFromSdrView; - SdrPageView* mpPageView; protected: SdrModel* mpModel; @@ -265,13 +238,10 @@ protected: virtual void ModelHasChanged(); // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView - // A SdrView always needs a SdrModel for lifetime (Pool, ...) - SdrPaintView(SdrModel& rSdrModel, OutputDevice* pOut); + SdrPaintView(SdrModel* pModel1, OutputDevice* pOut); virtual ~SdrPaintView() override; public: - // SdrModel access on SdrView level - SdrModel& getSdrModelFromSdrView() const { return mrSdrModelFromSdrView; } virtual void ClearPageView(); SdrModel* GetModel() const { return mpModel; } diff --git a/include/svx/svdpoev.hxx b/include/svx/svdpoev.hxx index 187eadd4ca12..c7a33bac1683 100644 --- a/include/svx/svdpoev.hxx +++ b/include/svx/svdpoev.hxx @@ -25,7 +25,7 @@ #include <svx/ipolypolygoneditorcontroller.hxx> -class SVX_DLLPUBLIC SdrPolyEditView : public SdrEditView, public IPolyPolygonEditorController +class SVX_DLLPUBLIC SdrPolyEditView: public SdrEditView, public IPolyPolygonEditorController { friend class SdrEditView; @@ -45,10 +45,7 @@ private: protected: // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView - SdrPolyEditView( - SdrModel& rSdrModel, - OutputDevice* pOut); - + SdrPolyEditView(SdrModel* pModel1, OutputDevice* pOut); virtual ~SdrPolyEditView() override; public: diff --git a/include/svx/svdsnpv.hxx b/include/svx/svdsnpv.hxx index 0a40c9ac59ac..a90bdf34d392 100644 --- a/include/svx/svdsnpv.hxx +++ b/include/svx/svdsnpv.hxx @@ -90,7 +90,7 @@ enum class SdrCrookMode { // #114409#-1 Migrate PageOrigin class ImplPageOriginOverlay; -class SVX_DLLPUBLIC SdrSnapView : public SdrPaintView +class SVX_DLLPUBLIC SdrSnapView: public SdrPaintView { protected: // #114409#-1 Migrate PageOrigin @@ -127,10 +127,7 @@ protected: protected: // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView - SdrSnapView( - SdrModel& rSdrModel, - OutputDevice* pOut); - + SdrSnapView(SdrModel* pModel1, OutputDevice* pOut); virtual ~SdrSnapView() override; public: diff --git a/include/svx/svdtext.hxx b/include/svx/svdtext.hxx index 11b91f028fb8..020d8a483b4b 100644 --- a/include/svx/svdtext.hxx +++ b/include/svx/svdtext.hxx @@ -47,6 +47,7 @@ public: explicit SdrText( SdrTextObj& rObject ); virtual ~SdrText() override; + virtual void SetModel(SdrModel* pNewModel); void ForceOutlinerParaObject( OutlinerMode nOutlMode ); virtual void SetOutlinerParaObject( OutlinerParaObject* pTextObject ); @@ -59,8 +60,7 @@ public: // return a text-specific ItemSet virtual const SfxItemSet& GetItemSet() const; - // This class does not need an own SdrModel reference - always - // has the SdrTextObj working with so can use SdrModel::getSdrModelFromSdrObject() + SdrModel* GetModel() const { return mpModel; } SdrTextObj& GetObject() const { return mrObject; } /** returns the current OutlinerParaObject and removes it from this instance */ @@ -76,6 +76,7 @@ protected: private: std::unique_ptr<OutlinerParaObject> mpOutlinerParaObject; SdrTextObj& mrObject; + SdrModel* mpModel; bool mbPortionInfoChecked; }; diff --git a/include/svx/svdview.hxx b/include/svx/svdview.hxx index 2bab7eaed548..e9d0f51aa476 100644 --- a/include/svx/svdview.hxx +++ b/include/svx/svdview.hxx @@ -144,7 +144,7 @@ public: }; -class SVX_DLLPUBLIC SdrView : public SdrCreateView, public virtual tools::WeakBase +class SVX_DLLPUBLIC SdrView: public SdrCreateView, public virtual tools::WeakBase { friend class SdrPageView; @@ -156,10 +156,7 @@ protected: SvtAccessibilityOptions maAccessibilityOptions; public: - explicit SdrView( - SdrModel& rSdrModel, - OutputDevice* pOut = nullptr); - + explicit SdrView(SdrModel* pModel1, OutputDevice* pOut = nullptr); virtual ~SdrView() override; // The default value for all dispatchers is activated. If the app for example diff --git a/include/svx/svdxcgv.hxx b/include/svx/svdxcgv.hxx index 52dc63b1a282..8c4deca123b9 100644 --- a/include/svx/svdxcgv.hxx +++ b/include/svx/svdxcgv.hxx @@ -25,7 +25,7 @@ #include <vcl/gdimtf.hxx> #include <svx/svxdllapi.h> -class SVX_DLLPUBLIC SdrExchangeView : public SdrObjEditView +class SVX_DLLPUBLIC SdrExchangeView: public SdrObjEditView { friend class SdrPageView; @@ -40,9 +40,7 @@ protected: protected: // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView - SdrExchangeView( - SdrModel& rSdrModel, - OutputDevice* pOut); + SdrExchangeView(SdrModel* pModel1, OutputDevice* pOut); public: // Output all marked objects on the specified OutputDevice @@ -74,16 +72,20 @@ public: Graphic GetAllMarkedGraphic() const; - /** Generate a Graphic for the given draw object + /** Generate a Graphic for the given draw object in the given model - @param rSdrObject + @param pModel + Must not be NULL. Denotes the draw model the object is a part + of. + + @param pObj The object (can also be a group object) to retrieve a Graphic - for. + for. Must not be NULL. @return a graphical representation of the given object, as it appears on screen (e.g. with rotation, if any, applied). */ - static Graphic GetObjGraphic(const SdrObject& rSdrObject); + static Graphic GetObjGraphic( const SdrModel* pModel, const SdrObject* pObj ); // The new Draw objects are marked for all paste methods. // If bAddMark is true, the new Draw objects are added to an existing diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index ae84bb361a92..77f4437f8ae9 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -464,7 +464,7 @@ public: const sal_uInt16 _nInitiallySelectedEvent ) = 0; - virtual VclPtr<SfxAbstractTabDialog> CreateSvxFormatCellsDialog( const SfxItemSet* pAttr, const SdrModel& rModel, const SdrObject* pObj )=0; + virtual VclPtr<SfxAbstractTabDialog> CreateSvxFormatCellsDialog( const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* pObj )=0; virtual VclPtr<SvxAbstractSplitTableDialog> CreateSvxSplitTableDialog(weld::Window* pParent, bool bIsTableVertical, long nMaxVertical) = 0; diff --git a/include/svx/unomod.hxx b/include/svx/unomod.hxx index 04571c9071b2..630c51ce52e4 100644 --- a/include/svx/unomod.hxx +++ b/include/svx/unomod.hxx @@ -32,10 +32,6 @@ SVX_DLLPUBLIC css::uno::Reference< css::container::XIndexReplace > SvxCreateNumR class SVX_DLLPUBLIC SvxUnoDrawMSFactory : public css::lang::XMultiServiceFactory { -protected: - /** abstract SdrModel provider */ - virtual SdrModel* getSdrModelFromUnoModel() const = 0; //TTTT make reference return - public: SvxUnoDrawMSFactory() throw() {}; diff --git a/include/svx/unomodel.hxx b/include/svx/unomodel.hxx index e637e4486d2a..ab9ab9ed2cec 100644 --- a/include/svx/unomodel.hxx +++ b/include/svx/unomodel.hxx @@ -31,12 +31,11 @@ class SdrModel; -class SVX_DLLPUBLIC SvxUnoDrawingModel -: public SfxBaseModel, // implements SfxListener, OWEAKOBJECT & other - public SvxFmMSFactory, - public css::drawing::XDrawPagesSupplier, - public css::lang::XServiceInfo, - public css::ucb::XAnyCompareFactory +class SVX_DLLPUBLIC SvxUnoDrawingModel : public SfxBaseModel, // implements SfxListener, OWEAKOBJECT & other + public SvxFmMSFactory, + public css::drawing::XDrawPagesSupplier, + public css::lang::XServiceInfo, + public css::ucb::XAnyCompareFactory { friend class SvxUnoDrawPagesAccess; @@ -54,10 +53,6 @@ private: css::uno::Sequence< css::uno::Type > maTypeSequence; -protected: - // SvxUnoDrawMSFactory - virtual SdrModel* getSdrModelFromUnoModel() const override; - public: SvxUnoDrawingModel( SdrModel* pDoc ) throw(); virtual ~SvxUnoDrawingModel() throw() override; diff --git a/include/svx/unopage.hxx b/include/svx/unopage.hxx index eefc11c61b2b..6f84e72b8e66 100644 --- a/include/svx/unopage.hxx +++ b/include/svx/unopage.hxx @@ -68,8 +68,8 @@ class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper6< css::drawin protected: cppu::OBroadcastHelper mrBHelper; - SdrPage* mpPage; // TTTT should be reference - SdrModel* mpModel; // TTTT probably not needed -> use from SdrPage + SdrPage* mpPage; + SdrModel* mpModel; SdrView* mpView; void SelectObjectsInView( const css::uno::Reference< css::drawing::XShapes >& aShapes, SdrPageView* pPageView ) throw (); @@ -83,6 +83,7 @@ class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper6< css::drawin // Internals SdrPage* GetSdrPage() const { return mpPage; } + void ChangeModel( SdrModel* pNewModel ); // Creation of a SdrObject and insertion into the SdrPage SdrObject *CreateSdrObject( const css::uno::Reference< css::drawing::XShape >& xShape, bool bBeginning = false ) throw(); diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx index 422f6b13b446..4bb90d88ee0e 100644 --- a/include/svx/unoshape.hxx +++ b/include/svx/unoshape.hxx @@ -137,10 +137,8 @@ protected: const SvxItemPropertySet* mpPropSet; const SfxItemPropertyMapEntry* maPropMapEntries; -private: - ::tools::WeakReference< SdrObject > mpSdrObjectWeakReference; - -protected: + ::tools::WeakReference< SdrObject > mpObj; + SdrModel* mpModel; // translations for writer, which works in TWIPS void ForceMetricToItemPoolMetric(Pair& rPoint) const throw(); void ForceMetricToItemPoolMetric(Point& rPoint) const throw() { ForceMetricToItemPoolMetric(rPoint.toPair()); } @@ -208,13 +206,10 @@ public: void TakeSdrObjectOwnership(); bool HasSdrObjectOwnership() const; - // used exclusively by SdrObject - void InvalidateSdrObject(); - - // Encapsulated access to SdrObject - SdrObject* GetSdrObject() const { return mpSdrObjectWeakReference.get(); } - bool HasSdrObject() const { return mpSdrObjectWeakReference.is(); } + void ChangeModel( SdrModel* pNewModel ); + void InvalidateSdrObject() { mpObj.reset( nullptr ); }; + SdrObject* GetSdrObject() const {return mpObj.get();} void SetShapeType( const OUString& ShapeType ) { maShapeType = ShapeType; } /// @throws css::uno::RuntimeException css::uno::Any GetBitmap( bool bMetaFile = false ) const; diff --git a/include/svx/unoshtxt.hxx b/include/svx/unoshtxt.hxx index f16358d2432d..f38cf8a62d0f 100644 --- a/include/svx/unoshtxt.hxx +++ b/include/svx/unoshtxt.hxx @@ -77,6 +77,8 @@ public: virtual Point LogicToPixel( const Point&, const MapMode& ) const override; virtual Point PixelToLogic( const Point&, const MapMode& ) const override; + void ChangeModel( SdrModel* pNewModel ); + void UpdateOutliner(); private: diff --git a/include/svx/view3d.hxx b/include/svx/view3d.hxx index be4381c21351..48ff9b6f12b2 100644 --- a/include/svx/view3d.hxx +++ b/include/svx/view3d.hxx @@ -63,10 +63,7 @@ protected: void BreakSingle3DObj(E3dObject* pObj); public: - E3dView( - SdrModel& rSdrModel, - OutputDevice* pOut); - + E3dView(SdrModel* pModel, OutputDevice* pOut); virtual ~E3dView() override; // Output all marked Objects on the given OutputDevice. |