Coverage Report

Created: 2026-08-14 10:22

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
3.42M
    SdrInventor GetInventor() const { return m_nInventor;}
154
2.97M
    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 a 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
    // OperationSmiley: Allow at each SdrObject to set a FillGeometryDefiningShape,
258
    // so that for SdrObjects where this is set, the definition of a defined FillStyle
259
    // will use this, but the local geometry will be filled. This allows to fill
260
    // multiple shapes with a unified fill, e.g think about CustomShapes.
261
    // Currently this is *only* used for CustomShapes, but may be developed to get a
262
    // common mechanism - usages for it are easy to be found. The current limitation
263
    // to CustomShapes allows to think about these SdrObjects to 'vanish' during the
264
    // lifetime of 'this' - the SdrObjects without SdrPage and SdrModel are used as helper
265
    // objects for SdrObjCustomShape and thus their lifetime is limited to the lifetime
266
    // of this local object. For unifying this mechanism, some weak reference of
267
    // SdrObjects would have to be thought about (not easy with the current implementation).
268
    // So - allow *only* EnhancedCustomShape2d (which creates the visualizations for
269
    // SdrObjCustomShape) to set this. Already allow unified read to use it - thus already
270
    // allowing to implement as standard case for all kinds of SdrObjects.
271
    friend class EnhancedCustomShape2d;
272
    const SdrObject*            mpFillGeometryDefiningShape;
273
15.0k
    void setFillGeometryDefiningShape(const SdrObject* pNew) { mpFillGeometryDefiningShape = pNew; }
274
public:
275
58
    const SdrObject* getFillGeometryDefiningShape() const { return mpFillGeometryDefiningShape; }
276
277
private:
278
    // the SdrModel this objects was created with, unchanged during SdrObject lifetime
279
    SdrModel&                   mrSdrModelFromSdrObject;
280
281
public:
282
    // A SdrObject always needs a SdrModel for lifetime (Pool, ...)
283
    SdrObject(SdrModel& rSdrModel);
284
    // Copy constructor
285
    SdrObject(SdrModel& rSdrModel, SdrObject const & rSource);
286
287
    virtual void SAL_CALL acquire() noexcept override final;
288
    virtual void SAL_CALL release() noexcept override final;
289
290
0
    sal_uInt64 GetUniqueID() const { return maUniqueID.getID(); }
291
292
    // SdrModel/SdrPage access on SdrObject level
293
    SdrPage* getSdrPageFromSdrObject() const;
294
    SdrModel& getSdrModelFromSdrObject() const;
295
296
    // access to possible children (SdrObjGroup/E3dScene)
297
    virtual SdrObjList* getChildrenOfSdrObject() const;
298
299
    // access to parent
300
    SdrObjList* getParentSdrObjListFromSdrObject() const;
301
    SdrObject* getParentSdrObjectFromSdrObject() const;
302
303
private:
304
    SVX_DLLPRIVATE void setParentOfSdrObject(SdrObjList* pNew);
305
306
public:
307
    // react on model/page change
308
    virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage);
309
310
    void AddObjectUser(sdr::ObjectUser& rNewUser);
311
    void RemoveObjectUser(sdr::ObjectUser& rOldUser);
312
313
    sdr::contact::ViewContact& GetViewContact() const;
314
315
    virtual sdr::properties::BaseProperties& GetProperties() const;
316
317
    // DrawContact support: Methods for handling Object changes
318
    void ActionChanged() const;
319
320
    static SdrItemPool& GetGlobalDrawObjectItemPool();
321
    void SetRelativeWidth( double nValue );
322
    void SetRelativeWidthRelation( sal_Int16 eValue );
323
    void SetRelativeHeight( double nValue );
324
    void SetRelativeHeightRelation( sal_Int16 eValue );
325
    const double* GetRelativeWidth() const;
326
    sal_Int16 GetRelativeWidthRelation() const;
327
    const double* GetRelativeHeight() const;
328
    sal_Int16 GetRelativeHeightRelation() const;
329
330
    /// @param bNotMyself = true: set only ObjList to dirty, don't mark this object as dirty.
331
    ///
332
    /// This is needed for instance for NbcMove, because usually one moves SnapRect and aOutRect
333
    /// at the same time to avoid recomputation.
334
    virtual void SetBoundAndSnapRectsDirty(bool bNotMyself = false, bool bRecursive = true);
335
336
    // this method is only for access from Property objects
337
    virtual void SetBoundRectDirty();
338
339
    SfxItemPool & GetObjectItemPool() const;
340
341
    void AddListener(SfxListener& rListener);
342
    void RemoveListener(SfxListener& rListener);
343
344
    void AddReference(SdrVirtObj& rVrtObj);
345
    void DelReference(SdrVirtObj& rVrtObj);
346
    virtual SdrInventor GetObjInventor() const;
347
    virtual SdrObjKind GetObjIdentifier() const;
348
    virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
349
350
    // Layer interface
351
    virtual SdrLayerID GetLayer() const;
352
    virtual void NbcSetLayer(SdrLayerID nLayer);
353
    virtual void SetLayer(SdrLayerID nLayer);
354
    bool isVisibleOnAnyOfTheseLayers(const SdrLayerIDSet& rSet) const;
355
356
    void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle& rBoundRect) const;
357
358
    // #i68101#
359
    // An object may have a user-set Name (Get/SetName()), e.g SdrGrafObj, SdrObjGroup
360
    // or SdrOle2Obj.
361
    // It may also have a Title and a Description for accessibility purposes.
362
    virtual void SetName(const OUString& rStr, const bool bSetChanged = true);
363
    virtual const OUString & GetName() const;
364
    void MakeNameUnique();
365
    void MakeNameUnique(std::unordered_set<OUString>& rNameSet);
366
    virtual void SetTitle(const OUString& rStr);
367
    virtual OUString GetTitle() const;
368
    virtual void SetDescription(const OUString& rStr);
369
    virtual OUString GetDescription() const;
370
    virtual void SetDecorative(bool isDecorative);
371
    virtual bool IsDecorative() const;
372
373
    // Object representing an annotation
374
132k
    bool isAnnotationObject() const { return bool(mpAnnotationData); }
375
    void setAsAnnotationObject();
376
    std::unique_ptr<sdr::annotation::ObjectAnnotationData>& getAnnotationData();
377
378
    // for group objects
379
    bool IsGroupObject() const;
380
    virtual SdrObjList* GetSubList() const;
381
382
    /// The order number (aka ZOrder, aka z-index) determines whether a
383
    /// SdrObject is located above or below another.  Objects are painted from
384
    /// lowest to highest order number.  If the order of SdrObjects in the
385
    /// SdrObjList is changed, the bObjOrdNumsDirty flag is set on the SdrPage
386
    /// and the next GetOrdNum() call recalculates the order number of all
387
    /// SdrObjects in the SdrObjList.
388
    sal_uInt32 GetOrdNum() const;
389
390
    /// Ensure this object is sorted immediately after rFirst
391
    /// ie. rFirst.GetOrdNum() + 1 == this->GetOrdNum()
392
    void ensureSortedImmediatelyAfter(const SdrObject& rFirst);
393
394
    // setting the order number should only happen from the model or from the page
395
    void SetOrdNum(sal_uInt32 nNum);
396
397
    // GrabBagItem for interim interop purposes
398
    void GetGrabBagItem(css::uno::Any& rVal) const;
399
400
    void SetGrabBagItem(const css::uno::Any& rVal);
401
402
    // Return the position in the navigation order for the called object.
403
    // Note that this method may update the navigation position of the
404
    // called and of other SdrObjects.  Therefore this method can not be
405
    // const.
406
    // @return
407
    //     If no navigation position has been explicitly defined then the
408
    //     result of GetOrdNum() is returned.
409
    sal_uInt32 GetNavigationPosition() const;
410
411
    // To make clearer that this method may trigger RecalcBoundRect and thus may be
412
    // expensive and sometimes problematic (inside a bigger object change You will get
413
    // non-useful BoundRects sometimes) i rename that method from GetBoundRect() to
414
    // GetCurrentBoundRect().
415
    virtual const tools::Rectangle& GetCurrentBoundRect() const;
416
417
    // To have a possibility to get the last calculated BoundRect e.g for producing
418
    // the first rectangle for repaints (old and new need to be used) without forcing
419
    // a RecalcBoundRect (which may be problematical and expensive sometimes) i add here
420
    // a new method for accessing the last BoundRect.
421
    virtual const tools::Rectangle& GetLastBoundRect() const;
422
423
    virtual void RecalcBoundRect();
424
425
    void BroadcastObjectChange() const;
426
427
    SfxBroadcaster* GetBroadcaster() const;
428
429
    // set modified-flag in the model
430
    virtual void SetChanged();
431
432
    // Tooling for painting a single object to an OutputDevice. This will be needed as long
433
    // as not all painting is changed to use DrawContact objects.
434
    void SingleObjectPainter(OutputDevice& rOut) const;
435
    bool LineGeometryUsageIsNecessary() const;
436
437
    // RotGrfFlyFrame: If true, this SdrObject supports only limited rotation, that
438
    // means no change of the rotation point (only centered) and no shear allowed
439
    virtual bool HasLimitedRotation() const;
440
441
    // Returns a copy of the object. Every inherited class must reimplement this.
442
    virtual rtl::Reference<SdrObject> CloneSdrObject(SdrModel& rTargetModel) const = 0;
443
    // helper, since Clone always return the type of the current subclass
444
    template<class T>
445
    static rtl::Reference<T> Clone(T const & rObj, SdrModel& rTargetModel)
446
0
    {
447
0
        rtl::Reference<SdrObject> newObj = rObj.CloneSdrObject(rTargetModel);
448
0
        return static_cast<T*>(newObj.get());
449
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&)
450
451
    // Overwriting this object makes no sense, it is too complicated for that
452
    SdrObject& operator=(const SdrObject& rObj) = delete;
453
    SdrObject& operator=(SdrObject&& rObj) = delete;
454
455
    // TakeObjName...() is for the display in the UI, e.g. "3 frames selected"
456
    virtual OUString TakeObjNameSingul() const;
457
    virtual OUString TakeObjNamePlural() const;
458
459
    /// The Xor-Polygon is required by the View to drag the object.
460
    /// All polygons within the PolyPolygon are interpreted as PolyLine.
461
    /// To get a closed Polygon, close it explicitly.
462
    virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
463
464
    /// contour for TextToContour
465
    virtual basegfx::B2DPolyPolygon TakeContour() const;
466
467
    /// Via GetHdlCount the number of Handles can be retrieved.
468
    /// Normally 8, if it's a line 2.
469
    /// For Polygon objects (Polygon/Spline/Bezier) the number may be much
470
    /// larger.  Polygon objects are also allowed to select a point of a
471
    /// selected object.  The handle of that point will then be replaced by
472
    /// a new set of handles (PlusHdl).  For a Polygon this would be a simple
473
    /// selection Handle, for a Bezier curve this may be up to 3 Handles
474
    /// (including Weights).
475
    /// GetHdl() and GetPlusHdl() must create Handle instances with new!
476
    /// An object that returns true from HasSpacialDrag() must provide these
477
    /// methods (incl. FillHdlList()).
478
    virtual sal_uInt32 GetHdlCount() const;
479
    virtual void AddToPlusHdlList(SdrHdlList& rHdlList, SdrHdl& rHdl) const;
480
    virtual void AddToHdlList(SdrHdlList& rHdlList) const;
481
    virtual void addCropHandles(SdrHdlList& rTarget) const;
482
483
    /// The standard transformations (Move,Resize,Rotate,Mirror,Shear) are
484
    /// taken over by the View (TakeXorPoly(),...).
485
    /// Object type specific dragging like corner radius of Rectangle,
486
    /// control points of Splines, weights of Bezier curves, pointer of
487
    /// Label objects must be handled by the object itself.
488
    /// To keep the Model free of state, the state is kept in the View
489
    /// and then passed to the object. EndDrag usually returns true for success,
490
    /// false may be returned if the dragging did not modify the object,
491
    /// where the View already handles the case that the pointer was not
492
    /// moved at all.
493
    virtual bool hasSpecialDrag() const;
494
    virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
495
    virtual bool applySpecialDrag(SdrDragStat& rDrag);
496
    virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const;
497
    virtual basegfx::B2DPolyPolygon getSpecialDragPoly(const SdrDragStat& rDrag) const;
498
499
    // FullDrag support. This is for standard interactions and for SdrObjOwn
500
    // support. If supportsFullDrag() returns true, getFullDragClone has to
501
    // return a cloned SdrObject (who's ownership it loses) at which modifications
502
    // like Move(), Scale(), etc or applySpecialDrag() will be executed. That
503
    // object will be visualized on overlay for full drag, but should not be
504
    // part of the model, thus not changing anything since it's only a temporary
505
    // helper object for interaction
506
    virtual bool supportsFullDrag() const;
507
    virtual rtl::Reference<SdrObject> getFullDragClone() const;
508
509
    /// Every object must be able to create itself interactively.
510
    /// On MouseDown first an object is created, and its BegCreate() method
511
    /// is called.  On every MouseMove, MovCreate() is called.  BrkCreate()
512
    /// is called if the user cancels the interactive object creation.
513
    /// EndCreate() is called on the MouseUp event.  If EndCreate() returns
514
    /// true, the creation is finished; the object is inserted into the
515
    /// corresponding list.  Otherwise it is assumed that further points
516
    /// are necessary to create the object (Polygon, ...).  The parameter
517
    /// eCmd contains the number of mouse clicks (if the application
518
    /// provides it).
519
    /// BckCreate() will undo the previous EndCreate(), e.g. to delete the
520
    /// last point of the Polygon.  If BckCreate() returns false, creation
521
    /// is cancelled.
522
    virtual bool BegCreate(SdrDragStat& rStat);
523
    virtual bool MovCreate(SdrDragStat& rStat); // if true, Xor needs to be repainted
524
    virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
525
    virtual bool BckCreate(SdrDragStat& rStat);
526
    virtual void BrkCreate(SdrDragStat& rStat);
527
528
    /// get the cursor/pointer that signals creating this object
529
    virtual PointerStyle GetCreatePointer() const;
530
531
    /// Polygon dragged by the user when creating the object
532
    virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
533
534
    /// The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and
535
    /// SetLogicRect call the corresponding Nbc-methods, send a Repaint
536
    /// broadcast and set the Modified state on the Model.
537
    /// Derived classes should usually only override the Nbc methods.
538
    /// Nbc means "no broadcast".
539
    virtual void NbcMove  (const Size& rSiz);
540
    virtual void NbcResize(const Point& rRef, double xFact, double yFact);
541
    virtual bool IsSizeValid(Size aTargetSize);
542
    virtual void NbcCrop  (const basegfx::B2DPoint& rRef, double fxFact, double fyFact);
543
    virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) = 0;
544
    // Utility for call sites that don't have sin and cos handy
545
    void NbcRotate(const Point& rRef, Degree100 nAngle);
546
    virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
547
    virtual void NbcShear (const Point& rRef, Degree100 nAngle, double tn, bool bVShear);
548
549
    virtual void Move  (const Size& rSiz);
550
    virtual void Resize(const Point& rRef, double xFact, double yFact, bool bUnsetRelative = true);
551
    virtual void Crop  (const basegfx::B2DPoint& rRef, double fxFact, double fyFact);
552
    virtual void Rotate(const Point& rRef, Degree100 nAngle, double sn, double cs);
553
    virtual void Mirror(const Point& rRef1, const Point& rRef2);
554
    virtual void Shear (const Point& rRef, Degree100 nAngle, double tn, bool bVShear);
555
556
    /// The relative position of a SdrObject is the distance of the upper
557
    /// left corner of the logic bounding rectangle (SnapRect) to the anchor.
558
    virtual void NbcSetRelativePos(const Point& rPnt);
559
    virtual void SetRelativePos(const Point& rPnt);
560
    virtual Point GetRelativePos() const;
561
    void ImpSetAnchorPos(const Point& rPnt);
562
    virtual void NbcSetAnchorPos(const Point& rPnt);
563
    virtual void SetAnchorPos(const Point& rPnt);
564
565
    /// Snap is not done on the BoundRect but if possible on logic coordinates
566
    /// (i.e. without considering stroke width, ...)
567
    /// SetSnapRect() tries to size the Object so that it fits into the
568
    /// passed Rect (without stroke width, ...)
569
    virtual void RecalcSnapRect();
570
    virtual const tools::Rectangle& GetSnapRect() const;
571
    virtual void SetSnapRect(const tools::Rectangle& rRect);
572
    virtual void NbcSetSnapRect(const tools::Rectangle& rRect);
573
574
    // Logic Rect: for the Rect for instance without regard to rotation angle, shear, ...
575
    virtual const tools::Rectangle& GetLogicRect() const;
576
    virtual void SetLogicRect(const tools::Rectangle& rRect);
577
    // @param bAdaptTextMinSize pass false if you know it is safe to avoid the cost of doing
578
    //              text layout right now.
579
    virtual void NbcSetLogicRect(const tools::Rectangle& rRect, bool bAdaptTextMinSize = true);
580
581
    // the default is to set the logic rect to the given rectangle rMaxRect. If the shape
582
    // has an intrinsic aspect ratio it may set the logic rect so the aspect
583
    // ratio is kept but still inside the rectangle rMaxRect.
584
    // If bShrinkOnly is set to true, the size of the current logic rect will not
585
    // be changed if it is smaller than the given rectangle rMaxRect.
586
    virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false );
587
588
    // rotation and shear angle
589
    virtual Degree100 GetRotateAngle() const;
590
    virtual Degree100 GetShearAngle(bool bVertical = false) const;
591
592
    /// snap to special points of an Object (polygon points, center of circle)
593
    virtual sal_uInt32 GetSnapPointCount() const;
594
    virtual Point GetSnapPoint(sal_uInt32 i) const;
595
596
    // For objects, whose points can be moved individually.
597
    // (e.g. polygons, polylines, lines)
598
    // The points of those objects are selected (if necessary multiselection),
599
    // deleted, inserted, or as a multiselection moved or rotated...
600
    // Only such objects can have PlusHandles (e.g. the weights of a Bezier curve).
601
    virtual bool IsPolyObj() const;
602
    virtual sal_uInt32 GetPointCount() const;
603
    virtual Point GetPoint(sal_uInt32 i) const;
604
    void SetPoint(const Point& rPnt, sal_uInt32 i);
605
    virtual void NbcSetPoint(const Point& rPnt, sal_uInt32 i);
606
607
    // get all geometrical data for undo/redo
608
    virtual std::unique_ptr<SdrObjGeoData> GetGeoData() const;
609
    virtual void SetGeoData(const SdrObjGeoData& rGeo);
610
611
    // ItemSet access
612
    const SfxItemSet& GetMergedItemSet() const;
613
    void SetMergedItem(const SfxPoolItem& rItem);
614
    void ClearMergedItem(const sal_uInt16 nWhich = 0);
615
    // @param bAdjustTextFrameWidthAndHeight pass false if you know it is safe to avoid the cost of doing
616
    //              text layout right now.
617
    void SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems = false, bool bAdjustTextFrameWidthAndHeight = true);
618
    const SfxPoolItem& GetMergedItem(const sal_uInt16 nWhich) const;
619
    template<class T>
620
    const T&           GetMergedItem( TypedWhichId<T> nWhich ) const
621
2.85M
    {
622
2.85M
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
2.85M
    }
SdrCustomShapeGeometryItem const& SdrObject::GetMergedItem<SdrCustomShapeGeometryItem>(TypedWhichId<SdrCustomShapeGeometryItem>) const
Line
Count
Source
621
1.16M
    {
622
1.16M
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
1.16M
    }
XLineWidthItem const& SdrObject::GetMergedItem<XLineWidthItem>(TypedWhichId<XLineWidthItem>) const
Line
Count
Source
621
4.21k
    {
622
4.21k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
4.21k
    }
XLineColorItem const& SdrObject::GetMergedItem<XLineColorItem>(TypedWhichId<XLineColorItem>) const
Line
Count
Source
621
6.30k
    {
622
6.30k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
6.30k
    }
Unexecuted instantiation: SvxFontHeightItem const& SdrObject::GetMergedItem<SvxFontHeightItem>(TypedWhichId<SvxFontHeightItem>) const
Unexecuted instantiation: SfxBoolItem const& SdrObject::GetMergedItem<SfxBoolItem>(TypedWhichId<SfxBoolItem>) const
SdrTextFitToSizeTypeItem const& SdrObject::GetMergedItem<SdrTextFitToSizeTypeItem>(TypedWhichId<SdrTextFitToSizeTypeItem>) const
Line
Count
Source
621
15.5k
    {
622
15.5k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
15.5k
    }
SdrMetricItem const& SdrObject::GetMergedItem<SdrMetricItem>(TypedWhichId<SdrMetricItem>) const
Line
Count
Source
621
60.8k
    {
622
60.8k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
60.8k
    }
SdrTextVertAdjustItem const& SdrObject::GetMergedItem<SdrTextVertAdjustItem>(TypedWhichId<SdrTextVertAdjustItem>) const
Line
Count
Source
621
15.2k
    {
622
15.2k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
15.2k
    }
SdrTextHorzAdjustItem const& SdrObject::GetMergedItem<SdrTextHorzAdjustItem>(TypedWhichId<SdrTextHorzAdjustItem>) const
Line
Count
Source
621
15.2k
    {
622
15.2k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
15.2k
    }
SvxFrameDirectionItem const& SdrObject::GetMergedItem<SvxFrameDirectionItem>(TypedWhichId<SvxFrameDirectionItem>) const
Line
Count
Source
621
13.4k
    {
622
13.4k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
13.4k
    }
XFillStyleItem const& SdrObject::GetMergedItem<XFillStyleItem>(TypedWhichId<XFillStyleItem>) const
Line
Count
Source
621
621k
    {
622
621k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
621k
    }
XFillColorItem const& SdrObject::GetMergedItem<XFillColorItem>(TypedWhichId<XFillColorItem>) const
Line
Count
Source
621
6.09k
    {
622
6.09k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
6.09k
    }
XFillGradientItem const& SdrObject::GetMergedItem<XFillGradientItem>(TypedWhichId<XFillGradientItem>) const
Line
Count
Source
621
691
    {
622
691
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
691
    }
XFillBitmapItem const& SdrObject::GetMergedItem<XFillBitmapItem>(TypedWhichId<XFillBitmapItem>) const
Line
Count
Source
621
1.09k
    {
622
1.09k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
1.09k
    }
XFillBmpStretchItem const& SdrObject::GetMergedItem<XFillBmpStretchItem>(TypedWhichId<XFillBmpStretchItem>) const
Line
Count
Source
621
28
    {
622
28
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
28
    }
XFillBmpTileItem const& SdrObject::GetMergedItem<XFillBmpTileItem>(TypedWhichId<XFillBmpTileItem>) const
Line
Count
Source
621
1.09k
    {
622
1.09k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
1.09k
    }
XFillTransparenceItem const& SdrObject::GetMergedItem<XFillTransparenceItem>(TypedWhichId<XFillTransparenceItem>) const
Line
Count
Source
621
6.43k
    {
622
6.43k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
6.43k
    }
XLineStyleItem const& SdrObject::GetMergedItem<XLineStyleItem>(TypedWhichId<XLineStyleItem>) const
Line
Count
Source
621
586k
    {
622
586k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
586k
    }
Unexecuted instantiation: SdrGrafCropItem const& SdrObject::GetMergedItem<SdrGrafCropItem>(TypedWhichId<SdrGrafCropItem>) const
XLineEndItem const& SdrObject::GetMergedItem<XLineEndItem>(TypedWhichId<XLineEndItem>) const
Line
Count
Source
621
92
    {
622
92
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
92
    }
XLineEndWidthItem const& SdrObject::GetMergedItem<XLineEndWidthItem>(TypedWhichId<XLineEndWidthItem>) const
Line
Count
Source
621
92
    {
622
92
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
92
    }
XLineEndCenterItem const& SdrObject::GetMergedItem<XLineEndCenterItem>(TypedWhichId<XLineEndCenterItem>) const
Line
Count
Source
621
92
    {
622
92
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
92
    }
XLineStartItem const& SdrObject::GetMergedItem<XLineStartItem>(TypedWhichId<XLineStartItem>) const
Line
Count
Source
621
92
    {
622
92
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
92
    }
XLineStartWidthItem const& SdrObject::GetMergedItem<XLineStartWidthItem>(TypedWhichId<XLineStartWidthItem>) const
Line
Count
Source
621
92
    {
622
92
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
92
    }
XLineStartCenterItem const& SdrObject::GetMergedItem<XLineStartCenterItem>(TypedWhichId<XLineStartCenterItem>) const
Line
Count
Source
621
92
    {
622
92
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
92
    }
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
621
726
    {
622
726
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
726
    }
SdrTextFixedCellHeightItem const& SdrObject::GetMergedItem<SdrTextFixedCellHeightItem>(TypedWhichId<SdrTextFixedCellHeightItem>) const
Line
Count
Source
621
14.9k
    {
622
14.9k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
14.9k
    }
SfxStringItem const& SdrObject::GetMergedItem<SfxStringItem>(TypedWhichId<SfxStringItem>) const
Line
Count
Source
621
315k
    {
622
315k
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
315k
    }
SfxInt16Item const& SdrObject::GetMergedItem<SfxInt16Item>(TypedWhichId<SfxInt16Item>) const
Line
Count
Source
621
88
    {
622
88
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
88
    }
XSecondaryFillColorItem const& SdrObject::GetMergedItem<XSecondaryFillColorItem>(TypedWhichId<XSecondaryFillColorItem>) const
Line
Count
Source
621
650
    {
622
650
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
650
    }
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
621
2
    {
622
2
        return static_cast<const T&>(GetMergedItem(sal_uInt16(nWhich)));
623
2
    }
624
625
    // syntactical sugar for ItemSet accesses
626
    void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems = false);
627
628
    // NotPersistAttr for Layer, ObjName, geometrical transformations etc.
629
    void TakeNotPersistAttr(SfxItemSet& rAttr) const;
630
    void ApplyNotPersistAttr(const SfxItemSet& rAttr);
631
    void NbcApplyNotPersistAttr(const SfxItemSet& rAttr);
632
633
    // if bDontRemoveHardAttr is false, set all attributes, which were set in the style sheet, to their default value
634
    // if true, all hard attributes keep their values
635
    void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr);
636
    // @param bAdjustTextFrameWidthAndHeight pass false if you know it is safe to avoid the cost of doing
637
    //              text layout right now.
638
    void NbcSetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr, bool bAdjustTextFrameWidthAndHeight = true);
639
    SfxStyleSheet* GetStyleSheet() const;
640
641
    virtual bool HasTextEdit() const;
642
643
    // keep text in outliner's format
644
    // SetOutlinerParaObject: transfer ownership of *pTextObject!
645
    void SetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject);
646
    virtual void NbcSetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject, bool bAdjustTextFrameWidthAndHeight = true);
647
    virtual OutlinerParaObject* GetOutlinerParaObject() const;
648
    virtual void NbcReformatText();
649
650
    void BurnInStyleSheetAttributes();
651
652
    // macro abilities, e.g. a rectangle as PushButton.
653
    virtual bool HasMacro() const;
654
    virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const;
655
    virtual PointerStyle GetMacroPointer (const SdrObjMacroHitRec& rRec) const;
656
    virtual void PaintMacro (OutputDevice& rOut, const tools::Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const;
657
    virtual bool DoMacro (const SdrObjMacroHitRec& rRec);
658
    bool IsMacroHit(const SdrObjMacroHitRec& rRec) const;
659
660
    // Connectors
661
    // (see also documentation in SvdoEdge.hxx, SdrEdgeObj, as well as SvdGlue.hxx and SvdGlEV.hxx)
662
    //
663
    // There are nodes and edges. In theory an edge can also be a node, but this isn't implemented yet.
664
    // A node has a number of gluepoints, onto which edges can glued to
665
    // An edge can be either
666
    // - without any connection to any node,
667
    // - or connected on one end to a node, while the other end is not connected,
668
    // - or connected on both ends with exactly one node each.
669
    // The edge is listener for its up to two nodes.
670
    // Whenever a node is moved or resized, all its connected edges follow.
671
    // This is also true for SetGluePoint()... on the node.
672
    // On the other hand, moving/resizing an edge breaks the connection.
673
674
    // automatic gluepoints:
675
    // a node object must provide four vertex and corner positions
676
    // usually 0: top, 1: right, 2: bottom, 3: left
677
    virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const;
678
679
    // usually:
680
    // 0: top-left, 1: top-right, 2: bottom-right, 3: bottom-left
681
    virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const;
682
683
    // list of all gluepoints, can be NULL
684
    virtual const SdrGluePointList* GetGluePointList() const;
685
686
    // after changing the GluePointList, one has to call the object's SendRepaintBroadcast!
687
    virtual SdrGluePointList* ForceGluePointList();
688
689
    // to be set temporarily when transforming related object(?)
690
    void SetGlueReallyAbsolute(bool bOn);
691
    void NbcRotateGluePoints(const Point& rRef, Degree100 nAngle, double sn, double cs);
692
    void NbcMirrorGluePoints(const Point& rRef1, const Point& rRef2);
693
    void NbcShearGluePoints (const Point& rRef, double tn, bool bVShear);
694
695
    // if bTail1 is true, line start, otherwise line end
696
    // if pObj is null disconnect
697
    virtual void ConnectToNode(bool bTail1, SdrObject* pObj);
698
    virtual void DisconnectFromNode(bool bTail1);
699
    virtual SdrObject* GetConnectedNode(bool bTail1) const;
700
701
    // sets the writing mode of the object's context
702
    // Objects which itself do not support different writing modes will ignore this call.
703
    // Objects which support different writing modes, but have an own, explicit writing mode set,
704
    // will also ignore this call.
705
    // Objects which support different writing modes, and whose own mode is set to css.text.WritingMode2.CONTEXT,
706
    // will use the given writing mode to calculate their "effective writing mode".
707
    // The behaviour of this method is undefined if you pass css.text.WritingMode2.CONTEXT.
708
    // @param _nContextWritingMode
709
    //     the effective writing mode of the context of the object
710
    virtual void    SetContextWritingMode( const sal_Int16 _nContextWritingMode );
711
712
    // If an object is able to convert itself into a polygon or into a Bezier curve (or into both),
713
    // then the following methods should be overridden.
714
    // E.g., convert a RectObj with line width 10, SOLID_PEN into a polygon:
715
    // In the bLineToArea=false mode a PolyObj with four supporting points,
716
    // line width 10 and SOLID_PEN shall be created.
717
    // On the contrary in the bLineToArea=true mode the generated object should
718
    // still have a line attribute NULL_PEN, and the line (also line pattern)
719
    // itself should be emulated by the polygon area, which thereby can be
720
    // manipulated by the user afterwards.
721
    // The RectObj therefore can only convert correctly if it has an area attribute NULL_BRUSH.
722
    // In this case it would have to:
723
    // - set SOLID_BRUSH with the color of the given pen,
724
    // - set NULL_PEN, and
725
    // - generate tools::PolyPolygon with two polygons with four supporting points each.
726
    // In each case the return value is a SdrObject*, because it is also
727
    // allowed to return group objects (e.g. for SdrTextObj).
728
    // In the case of the conversion from TextObj to PathObj,
729
    // both modi (bLineToArea=true/false) would be identical.
730
    // The methods' default implementations report "I'm unable to do this" (false/null).
731
    virtual rtl::Reference<SdrObject> DoConvertToPolyObj(bool bBezier, bool bAddText) const;
732
    rtl::Reference<SdrObject> ConvertToPolyObj(bool bBezier, bool bLineToArea) const;
733
734
    // convert this path object to contour object; bForceLineDash converts even
735
    // when there is no filled new polygon created from line-to-polygon conversion,
736
    // specially used for XLINE_DASH and 3D conversion
737
    rtl::Reference<SdrObject> ConvertToContourObj(SdrObject* pRet, bool bForceLineDash = false) const;
738
private:
739
    rtl::Reference<SdrObject> ImpConvertToContourObj(bool bForceLineDash);
740
public:
741
742
    // if true, reference onto an object
743
504k
    bool IsVirtualObj() const { return m_bVirtObj;}
744
745
    // is true, if object can probably be filled
746
    // is false, if object has probably line ends
747
    // is invalid, if this is a group object
748
45.6k
    bool IsClosedObj() const { return m_bClosedObj;}
749
750
    // tdf#118662 reorganize inserted state, no local bool needed anymore,
751
    // it depends on being a member of a SdrObjList
752
    void InsertedStateChange();
753
2.18M
    bool IsInserted() const { return nullptr != getParentSdrObjListFromSdrObject(); }
754
755
6.40k
    bool IsEdgeObj() const { return m_bIsEdge;}
756
88
    bool Is3DObj() const { return m_bIs3DObj;}
757
47.7k
    bool IsUnoObj() const { return m_bIsUnoObj;}
758
    void SetMoveProtect(bool bProt);
759
39.8k
    bool IsMoveProtect() const { return m_bMovProt;}
760
    void SetResizeProtect(bool bProt);
761
369k
    bool IsDeleteProtect() const { return m_bDelProt; }
762
    void SetDeleteProtect(bool bProt);
763
45.4k
    bool IsResizeProtect() const { return m_bSizProt;}
764
    virtual void SetPrintable(bool isPrintable);
765
    virtual bool IsPrintable() const;
766
    virtual void SetVisible(bool isVisible);
767
    virtual bool IsVisible() const;
768
    void SetMarkProtect(bool bProt);
769
60
    bool IsMarkProtect() const { return m_bMarkProt;}
770
1.12M
    virtual bool IsSdrTextObj() const { return false; }
771
0
    virtual bool IsSdrOle2Obj() const { return false; }
772
0
    virtual bool IsTextPath() const { return false ; }
773
786k
    virtual bool IsSwVirtFlyDrawObj() const { return false ; }
774
775
    /// Whether the aspect ratio should be kept by default when resizing.
776
9
    virtual bool shouldKeepAspectRatio() const { return false; }
777
778
    // application specific data
779
    sal_uInt16 GetUserDataCount() const;
780
    SdrObjUserData* GetUserData(sal_uInt16 nNum) const;
781
782
    void AppendUserData(std::unique_ptr<SdrObjUserData> pData);
783
784
    // removes the record from the list and performs delete (FreeMem+Dtor).
785
    void DeleteUserData(sal_uInt16 nNum);
786
787
    // access to the UNO representation of the shape
788
    virtual css::uno::Reference< css::drawing::XShape > getUnoShape();
789
790
    static SdrObject* getSdrObjectFromXShape( const css::uno::Reference< css::uno::XInterface >& xInt );
791
792
    // notifies a change in the given property, to all applicable listeners registered at the associated SvxShape
793
    //
794
    // This method is equivalent to calling getShapePropertyChangeNotifier().notifyPropertyChange( _eProperty ),
795
    // exception that it is allowed to be called when there does not yet exist an associated SvxShape - in which
796
    // case the method will silently return without doing anything.
797
    void notifyShapePropertyChange( const OUString& rPropName ) const;
798
799
    // transformation interface for StarOfficeAPI. This implements support for
800
    // homogen 3x3 matrices containing the transformation of the SdrObject. At the
801
    // moment it contains a shearX, rotation and translation, but for setting all linear
802
    // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
803
    //
804
    // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
805
    // with the base geometry and returns TRUE. Otherwise it returns FALSE.
806
    virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const;
807
808
    // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
809
    // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
810
    // to use (0,0) as upper left and will be scaled to the given size in the matrix.
811
    virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
812
813
    // give info if object is in destruction
814
    bool IsInDestruction() const;
815
816
    // return if fill is != XFILL_NONE
817
    bool HasFillStyle() const;
818
    bool HasLineStyle() const;
819
820
    // on import of OLE object from MS documents the BLIP size might be retrieved,
821
    // the following methods are used to control it;
822
    // usually this data makes no sense after the import is finished, since the object
823
    // might be resized
824
0
    const tools::Rectangle& GetBLIPSizeRectangle() const { return maBLIPSizeRectangle;}
825
    void SetBLIPSizeRectangle( const tools::Rectangle& aRect );
826
827
    // #i121917#
828
    virtual bool HasText() const;
829
830
    bool Equals(const SdrObject&) const;
831
832
    virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
833
834
    /// Is this a textbox of a drawinglayer shape?
835
    virtual bool IsTextBox() const;
836
837
    void SetEmptyPresObj(bool bEpt);
838
298k
    bool IsEmptyPresObj() const { return m_bEmptyPresObj;}
839
    void SetCustomPromptText(const OUString& aVal);
840
46.0k
    const OUString & GetCustomPromptText() const { return m_aCustomPromptText; }
841
    void SetNotVisibleAsMaster(bool bFlg);
842
0
    bool IsNotVisibleAsMaster() const { return m_bNotVisibleAsMaster;}
843
    void SetUserCall(SdrObjUserCall* pUser);
844
4.08M
    SdrObjUserCall* GetUserCall() const { return m_pUserCall;}
845
    /// @see mbDoNotInsertIntoPageAutomatically
846
    void SetDoNotInsertIntoPageAutomatically(bool bSet);
847
    /// @see mbDoNotInsertIntoPageAutomatically
848
27.0k
    bool IsDoNotInsertIntoPageAutomatically() const { return mbDoNotInsertIntoPageAutomatically;}
849
850
    // Warning: this method should only be used if you really know what you're doing
851
3.04k
    sal_uInt32 GetOrdNumDirect() const { return m_nOrdNum;}
852
853
    // #i25616#
854
607k
    bool DoesSupportTextIndentingOnLineWidthChange() const { return mbSupportTextIndentingOnLineWidthChange;}
855
856
    const Point& GetAnchorPos() const;
857
858
    // #i25616#
859
4.54k
    bool LineIsOutsideGeometry() const { return mbLineIsOutsideGeometry;}
860
861
    // Set the position in the navigation position to the given value.
862
    // This method is typically used only by the model after a change to
863
    // the navigation order.
864
    // This method does not change the navigation position of other
865
    // objects.
866
    // Use SdrObjList::SetObjectNavigationPosition() instead.
867
    void SetNavigationPosition (const sal_uInt32 nPosition);
868
869
    /// Sets a new UNO representation of the shape
870
    ///
871
    /// Calling this function is only allowed for the UNO representation
872
    /// itself!
873
    ///
874
    /// The default implementation of this function sets the new UNO
875
    /// shape. Derived classes should override the function to handle
876
    /// any other actions that are needed when the shape is being
877
    /// changed.
878
    ///
879
    /// The implementation _must_ call the same method of its parent
880
    /// class (preferably as the first step)!
881
    virtual void setUnoShape( const css::uno::Reference< css::drawing::XShape >& _rxUnoShape );
882
883
766k
    const css::uno::WeakReference< css::drawing::XShape >& getWeakUnoShape() const { return maWeakUnoShape; }
884
885
    // return true if a bg was set, false otherwise
886
    bool setSuitableOutlinerBg(Outliner& rOutliner) const;
887
    // If fillstyle is drawing::FillStyle_BITMAP, returns the graphic.
888
    const Graphic* getFillGraphic() const;
889
890
2.01k
    const OUString& getHyperlink() const { return msHyperlink; }
891
8
    void setHyperlink(const OUString& sHyperlink) { msHyperlink = sHyperlink; }
892
893
    void ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const noexcept;
894
895
protected:
896
    const tools::Rectangle& getOutRectangle() const;
897
    void setOutRectangleConst(tools::Rectangle const& rRectangle) const; // need to do something about this
898
    void setOutRectangle(tools::Rectangle const& rRectangle);
899
    void resetOutRectangle();
900
    void moveOutRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta);
901
902
    mutable tools::Rectangle m_aOutRect;     // surrounding rectangle for Paint (incl. LineWidth, ...)
903
    Point                       m_aAnchor;      // anchor position (Writer)
904
    SdrObjUserCall*             m_pUserCall;
905
    std::unique_ptr<SdrObjPlusData>
906
                                m_pPlusData;    // Broadcaster, UserData, connectors, ... (this is the Bitsack)
907
    // object is only pointing to another one
908
    bool                        m_bVirtObj : 1;
909
    bool                        m_bSnapRectDirty : 1;
910
    // the following flags will be streamed
911
    bool                        m_bMovProt : 1;   // if true, the position is protected
912
    bool                        m_bSizProt : 1;   // if true, the size is protected
913
    bool                        m_bDelProt : 1;   // if true, object cannot be deleted
914
    // If bEmptyPresObj is true, it is a presentation object that has no content yet.
915
    // The flag's default value is false.
916
    // The management is done by the application.
917
    // Neither assign operator nor cloning copies the flag!
918
    // The flag is persistent.
919
    bool                        m_bEmptyPresObj : 1; // empty presentation object (Draw)
920
    // if true, object is invisible as object of the MasterPage
921
    bool                        m_bNotVisibleAsMaster : 1;
922
    // if true, the object is closed, i.e. no line, arc...
923
    bool                        m_bClosedObj : 1;
924
    bool                        m_bIsEdge : 1;
925
    bool                        m_bIs3DObj : 1;
926
    bool                        m_bIsUnoObj : 1;
927
    // #i25616#
928
    bool                        mbLineIsOutsideGeometry : 1;
929
    // #i25616#
930
    bool                        mbSupportTextIndentingOnLineWidthChange : 1;
931
    // custom prompt text for empty presentation object
932
    OUString                    m_aCustomPromptText;
933
934
    std::unique_ptr<sdr::annotation::ObjectAnnotationData> mpAnnotationData;
935
936
    virtual ~SdrObject() override;
937
938
    virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() = 0;
939
940
    virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact();
941
942
    static void ImpCommonDragCalcRect(const SdrDragStat& rDrag, tools::Rectangle& rTmpRect, const Point& rPos);
943
    tools::Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const;
944
945
    // for GetDragComment
946
    OUString ImpGetDescriptionStr(TranslateId pStrCacheID) const;
947
948
    void ImpForcePlusData();
949
950
    OUString GetMetrStr(tools::Long nVal) const;
951
952
    /// A derived class must override these 3 methods if it has own geometric
953
    /// data that must be saved for Undo.
954
    /// NewGeoData() creates an empty instance of a class derived from
955
    /// SdrObjGeoData.
956
    virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const;
957
    virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
958
    virtual void RestoreGeoData(const SdrObjGeoData& rGeo);
959
960
    // internal versions
961
    const SfxItemSet& GetObjectItemSet() const;
962
    void SetObjectItem(const SfxPoolItem& rItem);
963
    void SetObjectItemSet(const SfxItemSet& rSet);
964
    const SfxPoolItem& GetObjectItem(const sal_uInt16 nWhich) const;
965
    template<class T> const T& GetObjectItem( TypedWhichId<T> nWhich ) const
966
631k
    {
967
631k
        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
968
631k
    }
SdrEdgeKindItem const& SdrObject::GetObjectItem<SdrEdgeKindItem>(TypedWhichId<SdrEdgeKindItem>) const
Line
Count
Source
966
80.5k
    {
967
80.5k
        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
968
80.5k
    }
SdrOnOffItem const& SdrObject::GetObjectItem<SdrOnOffItem>(TypedWhichId<SdrOnOffItem>) const
Line
Count
Source
966
399k
    {
967
399k
        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
968
399k
    }
XLineStyleItem const& SdrObject::GetObjectItem<XLineStyleItem>(TypedWhichId<XLineStyleItem>) const
Line
Count
Source
966
6.61k
    {
967
6.61k
        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
968
6.61k
    }
XLineWidthItem const& SdrObject::GetObjectItem<XLineWidthItem>(TypedWhichId<XLineWidthItem>) const
Line
Count
Source
966
175
    {
967
175
        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
968
175
    }
XFillStyleItem const& SdrObject::GetObjectItem<XFillStyleItem>(TypedWhichId<XFillStyleItem>) const
Line
Count
Source
966
1.59k
    {
967
1.59k
        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
968
1.59k
    }
Unexecuted instantiation: SdrGrafTransparenceItem const& SdrObject::GetObjectItem<SdrGrafTransparenceItem>(TypedWhichId<SdrGrafTransparenceItem>) const
SdrTextFitToSizeTypeItem const& SdrObject::GetObjectItem<SdrTextFitToSizeTypeItem>(TypedWhichId<SdrTextFitToSizeTypeItem>) const
Line
Count
Source
966
140k
    {
967
140k
        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
968
140k
    }
SvxWritingModeItem const& SdrObject::GetObjectItem<SvxWritingModeItem>(TypedWhichId<SvxWritingModeItem>) const
Line
Count
Source
966
2.29k
    {
967
2.29k
        return static_cast<const T&>(GetObjectItem(sal_uInt16(nWhich)));
968
2.29k
    }
969
970
    const SfxItemSet* getBackgroundFillSet() const;
971
972
    // @param bAdjustTextFrameWidthAndHeight pass false if you know it is safe to avoid the cost of doing
973
    //              text layout right now.
974
    virtual void InternalSetStyleSheet(SfxStyleSheet* pNewStyleSheet,
975
                    bool bDontRemoveHardAttr, bool bBroadcast, bool bAdjustTextFrameWidthAndHeight = true);
976
977
private:
978
    struct Impl;
979
    std::unique_ptr<Impl>             mpImpl;
980
    SdrObjList*                       mpParentOfSdrObject;     // list that includes this object
981
    sal_uInt32                        m_nOrdNum;      // order number of the object in the list
982
    class UniqueID                          maUniqueID;
983
    std::unique_ptr<SfxGrabBagItem>   m_pGrabBagItem; // holds the GrabBagItem property
984
    // Position in the navigation order. SAL_MAX_UINT32 when not used.
985
    sal_uInt32                        mnNavigationPosition;
986
    SdrLayerID                        mnLayerID;
987
    bool                              m_bNoPrint : 1;   // if true, the object is not printed.
988
    bool                              mbVisible : 1;  // if false, the object is not visible on screen (but maybe on printer, depending on bNoprint
989
    bool                              m_bMarkProt : 1;  // marking forbidden, persistent
990
    // on import of OLE object from MS documents the BLIP size might be retrieved,
991
    // in this case the following member is initialized as nonempty rectangle
992
    tools::Rectangle                         maBLIPSizeRectangle;
993
    std::unique_ptr<sdr::properties::BaseProperties>
994
                                      mpProperties;
995
    std::unique_ptr<sdr::contact::ViewContact>
996
                                      mpViewContact;
997
998
    // do not use directly, always use getSvxShape() if you have to, because not all
999
    // SdrObjects have an associated SvxShape subclass (e.g. reportdesign)
1000
    SvxShape*                   mpSvxShape;
1001
    css::uno::WeakReference< css::drawing::XShape >
1002
                                maWeakUnoShape;
1003
1004
    // HACK: Do not automatically insert newly created object into a page.
1005
    // The user needs to do it manually later.
1006
    bool                        mbDoNotInsertIntoPageAutomatically;
1007
1008
    // Hyperlink for the whole shape
1009
    OUString msHyperlink;
1010
1011
    // only for internal use!
1012
    SvxShape* getSvxShape();
1013
1014
    SdrObject( const SdrObject& ) = delete;
1015
};
1016
1017
SVXCORE_DLLPUBLIC E3dScene* DynCastE3dScene(SdrObject*);
1018
0
inline const E3dScene* DynCastE3dScene(const SdrObject* p) { return DynCastE3dScene(const_cast<SdrObject*>(p)); }
1019
SVXCORE_DLLPUBLIC E3dObject* DynCastE3dObject(SdrObject*);
1020
292
inline const E3dObject* DynCastE3dObject(const SdrObject* p) { return DynCastE3dObject(const_cast<SdrObject*>(p)); }
1021
SVXCORE_DLLPUBLIC SdrTextObj* DynCastSdrTextObj(SdrObject*);
1022
0
inline const SdrTextObj* DynCastSdrTextObj(const SdrObject* p) { return DynCastSdrTextObj(const_cast<SdrObject*>(p)); }
1023
SVXCORE_DLLPUBLIC SdrOle2Obj* DynCastSdrOle2Obj(SdrObject*);
1024
0
inline const SdrOle2Obj* DynCastSdrOle2Obj(const SdrObject* p) { return DynCastSdrOle2Obj(const_cast<SdrObject*>(p)); }
1025
1026
1027
struct SdrObjCreatorParams
1028
{
1029
    SdrInventor nInventor;
1030
    SdrObjKind nObjIdentifier;
1031
    SdrModel&   rSdrModel;
1032
};
1033
1034
/**
1035
 * Whoever creates his own objects must set a link in the SdrObjFactory class.
1036
 * The handler must have the following signature:
1037
 *      void Hdl(SdrObjFactory*)
1038
 * He must take a look at the referenced instance's nInventor and nIdentifier values,
1039
 * and must create a new drawing object instance accordingly.
1040
 * He must also make the pNewObj pointer reference to this instance.
1041
 */
1042
class SVXCORE_DLLPUBLIC SdrObjFactory
1043
{
1044
public:
1045
    static rtl::Reference<SdrObject> MakeNewObject(
1046
        SdrModel& rSdrModel,
1047
        SdrInventor nInventor,
1048
        SdrObjKind nObjIdentifier,
1049
        const tools::Rectangle* pSnapRect = nullptr);
1050
1051
    static void InsertMakeObjectHdl(Link<SdrObjCreatorParams, rtl::Reference<SdrObject>> const & rLink);
1052
    static void RemoveMakeObjectHdl(Link<SdrObjCreatorParams, rtl::Reference<SdrObject>> const & rLink);
1053
1054
private:
1055
    static SVX_DLLPRIVATE rtl::Reference<SdrObject> CreateObjectFromFactory(
1056
        SdrModel& rSdrModel,
1057
        SdrInventor nInventor,
1058
        SdrObjKind nIdentifier);
1059
1060
    SdrObjFactory() = delete;
1061
};
1062
1063
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */