Coverage Report

Created: 2025-07-07 10:01

/src/libreoffice/include/svx/svdotext.hxx
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#pragma once
21
22
#include <svx/itextprovider.hxx>
23
#include <svx/svdoattr.hxx>
24
#include <svx/sdtaitm.hxx>
25
#include <svx/sdtakitm.hxx>
26
#include <svx/sdtaditm.hxx>
27
#include <svx/svdtrans.hxx>
28
#include <svx/svdgeodata.hxx>
29
#include <tools/datetime.hxx>
30
#include <svl/style.hxx>
31
#include <svx/svdtext.hxx>
32
#include <svx/svxdllapi.h>
33
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
34
#include <memory>
35
#include <vector>
36
37
#include <com/sun/star/drawing/TextFitToSizeType.hpp>
38
39
//   forward declarations
40
41
class SdrOutliner;
42
class SdrPathObj;
43
class SdrTextObjTest;
44
class SvxFieldItem;
45
class ImpSdrObjTextLink;
46
class EditStatus;
47
class TextChain;
48
49
enum class EEAnchorMode;
50
enum class EETextFormat;
51
52
namespace sdr::properties {
53
    class TextProperties;
54
}
55
56
namespace drawinglayer::primitive2d {
57
    class SdrContourTextPrimitive2D;
58
    class SdrPathTextPrimitive2D;
59
    class SdrBlockTextPrimitive2D;
60
    class SdrAutoFitTextPrimitive2D;
61
    class SdrStretchTextPrimitive2D;
62
    class SdrChainedTextPrimitive2D;
63
}
64
65
namespace drawinglayer::animation {
66
    class AnimationEntryList;
67
}
68
69
namespace drawinglayer::geometry {
70
    class ViewInformation2D;
71
}
72
73
namespace sdr::table {
74
    class Cell;
75
    class SdrTableRtfExporter;
76
    class SdrTableRTFParser;
77
    class SdrTableHTMLParser;
78
}
79
80
81
//   Defines
82
constexpr const sal_uInt16 SDRUSERDATA_OBJTEXTLINK = 1;
83
84
85
//   helper class SdrTextObjGeoData
86
class SdrTextObjGeoData : public SdrObjGeoData
87
{
88
public:
89
    tools::Rectangle maRect;
90
    GeoStat maGeo;
91
};
92
93
94
//   helper class ImpSdrObjTextLinkUserData
95
class ImpSdrObjTextLinkUserData final : public SdrObjUserData
96
{
97
    friend class SdrTextObj;
98
    friend class ImpSdrObjTextLink;
99
100
    OUString maFileName;   // name of the referenced document
101
    OUString maFilterName; // a filter, if need be
102
    DateTime maFileDate0;  // avoiding unnecessary reload
103
    tools::SvRef<ImpSdrObjTextLink> mpLink;
104
    rtl_TextEncoding meCharSet;
105
106
public:
107
    ImpSdrObjTextLinkUserData();
108
    virtual ~ImpSdrObjTextLinkUserData() override;
109
110
    virtual std::unique_ptr<SdrObjUserData> Clone(SdrObject* pObj1) const override;
111
};
112
113
namespace sdr::properties
114
{
115
    class CustomShapeProperties;
116
    class CellProperties;
117
}
118
119
//   SdrTextObj
120
class SVXCORE_DLLPUBLIC SdrTextObj : public SdrAttrObj, public svx::ITextProvider
121
{
122
private:
123
    // Cell needs access to ImpGetDrawOutliner();
124
    friend class sdr::table::Cell;
125
    friend class sdr::table::SdrTableRtfExporter;
126
    friend class sdr::table::SdrTableRTFParser;
127
    friend class sdr::table::SdrTableHTMLParser;
128
    friend class TextChain;
129
    friend class TextChainFlow;
130
    friend class EditingTextChainFlow;
131
    friend class SdrOutliner;
132
133
    // CustomShapeproperties need to access the "mbTextFrame" member:
134
    friend class sdr::properties::CustomShapeProperties;
135
136
protected:
137
    virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
138
    virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
139
140
private:
141
    // This method is only allowed for sdr::properties::TextProperties
142
    SVX_DLLPRIVATE SdrOutliner* GetTextEditOutliner() const
143
10.9M
    {
144
10.9M
        return mpEditingOutliner;
145
10.9M
    }
146
147
    // to allow sdr::properties::TextProperties access to SetPortionInfoChecked()
148
    // and GetTextEditOutliner()
149
    friend class sdr::properties::TextProperties;
150
    friend class sdr::properties::CellProperties;
151
152
    friend class ImpSdrObjTextLink;
153
    friend class ImpSdrObjTextLinkUserData;
154
    friend class SdrPowerPointImport; // for PowerPointImport
155
    friend class SdrExchangeView;     // for ImpGetDrawOutliner
156
    friend class SdrView;             // for ImpGetDrawOutliner
157
    friend class SdrObjEditView;      // for TextEdit
158
    friend class SdrMeasureObj;       // for ImpGetDrawOutliner
159
    friend class SvxMSDffManager;     // for ImpGetDrawOutliner
160
    friend class SdrObjCustomShape;   // for ImpGetDrawOutliner
161
    friend class SdrText;             // for ImpGetDrawOutliner
162
163
protected:
164
    // The "aRect" is also the rect of RectObj and CircObj.
165
    // When mbTextFrame=true the text will be formatted into this rect
166
    // When mbTextFrame=false the text will be centered around its middle
167
    tools::Rectangle maRectangle;
168
169
    tools::Rectangle const& getRectangle() const
170
9.04M
    {
171
9.04M
        return maRectangle;
172
9.04M
    }
173
174
    void setRectangle(tools::Rectangle const& rRectangle)
175
5.36M
    {
176
5.36M
        maRectangle = rRectangle;
177
5.36M
    }
178
179
    void setRectangleSize(sal_Int32 nWidth, sal_Int32 nHeight)
180
0
    {
181
0
        maRectangle.SetSize(Size(nWidth, nHeight));
182
0
    }
183
184
    void moveRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta)
