Coverage Report

Created: 2026-03-31 11:00

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