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