185
168k
    {
186
168k
        maRectangle.Move(nXDelta, nYDelta);
187
168k
    }
188
189
    void moveRectanglePosition(sal_Int32 nX, sal_Int32 nY)
190
0
    {
191
0
        maRectangle.SetPos(Point(nX, nY));
192
0
    }
193
194
    // The GeoStat contains the rotation and shear angles
195
    GeoStat maGeo;
196
197
    // this is the active text
198
    rtl::Reference<SdrText> mxText;
199
200
    // This contains the dimensions of the text
201
    Size maTextSize;
202
203
    // an Outliner*, so that
204
    // 1. the TextObj won't be edited simultaneously by multiple views, and
205
    // 2. when streaming while editing Flush() can be done
206
    SdrOutliner* mpEditingOutliner;
207
208
    // Possible values for eTextKind are:
209
    //     SdrObjKind::Text         regular text frame
210
    //     SdrObjKind::TitleText    TitleText for presentations
211
    //     SdrObjKind::OutlineText  OutlineText for presentations
212
    // eTextKind only has meaning when mbTextFrame=true, since otherwise
213
    // we're dealing with a labeled graphical object
214
    SdrObjKind meTextKind;
215
216
    // For text editing in SW Header/Footer it is necessary to be
217
    // able to set an offset for the text edit to allow text editing at the
218
    // position of the virtual object. This offset is used when setting up
219
    // and maintaining the OutlinerView.
220
    Point maTextEditOffset;
221
222
    virtual rtl::Reference<SdrObject> getFullDragClone() const override;
223
224
225
public:
226
0
    const Point& GetTextEditOffset() const { return maTextEditOffset; }
227
0
    void SetTextEditOffset(const Point& rNew) { maTextEditOffset = rNew; }
228
229
protected:
230
    bool mbIsUnchainableClone = false;
231
232
    // the successor in a chain
233
    SdrTextObj* mpNextInChain = nullptr;
234
    SdrTextObj* mpPrevInChain = nullptr;
235
236
    // For labeled graphical objects bTextFrame is FALSE. The block of text
237
    // will then be centered horizontally and vertically on aRect.
238
    // For mbTextFrame=true the text will be formatted into aRect.
239
    // The actual text frame is realized by an SdrRectObj with
240
    // mbTextFrame=true.
241
    bool mbTextFrame : 1;
242
    bool mbNoShear : 1; // disable shearing (->graphic+Ole+TextFrame)
243
    bool mbTextSizeDirty : 1;
244
245
    bool mbInEditMode : 1;   // Is this text object in edit mode?
246
247
    // For objects with free size (flow text). The flag is set by the
248
    // application on create. If the object width is later resized,
249
    // AutoGrowWidth will be disabled (set to sal_False). This flag will
250
    // then also be set to sal_False, so that the object behaves like a
251
    // normal text object.
252
    // Width resize can result from:
253
    // - Interactive Resize in single or multiple selections
254
    // - position/size dialog
255
    bool mbDisableAutoWidthOnDragging : 1;
256
257
    // Flag for allowing text animation. Default is sal_true.
258
    bool mbTextAnimationAllowed : 1;
259
260
    // flag for preventing recursive onEditOutlinerStatusEvent calls
261
    bool mbInDownScale : 1;
262
263
    SdrOutliner& ImpGetDrawOutliner() const;
264
265
private:
266
    // #101029#: Extracted from ImpGetDrawOutliner()
267
    SVX_DLLPRIVATE void ImpInitDrawOutliner( SdrOutliner& rOutl ) const;
268
    // #101029#: Extracted from Paint()
269
    SVX_DLLPRIVATE void ImpSetupDrawOutlinerForPaint( bool bContourFrame,
270
                                       SdrOutliner&     rOutliner,
271
                                       tools::Rectangle&       rTextRect,
272
                                       tools::Rectangle&       rAnchorRect,
273
                                       tools::Rectangle&       rPaintRect,
274
                                       Fraction&        aFitXCorrection ) const;
275
276
    void setupAutoFitText( SdrOutliner& rOutliner ) const;
277
    void setupAutoFitText(SdrOutliner& rOutliner, const Size& rShapeSize) const;
278
279
    SVX_DLLPRIVATE rtl::Reference<SdrObject> ImpConvertContainedTextToSdrPathObjs(bool bToPoly) const;
280
    SVX_DLLPRIVATE void ImpRegisterLink();
281
    SVX_DLLPRIVATE void ImpDeregisterLink();
282
    SVX_DLLPRIVATE ImpSdrObjTextLinkUserData* GetLinkUserData() const;
283
284
    /** Appends the style family to a provided style name */
285
    static void AppendFamilyToStyleName(OUString& styleName, SfxStyleFamily family);
286
287
    /** Reads the style family from a style name to which the family has been appended. */
288
    static SfxStyleFamily ReadFamilyFromStyleName(std::u16string_view styleName);
289
290
protected:
291
    bool ImpCanConvTextToCurve() const;
292
    rtl::Reference<SdrPathObj> ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, bool bClosed, bool bBezier) const;
293
    rtl::Reference<SdrObject> ImpConvertAddText(const rtl::Reference<SdrObject> & pObj, bool bBezier) const;
294
    void ImpSetTextStyleSheetListeners();
295
    static void ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, Fraction& rFitXCorrection);
296
    static void ImpJustifyRect(tools::Rectangle& rRect);
297
    void ImpCheckShear();
298
    tools::Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const;
299
    void ImpSetTextEditParams() const;
300
3.78M
    void SetTextSizeDirty() { mbTextSizeDirty = true; }
301
302
    // rAnchorRect is InOut-Parameter!
303
    void ImpSetContourPolygon( SdrOutliner& rOutliner, tools::Rectangle const & rAnchorRect, bool bLineWidth ) const;
304
305
    virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
306
    virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
307
    virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
308
    void NbcSetEckenradius(tools::Long nRad);
309
310
    // #115391# new method for SdrObjCustomShape and SdrTextObj to correctly handle and set
311
    // SdrTextMinFrameWidthItem and SdrTextMinFrameHeightItem based on all settings, necessities
312
    // and object sizes
313
    virtual void AdaptTextMinSize();
314
315
    // constructor
316
    SdrTextObj(SdrModel& rSdrModel,
317
               const tools::Rectangle& rNewRect = tools::Rectangle(),
318
               std::optional<SdrObjKind> oeTextKind = std::nullopt);
319
    // copy constructor
320
    SdrTextObj(SdrModel& rSdrModel, SdrTextObj const& rSource);
321
322
    // protected destructor
323
    virtual ~SdrTextObj() override;
324
325
public:
326
327
5.75M
    bool IsInEditMode() const { return mbInEditMode; }
328
329
    // Currently ASCII and RTF are supported and the differentiation is done
330
    // internally.
331
    // rFilterName has no meaning and must be empty
332
    // Normally the application only has to call SetTextLink() - the
333
    // remainder is automatic (SfxLinkManager).
334
    // The LoadText() method can also be used to load a file into a text
335
    // object (without linking.)
336
    // TextLinks can't be edited (if needed later could be ReadOnly).
337
    // Setting attributes can only be done on the text frame.
338
    void SetTextLink(const OUString& rFileName, const OUString& rFilterName);
339
    void ReleaseTextLink();
340
3.51M
    bool IsLinkedText() const { return m_pPlusData != nullptr && GetLinkUserData() != nullptr; }
341
    bool ReloadLinkedText(bool bForceLoad);
342
    bool LoadText(const OUString& rFileName, rtl_TextEncoding eCharSet);
343
344
    virtual bool AdjustTextFrameWidthAndHeight(tools::Rectangle& rR, bool bHgt = true, bool bWdt = true) const;
345
    virtual bool NbcAdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true);
346
    virtual bool AdjustTextFrameWidthAndHeight();
347
14.8M
    bool IsTextFrame() const { return mbTextFrame; }
348
4.62M
    bool IsOutlText() const { return mbTextFrame && (meTextKind==SdrObjKind::OutlineText || meTextKind==SdrObjKind::TitleText); }
349
    /// returns true if the PPT autofit of text into shape bounds is enabled. implies IsFitToSize()==false!
350
    bool IsAutoFit() const;
351
    /// returns true if the old feature for fitting shape content should into shape is enabled. implies IsAutoFit()==false!
352
    bool IsFitToSize() const;
353
354
    // Chaining
355
    SdrTextObj *GetNextLinkInChain() const;
356
    void SetNextLinkInChain(SdrTextObj *);
357
    SdrTextObj *GetPrevLinkInChain() const;
358
    bool IsChainable() const;
359
    bool GetPreventChainable() const;
360
    TextChain *GetTextChain() const;
361
362
1.01M
    SdrObjKind GetTextKind() const { return meTextKind; }
363
364
    // #i121917#
365
    virtual bool HasText() const override;
366
367
1.23M
    bool IsTextEditActive() const { return mpEditingOutliner != nullptr; }
368
369
    /** returns the currently active text. */
370
    virtual SdrText* getActiveText() const;
371
372
    /** returns the nth available text. */
373
    virtual SdrText* getText( sal_Int32 nIndex ) const override;
374
375
    /** returns the number of texts available for this object. */
376
    virtual sal_Int32 getTextCount() const override;
377
378
    /** returns true only if we are in edit mode and the user actually changed anything */
379
    virtual bool IsReallyEdited() const;
380
381
    /** changes the current active text */
382
    virtual void setActiveText( sal_Int32 nIndex );
383
384
    /** returns the index of the text that contains the given point or -1 */
385
    virtual sal_Int32 CheckTextHit(const Point& rPnt) const;
386
387
0
    void SetDisableAutoWidthOnDragging(bool bOn) { mbDisableAutoWidthOnDragging=bOn; }
388
    void NbcSetText(const OUString& rStr);
389
    void SetText(const OUString& rStr);
390
    void NbcSetText(SvStream& rInput, const OUString& rBaseURL, EETextFormat eFormat);
391
    void SetText(SvStream& rInput, const OUString& rBaseURL, EETextFormat eFormat);
392
393
    // FitToSize and Fontwork are not taken into account in GetTextSize()!
394
    virtual const Size& GetTextSize() const;
395
    void FitFrameToTextSize();
396
397
    double GetFontScale() const;
398
    double GetSpacingScale() const;
399
400
    // Simultaneously sets the text into the Outliner (possibly
401
    // the one of the EditOutliner) and sets the PaperSize.
402
    virtual void TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRect, bool bNoEditText,
403
        tools::Rectangle* pAnchorRect, bool bLineWidth = true ) const;
404
    // Takes writing direction into account when adjusting the rectangle
405
    void AdjustRectToTextDistance(tools::Rectangle& rAnchorRect, double fExtraRot = 0.0) const;
406
    virtual void TakeTextAnchorRect(::tools::Rectangle& rAnchorRect) const;
407
60.3k
    const GeoStat& GetGeoStat() const { return maGeo; }
408
409
    // get corner radius
410
    tools::Long GetEckenradius() const;
411
    virtual bool IsAutoGrowHeight() const;
412
    tools::Long GetMinTextFrameHeight() const;
413
    tools::Long GetMaxTextFrameHeight() const;
414
    virtual bool IsAutoGrowWidth() const;
415
    tools::Long GetMinTextFrameWidth() const;
416
    tools::Long GetMaxTextFrameWidth() const;
417
418
    css::drawing::TextFitToSizeType GetFitToSize() const;
419
    const tools::Rectangle &GetGeoRect() const;
420
421
    // check if it's a TextFontwork
422
    virtual bool IsFontwork() const;
423
424
    // should the Fontwork contour be hidden?
425
    bool IsHideContour() const;
426
427
    // text flow within contour
428
    bool IsContourTextFrame() const;
429
430
    SdrTextHorzAdjust GetTextHorizontalAdjust(const SfxItemSet& rSet) const;
431
    SdrTextHorzAdjust GetTextHorizontalAdjust() const;
432
433
    SdrTextVertAdjust GetTextVerticalAdjust(const SfxItemSet& rSet) const;
434
    SdrTextVertAdjust GetTextVerticalAdjust() const;
435
436
    /** Left inner spacing to borders  */
437
    tools::Long GetTextLeftDistance() const;
438
    /** Right inner spacing to borders  */
439
    tools::Long GetTextRightDistance() const;
440
    /** Top inner spacing to borders */
441
    tools::Long GetTextUpperDistance() const;
442
    /** Bottom inner spacing to borders */
443
    tools::Long GetTextLowerDistance() const;
444
    SdrTextAniKind GetTextAniKind() const;
445
    SdrTextAniDirection GetTextAniDirection() const;
446
447
    bool HasTextColumnsNumber() const;
448
    sal_Int16 GetTextColumnsNumber() const;
449
    void SetTextColumnsNumber(sal_Int16 nColumns);
450
    bool HasTextColumnsSpacing() const;
451
    sal_Int32 GetTextColumnsSpacing() const;
452
    void SetTextColumnsSpacing(sal_Int32 nSpacing);
453
454
    // react on model/page change
455
    virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
456
457
    virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
458
    virtual SdrObjKind GetObjIdentifier() const override;
459
460
    // needed to determine text anchor area
461
    virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const;
462
    virtual OUString TakeObjNameSingul() const override;
463
    virtual OUString TakeObjNamePlural() const override;
464
    virtual rtl::Reference<SdrObject> CloneSdrObject(SdrModel& rTargetModel) const override;
465
    virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
466
    virtual basegfx::B2DPolyPolygon TakeContour() const override;
467
    virtual void RecalcSnapRect() override;
468
    virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
469
    virtual void NbcSetLogicRect(const tools::Rectangle& rRect, bool bAdaptTextMinSize = true) override;
470
    virtual const tools::Rectangle& GetLogicRect() const override;
471
    virtual Degree100 GetRotateAngle() const override;
472
    virtual Degree100 GetShearAngle(bool bVertical = false) const override;
473
474
    virtual sal_uInt32 GetSnapPointCount() const override;
475
    virtual Point GetSnapPoint(sal_uInt32 i) const override;
476
477
    virtual sal_uInt32 GetHdlCount() const override;
478
    virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
479
480
    // special drag methods
481
    virtual bool hasSpecialDrag() const override;
482
    virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
483
    virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const override;
484
485
    virtual bool BegCreate(SdrDragStat& rStat) override;
486
    virtual bool MovCreate(SdrDragStat& rStat) override;
487
    virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
488
    virtual bool BckCreate(SdrDragStat& rStat) override;
489
    virtual void BrkCreate(SdrDragStat& rStat) override;
490
    virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
491
    virtual PointerStyle GetCreatePointer() const override;
492
493
    virtual void NbcMove(const Size& rSiz) override;
494
    virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
495
    virtual void NbcRotate(const Point& rRef, Degree100 nAngle, double sn, double cs) override;
496
    virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
497
    virtual void NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override;
498
499
    virtual bool HasTextEdit() const override;
500
    // returns true if TextEditMode started
501
    virtual bool BegTextEdit(SdrOutliner& rOutl);
502
    virtual void TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, tools::Rectangle* pViewInit, tools::Rectangle* pViewMin) const;
503
    virtual void EndTextEdit(SdrOutliner& rOutl);
504
    virtual EEAnchorMode GetOutlinerViewAnchorMode() const;
505
506
    virtual void NbcSetOutlinerParaObject(std::optional<OutlinerParaObject> pTextObject, bool bAdjustTextFrameWidthAndHeight = true) override;
507
    // @param bAdjustTextFrameWidthAndHeight pass false if you know it is safe to avoid the cost of doing
508
    //              text layout right now.
509
    void NbcSetOutlinerParaObjectForText( std::optional<OutlinerParaObject> pTextObject, SdrText* pText, bool bAdjustTextFrameWidthAndHeight = true );
510
    virtual OutlinerParaObject* GetOutlinerParaObject() const override;
511
    bool CanCreateEditOutlinerParaObject() const;
512
    std::optional<OutlinerParaObject> CreateEditOutlinerParaObject() const;
513
514
    virtual void NbcReformatText() override;
515
516
    virtual bool CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_uInt16 nPos,
517
        bool bEdit, std::optional<Color>& rpTxtColor, std::optional<Color>& rpFldColor, std::optional<FontLineStyle>& rpFldLineStyle, OUString& rRet) const;
518
519
    virtual rtl::Reference<SdrObject> DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
520
521
0
    void SetTextEditOutliner(SdrOutliner* pOutl) { mpEditingOutliner = pOutl; }
522
523
    /** Setup given Outliner equivalently to SdrTextObj::Paint()
524
525
        To setup an arbitrary Outliner in the same way as the draw
526
        outliner on SdrTextObj::Paint(). Among others, the paper size,
527
        control word and character stretching are initialized, such
528
        that the formatting should match the screen representation.
529
        The textual content of the outliner is not touched, i.e. no
530
        Init() or Clear() is called on the Outliner.
531
532
        @param rOutl
533
        The Outliner to setup.
534
535
        @param rPaintRect
536
        The region to paint the outliner content into. This is useful
537
        to e.g. determine the top, left position of text in shapes.
538
     */
539
    void SetupOutlinerFormatting( SdrOutliner& rOutl, tools::Rectangle& rPaintRect ) const;
540
541
    /** Update given Outliner equivalently to SdrTextObj::Paint()
542
543
        Same functionality as in SetupOutlinerFormatting(), except
544
        that the outliner content is not cleared.
545
546
        @param rOutl
547
        The Outliner to update.
548
549
        @param rPaintRect
550
        The region to paint the outliner content into. This is useful
551
        to e.g. determine the top, left position of text in shapes.
552
     */
553
    void UpdateOutlinerFormatting( SdrOutliner& rOutl, tools::Rectangle& rPaintRect ) const;
554
    void ForceOutlinerParaObject();
555
    virtual bool IsVerticalWriting() const;
556
    virtual void SetVerticalWriting(bool bVertical);
557
    bool IsTopToBottom() const;
558
559
    /** called from the SdrObjEditView during text edit when the status of the edit outliner changes */
560
    virtual void onEditOutlinerStatusEvent( EditStatus* pEditStatus );
561
562
    /** called from the SdrObjEditView during text edit when a chain of boxes is to be updated */
563
    void onChainingEvent();
564
565
566
    // transformation interface for StarOfficeAPI. This implements support for
567
    // homogen 3x3 matrices containing the transformation of the SdrObject. At the
568
    // moment it contains a shearX, rotation and translation, but for setting all linear
569
    // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
570
571
572
    // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
573
    // with the base geometry and returns TRUE. Otherwise it returns FALSE.
574
    virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& rPolyPolygon) const override;
575
576
    // sets the base geometry of the object using infos contained in the homogen 3x3 matrix.
577
    // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
578
    // to use (0,0) as upper left and will be scaled to the given size in the matrix.
579
    virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon) override;
580
581
    // #103836# iterates over the paragraphs of a given SdrObject and removes all
582
    //          hard set character attributes with the which ids contained in the
583
    //          given vector
584
    void RemoveOutlinerCharacterAttribs( const std::vector<sal_uInt16>& rCharWhichIds );
585
586
    // Get necessary data for text scroll animation. ATM base it on a Text-Metafile and a
587
    // painting rectangle. Rotation is taken from the object.
588
    GDIMetaFile* GetTextScrollMetaFileAndRectangle(tools::Rectangle& rScrollRectangle, tools::Rectangle& rPaintRectangle);
589
590
    // Access to TextAnimationAllowed flag
591
    void SetTextAnimationAllowed(bool bNew);
592
593
    // #i8824#
594
    // Set single item at the local ItemSet. *Does not use* AllowItemChange(),
595
    // ItemChange(), PostItemChange() and ItemSetChanged() calls.
596
    void SetObjectItemNoBroadcast(const SfxPoolItem& rItem);
597
    double GetCameraZRotation() const;
598
599
public:
600
601
    // text primitive decomposition helpers
602
    void impDecomposeContourTextPrimitive(
603
        drawinglayer::primitive2d::Primitive2DContainer& rTarget,
604
        const drawinglayer::primitive2d::SdrContourTextPrimitive2D& rSdrContourTextPrimitive,
605
        const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
606
    void impDecomposePathTextPrimitive(
607
        drawinglayer::primitive2d::Primitive2DContainer& rTarget,
608
        const drawinglayer::primitive2d::SdrPathTextPrimitive2D& rSdrPathTextPrimitive,
609
        const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
610
    void impDecomposeBlockTextPrimitive(
611
        drawinglayer::primitive2d::Primitive2DContainer& rTarget,
612
        const drawinglayer::primitive2d::SdrBlockTextPrimitive2D& rSdrBlockTextPrimitive,
613
        const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
614
    void impDecomposeAutoFitTextPrimitive(
615
        drawinglayer::primitive2d::Primitive2DContainer& rTarget,
616
        const drawinglayer::primitive2d::SdrAutoFitTextPrimitive2D& rSdrAutofitTextPrimitive,
617
        const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
618
    void impDecomposeStretchTextPrimitive(
619
        drawinglayer::primitive2d::Primitive2DContainer& rTarget,
620
        const drawinglayer::primitive2d::SdrStretchTextPrimitive2D& rSdrStretchTextPrimitive,
621
        const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
622
    void impDecomposeChainedTextPrimitive(
623
        drawinglayer::primitive2d::Primitive2DContainer& rTarget,
624
        const drawinglayer::primitive2d::SdrChainedTextPrimitive2D& rSdrChainedTextPrimitive,
625
        const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
626
    void impHandleChainingEventsDuringDecomposition(SdrOutliner &rOutliner) const;
627
628
    // timing generators
629
    void impGetBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const;
630
    void impGetScrollTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList, double fFrameLength, double fTextLength) const;
631
632
    /** returns false if the given pointer is NULL
633
        or if the given SdrOutliner contains no text.
634
        Also checks for one empty paragraph.
635
    */
636
    static bool HasTextImpl( SdrOutliner const * pOutliner );
637
638
23.9M
    virtual bool IsSdrTextObj() const final { return true; }
639
640
    friend class ::SdrTextObjTest;
641
};
642
643
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */