Coverage Report

Created: 2026-10-14 09:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/svx/svdobj.hxx
Line
Count
Source
1
/*
2
 * This file is part of the LibreOffice project.
3
 *
4
 * This Source Code Form is subject to the terms of the Mozilla Public
5
 * License, v. 2.0. If a copy of the MPL was not distributed with this
6
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
 *
8
 * This file incorporates work covered by the following license notice:
9
 *
10
 *   Licensed to the Apache Software Foundation (ASF) under one or more
11
 *   contributor license agreements. See the NOTICE file distributed
12
 *   with this work for additional information regarding copyright
13
 *   ownership. The ASF licenses this file to you under the Apache
14
 *   License, Version 2.0 (the "License"); you may not use this file
15
 *   except in compliance with the License. You may obtain a copy of
16
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
17
 */
18
19
#pragma once
20
21
#include <memory>
22
#include <com/sun/star/uno/Any.hxx>
23
#include <cppuhelper/weak.hxx>
24
#include <cppuhelper/weakref.hxx>
25
#include <rtl/ustring.hxx>
26
#include <vcl/outdev.hxx>
27
#include <svl/lstner.hxx>
28
#include <svl/poolitem.hxx>
29
#include <svl/typedwhich.hxx>
30
#include <tools/degree.hxx>
31
#include <svx/svdtypes.hxx>
32
#include <svx/svdobjkind.hxx>
33
#include <svx/svxdllapi.h>
34
#include <tools/UniqueID.hxx>
35
#include <tools/link.hxx>
36
#include <tools/gen.hxx>
37
#include <unotools/resmgr.hxx>
38
39
#include <unordered_set>
40
41
class SfxBroadcaster;
42
class E3dObject;
43
class E3dScene;
44
class OutlinerParaObject;
45
class Outliner;
46
class SdrDragStat;
47
class SdrHdl;
48
class SdrHdlList;
49
class SdrItemPool;
50
class SdrModel;
51
class SdrObjList;
52
class SdrObject;
53
class SdrOle2Obj;
54
class SdrPage;
55
class SdrPageView;
56
class SdrTextObj;
57
class SfxItemSet;
58
class SfxGrabBagItem;
59
class SfxStyleSheet;
60
class SfxItemPool;
61
class SdrVirtObj;
62
class SdrObjPlusData;
63
class SdrGluePoint;
64
class SdrGluePointList;
65
class SdrLayerIDSet;
66
enum class PointerStyle;
67
class Graphic;
68
class SvxShape;
69
class SdrObjGeoData;
70
namespace basegfx
71
{
72
    class B2DPoint;
73
    class B2DPolyPolygon;
74
    class B2DHomMatrix;
75
}
76
77
namespace sdr { class ObjectUser; }
78
namespace sdr::properties { class BaseProperties; }
79
namespace sdr::contact { class ViewContact; }
80
namespace sdr::annotation { class ObjectAnnotationData; }
81
namespace com::sun::star::drawing { class XShape; }
82
namespace svx::diagram { class DiagramHelper_svx; }
83
84
85
enum class SdrInventor : sal_uInt32 {
86
    Unknown          = 0,
87
    BasicDialog      = sal_uInt32( 'D' | ('L' << 8) | ('G' << 16) | ('1' << 24) ),
88
    Default          = sal_uInt32( 'S' | ('V' << 8) | ('D' << 16) | ('r' << 24) ),
89
    E3d              = sal_uInt32( 'E' | ('3' << 8) | ('D' << 16) | ('1' << 24) ),
90
    FmForm           = sal_uInt32( 'F' | ('M' << 8) | ('0' << 16) | ('1' << 24) ),
91
    IMap             = sal_uInt32( 'I' | ('M' << 8) | ('A' << 16) | ('P' << 24) ),
92
    ReportDesign     = sal_uInt32( 'R' | ('P' << 8) | ('T' << 16) | ('1' << 24) ),
93
    ScOrSwDraw       = sal_uInt32( 'S' | ('C' << 8) | ('3' << 16) | ('0' << 24) ), // Used in sc/ and sw/
94
    SgaImap          = sal_uInt32( 'S' | ('D' << 8) | ('U' << 16) | ('D' << 24) ),
95
    StarDrawUserData = sal_uInt32( 'S' | ('D' << 8) | ('U' << 16) | ('D' << 24) ),
96
    Swg              = sal_uInt32( 'S' | ('W' << 8) | ('G' << 16) ),
97
};
98
99
enum class SdrUserCallType {
100
    MoveOnly,         // only moved, size unchanged
101
    Resize,           // size and maybe position changed
102
    ChangeAttr,       // attribute changed. Eventually new size, because of line width
103
    Delete,           // object is going to be deleted soon, no attributes anymore
104
    Inserted,         // inserted into an object list (e.g. Page)
105
    Removed,          // removed from an object list
106
    ChildMoveOnly,    // a child within a group has changed
107
    ChildResize,      // a child within a group has changed
108
    ChildChangeAttr,  // a child within a group has changed
109
    ChildDelete,      // a child within a group has changed
110
    ChildInserted,    // a child within a group has changed
111
    ChildRemoved      // a child within a group has changed
112
};
113
114
class SVXCORE_DLLPUBLIC SdrObjUserCall
115
{
116
public:
117
    virtual ~SdrObjUserCall();
118
    virtual void Changed(const SdrObject& rObj, SdrUserCallType eType, const tools::Rectangle& rOldBoundRect);
119
    virtual void const* GetPDFAnchorStructureElementKey(SdrObject const& rObj);
120
};
121
122
class SVXCORE_DLLPUBLIC SdrObjMacroHitRec
123
{
124
public:
125
    Point                       aPos;
126
    const SdrLayerIDSet*        pVisiLayer;
127
    const SdrPageView*          pPageView;
128
    sal_uInt16                  nTol;
129
130
    SdrObjMacroHitRec();
131
};
132
133
/**
134
 * User data of a drawing object, e.g. application specific data.
135
 * Every drawing object can have an arbitrary amount of such records (SV list).
136
 * Whoever wants to save data here, must inherit from this and set a corresponding link in the factory.
137
 */
138
class SVXCORE_DLLPUBLIC SdrObjUserData
139
{
140
    SdrInventor                      m_nInventor;
141
    sal_uInt16                       m_nIdentifier;
142
143
    void operator=(const SdrObjUserData& rData) = delete;
144
    bool operator==(const SdrObjUserData& rData) const = delete;
145
    bool operator!=(const SdrObjUserData& rData) const = delete;
146
147
public:
148
    SdrObjUserData(SdrInventor nInv, sal_uInt16 nId);
149
    SdrObjUserData(const SdrObjUserData& rData);
150
    virtual ~SdrObjUserData();
151
152
    virtual std::unique_ptr<SdrObjUserData> Clone(SdrObject* pObj1) const = 0; // #i71039# NULL -> 0
153
16.7M
    SdrInventor GetInventor() const { return m_nInventor;}
154
15.9M
    sal_uInt16 GetId() const { return m_nIdentifier;}
155
};
156
157
158
/**
159
 * Provides information about various ZObject properties
160
 */
161
class SVXCORE_DLLPUBLIC SdrObjTransformInfoRec
162
{
163
public:
164
    bool bMoveAllowed : 1;             // if false, object cannot be moved
165
    bool bResizeFreeAllowed : 1;       // if false, object cannot be resized freely
166
    bool bResizePropAllowed : 1;       // if false, object cannot even be resized proportionally
167
    bool bRotateFreeAllowed : 1;       // if false, object cannot be rotated freely
168
    bool bRotate90Allowed : 1;         // if false, object cannot even be rotated in 90 degree steps
169
    bool bMirrorFreeAllowed : 1;       // if false, object cannot be mirrored freely
170
    bool bMirror45Allowed : 1;         // if false, object cannot even be mirrored over axes in a 45 degree raster
171
    bool bMirror90Allowed : 1;         // if false, object cannot even be mirrored over axes in a 90 degree raster
172
    bool bTransparenceAllowed : 1;     // if false, object does not have an interactive transparence control
173
    bool bShearAllowed : 1;            // if false, object cannot be sheared
174
    bool bEdgeRadiusAllowed : 1;
175
    bool bNoOrthoDesired : 1;          // is true for Rect; is false for BMP, MTF
176
    bool bNoContortion : 1;            // if false, contortion not possible (for crook, only true for PathObj and grouped PathObjs)
177
    bool bCanConvToPath : 1;           // if false, no conversion into PathObj possible
178
    bool bCanConvToPoly : 1;           // if false, no conversion into PolyObj possible
179
    bool bCanConvToContour : 1;        // if false, no conversion down to whole contour possible
180
    bool bCanConvToPathLineToArea : 1; // if false, no conversion into PathObj with transformation from LineToArea possible
181
    bool bCanConvToPolyLineToArea : 1; // if false, no conversion into PolyObj with transformation from LineToArea possible
182
183
    SdrObjTransformInfoRec();
184
};
185
186
////////////////////////////////////////////////////////////////////////////////////////////////////
187
//
188
//  SdrObject
189
//      SdrAttrObj
190
//          E3dObject
191
//              E3dCompoundObject
192
//                  E3dCubeObj
193
//                  E3dExtrudeObj
194
//                  E3dLatheObj
195
//                  E3dPolygonObj
196
//                  E3dSphereObj
197
//              E3dScene
198
//          SdrTextObj
199
//              SdrObjCustomShape
200
//                  OCustomShape
201
//              SdrEdgeObj
202
//              SdrMeasureObj
203
//              SdrPathObj
204
//              SdrRectObj
205
//                  SdrCaptionObj
206
//                  SdrCircObj
207
//                  SdrGrafObj
208
//                  SdrMediaObj
209
//                  SdrOle2Obj
210
//                      OOle2Obj
211
//                  SdrUnoObj
212
//                      DlgEdObj
213
//                          DlgEdForm
214
//                      OUnoObject
215
//                      FmFormObj
216
//              SdrTableObj
217
//      SdrObjGroup
218
//      SdrPageObj
219
//      SdrVirtObj
220
//          SwDrawVirtObj
221
//          SwVirtFlyDrawObj
222
//      SwFlyDrawObj
223
224
/// Abstract DrawObject
225
class SVXCORE_DLLPUBLIC SdrObject : public SfxListener, public cppu::OWeakObject
226
{
227
public:
228
    // Basic DiagramHelper support
229
    virtual bool isDiagram() const;
230
    virtual const std::shared_ptr< svx::diagram::DiagramHelper_svx >& getDiagramHelper() const;
231
    void setDiagramDataModelID(const OUString& rID);
232
    const OUString& getDiagramDataModelID() const;
233
234
    // return DiagramSubSelection if exists. This will always return
235
    // a valid SdrObject* to allow to use this as a loop-through-call
236
    virtual SdrObject* getDiagramSubSelection();
237
238
    bool isDiagramBackgroundShape() const;
239
    bool isDiagramTextNode() const;
240
    bool removeDiagramNode();
241
242
    // temporary check if to use AdvancedDiagramFeatures
243
    static bool useAdvancedDiagramFeatures();
244
245
protected:
246
    void resetViewContact();
247
248
private:
249
    // check if an ObjectName is set and it is in DiagramModelID syntax
250
    bool ObjectNameIsDiagramModelID();
251
252
    friend class                SdrObjListIter;
253
    friend class                SdrObjList;
254
    friend class                SdrVirtObj;
255
    friend class                SdrRectObj;
256
257
    // Returns a copy of the object. Every inherited class must reimplement this.
258
    virtual rtl::Reference<SdrObject> implCloneSdrObject(SdrModel& rTargetModel) const = 0;
259
260
    // OperationSmiley: Allow at each SdrObject to set a FillGeometryDefiningShape,
261
    // so that for SdrObjects where this is set, the definition of a defined FillStyle
262
    // will use this, but the local geometry will be filled. This allows to fill
263
    // multiple shapes with a unified fill, e.g think about CustomShapes.
264
    // Currently this is *only* used for CustomShapes, but may be developed to get a
265
    // common mechanism - usages for it are easy to be found. The current limitation
266
    // to CustomShapes allows to think about these SdrObjects to 'vanish' during the
267
    // lifetime of 'this' - the SdrObjects without SdrPage and SdrModel are used as helper
268
    // objects for SdrObjCustomShape and thus their lifetime is limited to the lifetime
269
    // of this local object. For unifying this mechanism, some weak reference of
270
    // SdrObjects would have to be thought about (not easy with the current implementation).
271
    // So - allow *only* EnhancedCustomShape2d (which creates the visualizations for
272
    // SdrObjCustomShape) to set this. Already allow unified read to use it - thus already
273
    // allowing to implement as standard case for all kinds of SdrObjects.
274
    friend class EnhancedCustomShape2d;
275
    const SdrObject*            mpFillGeometryDefiningShape;
276
17.3k
    void setFillGeometryDefiningShape(const SdrObject* pNew) { mpFillGeometryDefiningShape = pNew; }
277
public:
278
149
    const SdrObject* getFillGeometryDefiningShape() const { return mpFillGeometryDefiningShape; }
279
280
private:
281
    // the SdrModel this objects was created with, unchanged during SdrObject lifetime
282
    SdrModel&                   mrSdrModelFromSdrObject;
283
284
public:
285
    // A SdrObject always needs a SdrModel for lifetime (Pool, ...)
286
    SdrObject(SdrModel& rSdrModel);
287
    // Copy constructor
288
    SdrObject(SdrModel& rSdrModel, SdrObject const & rSource);
289
290
    virtual void SAL_CALL acquire() noexcept override final;
291
    virtual void SAL_CALL release() noexcept override final;
292
293
0
    sal_uInt64 GetUniqueID() const { return maUniqueID.getID(); }
294
295
    // SdrModel/SdrPage access on SdrObject level
296
    SdrPage* getSdrPageFromSdrObject() const;
297
    SdrModel& getSdrModelFromSdrObject() const;
298
299
    // access to possible children (SdrObjGroup/E3dScene)
300
    virtual SdrObjList* getChildrenOfSdrObject() const;
301
302
    // access to parent
303
    SdrObjList* getParentSdrObjListFromSdrObject() const;
304
    SdrObject* getParentSdrObjectFromSdrObject() const;
305
306
private:
307
    SVX_DLLPRIVATE void setParentOfSdrObject(SdrObjList* pNew);
308
309
public:
310
    // react on model/page change
311
    virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage);
312
313
    void AddObjectUser(sdr::ObjectUser& rNewUser);
314
    void RemoveObjectUser(sdr::ObjectUser& rOldUser);
315
316
    sdr::contact::ViewContact& GetViewContact() const;
317
318
    virtual sdr::properties::BaseProperties& GetProperties() const;
319
320
    // DrawContact support: Methods for handling Object changes
321
    void ActionChanged() const;
322
323
    static SdrItemPool& GetGlobalDrawObjectItemPool();
324
    void SetRelativeWidth( double nValue );
325
    void SetRelativeWidthRelation( sal_Int16 eValue );
326
    void SetRelativeHeight( double nValue );
327
    void SetRelativeHeightRelation( sal_Int16 eValue );
328
    const double* GetRelativeWidth() const;
329
    sal_Int16 GetRelativeWidthRelation() const;
330
    const double* GetRelativeHeight() const;
331
    sal_Int16 GetRelativeHeightRelation() const;
332
333
    /// @param bNotMyself = true: set only ObjList to dirty, don't mark this object as dirty.
334
    ///
335
    /// This is needed for instance for NbcMove, because usually one moves SnapRect and aOutRect
336
    /// at the same time to avoid recomputation.
337
    virtual void SetBoundAndSnapRectsDirty(bool bNotMyself = false, bool bRecursive = true);
338
339
    // this method is only for access from Property objects
340
    virtual void SetBoundRectDirty();
341
342
    SfxItemPool & GetObjectItemPool() const;
343
344
    void AddListener(SfxListener& rListener);
345
    void RemoveListener(SfxListener& rListener);
346
347
    void AddReference(SdrVirtObj& rVrtObj);
348
    void DelReference(SdrVirtObj& rVrtObj);
349
    virtual SdrInventor GetObjInventor() const;
350
    virtual SdrObjKind GetObjIdentifier() const;
351
    virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
352
353
    // Layer interface
354
    virtual SdrLayerID GetLayer() const;
355
    virtual void NbcSetLayer(SdrLayerID nLayer);
356
    virtual void SetLayer(SdrLayerID nLayer);
357
    bool isVisibleOnAnyOfTheseLayers(const SdrLayerIDSet& rSet) const;
358
359
    void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle& rBoundRect) const;
360
361
    // #i68101#
362
    // An object may have a user-set Name (Get/SetName()), e.g SdrGrafObj, SdrObjGroup
363
    // or SdrOle2Obj.
364
    // It may also have a Title and a Description for accessibility purposes.
365
    virtual void SetName(const OUString& rStr, const bool bSetChanged = true);
366
    virtual const OUString & GetName() const;
367
    void MakeNameUnique();
368
    void MakeNameUnique(std::unordered_set<OUString>& rNameSet);
369
    virtual void SetTitle(const OUString& rStr);
370
    virtual OUString GetTitle() const;
371
    virtual void SetDescription(const OUString& rStr);
372
    virtual OUString GetDescription() const;
373
    virtual void SetDecorative(bool isDecorative);
374
    virtual bool IsDecorative() const;
375
    // tdf#167714 a "standard horizontal rule", which is laid out and cropped its own way.
376
    // This says which kind of object this is, not how it looks: it belongs to creating a rule and
377
    // is read-only afterwards, never toggled on an existing shape, so no undo action reverses it.
378
0
    void SetHorizontalRule(bool isHorizontalRule) { m_bHorizontalRule = isHorizontalRule; }
379
    // The flag lives in a graphic style, which can be shared or applied to anything, so it is
380
    // honoured only for the two shapes a rule can be made of: a filled bar (the shaded rule) and
381
    // a picture (a picture rule). On an ellipse, a group or a custom shape it would ask for a
382
    // layout that makes no sense.
383
    bool IsHorizontalRule() const
384
2.36k
    {
385
2.36k
        const SdrObjKind eKind = GetObjIdentifier();
386
2.36k
        return m_bHorizontalRule
387
0
               && (eKind == SdrObjKind::Rectangle || eKind == SdrObjKind::Graphic);
388
2.36k
    }
389
390
    // Object representing an annotation
391
135k
    bool isAnnotationObject() const { return bool(mpAnnotationData); }
392
    void setAsAnnotationObject();
393
    std::unique_ptr<sdr::annotation::ObjectAnnotationData>& getAnnotationData();
394
395
    // for group objects
396
    bool IsGroupObject() const;
397
    virtual SdrObjList* GetSubList() const;
398
399
    /// The order number (aka ZOrder, aka z-index) determines whether a
400
    /// SdrObject is located above or below another.  Objects are painted from
401
    /// lowest to highest order number.  If the order of SdrObjects in the
402
    /// SdrObjList is changed, the bObjOrdNumsDirty flag is set on the SdrPage
403
    /// and the next GetOrdNum() call recalculates the order number of all
404
    /// SdrObjects in the SdrObjList.
405
    sal_uInt32 GetOrdNum() const;
406
407
    /// Ensure this object is sorted immediately after rFirst
408
    /// ie. rFirst.GetOrdNum() + 1 == this->GetOrdNum()
409
    void ensureSortedImmediatelyAfter(const SdrObject& rFirst);
410
411
    // setting the order number should only happen from the model or from the page
412
    void SetOrdNum(sal_uInt32 nNum);
413
414
    // GrabBagItem for interim interop purposes
415
    void GetGrabBagItem(css::uno::Any& rVal) const;
416
417
    void SetGrabBagItem(const css::uno::Any& rVal);
418
419
    // Return the position in the navigation order for the called object.
420
    // Note that this method may update the navigation position of the
421
    // called and of other SdrObjects.  Therefore this method can not be
422
    // const.
423
    // @return
424
    //     If no navigation position has been explicitly defined then the
425
    //     result of GetOrdNum() is returned.
426
    sal_uInt32 GetNavigationPosition() const;
427
428
    // To make clearer that this method may trigger RecalcBoundRect and thus may be
429
    // expensive and sometimes problematic (inside a bigger object change You will get
430
    // non-useful BoundRects sometimes) i rename that method from GetBoundRect() to
431
    // GetCurrentBoundRect().
432
    virtual const tools::Rectangle& GetCurrentBoundRect() const;
433
434
    // To have a possibility to get the last calculated BoundRect e.g for producing
435
    // the first rectangle for repaints (old and new need to be used) without forcing
436
    // a RecalcBoundRect (which may be problematical and expensive sometimes) i add here
437
    // a new method for accessing the last BoundRect.
438
    virtual const tools::Rectangle& GetLastBoundRect() const;
439
440
    virtual void RecalcBoundRect();
441
442
    void BroadcastObjectChange() const;
443
444
    SfxBroadcaster* GetBroadcaster() const;
445
446
    // set modified-flag in the model
447
    virtual void SetChanged();
448
449
    // Tooling for painting a single object to an OutputDevice. This will be needed as long
450
    // as not all painting is changed to use DrawContact objects.
451
    void SingleObjectPainter(OutputDevice& rOut) const;
452
    bool LineGeometryUsageIsNecessary() const;
453
454
    // RotGrfFlyFrame: If true, this SdrObject supports only limited rotation, that
455
    // means no change of the rotation point (only centered) and no shear allowed
456
    virtual bool HasLimitedRotation() const;
457
458
    // Returns a copy of the object. Internally uses the virtual and
459
    // overridden method implCloneSdrObject that is implemented for each
460
    // derivation. If cloned to another SdrModel it will support calling
461
    // postProcessAfterCloneToDifferentModel
462
    rtl::Reference<SdrObject> CloneSdrObject(SdrModel& rTargetModel) const;
463
464
    // helper, since Clone always return the type of the current subclass
465
    template<class T>
466
    static rtl::Reference<T> Clone(T const & rObj, SdrModel& rTargetModel)
467
0
    {
468
0
        rtl::Reference<SdrObject> newObj = rObj.CloneSdrObject(rTargetModel);
469
0
        return static_cast<T*>(newObj.get());
470
0
    }
Unexecuted instantiation: rtl::Reference<SdrGrafObj> SdrObject::Clone<SdrGrafObj>(SdrGrafObj const&, SdrModel&)
Unexecuted instantiation: rtl::Reference<E3dCompoundObject> SdrObject::Clone<E3dCompoundObject>(E3dCompoundObject const&, SdrModel&)
Unexecuted instantiation: rtl::Reference<SdrEdgeObj> SdrObject::Clone<SdrEdgeObj>(SdrEdgeObj const&, SdrModel&)
Unexecuted instantiation: rtl::Reference<SdrPathObj> SdrObject::Clone<SdrPathObj>(SdrPathObj const&, SdrModel&)
Unexecuted instantiation: rtl::Reference<SdrTextObj> SdrObject::Clone<SdrTextObj>(SdrTextObj const&, SdrModel&)
Unexecuted instantiation: rtl::Reference<sdr::table::SdrTableObj> SdrObject::Clone<sdr::table::SdrTableObj>(sdr::table::SdrTableObj const&, SdrModel&)
Unexecuted instantiation: rtl::Reference<SdrMediaObj> SdrObject::Clone<SdrMediaObj>(SdrMediaObj const&, SdrModel&)
471
472
    // Overwriting this object makes no sense, it is too complicated for that
473
    SdrObject& operator=(const SdrObject& rObj) = delete;
474
    SdrObject& operator=(SdrObject&& rObj) = delete;
475
476
    // TakeObjName...() is for the display in the UI, e.g. "3 frames selected"
477
    virtual OUString TakeObjNameSingul() const;
478
    virtual OUString TakeObjNamePlural() const;
479
480
    /// The Xor-Polygon is required by the View to drag the object.
481
    /// All polygons within the PolyPolygon are interpreted as PolyLine.
482
    /// To get a closed Polygon, close it explicitly.
483
    virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
484
485
    /// contour for TextToContour
486
    virtual basegfx::B2DPolyPolygon TakeContour() const;
487
488
    /// Via GetHdlCount the number of Handles can be retrieved.
489
    /// Normally 8, if it's a line 2.
490
    /// For Polygon objects (Polygon/Spline/Bezier) the number may be much
491
    /// larger.  Polygon objects are also allowed to select a point of a
492
    /// selected object.  The handle of that point will then be replaced by
493
    /// a new set of handles (PlusHdl).  For a Polygon this would be a simple
494
    /// selection Handle, for a Bezier curve this may be up to 3 Handles
495
    /// (including Weights).
496
    /// GetHdl() and GetPlusHdl() must create Handle instances with new!
497
    /// An object that returns true from HasSpacialDrag() must provide these
498
    /// methods (incl. FillHdlList()).
499
    virtual sal_uInt32 GetHdlCount() const;
500
    virtual void AddToPlusHdlList(SdrHdlList& rHdlList, SdrHdl& rHdl) const;
501
    virtual void AddToHdlList(SdrHdlList& rHdlList) const;
502
    virtual void addCropHandles(SdrHdlList& rTarget) const;
503
504
    /// The standard transformations (Move,Resize,Rotate,Mirror,Shear) are
505
    /// taken over by the View (TakeXorPoly(),...).
506
    /// Object type specific dragging like corner radius of Rectangle,
507
    /// control points of Splines, weights of Bezier curves, pointer of
508
    /// Label objects must be handled by the object itself.
509
    /// To keep the Model free of state, the state is kept in the View
510
    /// and then passed to the object. EndDrag usually returns true for success,
511
    /// false may be returned if the dragging did not modify the object,
512
    /// where the View already handles the case that the pointer was not
513
    /// moved at all.
514
    virtual bool hasSpecialDrag() const;
515
    virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
516
    virtual bool applySpecialDrag(SdrDragStat& rDrag);
517
    virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const;
518
    virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
519
520
    // FullDrag support. This is for standard interactions and for SdrObjOwn
521
    // support. If supportsFullDrag() returns true, getFullDragClone has to
522
    // return a cloned SdrObject (whose ownership it loses) at which modifications
523
    // like Move(), Scale(), etc or applySpecialDrag() will be executed. That
524
    // object will be visualized on overlay for full drag, but should not be
525
    // part of the model, thus not changing anything since it's only a temporary
526
    // helper object for interaction
527
    virtual bool supportsFullDrag() const;
528
    virtual rtl::Reference<SdrObject> getFullDragClone() const;
529
530
    /// Every object must be able to create itself interactively.
531
    /// On MouseDown first an object is created, and its BegCreate() method
532
    /// is called.  On every MouseMove, MovCreate() is called.  BrkCreate()
533
    /// is called if the user cancels the interactive object creation.
534
    /// EndCreate() is called on the MouseUp event.  If EndCreate() returns
535
    /// true, the creation is finished; the object is inserted into the
536
    /// corresponding list.  Otherwise it is assumed that further points
537
    /// are necessary to create the object (Polygon, ...).  The parameter
538
    /// eCmd contains the number of mouse clicks (if the application
539
    /// provides it).
540
    /// BckCreate() will undo the previous EndCreate(), e.g. to delete the
541
    /// last point of the Polygon.  If BckCreate() returns false, creation
542
    /// is cancelled.
543
    virtual bool BegCreate(SdrDragStat& rStat);
544
    virtual bool MovCreate(SdrDragStat& rStat); // if true, Xor needs to be repainted
545
    virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
546
    virtual bool BckCreate(SdrDragStat& rStat);
547
    virtual void BrkCreate(SdrDragStat& rStat);
548
549
    /// get the cursor/pointer that signals creating this object
550
    virtual PointerStyle GetCreatePointer() const;
551
552
    /// Polygon dragged by the user when creating the object
553
    virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
554
555
    /// The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and
556
    /// SetLogicRect call the corresponding Nbc-methods, send a Repaint
557
    /// broadcast and set the Modified state on the Model.
558
    /// Derived classes should usually only override the Nbc methods.
559
    /// Nbc means "no broadcast".
560
    virtual void NbcMove  (const Size& rSiz);
561
    virtual void NbcResize(const Point& rRef, double xFact, double yFact);
562
    virtual bool IsSizeValid(Size aTargetSize);
563
    virtual void NbcCrop  (const basegfx::B2DPoint& rRef, double fxFact, double fyFact);
564
    virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) = 0;
565
    // Utility for call sites that don't have sin and cos handy
566
    void NbcRotate(const Point& rRef, Degree100 nAngle);
567
    virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
568
    virtual void NbcShear (const Point& rRef, Degree100 nAngle, double tn, bool bVShear);
569
570
    virtual void Move  (const Size& rSiz);
571
    virtual void Resize(const Point& rRef, double xFact, double yFact, bool bUnsetRelative = true);
572
    virtual void Crop  (const basegfx::B2DPoint& rRef, double fxFact, double fyFact);
573
    virtual void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs);
574
    virtual void Mirror(const Point& rRef1, const Point& rRef2);
575
    virtual void Shear (const Point& rRef, Degree100 nAngle, double tn, bool bVShear);
576
577
    /// The relative position of a SdrObject is the distance of the upper
578
    /// left corner of the logic bounding rectangle (SnapRect) to the anchor.
579
    virtual void NbcSetRelativePos(const Point& rPnt);
580
    virtual void SetRelativePos(const Point& rPnt);
581
    virtual Point GetRelativePos() const;
582
    void ImpSetAnchorPos(const Point& rPnt);
583
    virtual void NbcSetAnchorPos(const Point& rPnt);
584
    virtual void SetAnchorPos(const Point& rPnt);
585
586
    /// Snap is not done on the BoundRect but if possible on logic coordinates
587
    /// (i.e. without considering stroke width, ...)
588
    /// SetSnapRect() tries to size the Object so that it fits into the
589
    /// passed Rect (without stroke width, ...)
590
    virtual void RecalcSnapRect();
591
    virtual const tools::Rectangle& GetSnapRect() const;
592
    virtual void SetSnapRect(const tools::Rectangle& rRect);
593
    virtual void NbcSetSnapRect(const tools::Rectangle& rRect);
594
595
    // Logic Rect: for the Rect for instance without regard to rotation angle, shear, ...
596
    virtual const tools::Rectangle& GetLogicRect() const;
597
    virtual void SetLogicRect(const tools::Rectangle& rRect);
598
    // @param bAdaptTextMinSize pass false if you know it is safe to avoid the cost of doing
599
    //              text layout right now.
600
    virtual void NbcSetLogicRect(const tools::Rectangle& rRect, bool bAdaptTextMinSize = true);
601
602
    // the default is to set the logic rect to the given rectangle rMaxRect. If the shape
603
    // has an intrinsic aspect ratio it may set the logic rect so the aspect
604
    // ratio is kept but still inside the rectangle rMaxRect.
605
    // If bShrinkOnly is set to true, the size of the current logic rect will not
606
    // be changed if it is smaller than the given rectangle rMaxRect.
607
    virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false );
608
609
    // rotation and shear angle
610
    virtual Degree100 GetRotateAngle() const;
611
    virtual Degree100 GetShearAngle(bool bVertical = false) const;
612
613
    /// snap to special points of an Object (polygon points, center of circle)
614
    virtual sal_uInt32 GetSnapPointCount() const;
615
    virtual Point GetSnapPoint(sal_uInt32 i) const;
616
617
    // For objects, whose points can be moved individually.
618
    // (e.g. polygons, polylines, lines)
619
    // The points of those objects are selected (if necessary multiselection),
620
    // deleted, inserted, or as a multiselection moved or rotated...
621
    // Only such objects can have PlusHandles (e.g. the weights of a Bezier curve).
622
    virtual bool IsPolyObj() const;
623
    virtual sal_uInt32 GetPointCount() const;
624
    virtual Point GetPoint(sal_uInt32 i) const;
625
    void SetPoint(const Point& rPnt, sal_uInt32 i);
626
    virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i);
627
628
    // get all geometrical data for undo/redo
629
    virtual std::unique_ptr<SdrObjGeoData> GetGeoData() const;
630
    virtual void SetGeoData(const SdrObjGeoData& rGeo);
631
632
    // ItemSet access
633
    const SfxItemSet& GetMergedItemSet() const;
634
    void SetMergedItem(const SfxPoolItem& rItem);
635
    void ClearMergedItem(const sal_uInt16 nWhich = 0);
636
    // @param bAdjustTextFrameWidthAndHeight pass false if you know it is safe to avoid the cost of doing
637
    //              text layout right now.
638
    void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false, bool bAdjustTextFrameWidthAndHeight = true);
639
    const SfxPoolItem& GetMergedItem(const sal_uInt16 nWhich) const;
640
    template<class T>
641
    const T&           GetMergedItem( TypedWhichId<T> nWhich ) const
642
2.98M
    {
643
2.98M
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
2.98M
    }
SdrCustomShapeGeometryItem const& SdrObject::GetMergedItem<SdrCustomShapeGeometryItem>(TypedWhichId<SdrCustomShapeGeometryItem>) const
Line
Count
Source
642
1.22M
    {
643
1.22M
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
1.22M
    }
XLineWidthItem const& SdrObject::GetMergedItem<XLineWidthItem>(TypedWhichId<XLineWidthItem>) const
Line
Count
Source
642
4.49k
    {
643
4.49k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
4.49k
    }
XLineColorItem const& SdrObject::GetMergedItem<XLineColorItem>(TypedWhichId<XLineColorItem>) const
Line
Count
Source
642
6.65k
    {
643
6.65k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
6.65k
    }
Unexecuted instantiation: SvxFontHeightItem const& SdrObject::GetMergedItem<SvxFontHeightItem>(TypedWhichId<SvxFontHeightItem>) const
Unexecuted instantiation: SfxBoolItem const& SdrObject::GetMergedItem<SfxBoolItem>(TypedWhichId<SfxBoolItem>) const
Unexecuted instantiation: SdrTextFitToSizeTypeItem const& SdrObject::GetMergedItem<SdrTextFitToSizeTypeItem>(TypedWhichId<SdrTextFitToSizeTypeItem>) const
SdrMetricItem const& SdrObject::GetMergedItem<SdrMetricItem>(TypedWhichId<SdrMetricItem>) const
Line
Count
Source
642
65.4k
    {
643
65.4k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
65.4k
    }
SdrTextVertAdjustItem const& SdrObject::GetMergedItem<SdrTextVertAdjustItem>(TypedWhichId<SdrTextVertAdjustItem>) const
Line
Count
Source
642
16.3k
    {
643
16.3k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
16.3k
    }
SdrTextHorzAdjustItem const& SdrObject::GetMergedItem<SdrTextHorzAdjustItem>(TypedWhichId<SdrTextHorzAdjustItem>) const
Line
Count
Source
642
16.3k
    {
643
16.3k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
16.3k
    }
SvxFrameDirectionItem const& SdrObject::GetMergedItem<SvxFrameDirectionItem>(TypedWhichId<SvxFrameDirectionItem>) const
Line
Count
Source
642
14.5k
    {
643
14.5k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
14.5k
    }
XFillStyleItem const& SdrObject::GetMergedItem<XFillStyleItem>(TypedWhichId<XFillStyleItem>) const
Line
Count
Source
642
654k
    {
643
654k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
654k
    }
XFillColorItem const& SdrObject::GetMergedItem<XFillColorItem>(TypedWhichId<XFillColorItem>) const
Line
Count
Source
642
6.49k
    {
643
6.49k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
6.49k
    }
XFillGradientItem const& SdrObject::GetMergedItem<XFillGradientItem>(TypedWhichId<XFillGradientItem>) const
Line
Count
Source
642
695
    {
643
695
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
695
    }
XFillBitmapItem const& SdrObject::GetMergedItem<XFillBitmapItem>(TypedWhichId<XFillBitmapItem>) const
Line
Count
Source
642
1.09k
    {
643
1.09k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
1.09k
    }
XFillBmpStretchItem const& SdrObject::GetMergedItem<XFillBmpStretchItem>(TypedWhichId<XFillBmpStretchItem>) const
Line
Count
Source
642
28
    {
643
28
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
28
    }
XFillBmpTileItem const& SdrObject::GetMergedItem<XFillBmpTileItem>(TypedWhichId<XFillBmpTileItem>) const
Line
Count
Source
642
1.09k
    {
643
1.09k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
1.09k
    }
XFillTransparenceItem const& SdrObject::GetMergedItem<XFillTransparenceItem>(TypedWhichId<XFillTransparenceItem>) const
Line
Count
Source
642
6.82k
    {
643
6.82k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
6.82k
    }
XLineStyleItem const& SdrObject::GetMergedItem<XLineStyleItem>(TypedWhichId<XLineStyleItem>) const
Line
Count
Source
642
614k
    {
643
614k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
614k
    }
Unexecuted instantiation: SdrGrafCropItem const& SdrObject::GetMergedItem<SdrGrafCropItem>(TypedWhichId<SdrGrafCropItem>) const
XLineEndItem const& SdrObject::GetMergedItem<XLineEndItem>(TypedWhichId<XLineEndItem>) const
Line
Count
Source
642
96
    {
643
96
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
96
    }
XLineEndWidthItem const& SdrObject::GetMergedItem<XLineEndWidthItem>(TypedWhichId<XLineEndWidthItem>) const
Line
Count
Source
642
96
    {
643
96
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
96
    }
XLineEndCenterItem const& SdrObject::GetMergedItem<XLineEndCenterItem>(TypedWhichId<XLineEndCenterItem>) const
Line
Count
Source
642
96
    {
643
96
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
96
    }
XLineStartItem const& SdrObject::GetMergedItem<XLineStartItem>(TypedWhichId<XLineStartItem>) const
Line
Count
Source
642
96
    {
643
96
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
96
    }
XLineStartWidthItem const& SdrObject::GetMergedItem<XLineStartWidthItem>(TypedWhichId<XLineStartWidthItem>) const
Line
Count
Source
642
96
    {
643
96
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
96
    }
XLineStartCenterItem const& SdrObject::GetMergedItem<XLineStartCenterItem>(TypedWhichId<XLineStartCenterItem>) const
Line
Count
Source
642
96
    {
643
96
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
96
    }
Unexecuted instantiation: XFillHatchItem const& SdrObject::GetMergedItem<XFillHatchItem>(TypedWhichId<XFillHatchItem>) const
Unexecuted instantiation: XFormTextStyleItem const& SdrObject::GetMergedItem<XFormTextStyleItem>(TypedWhichId<XFormTextStyleItem>) const
SdrOnOffItem const& SdrObject::GetMergedItem<SdrOnOffItem>(TypedWhichId<SdrOnOffItem>) const
Line
Count
Source
642
757
    {
643
757
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
757
    }
SdrTextFixedCellHeightItem const& SdrObject::GetMergedItem<SdrTextFixedCellHeightItem>(TypedWhichId<SdrTextFixedCellHeightItem>) const
Line
Count
Source
642
15.1k
    {
643
15.1k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
15.1k
    }
SfxStringItem const& SdrObject::GetMergedItem<SfxStringItem>(TypedWhichId<SfxStringItem>) const
Line
Count
Source
642
330k
    {
643
330k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
330k
    }
SfxInt16Item const& SdrObject::GetMergedItem<SfxInt16Item>(TypedWhichId<SfxInt16Item>) const
Line
Count
Source
642
95
    {
643
95
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
95
    }
XSecondaryFillColorItem const& SdrObject::GetMergedItem<XSecondaryFillColorItem>(TypedWhichId<XSecondaryFillColorItem>) const
Line
Count
Source
642
686
    {
643
686
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
686
    }
Unexecuted instantiation: SvxCharScaleWidthItem const& SdrObject::GetMergedItem<SvxCharScaleWidthItem>(TypedWhichId<SvxCharScaleWidthItem>) const
Unexecuted instantiation: SvxKerningItem const& SdrObject::GetMergedItem<SvxKerningItem>(TypedWhichId<SvxKerningItem>) const
Unexecuted instantiation: SvxFontItem const& SdrObject::GetMergedItem<SvxFontItem>(TypedWhichId<SvxFontItem>) const
Unexecuted instantiation: SvxPostureItem const& SdrObject::GetMergedItem<SvxPostureItem>(TypedWhichId<SvxPostureItem>) const
Unexecuted instantiation: SvxWeightItem const& SdrObject::GetMergedItem<SvxWeightItem>(TypedWhichId<SvxWeightItem>) const
Unexecuted instantiation: SwFormatFrameSize const& SdrObject::GetMergedItem<SwFormatFrameSize>(TypedWhichId<SwFormatFrameSize>) const
SvxFieldItem const& SdrObject::GetMergedItem<SvxFieldItem>(TypedWhichId<SvxFieldItem>) const
Line
Count
Source
642
2
    {
643
2
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
644
2
    }
645
646
    // syntactical sugar for ItemSet accesses
647
    void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems = false);
648
649
    // NotPersistAttr for Layer, ObjName, geometrical transformations etc.
650
    void TakeNotPersistAttr(SfxItemSet& rAttr) const;
651
    void ApplyNotPersistAttr(const SfxItemSet& rAttr);
652
    void NbcApplyNotPersistAttr(const SfxItemSet& rAttr);
653
654
    // if bDontRemoveHardAttr is false, set all attributes, which were set in the style sheet, to their default value
655
    // if true, all hard attributes keep their values
656
    void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr);
657
    // @param bAdjustTextFrameWidthAndHeight pass false if you know it is safe to avoid the cost of doing
658
    //              text layout right now.
659
    void NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, bool bAdjustTextFrameWidthAndHeight = true);
660
    SfxStyleSheet* GetStyleSheet() const;
661
662
    virtual bool HasTextEdit() const;
663
664
    // keep text in outliner's format
665
    // SetOutlinerParaObject: transfer ownership of *pTextObject!
666
    void SetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject);
667
    virtual void NbcSetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject, bool bAdjustTextFrameWidthAndHeight = true);
668
    virtual OutlinerParaObject* GetOutlinerParaObject() const;
669
    virtual void NbcReformatText();
670
671
    void BurnInStyleSheetAttributes();
672
673
    // macro abilities, e.g. a rectangle as PushButton.
674
    virtual bool HasMacro() const;
675
    virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const;
676
    virtual PointerStyle GetMacroPointer (const SdrObjMacroHitRec& rRec) const;
677
    virtual void PaintMacro (OutputDevice& rOut, const tools::Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const;
678
    virtual bool DoMacro (const SdrObjMacroHitRec& rRec);
679
    bool IsMacroHit(const SdrObjMacroHitRec& rRec) const;
680
681
    // Connectors
682
    // (see also documentation in SvdoEdge.hxx, SdrEdgeObj, as well as SvdGlue.hxx and SvdGlEV.hxx)
683
    //
684
    // There are nodes and edges. In theory an edge can also be a node, but this isn't implemented yet.
685
    // A node has a number of gluepoints, onto which edges can glued to
686
    // An edge can be either
687
    // - without any connection to any node,
688
    // - or connected on one end to a node, while the other end is not connected,
689
    // - or connected on both ends with exactly one node each.
690
    // The edge is listener for its up to two nodes.
691
    // Whenever a node is moved or resized, all its connected edges follow.
692
    // This is also true for SetGluePoint()... on the node.
693
    // On the other hand, moving/resizing an edge breaks the connection.
694
695
    // automatic gluepoints:
696
    // a node object must provide four vertex and corner positions
697
    // usually 0: top, 1: right, 2: bottom, 3: left
698
    virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const;
699
700
    // usually:
701
    // 0: top-left, 1: top-right, 2: bottom-right, 3: bottom-left
702
    virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const;
703
704
    // list of all gluepoints, can be NULL
705
    virtual const SdrGluePointList* GetGluePointList() const;
706
707
    // after changing the GluePointList, one has to call the object's SendRepaintBroadcast!
708
    virtual SdrGluePointList* ForceGluePointList();
709
710
    // to be set temporarily when transforming related object(?)
711
    void SetGlueReallyAbsolute(bool bOn);
712
    void NbcRotateGluePoints(const Point& rRef, Degree100 nAngle, double sn, double cs);
713
    void NbcMirrorGluePoints(const Point& rRef1, const Point& rRef2);
714
    void NbcShearGluePoints (const Point& rRef, double tn, bool bVShear);
715
716
    // if bTail1 is true, line start, otherwise line end
717
    // if pObj is null disconnect
718
    virtual void ConnectToNode(bool bTail1, SdrObject* pObj);
719
    virtual void DisconnectFromNode(bool bTail1);
720
    virtual SdrObject* GetConnectedNode(bool bTail1) const;
721
722
    // sets the writing mode of the object's context
723
    // Objects which itself do not support different writing modes will ignore this call.
724
    // Objects which support different writing modes, but have an own, explicit writing mode set,
725
    // will also ignore this call.
726
    // Objects which support different writing modes, and whose own mode is set to css.text.WritingMode2.CONTEXT,
727
    // will use the given writing mode to calculate their "effective writing mode".
728
    // The behaviour of this method is undefined if you pass css.text.WritingMode2.CONTEXT.
729
    // @param _nContextWritingMode
730
    //     the effective writing mode of the context of the object
731
    virtual void    SetContextWritingMode( const sal_Int16 _nContextWritingMode );
732
733
    // If an object is able to convert itself into a polygon or into a Bezier curve (or into both),
734
    // then the following methods should be overridden.
735
    // E.g., convert a RectObj with line width 10, SOLID_PEN into a polygon:
736
    // In the bLineToArea=false mode a PolyObj with four supporting points,
737
    // line width 10 and SOLID_PEN shall be created.
738
    // On the contrary in the bLineToArea=true mode the generated object should
739
    // still have a line attribute NULL_PEN, and the line (also line pattern)
740
    // itself should be emulated by the polygon area, which thereby can be
741
    // manipulated by the user afterwards.
742
    // The RectObj therefore can only convert correctly if it has an area attribute NULL_BRUSH.
743
    // In this case it would have to:
744
    // - set SOLID_BRUSH with the color of the given pen,
745
    // - set NULL_PEN, and
746
    // - generate tools::PolyPolygon with two polygons with four supporting points each.
747
    // In each case the return value is a SdrObject*, because it is also
748
    // allowed to return group objects (e.g. for SdrTextObj).
749
    // In the case of the conversion from TextObj to PathObj,
750
    // both modi (bLineToArea=true/false) would be identical.
751
    // The methods' default implementations report "I'm unable to do this" (false/null).
752
    virtual rtl::Reference<SdrObject> DoConvertToPolyObj(bool bBezier, bool bAddText) const;
753
    rtl::Reference<SdrObject> ConvertToPolyObj(bool bBezier, bool bLineToArea) const;
754
755
    // convert this path object to contour object; bForceLineDash converts even
756
    // when there is no filled new polygon created from line-to-polygon conversion,
757
    // specially used for XLINE_DASH and 3D conversion
758
    rtl::Reference<SdrObject> ConvertToContourObj(SdrObject* pRet, bool bForceLineDash = false) const;
759
private:
760
    rtl::Reference<SdrObject> ImpConvertToContourObj(bool bForceLineDash);
761
public:
762
763
    // if true, reference onto an object
764
524k
    bool IsVirtualObj() const { return m_bVirtObj;}
765
766
    // is true, if object can probably be filled
767
    // is false, if object has probably line ends
768
    // is invalid, if this is a group object
769
49.1k
    bool IsClosedObj() const { return m_bClosedObj;}
770
771
    // tdf#118662 reorganize inserted state, no local bool needed anymore,
772
    // it depends on being a member of a SdrObjList
773
    void InsertedStateChange();
774
2.01M
    bool IsInserted() const { return nullptr != getParentSdrObjListFromSdrObject(); }
775
776
5.56k
    bool IsEdgeObj() const { return m_bIsEdge;}
777
89
    bool Is3DObj() const { return m_bIs3DObj;}
778
46.2k
    bool IsUnoObj() const { return m_bIsUnoObj;}
779
    void SetMoveProtect(bool bProt);
780
43.4k
    bool IsMoveProtect() const { return m_bMovProt;}
781
    void SetResizeProtect(bool bProt);
782
379k
    bool IsDeleteProtect() const { return m_bDelProt; }
783
    void SetDeleteProtect(bool bProt);
784
230k
    bool IsResizeProtect() const { return m_bSizProt;}
785
    virtual void SetPrintable(bool isPrintable);
786
    virtual bool IsPrintable() const;
787
    virtual void SetVisible(bool isVisible);
788
    virtual bool IsVisible() const;
789
    void SetMarkProtect(bool bProt);
790
72
    bool IsMarkProtect() const { return m_bMarkProt;}
791
2.07M
    virtual bool IsSdrTextObj() const { return false; }
792
0
    virtual bool IsSdrOle2Obj() const { return false; }
793
0
    virtual bool IsTextPath() const { return false ; }
794
866k
    virtual bool IsSwVirtFlyDrawObj() const { return false ; }
795
796
    /// Whether the aspect ratio should be kept by default when resizing.
797
13
    virtual bool shouldKeepAspectRatio() const { return false; }
798
799
    // application specific data
800
    sal_uInt16 GetUserDataCount() const;
801
    SdrObjUserData* GetUserData(sal_uInt16 nNum) const;
802
803
    void AppendUserData(std::unique_ptr<SdrObjUserData> pData);
804
805
    // removes the record from the list and performs delete (FreeMem+Dtor).
806
    void DeleteUserData(sal_uInt16 nNum);
807
808
    // access to the UNO representation of the shape
809
    virtual css::uno::Reference< css::drawing::XShape > getUnoShape();
810
811
    static SdrObject* getSdrObjectFromXShape( const css::uno::Reference< css::uno::XInterface >& xInt );
812
813
    // notifies a change in the given property, to all applicable listeners registered at the associated SvxShape
814
    //
815
    // This method is equivalent to calling getShapePropertyChangeNotifier().notifyPropertyChange( _eProperty ),
816
    // exception that it is allowed to be called when there does not yet exist an associated SvxShape - in which
817
    // case the method will silently return without doing anything.
818
    void notifyShapePropertyChange( const OUString& rPropName ) const;
819
820
    // transformation interface for StarOfficeAPI. This implements support for
821
    // homogen 3x3 matrices containing the transformation of the SdrObject. At the
822
    // moment it contains a shearX, rotation and translation, but for setting all linear
823
    // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
824
    //
825
    // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
826
    // with the base geometry and returns TRUE. Otherwise it returns FALSE.
827
    virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
828
829
    // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
830
    // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
831
    // to use (0,0) as upper left and will be scaled to the given size in the matrix.
832
    virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
833
834
    // give info if object is in destruction
835
    bool IsInDestruction() const;
836
837
    // return if fill is != XFILL_NONE
838
    bool HasFillStyle() const;
839
    bool HasLineStyle() const;
840
841
    // on import of OLE object from MS documents the BLIP size might be retrieved,
842
    // the following methods are used to control it;
843
    // usually this data makes no sense after the import is finished, since the object
844
    // might be resized
845
0
    const tools::Rectangle& GetBLIPSizeRectangle() const { return maBLIPSizeRectangle;}
846
    void SetBLIPSizeRectangle( const tools::Rectangle& aRect );
847
848
    // #i121917#
849
    virtual bool HasText() const;
850
851
    bool Equals(const SdrObject&) const;
852
853
    virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
854
855
    /// Is this a textbox of a drawinglayer shape?
856
    virtual bool IsTextBox() const;
857
858
    void SetEmptyPresObj(bool bEpt);
859
726k
    bool IsEmptyPresObj() const { return m_bEmptyPresObj;}
860
    void SetCustomPromptText(const OUString& aVal);
861
455k
    const OUString & GetCustomPromptText() const { return m_aCustomPromptText; }
862
    void SetNotVisibleAsMaster(bool bFlg);
863
0
    bool IsNotVisibleAsMaster() const { return m_bNotVisibleAsMaster;}
864
    void SetUserCall(SdrObjUserCall* pUser);
865
5.32M
    SdrObjUserCall* GetUserCall() const { return m_pUserCall;}
866
    /// @see mbDoNotInsertIntoPageAutomatically
867
    void SetDoNotInsertIntoPageAutomatically(bool bSet);
868
    /// @see mbDoNotInsertIntoPageAutomatically
869
30.0k
    bool IsDoNotInsertIntoPageAutomatically() const { return mbDoNotInsertIntoPageAutomatically;}
870
871
    // Warning: this method should only be used if you really know what you're doing
872
44.6k
    sal_uInt32 GetOrdNumDirect() const { return m_nOrdNum;}
873
874
    // #i25616#
875
616k
    bool DoesSupportTextIndentingOnLineWidthChange() const { return mbSupportTextIndentingOnLineWidthChange;}
876
877
    const Point& GetAnchorPos() const;
878
879
    // #i25616#
880
5.02k
    bool LineIsOutsideGeometry() const { return mbLineIsOutsideGeometry;}
881
882
    // Set the position in the navigation position to the given value.
883
    // This method is typically used only by the model after a change to
884
    // the navigation order.
885
    // This method does not change the navigation position of other
886
    // objects.
887
    // Use SdrObjList::SetObjectNavigationPosition() instead.
888
    void SetNavigationPosition (const sal_uInt32 nPosition);
889
890
    /// Sets a new UNO representation of the shape
891
    ///
892
    /// Calling this function is only allowed for the UNO representation
893
    /// itself!
894
    ///
895
    /// The default implementation of this function sets the new UNO
896
    /// shape. Derived classes should override the function to handle
897
    /// any other actions that are needed when the shape is being
898
    /// changed.
899
    ///
900
    /// The implementation _must_ call the same method of its parent
901
    /// class (preferably as the first step)!
902
    virtual void setUnoShape( const css::uno::Reference< css::drawing::XShape >& _rxUnoShape );
903
904
1.33M
    const css::uno::WeakReference< css::drawing::XShape >& getWeakUnoShape() const { return maWeakUnoShape; }
905
906
    // return true if a bg was set, false otherwise
907
    bool setSuitableOutlinerBg(Outliner& rOutliner) const;
908
    // If fillstyle is drawing::FillStyle_BITMAP, returns the graphic.
909
    const Graphic* getFillGraphic() const;
910
911
2.19k
    const OUString& getHyperlink() const { return msHyperlink; }
912
12
    void setHyperlink(const OUString& sHyperlink) { msHyperlink = sHyperlink; }
913
914
    void ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept;
915
916
protected:
917
    const tools::Rectangle& getOutRectangle() const;
918
    void setOutRectangleConst(tools::Rectangle const& rRectangle) const; // need to do something about this
919
    void setOutRectangle(tools::Rectangle const& rRectangle);
920
    void resetOutRectangle();
921
    void moveOutRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta);
922
923
    mutable tools::Rectangle m_aOutRect;     // surrounding rectangle for Paint (incl. LineWidth, ...)
924
    Point                       m_aAnchor;      // anchor position (Writer)
925
    SdrObjUserCall*             m_pUserCall;
926
    std::unique_ptr<SdrObjPlusData>
927
                                m_pPlusData;    // Broadcaster, UserData, connectors, ... (this is the Bitsack)
928
    // object is only pointing to another one
929
    bool                        m_bVirtObj : 1;
930
    bool                        m_bSnapRectDirty : 1;
931
    // the following flags will be streamed
932
    bool                        m_bMovProt : 1;   // if true, the position is protected
933
    bool                        m_bSizProt : 1;   // if true, the size is protected
934
    bool                        m_bDelProt : 1;   // if true, object cannot be deleted
935
    // If bEmptyPresObj is true, it is a presentation object that has no content yet.
936
    // The flag's default value is false.
937
    // The management is done by the application.
938
    // Neither assign operator nor cloning copies the flag!
939
    // The flag is persistent.
940
    bool                        m_bEmptyPresObj : 1; // empty presentation object (Draw)
941
    // if true, object is invisible as object of the MasterPage
942
    bool                        m_bNotVisibleAsMaster : 1;
943
    // if true, the object is closed, i.e. no line, arc...
944
    bool                        m_bClosedObj : 1;
945
    bool                        m_bIsEdge : 1;
946
    bool                        m_bIs3DObj : 1;
947
    bool                        m_bIsUnoObj : 1;
948
    // #i25616#
949
    bool                        mbLineIsOutsideGeometry : 1;
950
    // #i25616#
951
    bool                        mbSupportTextIndentingOnLineWidthChange : 1;
952
953
    bool                        m_bHorizontalRule = false;
954
955
    // custom prompt text for empty presentation object
956
    OUString                    m_aCustomPromptText;
957
958
    std::unique_ptr<sdr::annotation::ObjectAnnotationData> mpAnnotationData;
959
960
    virtual ~SdrObject() override;
961
962
    virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() = 0;
963
964
    virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact();
965
966
    static void ImpCommonDragCalcRect(const SdrDragStat& rDrag, tools::Rectangle& rTmpRect, const Point& rPos);
967
    tools::Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const;
968
969
    // for GetDragComment
970
    OUString ImpGetDescriptionStr(TranslateId pStrCacheID) const;
971
972
    void ImpForcePlusData();
973
974
    OUString GetMetrStr(tools::Long nVal) const;
975
976
    /// A derived class must override these 3 methods if it has own geometric
977
    /// data that must be saved for Undo.
978
    /// NewGeoData() creates an empty instance of a class derived from
979
    /// SdrObjGeoData.
980
    virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const;
981
    virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
982
    virtual void RestoreGeoData(const SdrObjGeoData& rGeo);
983
984
    // internal versions
985
    const SfxItemSet& GetObjectItemSet() const;
986
    void SetObjectItem(const SfxPoolItem& rItem);
987
    void SetObjectItemSet(const SfxItemSet& rSet);
988
    const SfxPoolItem& GetObjectItem(const sal_uInt16 nWhich) const;
989
    template<class T> const T& GetObjectItem( TypedWhichId<T> nWhich ) const
990
651k
    {
991
651k
        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
992
651k
    }
SdrEdgeKindItem const& SdrObject::GetObjectItem<SdrEdgeKindItem>(TypedWhichId<SdrEdgeKindItem>) const
Line
Count
Source
990
73.7k
    {
991
73.7k
        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
992
73.7k
    }
SdrOnOffItem const& SdrObject::GetObjectItem<SdrOnOffItem>(TypedWhichId<SdrOnOffItem>) const
Line
Count
Source
990
421k
    {
991
421k
        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
992
421k
    }
XLineStyleItem const& SdrObject::GetObjectItem<XLineStyleItem>(TypedWhichId<XLineStyleItem>) const
Line
Count
Source
990
7.60k
    {
991
7.60k
        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
992
7.60k
    }
XLineWidthItem const& SdrObject::GetObjectItem<XLineWidthItem>(TypedWhichId<XLineWidthItem>) const
Line
Count
Source
990
175
    {
991
175
        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
992
175
    }
XFillStyleItem const& SdrObject::GetObjectItem<XFillStyleItem>(TypedWhichId<XFillStyleItem>) const
Line
Count
Source
990
1.97k
    {
991
1.97k
        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
992
1.97k
    }
Unexecuted instantiation: SdrGrafTransparenceItem const& SdrObject::GetObjectItem<SdrGrafTransparenceItem>(TypedWhichId<SdrGrafTransparenceItem>) const
SdrTextFitToSizeTypeItem const& SdrObject::GetObjectItem<SdrTextFitToSizeTypeItem>(TypedWhichId<SdrTextFitToSizeTypeItem>) const
Line
Count
Source
990
144k
    {
991
144k
        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
992
144k
    }
SvxWritingModeItem const& SdrObject::GetObjectItem<SvxWritingModeItem>(TypedWhichId<SvxWritingModeItem>) const
Line
Count
Source
990
2.37k
    {
991
2.37k
        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
992
2.37k
    }
993
994
    const SfxItemSet* getBackgroundFillSet() const;
995
996
    // @param bAdjustTextFrameWidthAndHeight pass false if you know it is safe to avoid the cost of doing
997
    //              text layout right now.
998
    virtual void InternalSetStyleSheet(SfxStyleSheet* pNewStyleSheet,
999
                    bool bDontRemoveHardAttr, bool bBroadcast, bool bAdjustTextFrameWidthAndHeight = true);
1000
1001
private:
1002
    struct Impl;
1003
    std::unique_ptr<Impl>             mpImpl;
1004
    SdrObjList*                       mpParentOfSdrObject;     // list that includes this object
1005
    sal_uInt32                        m_nOrdNum;      // order number of the object in the list
1006
    class UniqueID                          maUniqueID;
1007
    std::unique_ptr<SfxGrabBagItem>   m_pGrabBagItem; // holds the GrabBagItem property
1008
    // Position in the navigation order. SAL_MAX_UINT32 when not used.
1009
    sal_uInt32                        mnNavigationPosition;
1010
    SdrLayerID                        mnLayerID;
1011
    bool                              m_bNoPrint : 1;   // if true, the object is not printed.
1012
    bool                              mbVisible : 1;  // if false, the object is not visible on screen (but maybe on printer, depending on bNoprint
1013
    bool                              m_bMarkProt : 1;  // marking forbidden, persistent
1014
    // on import of OLE object from MS documents the BLIP size might be retrieved,
1015
    // in this case the following member is initialized as nonempty rectangle
1016
    tools::Rectangle                         maBLIPSizeRectangle;
1017
    std::unique_ptr<sdr::properties::BaseProperties>
1018
                                      mpProperties;
1019
    std::unique_ptr<sdr::contact::ViewContact>
1020
                                      mpViewContact;
1021
1022
    // do not use directly, always use getSvxShape() if you have to, because not all
1023
    // SdrObjects have an associated SvxShape subclass (e.g. reportdesign)
1024
    SvxShape*                   mpSvxShape;
1025
    css::uno::WeakReference< css::drawing::XShape >
1026
                                maWeakUnoShape;
1027
1028
    // HACK: Do not automatically insert newly created object into a page.
1029
    // The user needs to do it manually later.
1030
    bool                        mbDoNotInsertIntoPageAutomatically;
1031
1032
    // Hyperlink for the whole shape
1033
    OUString msHyperlink;
1034
1035
    // only for internal use!
1036
    SvxShape* getSvxShape();
1037
1038
    SdrObject( const SdrObject& ) = delete;
1039
};
1040
1041
SVXCORE_DLLPUBLIC E3dScene* DynCastE3dScene(SdrObject*);
1042
0
inline const E3dScene* DynCastE3dScene(const SdrObject* p) { return DynCastE3dScene(const_cast<SdrObject*>(p)); }
1043
SVXCORE_DLLPUBLIC E3dObject* DynCastE3dObject(SdrObject*);
1044
412
inline const E3dObject* DynCastE3dObject(const SdrObject* p) { return DynCastE3dObject(const_cast<SdrObject*>(p)); }
1045
SVXCORE_DLLPUBLIC SdrTextObj* DynCastSdrTextObj(SdrObject*);
1046
0
inline const SdrTextObj* DynCastSdrTextObj(const SdrObject* p) { return DynCastSdrTextObj(const_cast<SdrObject*>(p)); }
1047
SVXCORE_DLLPUBLIC SdrOle2Obj* DynCastSdrOle2Obj(SdrObject*);
1048
0
inline const SdrOle2Obj* DynCastSdrOle2Obj(const SdrObject* p) { return DynCastSdrOle2Obj(const_cast<SdrObject*>(p)); }
1049
1050
1051
struct SdrObjCreatorParams
1052
{
1053
    SdrInventor nInventor;
1054
    SdrObjKind nObjIdentifier;
1055
    SdrModel&   rSdrModel;
1056
};
1057
1058
/**
1059
 * Whoever creates his own objects must set a link in the SdrObjFactory class.
1060
 * The handler must have the following signature:
1061
 *      void Hdl(SdrObjFactory*)
1062
 * He must take a look at the referenced instance's nInventor and nIdentifier values,
1063
 * and must create a new drawing object instance accordingly.
1064
 * He must also make the pNewObj pointer reference to this instance.
1065
 */
1066
class SVXCORE_DLLPUBLIC SdrObjFactory
1067
{
1068
public:
1069
    static rtl::Reference<SdrObject> MakeNewObject(
1070
        SdrModel& rSdrModel,
1071
        SdrInventor nInventor,
1072
        SdrObjKind nObjIdentifier,
1073
        const tools::Rectangle* pSnapRect = nullptr);
1074
1075
    static void InsertMakeObjectHdl(Link<SdrObjCreatorParams, rtl::Reference<SdrObject>> const & rLink);
1076
    static void RemoveMakeObjectHdl(Link<SdrObjCreatorParams, rtl::Reference<SdrObject>> const & rLink);
1077
1078
private:
1079
    static SVX_DLLPRIVATE rtl::Reference<SdrObject> CreateObjectFromFactory(
1080
        SdrModel& rSdrModel,
1081
        SdrInventor nInventor,
1082
        SdrObjKind nIdentifier);
1083
1084
    SdrObjFactory() = delete;
1085
};
1086
1087
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */