tdf#124953: Use rangelist's combined range top-left address...
[LibreOffice.git] / include / svx / svdobj.hxx
blob0d2d836f8efcf4bdd1aefa6fc87929e260706e6f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SVX_SVDOBJ_HXX
21 #define INCLUDED_SVX_SVDOBJ_HXX
23 #include <memory>
24 #include <com/sun/star/uno/Any.hxx>
25 #include <cppuhelper/weakref.hxx>
26 #include <rtl/ustring.hxx>
27 #include <vcl/outdev.hxx>
28 #include <vcl/vclptr.hxx>
29 #include <svl/lstner.hxx>
30 #include <svl/poolitem.hxx>
31 #include <svl/typedwhich.hxx>
32 #include <svx/svdtypes.hxx>
33 #include <svx/xenum.hxx>
34 #include <svx/svxdllapi.h>
35 #include <svx/shapeproperty.hxx>
36 #include <tools/link.hxx>
37 #include <tools/weakbase.hxx>
38 #include <tools/mapunit.hxx>
39 #include <tools/gen.hxx>
40 #include <osl/diagnose.h>
41 #include <typeinfo>
42 #include <functional>
44 class SfxBroadcaster;
45 class AutoTimer;
46 class OutlinerParaObject;
47 class Outliner;
48 class SdrOutliner;
49 class SdrDragStat;
50 class SdrHdl;
51 class SdrHdlList;
52 class SdrItemPool;
53 class SdrModel;
54 class SdrObjList;
55 class SdrObject;
56 class SdrPage;
57 class SdrPageView;
58 class SdrView;
59 class SfxItemSet;
60 class SfxGrabBagItem;
61 class SfxSetItem;
62 class SfxStyleSheet;
63 class SfxUndoAction;
64 class XFillAttrSetItem;
65 class XLineAttrSetItem;
66 class SfxItemPool;
67 namespace tools { class PolyPolygon; }
68 class SfxPoolItem;
69 class SdrVirtObj;
70 class SdrDragView;
71 class SdrObjUserDataList;
72 class SdrObjPlusData;
73 class SdrGluePoint;
74 class SdrGluePointList;
75 class SdrLayerIDSet;
76 class Fraction;
77 enum class PointerStyle;
79 namespace basegfx
81 class B2DPoint;
82 class B2DPolyPolygon;
83 class B2DHomMatrix;
86 namespace sdr
88 namespace properties
90 class BaseProperties;
93 class ObjectUser;
96 namespace sdr
98 namespace contact
100 class ViewContact;
101 } // end of namespace contact
104 namespace svx
106 class PropertyChangeNotifier;
109 class SvxShape;
111 enum SdrObjKind {
112 OBJ_NONE = 0, /// abstract object (SdrObject)
113 OBJ_GRUP = 1, /// object group
114 OBJ_LINE = 2, /// line
115 OBJ_RECT = 3, /// rectangle (round corners optional)
116 OBJ_CIRC = 4, /// circle, ellipse
117 OBJ_SECT = 5, /// circle section
118 OBJ_CARC = 6, /// circle arc
119 OBJ_CCUT = 7, /// circle cut
120 OBJ_POLY = 8, /// polygon, PolyPolygon
121 OBJ_PLIN = 9, /// PolyLine
122 OBJ_PATHLINE =10, /// open Bezier-curve
123 OBJ_PATHFILL =11, /// closed Bezier-curve
124 OBJ_FREELINE =12, /// open free-hand line
125 OBJ_FREEFILL =13, /// closed free-hand line
126 OBJ_SPLNLINE =14, /// natural cubic Spline (ni)
127 OBJ_SPLNFILL =15, /// periodic cubic Spline (ni)
128 OBJ_TEXT =16, /// text object
129 OBJ_TITLETEXT =20, /// TitleText, special text object for StarDraw
130 OBJ_OUTLINETEXT=21, /// OutlineText, special text object for StarDraw
131 OBJ_GRAF =22, /// foreign graphic (StarView Graphic)
132 OBJ_OLE2 =23, /// OLE object
133 OBJ_EDGE =24, /// connector object
134 OBJ_CAPTION =25, /// caption object
135 OBJ_PATHPOLY =26, /// Polygon/PolyPolygon represented by SdrPathObj
136 OBJ_PATHPLIN =27, /// Polyline represented by SdrPathObj
137 OBJ_PAGE =28, /// object that represents a SdrPage
138 OBJ_MEASURE =29, /// measurement object
139 OBJ_FRAME =31, /// continuously activated OLE (PlugIn-Frame or similar)
140 OBJ_UNO =32, /// Universal Network Object packed into SvDraw object
141 OBJ_CUSTOMSHAPE=33, /// custom shape
142 OBJ_MEDIA =34, /// media shape
143 OBJ_TABLE =35, /// table
144 OBJ_MAXI
147 enum class SdrInventor : sal_uInt32 {
148 Unknown = 0,
149 BasicDialog = sal_uInt32( 'D' | ('L' << 8) | ('G' << 16) | ('1' << 24) ),
150 Default = sal_uInt32( 'S' | ('V' << 8) | ('D' << 16) | ('r' << 24) ),
151 E3d = sal_uInt32( 'E' | ('3' << 8) | ('D' << 16) | ('1' << 24) ),
152 FmForm = sal_uInt32( 'F' | ('M' << 8) | ('0' << 16) | ('1' << 24) ),
153 IMap = sal_uInt32( 'I' | ('M' << 8) | ('A' << 16) | ('P' << 24) ),
154 ReportDesign = sal_uInt32( 'R' | ('P' << 8) | ('T' << 16) | ('1' << 24) ),
155 ScOrSwDraw = sal_uInt32( 'S' | ('C' << 8) | ('3' << 16) | ('0' << 24) ), // Used in sc/ and sw/
156 SgaImap = sal_uInt32( 'S' | ('D' << 8) | ('U' << 16) | ('D' << 24) ),
157 StarDrawUserData = sal_uInt32( 'S' | ('D' << 8) | ('U' << 16) | ('D' << 24) ),
158 Swg = sal_uInt32( 'S' | ('W' << 8) | ('G' << 16) ),
161 enum class SdrUserCallType {
162 MoveOnly, // only moved, size unchanged
163 Resize, // size and maybe position changed
164 ChangeAttr, // attribute changed. Eventually new size, because of line width
165 Delete, // object is going to be deleted soon, no attributes anymore
166 Inserted, // inserted into an object list (e.g. Page)
167 Removed, // removed from an object list
168 ChildMoveOnly, // a child within a group has changed
169 ChildResize, // a child within a group has changed
170 ChildChangeAttr, // a child within a group has changed
171 ChildDelete, // a child within a group has changed
172 ChildInserted, // a child within a group has changed
173 ChildRemoved // a child within a group has changed
176 class SVX_DLLPUBLIC SdrObjUserCall
178 public:
179 virtual ~SdrObjUserCall();
180 virtual void Changed(const SdrObject& rObj, SdrUserCallType eType, const tools::Rectangle& rOldBoundRect);
183 class SVX_DLLPUBLIC SdrObjMacroHitRec
185 public:
186 Point aPos;
187 const SdrLayerIDSet* pVisiLayer;
188 const SdrPageView* pPageView;
189 sal_uInt16 nTol;
191 SdrObjMacroHitRec();
195 * User data of a drawing object, e.g. application specific data.
196 * Every drawing object can have an arbitrary amount of such records (SV list).
197 * Whoever wants to save data here, must inherit from this and set a corresponding link in the factory.
199 class SVX_DLLPUBLIC SdrObjUserData
201 SdrInventor const nInventor;
202 sal_uInt16 const nIdentifier;
204 void operator=(const SdrObjUserData& rData) = delete;
205 bool operator==(const SdrObjUserData& rData) const = delete;
206 bool operator!=(const SdrObjUserData& rData) const = delete;
208 public:
209 SdrObjUserData(SdrInventor nInv, sal_uInt16 nId);
210 SdrObjUserData(const SdrObjUserData& rData);
211 virtual ~SdrObjUserData();
213 virtual std::unique_ptr<SdrObjUserData> Clone(SdrObject* pObj1) const = 0; // #i71039# NULL -> 0
214 SdrInventor GetInventor() const { return nInventor;}
215 sal_uInt16 GetId() const { return nIdentifier;}
219 * All geometrical data of an arbitrary object for use in undo/redo
221 class SVX_DLLPUBLIC SdrObjGeoData
223 public:
224 tools::Rectangle aBoundRect;
225 Point aAnchor;
226 std::unique_ptr<SdrGluePointList>
227 pGPL;
228 bool bMovProt;
229 bool bSizProt;
230 bool bNoPrint;
231 bool bClosedObj;
232 bool mbVisible;
233 SdrLayerID mnLayerID;
235 public:
236 SdrObjGeoData();
237 virtual ~SdrObjGeoData();
241 * Provides information about various ZObject properties
243 class SVX_DLLPUBLIC SdrObjTransformInfoRec
245 public:
246 bool bMoveAllowed : 1; // if false, object cannot be moved
247 bool bResizeFreeAllowed : 1; // if false, object cannot be resized freely
248 bool bResizePropAllowed : 1; // if false, object cannot even be resized proportionally
249 bool bRotateFreeAllowed : 1; // if false, object cannot be rotated freely
250 bool bRotate90Allowed : 1; // if false, object cannot even be rotated in 90 degree steps
251 bool bMirrorFreeAllowed : 1; // if false, object cannot be mirrored freely
252 bool bMirror45Allowed : 1; // if false, object cannot even be mirrored over axes in a 45 degree raster
253 bool bMirror90Allowed : 1; // if false, object cannot even be mirrored over axes in a 90 degree raster
254 bool bTransparenceAllowed : 1; // if false, object does not have an interactive transparence control
255 bool bShearAllowed : 1; // if false, object cannot be sheared
256 bool bEdgeRadiusAllowed : 1;
257 bool bNoOrthoDesired : 1; // is true for Rect; is false for BMP, MTF
258 bool bNoContortion : 1; // if false, contortion not possible (for crook, only true for PathObj and grouped PathObjs)
259 bool bCanConvToPath : 1; // if false, no conversion into PathObj possible
260 bool bCanConvToPoly : 1; // if false, no conversion into PolyObj possible
261 bool bCanConvToContour : 1; // if false, no conversion down to whole contour possible
262 bool bCanConvToPathLineToArea : 1; // if false, no conversion into PathObj with transformation from LineToArea possible
263 bool bCanConvToPolyLineToArea : 1; // if false, no conversion into PolyObj with transformation from LineToArea possible
265 SdrObjTransformInfoRec();
268 ////////////////////////////////////////////////////////////////////////////////////////////////////
270 // SdrObject
271 // SdrAttrObj
272 // E3dObject
273 // E3dCompoundObject
274 // E3dCubeObj
275 // E3dExtrudeObj
276 // E3dLatheObj
277 // E3dPolygonObj
278 // E3dSphereObj
279 // E3dScene
280 // SdrTextObj
281 // SdrObjCustomShape
282 // OCustomShape
283 // SdrEdgeObj
284 // SdrMeasureObj
285 // SdrPathObj
286 // SdrRectObj
287 // SdrCaptionObj
288 // SdrCircObj
289 // SdrGrafObj
290 // SdrMediaObj
291 // SdrOle2Obj
292 // OOle2Obj
293 // SdrUnoObj
294 // DlgEdObj
295 // DlgEdForm
296 // OUnoObject
297 // FmFormObj
298 // SdrTableObj
299 // SdrObjGroup
300 // SdrPageObj
301 // SdrVirtObj
302 // SwDrawVirtObj
303 // SwVirtFlyDrawObj
304 // SwFlyDrawObj
306 /// Abstract DrawObject
307 class SVX_DLLPUBLIC SdrObject : public SfxListener, public tools::WeakBase
309 private:
310 friend class SdrObjListIter;
311 friend class SdrVirtObj;
312 friend class SdrRectObj;
314 // OperationSmiley: Allow at each SdrObject to set a FillGeometryDefiningShape,
315 // so that for SdrObjects where this is set, the definition of a defined FillStyle
316 // will use this, but the local geometry will be filled. This allows to fill
317 // multiple shapes with a unified fill, e.g think about CustomShapes.
318 // Currently this is *only* used for CustomShapes, but may be developed to get a
319 // common mechanism - usages for it are easy to be found. The current limitation
320 // to CustomShapes allows to think about these SdrObjects to 'vanish' during the
321 // lifetime of 'this' - the SdrObjects without SdrPage and SdrModel are used as helper
322 // objects for SdrObjCustomShape and thus their lifetime is limited to the lifetime
323 // of this local object. For unifying this mechanism, some weak reference of
324 // SdrObjects would have to be thought about (not easy with the current implementation).
325 // So - allow *only* EnhancedCustomShape2d (which creates the visualizations for
326 // SdrObjCustomShape) to set this. Already allow unified read to use it - thus already
327 // allowing to implement as standard case for all kinds of SdrObjects.
328 friend class EnhancedCustomShape2d;
329 const SdrObject* mpFillGeometryDefiningShape;
330 void setFillGeometryDefiningShape(const SdrObject* pNew) { mpFillGeometryDefiningShape = pNew; }
331 public:
332 const SdrObject* getFillGeometryDefiningShape() const { return mpFillGeometryDefiningShape; }
334 private:
335 // the SdrModel this objects was created with, unchanged during SdrObject lifetime
336 SdrModel& mrSdrModelFromSdrObject;
338 public:
339 // A SdrObject always needs a SdrModel for lifetime (Pool, ...)
340 SdrObject(SdrModel& rSdrModel);
342 // SdrModel/SdrPage access on SdrObject level
343 SdrPage* getSdrPageFromSdrObject() const;
344 SdrModel& getSdrModelFromSdrObject() const;
346 // access to possible children (SdrObjGroup/E3dScene)
347 virtual SdrObjList* getChildrenOfSdrObject() const;
349 // access to parent
350 SdrObjList* getParentSdrObjListFromSdrObject() const;
351 SdrObject* getParentSdrObjectFromSdrObject() const;
353 private:
354 // only allow SetParentAtSdrObjectFromSdrObjList to call setParentOfSdrObject
355 friend void SetParentAtSdrObjectFromSdrObjList(SdrObject& rSdrObject, SdrObjList* pNew);
356 SVX_DLLPRIVATE void setParentOfSdrObject(SdrObjList* pNew);
358 public:
359 // react on model/page change
360 virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage);
362 void AddObjectUser(sdr::ObjectUser& rNewUser);
363 void RemoveObjectUser(sdr::ObjectUser& rOldUser);
365 sdr::contact::ViewContact& GetViewContact() const;
367 virtual sdr::properties::BaseProperties& GetProperties() const;
369 // DrawContact support: Methods for handling Object changes
370 void ActionChanged() const;
372 static SdrItemPool& GetGlobalDrawObjectItemPool();
373 void SetRelativeWidth( double nValue );
374 void SetRelativeWidthRelation( sal_Int16 eValue );
375 void SetRelativeHeight( double nValue );
376 void SetRelativeHeightRelation( sal_Int16 eValue );
377 const double* GetRelativeWidth() const;
378 sal_Int16 GetRelativeWidthRelation() const;
379 const double* GetRelativeHeight() const;
380 sal_Int16 GetRelativeHeightRelation() const;
382 /// @param bNotMyself = true: set only ObjList to dirty, don't mark this object as dirty.
384 /// This is needed for instance for NbcMove, because usually one moves SnapRect and aOutRect
385 /// at the same time to avoid recomputation.
386 virtual void SetRectsDirty(bool bNotMyself = false, bool bRecursive = true);
388 // frees the SdrObject pointed to by the argument
389 // In case the object has an SvxShape, which has the ownership of the object, it
390 // is actually *not* deleted.
391 static void Free( SdrObject*& _rpObject );
393 // this method is only for access from Property objects
394 virtual void SetBoundRectDirty();
396 SfxItemPool & GetObjectItemPool() const;
398 void AddListener(SfxListener& rListener);
399 void RemoveListener(SfxListener& rListener);
401 void AddReference(SdrVirtObj& rVrtObj);
402 void DelReference(SdrVirtObj& rVrtObj);
403 virtual SdrInventor GetObjInventor() const;
404 virtual sal_uInt16 GetObjIdentifier() const;
405 virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
407 // Layer interface
408 virtual SdrLayerID GetLayer() const;
409 virtual void NbcSetLayer(SdrLayerID nLayer);
410 virtual void SetLayer(SdrLayerID nLayer);
411 // renaming GetSdrLayerIDSet -> getMergedHierarchySdrLayerIDSet to make clear what happens here. rSet needs to be empty.
412 void getMergedHierarchySdrLayerIDSet(SdrLayerIDSet& rSet) const;
414 void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle& rBoundRect) const;
416 // #i68101#
417 // An object may have a user-set Name (Get/SetName()), e.g SdrGrafObj, SdrObjGroup
418 // or SdrOle2Obj.
419 // It may also have a Title and a Description for accessibility purposes.
420 void SetName(const OUString& rStr);
421 OUString GetName() const;
422 void SetTitle(const OUString& rStr);
423 OUString GetTitle() const;
424 void SetDescription(const OUString& rStr);
425 OUString GetDescription() const;
427 // for group objects
428 bool IsGroupObject() const;
429 virtual SdrObjList* GetSubList() const;
431 /// The order number (aka ZOrder, aka z-index) determines whether a
432 /// SdrObject is located above or below another. Objects are painted from
433 /// lowest to highest order number. If the order of SdrObjects in the
434 /// SdrObjList is changed, the bObjOrdNumsDirty flag is set on the SdrPage
435 /// and the next GetOrdNum() call recalculates the order number of all
436 /// SdrObjects in the SdrObjList.
437 sal_uInt32 GetOrdNum() const;
439 // setting the order number should only happen from the model or from the page
440 void SetOrdNum(sal_uInt32 nNum);
442 // GrabBagItem for interim interop purposes
443 void GetGrabBagItem(css::uno::Any& rVal) const;
445 void SetGrabBagItem(const css::uno::Any& rVal);
447 // Return the position in the navigation order for the called object.
448 // Note that this method may update the navigation position of the
449 // called and of other SdrObjects. Therefore this method can not be
450 // const.
451 // @return
452 // If no navigation position has been explicitly defined then the
453 // result of GetOrdNum() is returned.
454 sal_uInt32 GetNavigationPosition();
456 // To make clearer that this method may trigger RecalcBoundRect and thus may be
457 // expensive and sometimes problematic (inside a bigger object change You will get
458 // non-useful BoundRects sometimes) i rename that method from GetBoundRect() to
459 // GetCurrentBoundRect().
460 virtual const tools::Rectangle& GetCurrentBoundRect() const;
462 // To have a possibility to get the last calculated BoundRect e.g for producing
463 // the first rectangle for repaints (old and new need to be used) without forcing
464 // a RecalcBoundRect (which may be problematical and expensive sometimes) i add here
465 // a new method for accessing the last BoundRect.
466 virtual const tools::Rectangle& GetLastBoundRect() const;
468 virtual void RecalcBoundRect();
470 void BroadcastObjectChange() const;
472 const SfxBroadcaster* GetBroadcaster() const;
474 // set modified-flag in the model
475 virtual void SetChanged();
477 // Tooling for painting a single object to a OutputDevice. This will be needed as long
478 // as not all painting is changed to use DrawContact objects.
479 void SingleObjectPainter(OutputDevice& rOut) const;
480 bool LineGeometryUsageIsNecessary() const;
482 // RotGrfFlyFrame: If true, this SdrObject supports only limited rotation, that
483 // means no change of the rotation point (only centered) and no shear allowed
484 virtual bool HasLimitedRotation() const;
486 // Returns a copy of the object. Every inherited class must reimplement this (in class Foo
487 // it should be sufficient to do "virtual Foo* CloneSdrObject(...) const { return CloneHelper< Foo >(); }".
488 // Note that this function uses operator= internally.
489 virtual SdrObject* CloneSdrObject(SdrModel& rTargetModel) const;
491 // implemented mainly for the purposes of CloneSdrObject()
492 SdrObject& operator=(const SdrObject& rObj);
494 // TakeObjName...() is for the display in the UI, e.g. "3 frames selected"
495 virtual OUString TakeObjNameSingul() const;
496 virtual OUString TakeObjNamePlural() const;
498 /// The Xor-Polygon is required by the View to drag the object.
499 /// All polygons within the PolyPolygon are interpreted as PolyLine.
500 /// To get a closed Polygon, close it explicitly.
501 virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
503 /// contour for TextToContour
504 virtual basegfx::B2DPolyPolygon TakeContour() const;
506 /// Via GetHdlCount the number of Handles can be retrieved.
507 /// Normally 8, if it's a line 2.
508 /// For Polygon objects (Polygon/Spline/Bezier) the number may be much
509 /// larger. Polygon objects are also allowed to select a point of a
510 /// selected object. The handle of that point will then be replaced by
511 /// a new set of handles (PlusHdl). For a Polygon this would be a simple
512 /// selection Handle, for a Bezier curve this may be up to 3 Handles
513 /// (including Weights).
514 /// GetHdl() and GetPlusHdl() must create Handle instances with new!
515 /// An object that returns true from HasSpacialDrag() must provide these
516 /// methods (incl. FillHdlList()).
517 virtual sal_uInt32 GetHdlCount() const;
518 virtual void AddToPlusHdlList(SdrHdlList& rHdlList, SdrHdl& rHdl) const;
519 virtual void AddToHdlList(SdrHdlList& rHdlList) const;
520 virtual void addCropHandles(SdrHdlList& rTarget) const;
522 /// The standard transformations (Move,Resize,Rotate,Mirror,Shear) are
523 /// taken over by the View (TakeXorPoly(),...).
524 /// Object type specific dragging like corner radius of Rectangle,
525 /// control points of Splines, weights of Bezier curves, pointer of
526 /// Label objects must be handled by the object itself.
527 /// To keep the Model free of state, the state is kept in the View
528 /// and then passed to the object. EndDrag usually returns true for success,
529 /// false may be returned if the dragging did not modify the object,
530 /// where the View already handles the case that the pointer was not
531 /// moved at all.
532 virtual bool hasSpecialDrag() const;
533 virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
534 virtual bool applySpecialDrag(SdrDragStat& rDrag);
535 virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const;
536 virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
538 // FullDrag support. This is for standard interactions and for SdrObjOwn
539 // support. If supportsFullDrag() returns true, getFullDragClone has to
540 // return a cloned SdrObject (who's ownership it loses) at which modifications
541 // like Move(), Scale(), etc or applySpecialDrag() will be executed. That
542 // object will be visualized on overlay for full drag, but should not be
543 // part of the model, thus not changing anything since it's only a temporary
544 // helper object for interaction
545 virtual bool supportsFullDrag() const;
546 virtual SdrObject* getFullDragClone() const;
548 /// Every object must be able to create itself interactively.
549 /// On MouseDown first an object is created, and its BegCreate() method
550 /// is called. On every MouseMove, MovCreate() is called. BrkCreate()
551 /// is called if the user cancels the interactive object creation.
552 /// EndCreate() is called on the MouseUp event. If EndCreate() returns
553 /// true, the creation is finished; the object is inserted into the
554 /// corresponding list. Otherwise it is assumed that further points
555 /// are necessary to create the object (Polygon, ...). The parameter
556 /// eCmd contains the number of mouse clicks (if the application
557 /// provides it).
558 /// BckCreate() will undo the previous EndCreate(), e.g. to delete the
559 /// last point of the Polygon. If BckCreate() returns false, creation
560 /// is cancelled.
561 virtual bool BegCreate(SdrDragStat& rStat);
562 virtual bool MovCreate(SdrDragStat& rStat); // if true, Xor needs to be repainted
563 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
564 virtual bool BckCreate(SdrDragStat& rStat);
565 virtual void BrkCreate(SdrDragStat& rStat);
567 /// get the cursor/pointer that signals creating this object
568 virtual PointerStyle GetCreatePointer() const;
570 /// Polygon dragged by the user when creating the object
571 virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
573 /// The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and
574 /// SetLogicRect call the corresponding Nbc-methods, send a Repaint
575 /// broadcast and set the Modified state on the Model.
576 /// Derived classes should usually only override the Nbc methods.
577 /// Nbc means "no broadcast".
578 virtual void NbcMove (const Size& rSiz);
579 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
580 virtual void NbcCrop (const basegfx::B2DPoint& rRef, double fxFact, double fyFact);
581 virtual void NbcRotate(const Point& rRef, long nAngle, double sn, double cs);
582 virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
583 virtual void NbcShear (const Point& rRef, long nAngle, double tn, bool bVShear);
585 virtual void Move (const Size& rSiz);
586 virtual void Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact, bool bUnsetRelative = true);
587 virtual void Crop (const basegfx::B2DPoint& rRef, double fxFact, double fyFact);
588 virtual void Rotate(const Point& rRef, long nAngle, double sn, double cs);
589 virtual void Mirror(const Point& rRef1, const Point& rRef2);
590 virtual void Shear (const Point& rRef, long nAngle, double tn, bool bVShear);
592 /// The relative position of a SdrObject is the distance of the upper
593 /// left corner of the logic bounding rectangle (SnapRect) to the anchor.
594 virtual void NbcSetRelativePos(const Point& rPnt);
595 virtual void SetRelativePos(const Point& rPnt);
596 virtual Point GetRelativePos() const;
597 void ImpSetAnchorPos(const Point& rPnt);
598 virtual void NbcSetAnchorPos(const Point& rPnt);
599 virtual void SetAnchorPos(const Point& rPnt);
601 /// Snap is not done on the BoundRect but if possible on logic coordinates
602 /// (i.e. without considering stroke width, ...)
603 /// SetSnapRect() tries to size the Object so that it fits into the
604 /// passed Rect (without stroke width, ...)
605 virtual void RecalcSnapRect();
606 virtual const tools::Rectangle& GetSnapRect() const;
607 virtual void SetSnapRect(const tools::Rectangle& rRect);
608 virtual void NbcSetSnapRect(const tools::Rectangle& rRect);
610 // Logic Rect: for the Rect for instance without regard to rotation angle, shear, ...
611 virtual const tools::Rectangle& GetLogicRect() const;
612 virtual void SetLogicRect(const tools::Rectangle& rRect);
613 virtual void NbcSetLogicRect(const tools::Rectangle& rRect);
615 // the default is to set the logic rect to the given rectangle rMaxRect. If the shape
616 // has an intrinsic aspect ratio it may set the logic rect so the aspect
617 // ratio is kept but still inside the rectangle rMaxRect.
618 // If bShrinkOnly is set to true, the size of the current logic rect will not
619 // be changed if it is smaller than the given rectangle rMaxRect.
620 virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false );
622 // rotation and shear angle
623 virtual long GetRotateAngle() const;
624 virtual long GetShearAngle(bool bVertical = false) const;
626 /// snap to special points of an Object (polygon points, center of circle)
627 virtual sal_uInt32 GetSnapPointCount() const;
628 virtual Point GetSnapPoint(sal_uInt32 i) const;
630 // For objects, whose points can be moved individually.
631 // (e.g. polygons, polylines, lines)
632 // The points of those objects are selected (if necessary multiselection),
633 // deleted, inserted, or as a multiselection moved or rotated...
634 // Only such objects can have PlusHandles (e.g. the weights of an Bezier curve).
635 virtual bool IsPolyObj() const;
636 virtual sal_uInt32 GetPointCount() const;
637 virtual Point GetPoint(sal_uInt32 i) const;
638 void SetPoint(const Point& rPnt, sal_uInt32 i);
639 virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i);
641 // get all geometrical data for undo/redo
642 virtual SdrObjGeoData* GetGeoData() const;
643 virtual void SetGeoData(const SdrObjGeoData& rGeo);
645 // ItemSet access
646 const SfxItemSet& GetMergedItemSet() const;
647 void SetMergedItem(const SfxPoolItem& rItem);
648 void ClearMergedItem(const sal_uInt16 nWhich = 0);
649 void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false);
650 const SfxPoolItem& GetMergedItem(const sal_uInt16 nWhich) const;
651 template<class T>
652 const T& GetMergedItem( TypedWhichId<T> nWhich ) const
654 return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
657 // syntactical sugar for ItemSet accesses
658 void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems = false);
660 // NotPersistAttr for Layer, ObjName, geometrical transformations etc.
661 void TakeNotPersistAttr(SfxItemSet& rAttr) const;
662 void ApplyNotPersistAttr(const SfxItemSet& rAttr);
663 void NbcApplyNotPersistAttr(const SfxItemSet& rAttr);
665 // if bDontRemoveHardAttr is false, set all attributes, which were set in the style sheet, to their default value
666 // if true, all hard attributes keep their values
667 void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr);
668 virtual void NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr);
669 SfxStyleSheet* GetStyleSheet() const;
671 virtual bool HasTextEdit() const;
673 // keep text in outliner's format
674 // SetOutlinerParaObject: transfer ownership of *pTextObject!
675 void SetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject);
676 virtual void NbcSetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject);
677 virtual OutlinerParaObject* GetOutlinerParaObject() const;
678 virtual void NbcReformatText();
680 void BurnInStyleSheetAttributes();
682 // macro abilities, e.g. a rectangle as PushButton.
683 virtual bool HasMacro() const;
684 virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const;
685 virtual PointerStyle GetMacroPointer (const SdrObjMacroHitRec& rRec) const;
686 virtual void PaintMacro (OutputDevice& rOut, const tools::Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const;
687 virtual bool DoMacro (const SdrObjMacroHitRec& rRec);
688 bool IsMacroHit(const SdrObjMacroHitRec& rRec) const;
690 // Connectors
691 // (see also documentation in SvdoEdge.hxx, SdrEdgeObj, as well as SvdGlue.hxx and SvdGlEV.hxx)
693 // There are nodes and edges. In theory an edge can also be a node, but this isn't implemented yet.
694 // A node has a number of glue points, onto which edges can glued to
695 // An edge can be either
696 // - without any connection to any node,
697 // - or connected on one end to a node, while the other end is not connected,
698 // - or connected on both ends with exactly one node each.
699 // The edge is listener for its up to two nodes.
700 // Whenever a node is moved or resized, all its connected edges follow.
701 // This is also true for SetGluePoint()... on the node.
702 // On the other hand, moving/resizing an edge breaks the connection.
704 // is object a node?
705 virtual bool IsNode() const;
707 // automatic glue points:
708 // a node object must provide four vertex and corner positions
709 // usually 0: top, 1: right, 2: bottom, 3: left
710 virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const;
712 // usually:
713 // 0: top-left, 1: top-right, 2: bottom-right, 3: bottom-left
714 virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const;
716 // list of all glue points, can be NULL
717 virtual const SdrGluePointList* GetGluePointList() const;
719 // after changing the GluePointList, one has to call the object's SendRepaintBroadcast!
720 virtual SdrGluePointList* ForceGluePointList();
722 // to be set temporarily when transforming related object(?)
723 void SetGlueReallyAbsolute(bool bOn);
724 void NbcRotateGluePoints(const Point& rRef, long nAngle, double sn, double cs);
725 void NbcMirrorGluePoints(const Point& rRef1, const Point& rRef2);
726 void NbcShearGluePoints (const Point& rRef, double tn, bool bVShear);
728 // if bTail1 is true, line start, otherwise line end
729 // if pObj is null disconnect
730 virtual void ConnectToNode(bool bTail1, SdrObject* pObj);
731 virtual void DisconnectFromNode(bool bTail1);
732 virtual SdrObject* GetConnectedNode(bool bTail1) const;
734 // sets the writing mode of the object's context
735 // Objects which itself do not support different writing modes will ignore this call.
736 // Objects which support different writing modes, but have an own, explicit writing mode set,
737 // will also ignore this call.
738 // Objects which support different writing modes, and whose own mode is set to css.text.WritingMode2.CONTEXT,
739 // will use the given writing mode to calculate their "effective writing mode".
740 // The behaviour of this method is undefined if you pass css.text.WritingMode2.CONTEXT.
741 // @param _nContextWritingMode
742 // the effective writing mode of the context of the object
743 virtual void SetContextWritingMode( const sal_Int16 _nContextWritingMode );
745 // If an object is able to convert itself into a polygon or into a Bezier curve (or into both),
746 // then the following methods should be overridden.
747 // E.g., convert a RectObj with line width 10, SOLID_PEN into a polygon:
748 // In the bLineToArea=false mode a PolyObj with four supporting points,
749 // line width 10 and SOLID_PEN shall be created.
750 // On the contrary in the bLineToArea=true mode the generated object should
751 // still have a line attribute NULL_PEN, and the line (also line pattern)
752 // itself should be emulated by the polygon area, which thereby can be
753 // manipulated by the user afterwards.
754 // The RectObj therefore can only convert correctly if it has an area attribute NULL_BRUSH.
755 // In this case it would have to:
756 // - set SOLID_BRUSH with the color of the given pen,
757 // - set NULL_PEN, and
758 // - generate tools::PolyPolygon with two polygons with four supporting points each.
759 // In each case the return value is a SdrObject*, because it is also
760 // allowed to return group objects (e.g. for SdrTextObj).
761 // In the case of the conversion from TextObj to PathObj,
762 // both modi (bLineToArea=true/false) would be identical.
763 // The methods' default implementations report "I'm unable to do this" (false/null).
764 virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const;
765 SdrObject* ConvertToPolyObj(bool bBezier, bool bLineToArea) const;
767 // convert this path object to contour object; bForceLineDash converts even
768 // when there is no filled new polygon created from line-to-polygon conversion,
769 // specially used for XLINE_DASH and 3D conversion
770 SdrObject* ConvertToContourObj(SdrObject* pRet, bool bForceLineDash = false) const;
771 private:
772 SdrObject* ImpConvertToContourObj(bool bForceLineDash);
773 public:
775 // if true, reference onto an object
776 bool IsVirtualObj() const { return bVirtObj;}
778 // is true, if object can probably be filled
779 // is false, if object has probably line ends
780 // is invalid, if this is a group object
781 bool IsClosedObj() const { return bClosedObj;}
783 // tdf#118662 reorganize inserted state, no local bool needed anymore,
784 // it depends on being a member of a SdrObjList
785 void InsertedStateChange();
786 bool IsInserted() const { return nullptr != getParentSdrObjListFromSdrObject(); }
788 bool IsEdgeObj() const { return bIsEdge;}
789 bool Is3DObj() const { return bIs3DObj;}
790 bool IsUnoObj() const { return bIsUnoObj;}
791 void SetMoveProtect(bool bProt);
792 bool IsMoveProtect() const { return bMovProt;}
793 void SetResizeProtect(bool bProt);
794 bool IsResizeProtect() const { return bSizProt;}
795 void SetPrintable(bool bPrn);
796 bool IsPrintable() const { return !bNoPrint;}
797 void SetVisible(bool bVisible);
798 bool IsVisible() const { return mbVisible;}
799 void SetMarkProtect(bool bProt);
800 bool IsMarkProtect() const { return bMarkProt;}
802 /// Whether the aspect ratio should be kept by default when resizing.
803 virtual bool shouldKeepAspectRatio() const { return false; }
805 // application specific data
806 sal_uInt16 GetUserDataCount() const;
807 SdrObjUserData* GetUserData(sal_uInt16 nNum) const;
809 void AppendUserData(std::unique_ptr<SdrObjUserData> pData);
811 // removes the record from the list and performs delete (FreeMem+Dtor).
812 void DeleteUserData(sal_uInt16 nNum);
814 // access to the UNO representation of the shape
815 virtual css::uno::Reference< css::uno::XInterface > getUnoShape();
817 static SdrObject* getSdrObjectFromXShape( const css::uno::Reference< css::uno::XInterface >& xInt );
819 // retrieves the instance responsible for notifying changes in the properties of the shape associated with
820 // the SdrObject
822 // @precond
823 // There already exists an SvxShape instance associated with the SdrObject
824 // @throws css::uno::RuntimeException
825 // if there does nt yet exists an SvxShape instance associated with the SdrObject.
826 svx::PropertyChangeNotifier& getShapePropertyChangeNotifier();
828 // notifies a change in the given property, to all applicable listeners registered at the associated SvxShape
830 // This method is equivalent to calling getShapePropertyChangeNotifier().notifyPropertyChange( _eProperty ),
831 // exception that it is allowed to be called when there does not yet exist an associated SvxShape - in which
832 // case the method will silently return without doing anything.
833 void notifyShapePropertyChange( const svx::ShapeProperty _eProperty ) const;
835 // transformation interface for StarOfficeAPI. This implements support for
836 // homogen 3x3 matrices containing the transformation of the SdrObject. At the
837 // moment it contains a shearX, rotation and translation, but for setting all linear
838 // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
840 // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
841 // with the base geometry and returns TRUE. Otherwise it returns FALSE.
842 virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
844 // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
845 // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
846 // to use (0,0) as upper left and will be scaled to the given size in the matrix.
847 virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
849 // give info if object is in destruction
850 bool IsInDestruction() const;
852 // return if fill is != XFILL_NONE
853 bool HasFillStyle() const;
854 bool HasLineStyle() const;
856 // on import of OLE object from MS documents the BLIP size might be retrieved,
857 // the following methods are used to control it;
858 // usually this data makes no sense after the import is finished, since the object
859 // might be resized
860 const tools::Rectangle& GetBLIPSizeRectangle() const { return maBLIPSizeRectangle;}
861 void SetBLIPSizeRectangle( const tools::Rectangle& aRect );
863 // #i121917#
864 virtual bool HasText() const;
866 bool Equals(const SdrObject&) const;
868 virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
870 /// Is this a textbox of a drawinglayer shape?
871 virtual bool IsTextBox() const;
873 void SetEmptyPresObj(bool bEpt);
874 bool IsEmptyPresObj() const { return bEmptyPresObj;}
875 void SetNotVisibleAsMaster(bool bFlg);
876 bool IsNotVisibleAsMaster() const { return bNotVisibleAsMaster;}
877 void SetUserCall(SdrObjUserCall* pUser);
878 SdrObjUserCall* GetUserCall() const { return pUserCall;}
879 /// @see mbDoNotInsertIntoPageAutomatically
880 void SetDoNotInsertIntoPageAutomatically(bool bSet);
881 /// @see mbDoNotInsertIntoPageAutomatically
882 bool IsDoNotInsertIntoPageAutomatically() const { return mbDoNotInsertIntoPageAutomatically;}
884 // Warning: this method should only be used if you really know what you're doing
885 sal_uInt32 GetOrdNumDirect() const { return nOrdNum;}
887 // #i25616#
888 bool DoesSupportTextIndentingOnLineWidthChange() const { return mbSupportTextIndentingOnLineWidthChange;}
890 const Point& GetAnchorPos() const;
892 // #i25616#
893 bool LineIsOutsideGeometry() const { return mbLineIsOutsideGeometry;}
895 // Set the position in the navigation position to the given value.
896 // This method is typically used only by the model after a change to
897 // the navigation order.
898 // This method does not change the navigation position of other
899 // objects.
900 // Use SdrObjList::SetObjectNavigationPosition() instead.
901 void SetNavigationPosition (const sal_uInt32 nPosition);
903 // sets a new UNO representation of the shape
904 // This is only a public interface function. The actual work is
905 // done by impl_setUnoShape().
906 // Calling this function is only allowed for the UNO representation
907 // itself!
908 void setUnoShape( const css::uno::Reference<css::uno::XInterface>& _rxUnoShape);
910 const css::uno::WeakReference< css::uno::XInterface >& getWeakUnoShape() const { return maWeakUnoShape; }
912 void setSuitableOutlinerBg(Outliner& rOutliner) const;
914 protected:
915 tools::Rectangle aOutRect; // surrounding rectangle for Paint (incl. LineWidth, ...)
916 Point aAnchor; // anchor position (Writer)
917 SdrObjUserCall* pUserCall;
918 std::unique_ptr<SdrObjPlusData>
919 pPlusData; // Broadcaster, UserData, connectors, ... (this is the Bitsack)
920 // object is only pointing to another one
921 bool bVirtObj : 1;
922 bool bSnapRectDirty : 1;
923 // the following flags will be streamed
924 bool bMovProt : 1; // if true, the position is protected
925 bool bSizProt : 1; // if true, the size is protected
926 // If bEmptyPresObj is true, it is a presentation object that has no content yet.
927 // The flag's default value is false.
928 // The management is done by the application.
929 // Neither assign operator nor cloning copies the flag!
930 // The flag is persistent.
931 bool bEmptyPresObj : 1; // empty presentation object (Draw)
932 // if true, object is invisible as object of the MasterPage
933 bool bNotVisibleAsMaster : 1;
934 // if true, the object is closed, i.e. no line, arc...
935 bool bClosedObj : 1;
936 bool bIsEdge : 1;
937 bool bIs3DObj : 1;
938 bool bIsUnoObj : 1;
939 // #i25616#
940 bool mbLineIsOutsideGeometry : 1;
941 // #i25616#
942 bool mbSupportTextIndentingOnLineWidthChange : 1;
944 virtual ~SdrObject() override;
946 virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties();
948 virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact();
950 tools::Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const;
952 // for GetDragComment
953 void ImpTakeDescriptionStr(const char* pStrCacheID, OUString& rStr) const;
955 void ImpForcePlusData();
957 OUString GetMetrStr(long nVal) const;
959 /// A derived class must override these 3 methods if it has own geometric
960 /// data that must be saved for Undo.
961 /// NewGeoData() creates an empty instance of a class derived from
962 /// SdrObjGeoData.
963 virtual SdrObjGeoData* NewGeoData() const;
964 virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
965 virtual void RestGeoData(const SdrObjGeoData& rGeo);
967 // internal versions
968 const SfxItemSet& GetObjectItemSet() const;
969 void SetObjectItem(const SfxPoolItem& rItem);
970 void SetObjectItemSet(const SfxItemSet& rSet);
971 const SfxPoolItem& GetObjectItem(const sal_uInt16 nWhich) const;
972 template<class T> const T& GetObjectItem( TypedWhichId<T> nWhich ) const
974 return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
977 /// Sets a new UNO shape
979 /// The default implementation of this function sets the new UNO
980 /// shape. Derived classes should override the function to handle
981 /// any other actions that are needed when the shape is being
982 /// changed.
984 /// The implementation _must_ call the same method of its parent
985 /// class (preferably as the first step)!
986 virtual void impl_setUnoShape( const css::uno::Reference< css::uno::XInterface >& _rxUnoShape );
988 // helper function for reimplementing Clone().
989 template< typename T > T* CloneHelper(SdrModel& rTargetModel) const;
991 private:
992 struct Impl;
993 std::unique_ptr<Impl> mpImpl;
994 SdrObjList* mpParentOfSdrObject; // list that includes this object
995 sal_uInt32 nOrdNum; // order number of the object in the list
996 std::unique_ptr<SfxGrabBagItem> pGrabBagItem; // holds the GrabBagItem property
997 // Position in the navigation order. SAL_MAX_UINT32 when not used.
998 sal_uInt32 mnNavigationPosition;
999 SdrLayerID mnLayerID;
1000 bool bNoPrint : 1; // if true, the object is not printed.
1001 bool mbVisible : 1; // if false, the object is not visible on screen (but maybe on printer, depending on bNoprint
1002 bool bMarkProt : 1; // marking forbidden, persistent
1003 // on import of OLE object from MS documents the BLIP size might be retrieved,
1004 // in this case the following member is initialized as nonempty rectangle
1005 tools::Rectangle maBLIPSizeRectangle;
1006 std::unique_ptr<sdr::properties::BaseProperties>
1007 mpProperties;
1008 std::unique_ptr<sdr::contact::ViewContact>
1009 mpViewContact;
1011 // global static ItemPool for not-yet-inserted items
1012 static SdrItemPool* mpGlobalItemPool;
1014 // do not use directly, always use getSvxShape() if you have to!
1015 SvxShape* mpSvxShape;
1016 css::uno::WeakReference< css::uno::XInterface >
1017 maWeakUnoShape;
1018 // HACK: Do not automatically insert newly created object into a page.
1019 // The user needs to do it manually later.
1020 bool mbDoNotInsertIntoPageAutomatically;
1022 // only for internal use!
1023 SvxShape* getSvxShape();
1025 SdrObject( const SdrObject& ) = delete;
1028 // helper for constructing std::unique_ptr for SdrObjects where a
1029 // deleter is needed - here, SdrObject::Free needs to be used.
1030 struct SVX_DLLPUBLIC SdrObjectFreeOp
1032 void operator()(SdrObject* obj)
1034 SdrObject::Free(obj);
1037 typedef std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr;
1039 struct SdrObjCreatorParams
1041 SdrInventor const nInventor;
1042 sal_uInt16 const nObjIdentifier;
1043 SdrModel& rSdrModel;
1047 * Whoever creates his own objects must set a link in the SdrObjFactory class.
1048 * The handler must have the following signature:
1049 * void Hdl(SdrObjFactory*)
1050 * He must take a look at the referenced instance's nInventor and nIdentifier values,
1051 * and must create a new drawing object instance accordingly.
1052 * He must also make the pNewObj pointer reference to this instance.
1054 class SVX_DLLPUBLIC SdrObjFactory
1056 public:
1057 static SdrObject* MakeNewObject(
1058 SdrModel& rSdrModel,
1059 SdrInventor nInventor,
1060 sal_uInt16 nObjIdentifier,
1061 const tools::Rectangle* pSnapRect = nullptr);
1063 static void InsertMakeObjectHdl(Link<SdrObjCreatorParams, SdrObject*> const & rLink);
1064 static void RemoveMakeObjectHdl(Link<SdrObjCreatorParams, SdrObject*> const & rLink);
1066 private:
1067 static SVX_DLLPRIVATE SdrObject* CreateObjectFromFactory(
1068 SdrModel& rSdrModel,
1069 SdrInventor nInventor,
1070 sal_uInt16 nIdentifier);
1072 SdrObjFactory() = delete;
1075 template< typename T > T* SdrObject::CloneHelper(SdrModel& rTargetModel) const
1077 OSL_ASSERT( typeid( T ) == typeid( *this ));
1078 T* pObj = dynamic_cast< T* >(
1079 SdrObjFactory::MakeNewObject(
1080 rTargetModel,
1081 GetObjInventor(),
1082 GetObjIdentifier()));
1084 if(nullptr != pObj)
1086 // use ::operator=()
1087 *pObj = *static_cast< const T* >( this );
1090 return pObj;
1093 #endif // INCLUDED_SVX_SVDOBJ_HXX
1095 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */