LibreOffice Module svx (master)  1
svdotext.cxx
Go to the documentation of this file.
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 
21 #include <comphelper/string.hxx>
22 #include <svl/stritem.hxx>
23 #include <svx/svdotext.hxx>
24 #include <svx/svdpage.hxx>
25 #include <svx/svdoutl.hxx>
26 #include <svx/svdmodel.hxx>
27 #include <svx/dialmgr.hxx>
28 #include <svx/strings.hrc>
30 #include <svx/sdtfchim.hxx>
31 #include <editeng/editdata.hxx>
32 #include <editeng/editstat.hxx>
33 #include <editeng/outlobj.hxx>
34 #include <editeng/editobj.hxx>
35 #include <editeng/outliner.hxx>
36 #include <textchain.hxx>
37 #include <textchainflow.hxx>
38 #include <tools/helpers.hxx>
39 #include <svx/sderitm.hxx>
40 #include <svx/sdooitm.hxx>
41 #include <svx/sdshitm.hxx>
42 #include <svx/sdtagitm.hxx>
43 #include <svx/sdtfsitm.hxx>
44 #include <svx/sdtmfitm.hxx>
45 #include <svx/xtextit0.hxx>
50 #include <vcl/gdimtf.hxx>
51 #include <vcl/virdev.hxx>
53 #include <sal/log.hxx>
54 #include <o3tl/temporary.hxx>
55 #include <unotools/configmgr.hxx>
56 
57 using namespace com::sun::star;
58 
59 // BaseProperties section
60 std::unique_ptr<sdr::properties::BaseProperties> SdrTextObj::CreateObjectSpecificProperties()
61 {
62  return std::make_unique<sdr::properties::TextProperties>(*this);
63 }
64 
65 // DrawContact section
66 std::unique_ptr<sdr::contact::ViewContact> SdrTextObj::CreateObjectSpecificViewContact()
67 {
68  return std::make_unique<sdr::contact::ViewContactOfTextObj>(*this);
69 }
70 
72 : SdrAttrObj(rSdrModel),
73  mpEditingOutliner(nullptr),
74  meTextKind(SdrObjKind::Text)
75 {
76  mbTextSizeDirty = false;
77  mbTextFrame = false;
78  mbNoShear = false;
80 
81  mbInEditMode = false;
83  maTextEditOffset = Point(0, 0);
84 
85  // #i25616#
87  mbInDownScale = false;
88 }
89 
90 SdrTextObj::SdrTextObj(SdrModel& rSdrModel, SdrTextObj const & rSource)
91 : SdrAttrObj(rSdrModel, rSource),
92  mpEditingOutliner(nullptr)
93 {
94  mbInEditMode = false;
96  maTextEditOffset = Point(0, 0);
97 
98  // #i25616#
100  mbInDownScale = false;
101 
102  maRect = rSource.maRect;
103  maGeo = rSource.maGeo;
104  meTextKind = rSource.meTextKind;
105  mbTextFrame = rSource.mbTextFrame;
106  maTextSize = rSource.maTextSize;
108 
109  // Not all of the necessary parameters were copied yet.
110  mbNoShear = rSource.mbNoShear;
112  SdrText* pText = getActiveText();
113 
114  if( pText && rSource.HasText() )
115  {
116  // before pNewOutlinerParaObject was created the same, but
117  // set at mpText (outside this scope), but mpText might be
118  // empty (this operator== seems not prepared for MultiText
119  // objects). In the current form it makes only sense to
120  // create locally and use locally on a known existing SdrText
121  const Outliner* pEO = rSource.mpEditingOutliner;
122  std::optional<OutlinerParaObject> pNewOutlinerParaObject;
123 
124  if (pEO!=nullptr)
125  {
126  pNewOutlinerParaObject = pEO->CreateParaObject();
127  }
128  else if (nullptr != rSource.getActiveText()->GetOutlinerParaObject())
129  {
130  pNewOutlinerParaObject = *rSource.getActiveText()->GetOutlinerParaObject();
131  }
132 
133  pText->SetOutlinerParaObject( std::move(pNewOutlinerParaObject) );
134  }
135 
137 }
138 
140  SdrModel& rSdrModel,
141  const tools::Rectangle& rNewRect)
142 : SdrAttrObj(rSdrModel),
143  maRect(rNewRect),
144  mpEditingOutliner(nullptr),
145  meTextKind(SdrObjKind::Text)
146 {
147  mbTextSizeDirty = false;
148  mbTextFrame = false;
149  mbNoShear = false;
152 
153  mbInEditMode = false;
154  mbTextAnimationAllowed = true;
155  mbInDownScale = false;
156  maTextEditOffset = Point(0, 0);
157 
158  // #i25616#
160 }
161 
163  SdrModel& rSdrModel,
164  SdrObjKind eNewTextKind)
165 : SdrAttrObj(rSdrModel),
166  mpEditingOutliner(nullptr),
167  meTextKind(eNewTextKind)
168 {
169  mbTextSizeDirty = false;
170  mbTextFrame = true;
171  mbNoShear = true;
173 
174  mbInEditMode = false;
175  mbTextAnimationAllowed = true;
176  mbInDownScale = false;
177  maTextEditOffset = Point(0, 0);
178 
179  // #i25616#
181 }
182 
184  SdrModel& rSdrModel,
185  SdrObjKind eNewTextKind,
186  const tools::Rectangle& rNewRect)
187 : SdrAttrObj(rSdrModel),
188  maRect(rNewRect),
189  mpEditingOutliner(nullptr),
190  meTextKind(eNewTextKind)
191 {
192  mbTextSizeDirty = false;
193  mbTextFrame = true;
194  mbNoShear = true;
197 
198  mbInEditMode = false;
199  mbTextAnimationAllowed = true;
200  mbInDownScale = false;
201  maTextEditOffset = Point(0, 0);
202 
203  // #i25616#
205 }
206 
208 {
209  SdrOutliner& rOutl(getSdrModelFromSdrObject().GetHitTestOutliner());
210  if( rOutl.GetTextObj() == this )
211  rOutl.SetTextObj( nullptr );
212  mpText.reset();
214 }
215 
217 {
219 
220  SdrText* pText = getActiveText();
221  if(pText==nullptr || !pText->GetOutlinerParaObject())
222  return;
223 
224  SdrOutliner& rOutliner=ImpGetDrawOutliner();
226  rOutliner.SetUpdateLayout(true);
227  rOutliner.SetText(*pText->GetOutlinerParaObject());
228  Size aNewSize(rOutliner.CalcTextSize());
229  rOutliner.Clear();
230  aNewSize.AdjustWidth( 1 ); // because of possible rounding errors
231  aNewSize.AdjustWidth(GetTextLeftDistance()+GetTextRightDistance() );
232  aNewSize.AdjustHeight(GetTextUpperDistance()+GetTextLowerDistance() );
233  tools::Rectangle aNewRect(maRect);
234  aNewRect.SetSize(aNewSize);
235  ImpJustifyRect(aNewRect);
236  if (aNewRect!=maRect) {
237  SetLogicRect(aNewRect);
238  }
239 }
240 
241 void SdrTextObj::NbcSetText(const OUString& rStr)
242 {
243  SdrOutliner& rOutliner=ImpGetDrawOutliner();
244  rOutliner.SetStyleSheet( 0, GetStyleSheet());
245  rOutliner.SetText(rStr,rOutliner.GetParagraph( 0 ));
247  NbcSetOutlinerParaObject(std::move(pNewText));
248  mbTextSizeDirty=true;
249 }
250 
251 void SdrTextObj::SetText(const OUString& rStr)
252 {
253  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
254  NbcSetText(rStr);
255  SetChanged();
258 }
259 
260 void SdrTextObj::NbcSetText(SvStream& rInput, const OUString& rBaseURL, EETextFormat eFormat)
261 {
262  SdrOutliner& rOutliner=ImpGetDrawOutliner();
263  rOutliner.SetStyleSheet( 0, GetStyleSheet());
264  rOutliner.Read(rInput,rBaseURL,eFormat);
266  rOutliner.SetUpdateLayout(true);
267  Size aSize(rOutliner.CalcTextSize());
268  rOutliner.Clear();
269  NbcSetOutlinerParaObject(std::move(pNewText));
270  maTextSize=aSize;
271  mbTextSizeDirty=false;
272 }
273 
274 void SdrTextObj::SetText(SvStream& rInput, const OUString& rBaseURL, EETextFormat eFormat)
275 {
276  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
277  NbcSetText(rInput,rBaseURL,eFormat);
278  SetChanged();
281 }
282 
284 {
285  if (mbTextSizeDirty)
286  {
287  Size aSiz;
288  SdrText* pText = getActiveText();
289  if( pText && pText->GetOutlinerParaObject ())
290  {
291  SdrOutliner& rOutliner=ImpGetDrawOutliner();
292  rOutliner.SetText(*pText->GetOutlinerParaObject());
293  rOutliner.SetUpdateLayout(true);
294  aSiz=rOutliner.CalcTextSize();
295  rOutliner.Clear();
296  }
297  // casting to nonconst twice
298  const_cast<SdrTextObj*>(this)->maTextSize = aSiz;
299  const_cast<SdrTextObj*>(this)->mbTextSizeDirty = false;
300  }
301  return maTextSize;
302 }
303 
305 {
306  if(!mbTextFrame)
307  return false; // AutoGrow only together with TextFrames
308 
309  const SfxItemSet& rSet = GetObjectItemSet();
310  bool bRet = rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue();
311 
312  if(bRet)
313  {
314  SdrTextAniKind eAniKind = rSet.Get(SDRATTR_TEXT_ANIKIND).GetValue();
315 
316  if(eAniKind == SdrTextAniKind::Scroll || eAniKind == SdrTextAniKind::Alternate || eAniKind == SdrTextAniKind::Slide)
317  {
318  SdrTextAniDirection eDirection = rSet.Get(SDRATTR_TEXT_ANIDIRECTION).GetValue();
319 
320  if(eDirection == SdrTextAniDirection::Up || eDirection == SdrTextAniDirection::Down)
321  {
322  bRet = false;
323  }
324  }
325  }
326  return bRet;
327 }
328 
330 {
331  if (!mbTextFrame)
332  return false; // AutoGrow only together with TextFrames
333 
334  const SfxItemSet& rSet = GetObjectItemSet();
335  bool bRet = rSet.Get(SDRATTR_TEXT_AUTOGROWWIDTH).GetValue();
336 
337  bool bInEditMOde = IsInEditMode();
338 
339  if(!bInEditMOde && bRet)
340  {
341  SdrTextAniKind eAniKind = rSet.Get(SDRATTR_TEXT_ANIKIND).GetValue();
342 
343  if(eAniKind == SdrTextAniKind::Scroll || eAniKind == SdrTextAniKind::Alternate || eAniKind == SdrTextAniKind::Slide)
344  {
345  SdrTextAniDirection eDirection = rSet.Get(SDRATTR_TEXT_ANIDIRECTION).GetValue();
346 
347  if(eDirection == SdrTextAniDirection::Left || eDirection == SdrTextAniDirection::Right)
348  {
349  bRet = false;
350  }
351  }
352  }
353  return bRet;
354 }
355 
357 {
359 }
360 
362 {
363  if(IsContourTextFrame())
365 
366  SdrTextHorzAdjust eRet = rSet.Get(SDRATTR_TEXT_HORZADJUST).GetValue();
367 
368  bool bInEditMode = IsInEditMode();
369 
370  if(!bInEditMode && eRet == SDRTEXTHORZADJUST_BLOCK)
371  {
372  SdrTextAniKind eAniKind = rSet.Get(SDRATTR_TEXT_ANIKIND).GetValue();
373 
374  if(eAniKind == SdrTextAniKind::Scroll || eAniKind == SdrTextAniKind::Alternate || eAniKind == SdrTextAniKind::Slide)
375  {
376  SdrTextAniDirection eDirection = rSet.Get(SDRATTR_TEXT_ANIDIRECTION).GetValue();
377 
378  if(eDirection == SdrTextAniDirection::Left || eDirection == SdrTextAniDirection::Right)
379  {
380  eRet = SDRTEXTHORZADJUST_LEFT;
381  }
382  }
383  }
384 
385  return eRet;
386 } // defaults: BLOCK (justify) for text frame, CENTER for captions of drawing objects
387 
389 {
391 }
392 
394 {
395  if(IsContourTextFrame())
396  return SDRTEXTVERTADJUST_TOP;
397 
398  // Take care for vertical text animation here
399  SdrTextVertAdjust eRet = rSet.Get(SDRATTR_TEXT_VERTADJUST).GetValue();
400  bool bInEditMode = IsInEditMode();
401 
402  // Take care for vertical text animation here
403  if(!bInEditMode && eRet == SDRTEXTVERTADJUST_BLOCK)
404  {
405  SdrTextAniKind eAniKind = rSet.Get(SDRATTR_TEXT_ANIKIND).GetValue();
406 
407  if(eAniKind == SdrTextAniKind::Scroll || eAniKind == SdrTextAniKind::Alternate || eAniKind == SdrTextAniKind::Slide)
408  {
409  SdrTextAniDirection eDirection = rSet.Get(SDRATTR_TEXT_ANIDIRECTION).GetValue();
410 
411  if(eDirection == SdrTextAniDirection::Left || eDirection == SdrTextAniDirection::Right)
412  {
413  eRet = SDRTEXTVERTADJUST_TOP;
414  }
415  }
416  }
417 
418  return eRet;
419 } // defaults: TOP for text frame, CENTER for captions of drawing objects
420 
422 {
423  if (!rRect.IsEmpty()) {
424  rRect.Justify();
425  if (rRect.Left()==rRect.Right()) rRect.AdjustRight( 1 );
426  if (rRect.Top()==rRect.Bottom()) rRect.AdjustBottom( 1 );
427  }
428 }
429 
431 {
432  if (mbNoShear && maGeo.nShearAngle)
433  {
434  maGeo.nShearAngle = 0_deg100;
436  }
437 }
438 
440 {
441  bool bNoTextFrame=!IsTextFrame();
442  rInfo.bResizeFreeAllowed=bNoTextFrame || ((maGeo.nRotationAngle.get() % 9000) == 0);
443  rInfo.bResizePropAllowed=true;
444  rInfo.bRotateFreeAllowed=true;
445  rInfo.bRotate90Allowed =true;
446  rInfo.bMirrorFreeAllowed=bNoTextFrame;
447  rInfo.bMirror45Allowed =bNoTextFrame;
448  rInfo.bMirror90Allowed =bNoTextFrame;
449 
450  // allow transparency
451  rInfo.bTransparenceAllowed = true;
452 
453  rInfo.bShearAllowed =bNoTextFrame;
454  rInfo.bEdgeRadiusAllowed=true;
455  bool bCanConv=ImpCanConvTextToCurve();
456  rInfo.bCanConvToPath =bCanConv;
457  rInfo.bCanConvToPoly =bCanConv;
458  rInfo.bCanConvToPathLineToArea=bCanConv;
459  rInfo.bCanConvToPolyLineToArea=bCanConv;
461 }
462 
464 {
465  return meTextKind;
466 }
467 
468 bool SdrTextObj::HasTextImpl( SdrOutliner const * pOutliner )
469 {
470  bool bRet=false;
471  if(pOutliner)
472  {
473  Paragraph* p1stPara=pOutliner->GetParagraph( 0 );
474  sal_Int32 nParaCount=pOutliner->GetParagraphCount();
475  if(p1stPara==nullptr)
476  nParaCount=0;
477 
478  if(nParaCount==1)
479  {
480  // if it is only one paragraph, check if that paragraph is empty
481  if( pOutliner->GetText(p1stPara).isEmpty() )
482  nParaCount = 0;
483  }
484 
485  bRet= nParaCount!=0;
486  }
487  return bRet;
488 }
489 
490 void SdrTextObj::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
491 {
492  const bool bRemove(pNewPage == nullptr && pOldPage != nullptr);
493  const bool bInsert(pNewPage != nullptr && pOldPage == nullptr);
494  const bool bLinked(IsLinkedText());
495 
496  if (bLinked && bRemove)
497  {
499  }
500 
501  // call parent
502  SdrAttrObj::handlePageChange(pOldPage, pNewPage);
503 
504  if (bLinked && bInsert)
505  {
506  ImpRegisterLink();
507  }
508 }
509 
511 {
513 }
514 
515 // #115391# This implementation is based on the object size (aRect) and the
516 // states of IsAutoGrowWidth/Height to correctly set TextMinFrameWidth/Height
518 {
519  if (!mbTextFrame)
520  // Only do this for text frame.
521  return;
522 
523  if (getSdrModelFromSdrObject().IsPasteResize())
524  // Don't do this during paste resize.
525  return;
526 
527  const bool bW = IsAutoGrowWidth();
528  const bool bH = IsAutoGrowHeight();
529 
530  if (!bW && !bH)
531  // No auto grow requested. Bail out.
532  return;
533 
535  SDRATTR_TEXT_MINFRAMEWIDTH, SDRATTR_TEXT_AUTOGROWWIDTH> // contains SDRATTR_TEXT_MAXFRAMEWIDTH
536  aSet(*GetObjectItemSet().GetPool());
537 
538  if(bW)
539  {
540  // Set minimum width.
542  const tools::Long nW = std::max<tools::Long>(0, maRect.GetWidth() - 1 - nDist); // text width without margins
543 
544  aSet.Put(makeSdrTextMinFrameWidthItem(nW));
545 
547  {
549  aSet.Put(makeSdrTextAutoGrowWidthItem(false));
550  }
551  }
552 
553  if(bH)
554  {
555  // Set Minimum height.
557  const tools::Long nH = std::max<tools::Long>(0, maRect.GetHeight() - 1 - nDist); // text height without margins
558 
559  aSet.Put(makeSdrTextMinFrameHeightItem(nH));
560 
562  {
564  aSet.Put(makeSdrTextAutoGrowHeightItem(false));
565  }
566  }
567 
568  SetObjectItemSet(aSet);
569 }
570 
571 void SdrTextObj::ImpSetContourPolygon( SdrOutliner& rOutliner, tools::Rectangle const & rAnchorRect, bool bLineWidth ) const
572 {
573  basegfx::B2DPolyPolygon aXorPolyPolygon(TakeXorPoly());
574  std::optional<basegfx::B2DPolyPolygon> pContourPolyPolygon;
576  -rAnchorRect.Left(), -rAnchorRect.Top()));
577 
579  {
580  // Unrotate!
582  }
583 
584  aXorPolyPolygon.transform(aMatrix);
585 
586  if( bLineWidth )
587  {
588  // Take line width into account.
589  // When doing the hit test, avoid this. (Performance!)
590  pContourPolyPolygon.emplace();
591 
592  // test if shadow needs to be avoided for TakeContour()
593  const SfxItemSet& rSet = GetObjectItemSet();
594  bool bShadowOn = rSet.Get(SDRATTR_SHADOW).GetValue();
595 
596  // #i33696#
597  // Remember TextObject currently set at the DrawOutliner, it WILL be
598  // replaced during calculating the outline since it uses an own paint
599  // and that one uses the DrawOutliner, too.
600  const SdrTextObj* pLastTextObject = rOutliner.GetTextObj();
601 
602  if(bShadowOn)
603  {
604  // force shadow off
606  pCopy->SetMergedItem(makeSdrShadowItem(false));
607  *pContourPolyPolygon = pCopy->TakeContour();
608  SdrObject::Free( pCopy );
609  }
610  else
611  {
612  *pContourPolyPolygon = TakeContour();
613  }
614 
615  // #i33696#
616  // restore remembered text object
617  if(pLastTextObject != rOutliner.GetTextObj())
618  {
619  rOutliner.SetTextObj(pLastTextObject);
620  }
621 
622  pContourPolyPolygon->transform(aMatrix);
623  }
624 
625  rOutliner.SetPolygon(aXorPolyPolygon, pContourPolyPolygon ? &*pContourPolyPolygon : nullptr);
626 }
627 
629 {
630  rRect=maRect;
631 }
632 
633 // See also: <unnamed>::getTextAnchorRange in svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
635 {
636  const tools::Long nLeftDist = GetTextLeftDistance();
637  const tools::Long nRightDist = GetTextRightDistance();
638  const tools::Long nUpperDist = GetTextUpperDistance();
639  const tools::Long nLowerDist = GetTextLowerDistance();
640  if (!IsVerticalWriting())
641  {
642  rAnchorRect.AdjustLeft(nLeftDist);
643  rAnchorRect.AdjustTop(nUpperDist);
644  rAnchorRect.AdjustRight(-nRightDist);
645  rAnchorRect.AdjustBottom(-nLowerDist);
646  }
647  else if (IsTopToBottom())
648  {
649  rAnchorRect.AdjustLeft(nLowerDist);
650  rAnchorRect.AdjustTop(nLeftDist);
651  rAnchorRect.AdjustRight(-nUpperDist);
652  rAnchorRect.AdjustBottom(-nRightDist);
653  }
654  else
655  {
656  rAnchorRect.AdjustLeft(nUpperDist);
657  rAnchorRect.AdjustTop(nRightDist);
658  rAnchorRect.AdjustRight(-nLowerDist);
659  rAnchorRect.AdjustBottom(-nLeftDist);
660  }
661 
662  // Since sizes may be bigger than the object bounds it is necessary to
663  // justify the rect now.
664  ImpJustifyRect(rAnchorRect);
665 }
666 
668 {
669  tools::Rectangle aAnkRect(maRect); // the rectangle in which we anchor
670  bool bFrame=IsTextFrame();
671  if (!bFrame) {
672  TakeUnrotatedSnapRect(aAnkRect);
673  }
674  Point aRotateRef(aAnkRect.TopLeft());
675  AdjustRectToTextDistance(aAnkRect);
676 
677  if (bFrame) {
678  // TODO: Optimize this.
679  if (aAnkRect.GetWidth()<2) aAnkRect.SetRight(aAnkRect.Left()+1 ); // minimum size h and v: 2 px
680  if (aAnkRect.GetHeight()<2) aAnkRect.SetBottom(aAnkRect.Top()+1 );
681  }
682  if (maGeo.nRotationAngle) {
683  Point aTmpPt(aAnkRect.TopLeft());
685  aTmpPt-=aAnkRect.TopLeft();
686  aAnkRect.Move(aTmpPt.X(),aTmpPt.Y());
687  }
688  rAnchorRect=aAnkRect;
689 }
690 
691 void SdrTextObj::TakeTextRect( SdrOutliner& rOutliner, tools::Rectangle& rTextRect, bool bNoEditText,
692  tools::Rectangle* pAnchorRect, bool bLineWidth ) const
693 {
694  tools::Rectangle aAnkRect; // the rectangle in which we anchor
695  TakeTextAnchorRect(aAnkRect);
698  SdrTextAniKind eAniKind=GetTextAniKind();
700 
701  bool bFitToSize(IsFitToSize());
702  bool bContourFrame=IsContourTextFrame();
703 
704  bool bFrame=IsTextFrame();
705  EEControlBits nStat0=rOutliner.GetControlWord();
706  Size aNullSize;
707  if (!bContourFrame)
708  {
709  rOutliner.SetControlWord(nStat0|EEControlBits::AUTOPAGESIZE);
710  rOutliner.SetMinAutoPaperSize(aNullSize);
711  rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000));
712  }
713 
714  if (!bFitToSize && !bContourFrame)
715  {
716  tools::Long nAnkWdt=aAnkRect.GetWidth();
717  tools::Long nAnkHgt=aAnkRect.GetHeight();
718  if (bFrame)
719  {
720  tools::Long nWdt=nAnkWdt;
721  tools::Long nHgt=nAnkHgt;
722 
723  bool bInEditMode = IsInEditMode();
724 
725  if (!bInEditMode && (eAniKind==SdrTextAniKind::Scroll || eAniKind==SdrTextAniKind::Alternate || eAniKind==SdrTextAniKind::Slide))
726  {
727  // unlimited paper size for ticker text
728  if (eAniDirection==SdrTextAniDirection::Left || eAniDirection==SdrTextAniDirection::Right) nWdt=1000000;
729  if (eAniDirection==SdrTextAniDirection::Up || eAniDirection==SdrTextAniDirection::Down) nHgt=1000000;
730  }
731 
732  bool bChainedFrame = IsChainable();
733  // Might be required for overflow check working: do limit height to frame if box is chainable.
734  if (!bChainedFrame) {
735  // #i119885# Do not limit/force height to geometrical frame (vice versa for vertical writing)
736 
737  if(IsVerticalWriting())
738  {
739  nWdt = 1000000;
740  }
741  else
742  {
743  nHgt = 1000000;
744  }
745  }
746 
747  rOutliner.SetMaxAutoPaperSize(Size(nWdt,nHgt));
748  }
749 
750  // New try with _BLOCK for hor and ver after completely
751  // supporting full width for vertical text.
752  if(SDRTEXTHORZADJUST_BLOCK == eHAdj && !IsVerticalWriting())
753  {
754  rOutliner.SetMinAutoPaperSize(Size(nAnkWdt, 0));
755  rOutliner.SetMinColumnWrapHeight(nAnkHgt);
756  }
757 
759  {
760  rOutliner.SetMinAutoPaperSize(Size(0, nAnkHgt));
761  rOutliner.SetMinColumnWrapHeight(nAnkWdt);
762  }
763  }
764 
765  rOutliner.SetPaperSize(aNullSize);
766  if (bContourFrame)
767  ImpSetContourPolygon( rOutliner, aAnkRect, bLineWidth );
768 
769  // put text into the outliner, if available from the edit outliner
770  SdrText* pText = getActiveText();
771  OutlinerParaObject* pOutlinerParaObject = pText ? pText->GetOutlinerParaObject() : nullptr;
773  if (mpEditingOutliner && !bNoEditText)
775  else if (pOutlinerParaObject)
776  pPara = *pOutlinerParaObject;
777 
778  if (pPara)
779  {
780  const bool bHitTest(&getSdrModelFromSdrObject().GetHitTestOutliner() == &rOutliner);
781  const SdrTextObj* pTestObj = rOutliner.GetTextObj();
782 
783  if( !pTestObj || !bHitTest || pTestObj != this ||
784  pTestObj->GetOutlinerParaObject() != pOutlinerParaObject )
785  {
786  if( bHitTest ) // #i33696# take back fix #i27510#
787  {
788  rOutliner.SetTextObj( this );
790  }
791 
792  rOutliner.SetUpdateLayout(true);
793  rOutliner.SetText(*pPara);
794  }
795  }
796  else
797  {
798  rOutliner.SetTextObj( nullptr );
799  }
800 
801  rOutliner.SetUpdateLayout(true);
802  rOutliner.SetControlWord(nStat0);
803 
804  if( pText )
805  pText->CheckPortionInfo(rOutliner);
806 
807  Point aTextPos(aAnkRect.TopLeft());
808  Size aTextSiz(rOutliner.GetPaperSize()); // GetPaperSize() adds a little tolerance, right?
809 
810  // For draw objects containing text correct hor/ver alignment if text is bigger
811  // than the object itself. Without that correction, the text would always be
812  // formatted to the left edge (or top edge when vertical) of the draw object.
813  if(!IsTextFrame())
814  {
815  if(aAnkRect.GetWidth() < aTextSiz.Width() && !IsVerticalWriting())
816  {
817  // Horizontal case here. Correct only if eHAdj == SDRTEXTHORZADJUST_BLOCK,
818  // else the alignment is wanted.
819  if(SDRTEXTHORZADJUST_BLOCK == eHAdj)
820  {
821  eHAdj = SDRTEXTHORZADJUST_CENTER;
822  }
823  }
824 
825  if(aAnkRect.GetHeight() < aTextSiz.Height() && IsVerticalWriting())
826  {
827  // Vertical case here. Correct only if eHAdj == SDRTEXTVERTADJUST_BLOCK,
828  // else the alignment is wanted.
829  if(SDRTEXTVERTADJUST_BLOCK == eVAdj)
830  {
831  eVAdj = SDRTEXTVERTADJUST_CENTER;
832  }
833  }
834  }
835 
837  {
838  tools::Long nFreeWdt=aAnkRect.GetWidth()-aTextSiz.Width();
839  if (eHAdj==SDRTEXTHORZADJUST_CENTER)
840  aTextPos.AdjustX(nFreeWdt/2 );
841  if (eHAdj==SDRTEXTHORZADJUST_RIGHT)
842  aTextPos.AdjustX(nFreeWdt );
843  }
845  {
846  tools::Long nFreeHgt=aAnkRect.GetHeight()-aTextSiz.Height();
847  if (eVAdj==SDRTEXTVERTADJUST_CENTER)
848  aTextPos.AdjustY(nFreeHgt/2 );
849  if (eVAdj==SDRTEXTVERTADJUST_BOTTOM)
850  aTextPos.AdjustY(nFreeHgt );
851  }
852  if (maGeo.nRotationAngle)
854 
855  if (pAnchorRect)
856  *pAnchorRect=aAnkRect;
857 
858  // rTextRect might not be correct in some cases at ContourFrame
859  rTextRect=tools::Rectangle(aTextPos,aTextSiz);
860  if (bContourFrame)
861  rTextRect=aAnkRect;
862 }
863 
865 {
867  {
868  return mpEditingOutliner->GetParagraphCount() > 0;
869  }
870  return false;
871 }
872 
874 {
877  {
878  sal_Int32 nParaCount = mpEditingOutliner->GetParagraphCount();
879  pPara = mpEditingOutliner->CreateParaObject(0, nParaCount);
880  }
881  return pPara;
882 }
883 
884 void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, Fraction& rFitXCorrection)
885 {
886  OutputDevice* pOut = rOutliner.GetRefDevice();
887  bool bNoStretching(false);
888 
889  if(pOut && pOut->GetOutDevType() == OUTDEV_PRINTER)
890  {
891  // check whether CharStretching is possible at all
892  GDIMetaFile* pMtf = pOut->GetConnectMetaFile();
893  OUString aTestString(u'J');
894 
895  if(pMtf && (!pMtf->IsRecord() || pMtf->IsPause()))
896  pMtf = nullptr;
897 
898  if(pMtf)
899  pMtf->Pause(true);
900 
901  vcl::Font aOriginalFont(pOut->GetFont());
902  vcl::Font aTmpFont( OutputDevice::GetDefaultFont( DefaultFontType::SERIF, LANGUAGE_SYSTEM, GetDefaultFontFlags::OnlyOne ) );
903 
904  aTmpFont.SetFontSize(Size(0,100));
905  pOut->SetFont(aTmpFont);
906  Size aSize1(pOut->GetTextWidth(aTestString), pOut->GetTextHeight());
907  aTmpFont.SetFontSize(Size(800,100));
908  pOut->SetFont(aTmpFont);
909  Size aSize2(pOut->GetTextWidth(aTestString), pOut->GetTextHeight());
910  pOut->SetFont(aOriginalFont);
911 
912  if(pMtf)
913  pMtf->Pause(false);
914 
915  bNoStretching = (aSize1 == aSize2);
916 
917 #ifdef _WIN32
918  // Windows zooms the font proportionally when using Size(100,500),
919  // we don't like that.
920  if(aSize2.Height() >= aSize1.Height() * 2)
921  {
922  bNoStretching = true;
923  }
924 #endif
925  }
926  unsigned nLoopCount=0;
927  bool bNoMoreLoop = false;
928  tools::Long nXDiff0=0x7FFFFFFF;
929  tools::Long nWantWdt=rShapeSize.Width();
930  tools::Long nIsWdt=rTextSize.Width();
931  if (nIsWdt==0) nIsWdt=1;
932 
933  tools::Long nWantHgt=rShapeSize.Height();
934  tools::Long nIsHgt=rTextSize.Height();
935  if (nIsHgt==0) nIsHgt=1;
936 
937  tools::Long nXTolPl=nWantWdt/100; // tolerance: +1%
938  tools::Long nXTolMi=nWantWdt/25; // tolerance: -4%
939  tools::Long nXCorr =nWantWdt/20; // correction scale: 5%
940 
941  tools::Long nX=(nWantWdt*100) /nIsWdt; // calculate X stretching
942  tools::Long nY=(nWantHgt*100) /nIsHgt; // calculate Y stretching
943  bool bChkX = true;
944  if (bNoStretching) { // might only be possible proportionally
945  if (nX>nY) { nX=nY; bChkX=false; }
946  else { nY=nX; }
947  }
948 
949  while (nLoopCount<5 && !bNoMoreLoop) {
950  if (nX<0) nX=-nX;
951  if (nX<1) { nX=1; bNoMoreLoop = true; }
952  if (nX>65535) { nX=65535; bNoMoreLoop = true; }
953 
954  if (nY<0) nY=-nY;
955  if (nY<1) { nY=1; bNoMoreLoop = true; }
956  if (nY>65535) { nY=65535; bNoMoreLoop = true; }
957 
958  // exception, there is no text yet (horizontal case)
959  if(nIsWdt <= 1)
960  {
961  nX = nY;
962  bNoMoreLoop = true;
963  }
964 
965  // exception, there is no text yet (vertical case)
966  if(nIsHgt <= 1)
967  {
968  nY = nX;
969  bNoMoreLoop = true;
970  }
971 
972  rOutliner.SetGlobalCharStretching(static_cast<sal_uInt16>(nX),static_cast<sal_uInt16>(nY));
973  nLoopCount++;
974  Size aSiz(rOutliner.CalcTextSize());
975  tools::Long nXDiff=aSiz.Width()-nWantWdt;
976  rFitXCorrection=Fraction(nWantWdt,aSiz.Width());
977  if (((nXDiff>=nXTolMi || !bChkX) && nXDiff<=nXTolPl) || nXDiff==nXDiff0) {
978  bNoMoreLoop = true;
979  } else {
980  // correct stretching factors
981  tools::Long nMul=nWantWdt;
982  tools::Long nDiv=aSiz.Width();
983  if (std::abs(nXDiff)<=2*nXCorr) {
984  if (nMul>nDiv) nDiv+=(nMul-nDiv)/2; // but only add half of what we calculated,
985  else nMul+=(nDiv-nMul)/2; // because the EditEngine calculates wrongly later on
986  }
987  nX=nX*nMul/nDiv;
988  if (bNoStretching) nY=nX;
989  }
990  nXDiff0=nXDiff;
991  }
992 }
993 
995 {
996  OUString aStr;
997 
998  switch(meTextKind)
999  {
1001  {
1002  aStr = SvxResId(STR_ObjNameSingulOUTLINETEXT);
1003  break;
1004  }
1005 
1006  case SdrObjKind::TitleText :
1007  {
1008  aStr = SvxResId(STR_ObjNameSingulTITLETEXT);
1009  break;
1010  }
1011 
1012  default:
1013  {
1014  if(IsLinkedText())
1015  aStr = SvxResId(STR_ObjNameSingulTEXTLNK);
1016  else
1017  aStr = SvxResId(STR_ObjNameSingulTEXT);
1018  break;
1019  }
1020  }
1021 
1022  OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
1023  if(pOutlinerParaObject && meTextKind != SdrObjKind::OutlineText)
1024  {
1025  // shouldn't currently cause any problems at OUTLINETEXT
1026  OUString aStr2(comphelper::string::stripStart(pOutlinerParaObject->GetTextObject().GetText(0), ' '));
1027 
1028  // avoid non expanded text portions in object name
1029  // (second condition is new)
1030  if(!aStr2.isEmpty() && aStr2.indexOf(u'\x00FF') == -1)
1031  {
1032  // space between ResStr and content text
1033  aStr += " \'";
1034 
1035  if(aStr2.getLength() > 10)
1036  {
1037  aStr2 = OUString::Concat(aStr2.subView(0, 8)) + "...";
1038  }
1039 
1040  aStr += aStr2 + "\'";
1041  }
1042  }
1043 
1044  OUString sName(aStr);
1045 
1046  OUString aName(GetName());
1047  if (!aName.isEmpty())
1048  sName += " '" + aName + "'";
1049 
1050  return sName;
1051 }
1052 
1054 {
1055  OUString sName;
1056  switch (meTextKind)
1057  {
1058  case SdrObjKind::OutlineText: sName=SvxResId(STR_ObjNamePluralOUTLINETEXT); break;
1059  case SdrObjKind::TitleText : sName=SvxResId(STR_ObjNamePluralTITLETEXT); break;
1060  default: {
1061  if (IsLinkedText()) {
1062  sName=SvxResId(STR_ObjNamePluralTEXTLNK);
1063  } else {
1064  sName=SvxResId(STR_ObjNamePluralTEXT);
1065  }
1066  } break;
1067  } // switch
1068  return sName;
1069 }
1070 
1072 {
1073  return new SdrTextObj(rTargetModel, *this);
1074 }
1075 
1077 {
1078  tools::Polygon aPol(maRect);
1081 
1082  basegfx::B2DPolyPolygon aRetval;
1083  aRetval.append(aPol.getB2DPolygon());
1084  return aRetval;
1085 }
1086 
1088 {
1090 
1091  // and now add the BoundRect of the text, if necessary
1093  {
1094  // using Clone()-Paint() strategy inside TakeContour() leaves a destroyed
1095  // SdrObject as pointer in DrawOutliner. Set *this again in fetching the outliner
1096  // in every case
1097  SdrOutliner& rOutliner=ImpGetDrawOutliner();
1098 
1099  tools::Rectangle aAnchor2;
1100  tools::Rectangle aR;
1101  TakeTextRect(rOutliner,aR,false,&aAnchor2);
1102  rOutliner.Clear();
1103  bool bFitToSize(IsFitToSize());
1104  if (bFitToSize) aR=aAnchor2;
1105  tools::Polygon aPol(aR);
1107 
1108  aRetval.append(aPol.getB2DPolygon());
1109  }
1110 
1111  return aRetval;
1112 }
1113 
1115 {
1117  {
1119  } else {
1120  maSnapRect = maRect;
1121  }
1122 }
1123 
1125 {
1126  return 4;
1127 }
1128 
1129 Point SdrTextObj::GetSnapPoint(sal_uInt32 i) const
1130 {
1131  Point aP;
1132  switch (i) {
1133  case 0: aP=maRect.TopLeft(); break;
1134  case 1: aP=maRect.TopRight(); break;
1135  case 2: aP=maRect.BottomLeft(); break;
1136  case 3: aP=maRect.BottomRight(); break;
1137  default: aP=maRect.Center(); break;
1138  }
1141  return aP;
1142 }
1143 
1144 // Extracted from ImpGetDrawOutliner()
1146 {
1147  rOutl.SetUpdateLayout(false);
1148  OutlinerMode nOutlinerMode = OutlinerMode::OutlineObject;
1149  if ( !IsOutlText() )
1150  nOutlinerMode = OutlinerMode::TextObject;
1151  rOutl.Init( nOutlinerMode );
1152 
1153  rOutl.SetGlobalCharStretching();
1154  EEControlBits nStat=rOutl.GetControlWord();
1155  nStat &= ~EEControlBits(EEControlBits::STRETCHING|EEControlBits::AUTOPAGESIZE);
1156  rOutl.SetControlWord(nStat);
1157  Size aMaxSize(100000,100000);
1158  rOutl.SetMinAutoPaperSize(Size());
1159  rOutl.SetMaxAutoPaperSize(aMaxSize);
1160  rOutl.SetPaperSize(aMaxSize);
1161  rOutl.ClearPolygon();
1162 }
1163 
1165 {
1166  SdrOutliner& rOutl(getSdrModelFromSdrObject().GetDrawOutliner(this));
1167 
1168  // Code extracted to ImpInitDrawOutliner()
1169  ImpInitDrawOutliner( rOutl );
1170 
1171  return rOutl;
1172 }
1173 
1174 // Extracted from Paint()
1176  SdrOutliner& rOutliner,
1177  tools::Rectangle& rTextRect,
1178  tools::Rectangle& rAnchorRect,
1179  tools::Rectangle& rPaintRect,
1180  Fraction& rFitXCorrection ) const
1181 {
1182  if (!bContourFrame)
1183  {
1184  // FitToSize can't be used together with ContourFrame for now
1185  if (IsFitToSize() || IsAutoFit())
1186  {
1187  EEControlBits nStat=rOutliner.GetControlWord();
1188  nStat|=EEControlBits::STRETCHING|EEControlBits::AUTOPAGESIZE;
1189  rOutliner.SetControlWord(nStat);
1190  }
1191  }
1193  TakeTextRect(rOutliner, rTextRect, false, &rAnchorRect);
1194  rPaintRect = rTextRect;
1195 
1196  if (bContourFrame)
1197  return;
1198 
1199  // FitToSize can't be used together with ContourFrame for now
1200  if (IsFitToSize())
1201  {
1202  ImpSetCharStretching(rOutliner,rTextRect.GetSize(),rAnchorRect.GetSize(),rFitXCorrection);
1203  rPaintRect=rAnchorRect;
1204  }
1205  else if (IsAutoFit())
1206  {
1207  ImpAutoFitText(rOutliner);
1208  }
1209 }
1210 
1211 sal_uInt16 SdrTextObj::GetFontScaleY() const
1212 {
1213  SdrOutliner& rOutliner = ImpGetDrawOutliner();
1214  // This eventually calls ImpAutoFitText
1216 
1217  sal_uInt16 nStretchY;
1218  rOutliner.GetGlobalCharStretching(o3tl::temporary(sal_uInt16()), nStretchY);
1219  return nStretchY;
1220 }
1221 
1222 void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner ) const
1223 {
1224  const Size aShapeSize=GetSnapRect().GetSize();
1225  ImpAutoFitText( rOutliner,
1228  IsVerticalWriting() );
1229 }
1230 
1231 void SdrTextObj::ImpAutoFitText(SdrOutliner& rOutliner, const Size& rTextSize,
1232  bool bIsVerticalWriting) const
1233 {
1234  // EditEngine formatting is unstable enough for
1235  // line-breaking text that we need some more samples
1236 
1237  // loop early-exits if we detect an already attained value
1238  sal_uInt16 nMinStretchX=0, nMinStretchY=0;
1239  sal_uInt16 aOldStretchXVals[]={0,0,0,0,0,0,0,0,0,0};
1240  const size_t aStretchArySize=SAL_N_ELEMENTS(aOldStretchXVals);
1241  for(unsigned int i=0; i<aStretchArySize; ++i)
1242  {
1243  const Size aCurrTextSize = rOutliner.CalcTextSizeNTP();
1244  double fFactor(1.0);
1245  if( bIsVerticalWriting )
1246  {
1247  if (aCurrTextSize.Width() != 0)
1248  {
1249  fFactor = double(rTextSize.Width())/aCurrTextSize.Width();
1250  }
1251  }
1252  else if (aCurrTextSize.Height() != 0)
1253  {
1254  fFactor = double(rTextSize.Height())/aCurrTextSize.Height();
1255  }
1256  // fFactor scales in both x and y directions
1257  // - this is fine for bulleted words
1258  // - but it scales too much for a long paragraph
1259  // - taking sqrt scales long paragraphs the best
1260  // - bulleted words will have to go through more iterations
1261  fFactor = std::sqrt(fFactor);
1262 
1263  sal_uInt16 nCurrStretchX, nCurrStretchY;
1264  rOutliner.GetGlobalCharStretching(nCurrStretchX, nCurrStretchY);
1265 
1266  if (fFactor >= 1.0 )
1267  {
1268  // resulting text area fits into available shape rect -
1269  // err on the larger stretching, to optimally fill area
1270  nMinStretchX = std::max(nMinStretchX,nCurrStretchX);
1271  nMinStretchY = std::max(nMinStretchY,nCurrStretchY);
1272  }
1273 
1274  aOldStretchXVals[i] = nCurrStretchX;
1275  if( std::find(aOldStretchXVals, aOldStretchXVals+i, nCurrStretchX) != aOldStretchXVals+i )
1276  break; // same value already attained once; algo is looping, exit
1277 
1278  if (fFactor < 1.0 || nCurrStretchX != 100)
1279  {
1280  nCurrStretchX = sal::static_int_cast<sal_uInt16>(nCurrStretchX*fFactor);
1281  nCurrStretchY = sal::static_int_cast<sal_uInt16>(nCurrStretchY*fFactor);
1282  rOutliner.SetGlobalCharStretching(std::min(sal_uInt16(100),nCurrStretchX),
1283  std::min(sal_uInt16(100),nCurrStretchY));
1284  SAL_INFO("svx", "zoom is " << nCurrStretchX);
1285  }
1286  }
1287 
1289  if (rItem.GetMaxScale() > 0)
1290  {
1291  nMinStretchX = std::min<sal_uInt16>(rItem.GetMaxScale(), nMinStretchX);
1292  nMinStretchY = std::min<sal_uInt16>(rItem.GetMaxScale(), nMinStretchY);
1293  }
1294 
1295  SAL_INFO("svx", "final zoom is " << nMinStretchX);
1296  rOutliner.SetGlobalCharStretching(std::min(sal_uInt16(100),nMinStretchX),
1297  std::min(sal_uInt16(100),nMinStretchY));
1298 }
1299 
1301 {
1302  ImpInitDrawOutliner( rOutl );
1303  UpdateOutlinerFormatting( rOutl, rPaintRect );
1304 }
1305 
1307 {
1308  tools::Rectangle aTextRect;
1309  tools::Rectangle aAnchorRect;
1310  Fraction aFitXCorrection(1,1);
1311 
1312  const bool bContourFrame(IsContourTextFrame());
1313  const MapMode aMapMode(
1314  getSdrModelFromSdrObject().GetScaleUnit(),
1315  Point(0,0),
1316  getSdrModelFromSdrObject().GetScaleFraction(),
1317  getSdrModelFromSdrObject().GetScaleFraction());
1318 
1319  rOutl.SetRefMapMode(aMapMode);
1321  bContourFrame,
1322  rOutl,
1323  aTextRect,
1324  aAnchorRect,
1325  rPaintRect,
1326  aFitXCorrection);
1327 }
1328 
1329 
1331 {
1332  SdrText* pText = getActiveText();
1333  if( pText )
1334  return pText->GetOutlinerParaObject();
1335  else
1336  return nullptr;
1337 }
1338 
1340 {
1341  NbcSetOutlinerParaObjectForText( std::move(pTextObject), getActiveText() );
1342 }
1343 
1344 namespace
1345 {
1346  bool IsAutoGrow(const SdrTextObj& rObj)
1347  {
1348  bool bAutoGrow = rObj.IsAutoGrowHeight() || rObj.IsAutoGrowWidth();
1349  return bAutoGrow && !utl::ConfigManager::IsFuzzing();
1350  }
1351 }
1352 
1354 {
1355  if( pText )
1356  pText->SetOutlinerParaObject( std::move(pTextObject) );
1357 
1358  if (pText && pText->GetOutlinerParaObject())
1359  {
1361  ? css::text::WritingMode_TB_RL
1362  : css::text::WritingMode_LR_TB,
1364  GetProperties().SetObjectItemDirect(aWritingMode);
1365  }
1366 
1367  SetTextSizeDirty();
1368  if (IsTextFrame() && IsAutoGrow(*this))
1369  { // adapt text frame!
1371  }
1372  if (!IsTextFrame())
1373  {
1374  // the SnapRect keeps its size
1376  }
1377 
1378  // always invalidate BoundRect on change
1380  ActionChanged();
1381 
1383 }
1384 
1386 {
1387  SdrText* pText = getActiveText();
1388  if( !(pText && pText->GetOutlinerParaObject()) )
1389  return;
1390 
1391  pText->ReformatText();
1392  if (mbTextFrame)
1393  {
1395  }
1396  else
1397  {
1398  // the SnapRect keeps its size
1400  SetBoundAndSnapRectsDirty(/*bNotMyself*/true);
1401  }
1402  SetTextSizeDirty();
1403  ActionChanged();
1404  // i22396
1405  // Necessary here since we have no compare operator at the outliner
1406  // para object which may detect changes regarding the combination
1407  // of outliner para data and configuration (e.g., change of
1408  // formatting of text numerals)
1410 }
1411 
1412 std::unique_ptr<SdrObjGeoData> SdrTextObj::NewGeoData() const
1413 {
1414  return std::make_unique<SdrTextObjGeoData>();
1415 }
1416 
1418 {
1420  SdrTextObjGeoData& rTGeo=static_cast<SdrTextObjGeoData&>(rGeo);
1421  rTGeo.maRect = maRect;
1422  rTGeo.maGeo = maGeo;
1423 }
1424 
1426 { // RectsDirty is called by SdrObject
1428  const SdrTextObjGeoData& rTGeo=static_cast<const SdrTextObjGeoData&>(rGeo);
1429  NbcSetLogicRect(rTGeo.maRect);
1430  maGeo = rTGeo.maGeo;
1431  SetTextSizeDirty();
1432 }
1433 
1434 drawing::TextFitToSizeType SdrTextObj::GetFitToSize() const
1435 {
1436  drawing::TextFitToSizeType eType = drawing::TextFitToSizeType_NONE;
1437 
1438  if(!IsAutoGrowWidth())
1439  eType = GetObjectItem(SDRATTR_TEXT_FITTOSIZE).GetValue();
1440 
1441  return eType;
1442 }
1443 
1445 {
1446  return maRect;
1447 }
1448 
1450 {
1451  SdrText* pText = getActiveText();
1452  if( pText && (pText->GetOutlinerParaObject() == nullptr) )
1453  {
1454  OutlinerMode nOutlMode = OutlinerMode::TextObject;
1456  nOutlMode = OutlinerMode::OutlineObject;
1457 
1458  pText->ForceOutlinerParaObject( nOutlMode );
1459  }
1460 }
1461 
1463 {
1464  //if (!IsChainable())
1465  // return NULL;
1466 
1468 }
1469 
1471 {
1472  if(mpEditingOutliner)
1473  {
1474  return mpEditingOutliner->IsVertical();
1475  }
1476 
1477  OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
1478  if(pOutlinerParaObject)
1479  {
1480  return pOutlinerParaObject->IsEffectivelyVertical();
1481  }
1482 
1483  return false;
1484 }
1485 
1487 {
1488  OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
1489 
1490  if( !pOutlinerParaObject && bVertical )
1491  {
1492  // we only need to force an outliner para object if the default of
1493  // horizontal text is changed
1495  pOutlinerParaObject = GetOutlinerParaObject();
1496  }
1497 
1498  if (!pOutlinerParaObject ||
1499  (pOutlinerParaObject->IsEffectivelyVertical() == bVertical))
1500  return;
1501 
1502  // get item settings
1503  const SfxItemSet& rSet = GetObjectItemSet();
1504  bool bAutoGrowWidth = rSet.Get(SDRATTR_TEXT_AUTOGROWWIDTH).GetValue();
1505  bool bAutoGrowHeight = rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue();
1506 
1507  // Also exchange hor/ver adjust items
1508  SdrTextHorzAdjust eHorz = rSet.Get(SDRATTR_TEXT_HORZADJUST).GetValue();
1509  SdrTextVertAdjust eVert = rSet.Get(SDRATTR_TEXT_VERTADJUST).GetValue();
1510 
1511  // rescue object size
1512  tools::Rectangle aObjectRect = GetSnapRect();
1513 
1514  // prepare ItemSet to set exchanged width and height items
1516  // Expanded item ranges to also support hor and ver adjust.
1519 
1520  aNewSet.Put(rSet);
1521  aNewSet.Put(makeSdrTextAutoGrowWidthItem(bAutoGrowHeight));
1522  aNewSet.Put(makeSdrTextAutoGrowHeightItem(bAutoGrowWidth));
1523 
1524  // Exchange horz and vert adjusts
1525  switch (eVert)
1526  {
1531  }
1532  switch (eHorz)
1533  {
1538  }
1539 
1540  SetObjectItemSet(aNewSet);
1541 
1542  pOutlinerParaObject = GetOutlinerParaObject();
1543  if (pOutlinerParaObject)
1544  {
1545  // set ParaObject orientation accordingly
1546  pOutlinerParaObject->SetVertical(bVertical);
1547  }
1548 
1549  // restore object size
1550  SetSnapRect(aObjectRect);
1551 }
1552 
1554 {
1555  if (mpEditingOutliner)
1556  return mpEditingOutliner->IsTopToBottom();
1557 
1558  if (OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject())
1559  return pOutlinerParaObject->IsTopToBottom();
1560 
1561  return false;
1562 }
1563 
1564 // transformation interface for StarOfficeAPI. This implements support for
1565 // homogeneous 3x3 matrices containing the transformation of the SdrObject. At the
1566 // moment it contains a shearX, rotation and translation, but for setting all linear
1567 // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
1568 
1569 
1570 // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
1571 // with the base geometry and returns TRUE. Otherwise it returns FALSE.
1573 {
1574  // get turn and shear
1575  double fRotate = toRadians(maGeo.nRotationAngle);
1576  double fShearX = toRadians(maGeo.nShearAngle);
1577 
1578  // get aRect, this is the unrotated snaprect
1579  tools::Rectangle aRectangle(maRect);
1580 
1581  // fill other values
1582  basegfx::B2DTuple aScale(aRectangle.GetWidth(), aRectangle.GetHeight());
1583  basegfx::B2DTuple aTranslate(aRectangle.Left(), aRectangle.Top());
1584 
1585  // position maybe relative to anchorpos, convert
1587  {
1588  if(GetAnchorPos().X() || GetAnchorPos().Y())
1589  {
1590  aTranslate -= basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
1591  }
1592  }
1593 
1594  // build matrix
1596  aScale,
1597  basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX),
1598  basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate,
1599  aTranslate);
1600 
1601  return false;
1602 }
1603 
1604 // sets the base geometry of the object using infos contained in the homogeneous 3x3 matrix.
1605 // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
1606 // to use (0,0) as upper left and will be scaled to the given size in the matrix.
1608 {
1609  // break up matrix
1610  basegfx::B2DTuple aScale;
1611  basegfx::B2DTuple aTranslate;
1612  double fRotate(0.0);
1613  double fShearX(0.0);
1614  rMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
1615 
1616  // flip?
1617  bool bFlipX = aScale.getX() < 0.0,
1618  bFlipY = aScale.getY() < 0.0;
1619  if (bFlipX)
1620  {
1621  aScale.setX(fabs(aScale.getX()));
1622  }
1623  if (bFlipY)
1624  {
1625  aScale.setY(fabs(aScale.getY()));
1626  }
1627 
1628  // reset object shear and rotations
1629  maGeo.nRotationAngle = 0_deg100;
1630  maGeo.RecalcSinCos();
1631  maGeo.nShearAngle = 0_deg100;
1632  maGeo.RecalcTan();
1633 
1634  // if anchor is used, make position relative to it
1635  if( getSdrModelFromSdrObject().IsWriter() )
1636  {
1637  if(GetAnchorPos().X() || GetAnchorPos().Y())
1638  {
1639  aTranslate += basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
1640  }
1641  }
1642 
1643  // build and set BaseRect (use scale)
1644  Size aSize(FRound(aScale.getX()), FRound(aScale.getY()));
1645  tools::Rectangle aBaseRect(Point(), aSize);
1646  SetSnapRect(aBaseRect);
1647 
1648  // flip?
1649  if (bFlipX)
1650  {
1651  Mirror(Point(), Point(0, 1));
1652  }
1653  if (bFlipY)
1654  {
1655  Mirror(Point(), Point(1, 0));
1656  }
1657 
1658  // shear?
1659  if(!basegfx::fTools::equalZero(fShearX))
1660  {
1661  GeoStat aGeoStat;
1662  aGeoStat.nShearAngle = Degree100(FRound(basegfx::rad2deg<100>(atan(fShearX))));
1663  aGeoStat.RecalcTan();
1664  Shear(Point(), aGeoStat.nShearAngle, aGeoStat.mfTanShearAngle, false);
1665  }
1666 
1667  // rotation?
1668  if(!basegfx::fTools::equalZero(fRotate))
1669  {
1670  GeoStat aGeoStat;
1671 
1672  // #i78696#
1673  // fRotate is matematically correct, but aGeoStat.nRotationAngle is
1674  // mirrored -> mirror value here
1675  aGeoStat.nRotationAngle = NormAngle36000(Degree100(FRound(-basegfx::rad2deg<100>(fRotate))));
1676  aGeoStat.RecalcSinCos();
1677  Rotate(Point(), aGeoStat.nRotationAngle, aGeoStat.mfSinRotationAngle, aGeoStat.mfCosRotationAngle);
1678  }
1679 
1680  // translate?
1681  if(!aTranslate.equalZero())
1682  {
1683  Move(Size(FRound(aTranslate.getX()), FRound(aTranslate.getY())));
1684  }
1685 }
1686 
1688 {
1690 }
1691 
1692 // moved inlines here form hxx
1693 
1695 {
1696  return GetObjectItemSet().Get(SDRATTR_CORNER_RADIUS).GetValue();
1697 }
1698 
1700 {
1701  return GetObjectItemSet().Get(SDRATTR_TEXT_MINFRAMEHEIGHT).GetValue();
1702 }
1703 
1705 {
1706  return GetObjectItemSet().Get(SDRATTR_TEXT_MAXFRAMEHEIGHT).GetValue();
1707 }
1708 
1710 {
1711  return GetObjectItemSet().Get(SDRATTR_TEXT_MINFRAMEWIDTH).GetValue();
1712 }
1713 
1715 {
1716  return GetObjectItemSet().Get(SDRATTR_TEXT_MAXFRAMEWIDTH).GetValue();
1717 }
1718 
1720 {
1721  return !mbTextFrame // Default is FALSE
1723 }
1724 
1726 {
1727  return !mbTextFrame // Default is: no, don't HideContour; HideContour not together with TextFrames
1728  && GetObjectItemSet().Get(XATTR_FORMTXTHIDEFORM).GetValue();
1729 }
1730 
1732 {
1733  return !mbTextFrame // ContourFrame not together with normal TextFrames
1735 }
1736 
1738 {
1739  return GetObjectItemSet().Get(SDRATTR_TEXT_LEFTDIST).GetValue();
1740 }
1741 
1743 {
1744  return GetObjectItemSet().Get(SDRATTR_TEXT_RIGHTDIST).GetValue();
1745 }
1746 
1748 {
1749  return GetObjectItemSet().Get(SDRATTR_TEXT_UPPERDIST).GetValue();
1750 }
1751 
1753 {
1754  return GetObjectItemSet().Get(SDRATTR_TEXT_LOWERDIST).GetValue();
1755 }
1756 
1758 {
1759  return GetObjectItemSet().Get(SDRATTR_TEXT_ANIKIND).GetValue();
1760 }
1761 
1763 {
1764  return GetObjectItemSet().Get(SDRATTR_TEXT_ANIDIRECTION).GetValue();
1765 }
1766 
1768 {
1770 }
1771 
1773 {
1774  return GetObjectItemSet().Get(SDRATTR_TEXTCOLUMNS_NUMBER).GetValue();
1775 }
1776 
1777 void SdrTextObj::SetTextColumnsNumber(sal_Int16 nColumns)
1778 {
1780 }
1781 
1783 {
1785 }
1786 
1788 {
1789  return GetObjectItemSet().Get(SDRATTR_TEXTCOLUMNS_SPACING).GetValue();
1790 }
1791 
1792 void SdrTextObj::SetTextColumnsSpacing(sal_Int32 nSpacing)
1793 {
1795 }
1796 
1797 // Get necessary data for text scroll animation. ATM base it on a Text-Metafile and a
1798 // painting rectangle. Rotation is excluded from the returned values.
1800  tools::Rectangle& rScrollRectangle, tools::Rectangle& rPaintRectangle)
1801 {
1802  GDIMetaFile* pRetval = nullptr;
1803  SdrOutliner& rOutliner = ImpGetDrawOutliner();
1804  tools::Rectangle aTextRect;
1805  tools::Rectangle aAnchorRect;
1806  tools::Rectangle aPaintRect;
1807  Fraction aFitXCorrection(1,1);
1808  bool bContourFrame(IsContourTextFrame());
1809 
1810  // get outliner set up. To avoid getting a somehow rotated MetaFile,
1811  // temporarily disable object rotation.
1812  Degree100 nAngle(maGeo.nRotationAngle);
1813  maGeo.nRotationAngle = 0_deg100;
1814  ImpSetupDrawOutlinerForPaint( bContourFrame, rOutliner, aTextRect, aAnchorRect, aPaintRect, aFitXCorrection );
1815  maGeo.nRotationAngle = nAngle;
1816 
1817  tools::Rectangle aScrollFrameRect(aPaintRect);
1818  const SfxItemSet& rSet = GetObjectItemSet();
1819  SdrTextAniDirection eDirection = rSet.Get(SDRATTR_TEXT_ANIDIRECTION).GetValue();
1820 
1821  if(SdrTextAniDirection::Left == eDirection || SdrTextAniDirection::Right == eDirection)
1822  {
1823  aScrollFrameRect.SetLeft( aAnchorRect.Left() );
1824  aScrollFrameRect.SetRight( aAnchorRect.Right() );
1825  }
1826 
1827  if(SdrTextAniDirection::Up == eDirection || SdrTextAniDirection::Down == eDirection)
1828  {
1829  aScrollFrameRect.SetTop( aAnchorRect.Top() );
1830  aScrollFrameRect.SetBottom( aAnchorRect.Bottom() );
1831  }
1832 
1833  // create the MetaFile
1834  pRetval = new GDIMetaFile;
1836  pBlackHole->EnableOutput(false);
1837  pRetval->Record(pBlackHole);
1838  Point aPaintPos = aPaintRect.TopLeft();
1839 
1840  rOutliner.Draw(*pBlackHole, aPaintPos);
1841 
1842  pRetval->Stop();
1843  pRetval->WindStart();
1844 
1845  // return PaintRectanglePixel and pRetval;
1846  rScrollRectangle = aScrollFrameRect;
1847  rPaintRectangle = aPaintRect;
1848 
1849  return pRetval;
1850 }
1851 
1852 // Access to TextAnimationAllowed flag
1854 {
1855  return GetFitToSize() == drawing::TextFitToSizeType_AUTOFIT;
1856 }
1857 
1859 {
1860  const drawing::TextFitToSizeType eFit = GetFitToSize();
1861  return (eFit == drawing::TextFitToSizeType_PROPORTIONAL
1862  || eFit == drawing::TextFitToSizeType_ALLLINES);
1863 }
1864 
1866 {
1867  if(mbTextAnimationAllowed != bNew)
1868  {
1869  mbTextAnimationAllowed = bNew;
1870  ActionChanged();
1871  }
1872 }
1873 
1876 {
1877  const EditStatusFlags nStat = pEditStatus->GetStatusWord();
1878  const bool bGrowX = bool(nStat & EditStatusFlags::TEXTWIDTHCHANGED);
1879  const bool bGrowY = bool(nStat & EditStatusFlags::TextHeightChanged);
1880  if(!(mbTextFrame && (bGrowX || bGrowY)))
1881  return;
1882 
1883  if ((bGrowX && IsAutoGrowWidth()) || (bGrowY && IsAutoGrowHeight()))
1884  {
1886  }
1887  else if ( (IsAutoFit() || IsFitToSize()) && !mbInDownScale)
1888  {
1889  assert(mpEditingOutliner);
1890  mbInDownScale = true;
1891 
1892  // sucks that we cannot disable paints via
1893  // mpEditingOutliner->SetUpdateMode(FALSE) - but EditEngine skips
1894  // formatting as well, then.
1896  mbInDownScale = false;
1897  }
1898 }
1899 
1900 /* Begin chaining code */
1901 
1902 // XXX: Make it a method somewhere?
1903 static SdrObject *ImpGetObjByName(SdrObjList const *pObjList, std::u16string_view aObjName)
1904 {
1905  // scan the whole list
1906  size_t nObjCount = pObjList->GetObjCount();
1907  for (size_t i = 0; i < nObjCount; i++) {
1908  SdrObject *pCurObj = pObjList->GetObj(i);
1909 
1910  if (pCurObj->GetName() == aObjName) {
1911  return pCurObj;
1912  }
1913  }
1914  // not found
1915  return nullptr;
1916 }
1917 
1918 // XXX: Make it a (private) method of SdrTextObj
1919 static void ImpUpdateChainLinks(SdrTextObj *pTextObj, std::u16string_view aNextLinkName)
1920 {
1921  // XXX: Current implementation constraints text boxes to be on the same page
1922 
1923  // No next link
1924  if (aNextLinkName.empty()) {
1925  pTextObj->SetNextLinkInChain(nullptr);
1926  return;
1927  }
1928 
1929  SdrPage *pPage(pTextObj->getSdrPageFromSdrObject());
1930  assert(pPage);
1931  SdrTextObj *pNextTextObj = dynamic_cast< SdrTextObj * >
1932  (ImpGetObjByName(pPage, aNextLinkName));
1933  if (!pNextTextObj) {
1934  SAL_INFO("svx.chaining", "[CHAINING] Can't find object as next link.");
1935  return;
1936  }
1937 
1938  pTextObj->SetNextLinkInChain(pNextTextObj);
1939 }
1940 
1942 {
1943  // Read it as item
1944  const SfxItemSet& rSet = GetObjectItemSet();
1945  OUString aNextLinkName = rSet.Get(SDRATTR_TEXT_CHAINNEXTNAME).GetValue();
1946 
1947  // Update links if any inconsistency is found
1948  bool bNextLinkUnsetYet = !aNextLinkName.isEmpty() && !mpNextInChain;
1949  bool bInconsistentNextLink = mpNextInChain && mpNextInChain->GetName() != aNextLinkName;
1950  // if the link is not set despite there should be one OR if it has changed
1951  if (bNextLinkUnsetYet || bInconsistentNextLink) {
1952  ImpUpdateChainLinks(const_cast<SdrTextObj *>(this), aNextLinkName);
1953  }
1954 
1955  return !aNextLinkName.isEmpty(); // XXX: Should we also check for GetNilChainingEvent? (see old code below)
1956 
1957 /*
1958  // Check that no overflow is going on
1959  if (!GetTextChain() || GetTextChain()->GetNilChainingEvent(this))
1960  return false;
1961 */
1962 }
1963 
1965 {
1966  if (!mpEditingOutliner)
1967  return;
1968 
1969  // Outliner for text transfer
1970  SdrOutliner &aDrawOutliner = ImpGetDrawOutliner();
1971 
1972  EditingTextChainFlow aTxtChainFlow(this);
1973  aTxtChainFlow.CheckForFlowEvents(mpEditingOutliner);
1974 
1975  if (aTxtChainFlow.IsOverflow()) {
1976  SAL_INFO("svx.chaining", "[CHAINING] Overflow going on");
1977  // One outliner is for non-overflowing text, the other for overflowing text
1978  // We remove text directly from the editing outliner
1979  aTxtChainFlow.ExecuteOverflow(mpEditingOutliner, &aDrawOutliner);
1980  } else if (aTxtChainFlow.IsUnderflow()) {
1981  SAL_INFO("svx.chaining", "[CHAINING] Underflow going on");
1982  // underflow-induced overflow
1983  aTxtChainFlow.ExecuteUnderflow(&aDrawOutliner);
1984  bool bIsOverflowFromUnderflow = aTxtChainFlow.IsOverflow();
1985  // handle overflow
1986  if (bIsOverflowFromUnderflow) {
1987  SAL_INFO("svx.chaining", "[CHAINING] Overflow going on (underflow induced)");
1988  // prevents infinite loops when setting text for editing outliner
1989  aTxtChainFlow.ExecuteOverflow(&aDrawOutliner, &aDrawOutliner);
1990  }
1991  }
1992 }
1993 
1995 {
1996  /*
1997  if (GetTextChain())
1998  return GetTextChain()->GetNextLink(this);
1999 
2000  return NULL;
2001  */
2002 
2003  return mpNextInChain;
2004 }
2005 
2007 {
2008  // Basically a doubly linked list implementation
2009 
2010  SdrTextObj *pOldNextObj = mpNextInChain;
2011 
2012  // Replace next link
2013  mpNextInChain = pNextObj;
2014  // Deal with old next link's prev link
2015  if (pOldNextObj) {
2016  pOldNextObj->mpPrevInChain = nullptr;
2017  }
2018 
2019  // Deal with new next link's prev link
2020  if (mpNextInChain) {
2021  // If there is a prev already at all and this is not already the current object
2023  mpNextInChain->mpPrevInChain != this)
2025  mpNextInChain->mpPrevInChain = this;
2026  }
2027 
2028  // TODO: Introduce check for circular chains
2029 
2030 }
2031 
2033 {
2034  /*
2035  if (GetTextChain())
2036  return GetTextChain()->GetPrevLink(this);
2037 
2038  return NULL;
2039  */
2040 
2041  return mpPrevInChain;
2042 }
2043 
2045 {
2046  // Prevent chaining it 1) during dragging && 2) when we are editing next link
2048 }
2049 
2051 {
2053  SdrTextObj *pTextObjClone = dynamic_cast<SdrTextObj *>(pClone.get());
2054  if (pTextObjClone != nullptr) {
2055  // Avoid transferring of text for chainable object during dragging
2056  pTextObjClone->mbIsUnchainableClone = true;
2057  }
2058 
2059  return pClone;
2060  }
2061 
2062 /* End chaining code */
2063 
2066 {
2067  if( !mpText )
2068  return getText( 0 );
2069  else
2070  return mpText.get();
2071 }
2072 
2074 SdrText* SdrTextObj::getText( sal_Int32 nIndex ) const
2075 {
2076  if( nIndex == 0 )
2077  {
2078  if( !mpText )
2079  const_cast< SdrTextObj* >(this)->mpText.reset( new SdrText( *const_cast< SdrTextObj* >(this) ) );
2080  return mpText.get();
2081  }
2082  else
2083  {
2084  return nullptr;
2085  }
2086 }
2087 
2089 sal_Int32 SdrTextObj::getTextCount() const
2090 {
2091  return 1;
2092 }
2093 
2095 void SdrTextObj::setActiveText( sal_Int32 /*nIndex*/ )
2096 {
2097 }
2098 
2100 sal_Int32 SdrTextObj::CheckTextHit(const Point& /*rPnt*/) const
2101 {
2102  return 0;
2103 }
2104 
2106 {
2108 }
2109 
2110 
2111 // The concept of the text object:
2112 // ~~~~~~~~~~~~~~~~~~~~~~~~
2113 // Attributes/Variations:
2114 // - bool text frame / graphics object with caption
2115 // - bool FontWork (if it is not a text frame and not a ContourTextFrame)
2116 // - bool ContourTextFrame (if it is not a text frame and not Fontwork)
2117 // - long rotation angle (if it is not FontWork)
2118 // - long text frame margins (if it is not FontWork)
2119 // - bool FitToSize (if it is not FontWork)
2120 // - bool AutoGrowingWidth/Height (if it is not FitToSize and not FontWork)
2121 // - long Min/MaxFrameWidth/Height (if AutoGrowingWidth/Height)
2122 // - enum horizontal text anchoring left,center,right,justify/block,Stretch(ni)
2123 // - enum vertical text anchoring top, middle, bottom, block, stretch(ni)
2124 // - enum ticker text (if it is not FontWork)
2125 
2126 // Every derived object is either a text frame (mbTextFrame=true)
2127 // or a drawing object with a caption (mbTextFrame=false).
2128 
2129 // Default anchoring for text frames:
2130 // SDRTEXTHORZADJUST_BLOCK, SDRTEXTVERTADJUST_TOP
2131 // = static Pool defaults
2132 // Default anchoring for drawing objects with a caption:
2133 // SDRTEXTHORZADJUST_CENTER, SDRTEXTVERTADJUST_CENTER
2134 // via "hard" attribution of SdrAttrObj
2135 
2136 // Every object derived from SdrTextObj must return an "UnrotatedSnapRect"
2137 // (->TakeUnrotatedSnapRect()) (the reference point for the rotation is the top
2138 // left of the rectangle (maGeo.nRotationAngle)) which is the basis for anchoring
2139 // text. We then subtract the text frame margins from this rectangle, as a re-
2140 // sult we get the anchoring area (->TakeTextAnchorRect()). Within this area, we
2141 // calculate the anchoring point and the painting area, depending on the hori-
2142 // zontal and vertical adjustment of the text (SdrTextVertAdjust,
2143 // SdrTextHorzAdjust).
2144 // In the case of drawing objects with a caption the painting area might well
2145 // be larger than the anchoring area, for text frames on the other hand, it is
2146 // always of the same or a smaller size (except when there are negative text
2147 // frame margins).
2148 
2149 // FitToSize takes priority over text anchoring and AutoGrowHeight/Width. When
2150 // FitToSize is turned on, the painting area is always equal to the anchoring
2151 // area. Additionally, FitToSize doesn't allow automatic line breaks.
2152 
2153 // ContourTextFrame:
2154 // - long rotation angle
2155 // - long text frame margins (maybe later)
2156 // - bool FitToSize (maybe later)
2157 // - bool AutoGrowingWidth/Height (maybe much later)
2158 // - long Min/MaxFrameWidth/Height (maybe much later)
2159 // - enum horizontal text anchoring (maybe later, for now: left, centered)
2160 // - enum vertical text anchoring (maybe later, for now: top)
2161 // - enum ticker text (maybe later, maybe even with correct clipping)
2162 
2163 // When making changes, check these:
2164 // - Paint
2165 // - HitTest
2166 // - ConvertToPoly
2167 // - Edit
2168 // - Printing, Saving, Painting in neighboring View while editing
2169 // - ModelChanged (e. g. through a neighboring View or rulers) while editing
2170 // - FillColorChanged while editing
2171 // - and many more...
2172 
2173 
2174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Shear(const Point &rRef, Degree100 nAngle, double tn, bool bVShear)
Definition: svdobj.cxx:1603
constexpr TypedWhichId< XFormTextHideFormItem > XATTR_FORMTXTHIDEFORM(XATTR_TEXT_FIRST+10)
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_AUTOGROWHEIGHT(SDRATTR_MISC_FIRST+2)
tools::Long GetTextLowerDistance() const
Bottom inner spacing to borders.
Definition: svdotext.cxx:1752
OutDevType GetOutDevType() const
double getY() const
virtual sal_Int32 CheckTextHit(const Point &rPnt) const
returns the index of the text that contains the given point or -1
Definition: svdotext.cxx:2100
virtual void NbcSetOutlinerParaObject(std::optional< OutlinerParaObject > pTextObject) override
Definition: svdotext.cxx:1339
bool IsOverflow() const
void FitFrameToTextSize()
Definition: svdotext.cxx:216
virtual bool IsAutoGrowHeight() const
Definition: svdotext.cxx:304
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
constexpr TypedWhichId< SdrTextHorzAdjustItem > SDRATTR_TEXT_HORZADJUST(SDRATTR_MISC_FIRST+13)
TextChain * GetTextChain() const
Definition: svdmodel.cxx:1821
GDIMetaFile * GetTextScrollMetaFileAndRectangle(tools::Rectangle &rScrollRectangle, tools::Rectangle &rPaintRectangle)
Definition: svdotext.cxx:1799
OutlinerMode
virtual bool NbcAdjustTextFrameWidthAndHeight(bool bHgt=true, bool bWdt=true)
Definition: svdotxat.cxx:240
bool IsChainable() const
Definition: svdotext.cxx:1941
virtual void SetObjectItemDirect(const SfxPoolItem &rItem)=0
Point maTextEditOffset
Definition: svdotext.hxx:198
void ShearPoint(Point &rPnt, const Point &rRef, double tn, bool bVShear=false)
Definition: svdtrans.hxx:109
void SetupOutlinerFormatting(SdrOutliner &rOutl, tools::Rectangle &rPaintRect) const
Setup given Outliner equivalently to SdrTextObj::Paint()
Definition: svdotext.cxx:1300
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
virtual sal_uInt32 GetSnapPointCount() const override
snap to special points of an Object (polygon points, center of circle)
Definition: svdotext.cxx:1124
virtual SdrObjKind GetObjIdentifier() const override
Definition: svdotext.cxx:463
void SetNextLinkInChain(SdrTextObj *)
Definition: svdotext.cxx:2006
void ForceOutlinerParaObject()
Definition: svdotext.cxx:1449
std::string GetValue
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage)
Definition: svdobj.cxx:525
bool equalZero(const T &rfVal)
constexpr tools::Long Left() const
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_AUTOGROWWIDTH(SDRATTR_MISC_FIRST+12)
virtual SdrText * getText(sal_Int32 nIndex) const override
returns the nth available text.
Definition: svdotext.cxx:2074
static SdrObject * ImpGetObjByName(SdrObjList const *pObjList, std::u16string_view aObjName)
Definition: svdotext.cxx:1903
bool IsLinkedText() const
Definition: svdotext.hxx:327
virtual const Size & GetTextSize() const
Definition: svdotext.cxx:283
void SetPaperSize(const Size &rSize)
tools::Long GetTextLeftDistance() const
Left inner spacing to borders.
Definition: svdotext.cxx:1737
SdrTextHorzAdjust
Definition: sdtaitm.hxx:53
tools::Rectangle maRect
Definition: svdotext.hxx:91
tools::Long GetEckenradius() const
Definition: svdotext.cxx:1694
long Long
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_CONTOURFRAME(SDRATTR_MISC_FIRST+21)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_MAXFRAMEWIDTH(SDRATTR_MISC_FIRST+11)
bool ImpCanConvTextToCurve() const
Definition: svdotxtr.cxx:418
bool IsTextFrame() const
Definition: svdotext.hxx:334
std::unique_ptr< SdrText > mpText
Definition: svdotext.hxx:176
double mfSinRotationAngle
Definition: svdtrans.hxx:206
SdrObject * GetObj(size_t nNum) const
Definition: svdpage.cxx:809
SVX_DLLPRIVATE void ImpInitDrawOutliner(SdrOutliner &rOutl) const
Definition: svdotext.cxx:1145
size_t GetObjCount() const
Definition: svdpage.cxx:803
virtual void SetBoundRectDirty()
Definition: svdobj.cxx:317
bool IsInEditMode() const
Definition: svdotext.hxx:314
SdrTextAniKind GetTextAniKind() const
Definition: svdotext.cxx:1757
void ImpSetContourPolygon(SdrOutliner &rOutliner, tools::Rectangle const &rAnchorRect, bool bLineWidth) const
Definition: svdotext.cxx:571
void RotatePoly(tools::Polygon &rPoly, const Point &rRef, double sn, double cs)
Definition: svdtrans.cxx:81
SVX_DLLPRIVATE void ImpSetupDrawOutlinerForPaint(bool bContourFrame, SdrOutliner &rOutliner, tools::Rectangle &rTextRect, tools::Rectangle &rAnchorRect, tools::Rectangle &rPaintRect, Fraction &aFitXCorrection) const
Definition: svdotext.cxx:1175
GDIMetaFile * GetConnectMetaFile() const
sal_Int32 GetParagraphCount() const
SVX_DLLPRIVATE void ImpDeregisterLink()
Definition: svdotxln.cxx:266
tools::Long GetMinTextFrameHeight() const
Definition: svdotext.cxx:1699
void ExecuteUnderflow(SdrOutliner *)
void CheckPortionInfo(const SdrOutliner &rOutliner)
Definition: svdtext.cxx:42
virtual OUString TakeObjNameSingul() const override
Definition: svdotext.cxx:994
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXTCOLUMNS_SPACING(SDRATTR_TEXTCOLUMNS_FIRST+1)
bool mbTextAnimationAllowed
Definition: svdotext.hxx:236
bool IsTopToBottom() const
virtual void setActiveText(sal_Int32 nIndex)
changes the current active text
Definition: svdotext.cxx:2095
bool IsRecord() const
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix &rMatrix, const basegfx::B2DPolyPolygon &rPolyPolygon) override
Definition: svdotext.cxx:1607
virtual void NbcReformatText() override
Definition: svdotext.cxx:1385
void SetTextColumnsSpacing(sal_Int32 nSpacing)
Definition: svdotext.cxx:1792
static void Free(SdrObject *&_rpObject)
Definition: svdobj.cxx:472
void RecalcTan()
Definition: svdtrans.cxx:456
virtual sdr::properties::BaseProperties & GetProperties() const
Definition: svdobj.cxx:211
void Init(OutlinerMode nMode)
void SetRefMapMode(const MapMode &)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_CORNER_RADIUS(SDRATTR_MISC_FIRST+0)
virtual const tools::Rectangle & GetSnapRect() const override
Definition: svdoattr.cxx:49
virtual SdrObjectUniquePtr getFullDragClone() const override
Definition: svdotext.cxx:2050
virtual void RecalcSnapRect() override
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
Definition: svdotext.cxx:1114
EEControlBits
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:174
void setX(double fX)
virtual bool HasText() const override
Definition: svdotxat.cxx:417
sdr::contact::ViewContact & GetViewContact() const
Definition: svdobj.cxx:252
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
Definition: sdtagitm.hxx:25
SdrTextAniKind
Animation type for text frame.
Definition: sdtakitm.hxx:29
bool mbInEditMode
Definition: svdotext.hxx:223
EETextFormat
void ShearPoly(tools::Polygon &rPoly, const Point &rRef, double tn)
Definition: svdtrans.cxx:147
SdrObjKind
Definition: svdobjkind.hxx:24
TextChain * GetTextChain() const
Definition: svdotext.cxx:1462
bool equalZero() const
tools::Long GetMaxTextFrameHeight() const
Definition: svdotext.cxx:1704
constexpr tools::Long Width() const
Provides information about various ZObject properties.
Definition: svdobj.hxx:196
OutlinerParaObject * GetOutlinerParaObject()
Definition: svdtext.cxx:89
virtual ~SdrTextObj() override
Definition: svdotext.cxx:207
SdrMetricItem makeSdrTextMinFrameWidthItem(tools::Long mnWidth)
Definition: sdtmfitm.hxx:35
void Record(OutputDevice *pOutDev)
void SetControlWord(EEControlBits nWord)
SdrTextObj * mpPrevInChain
Definition: svdotext.hxx:212
SdrPage * getSdrPageFromSdrObject() const
Definition: svdobj.cxx:270
SdrTextObj(SdrModel &rSdrModel)
Definition: svdotext.cxx:71
const vcl::Font & GetFont() const
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdotext.cxx:1417
B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fShearX, double fRadiant, double fTranslateX, double fTranslateY)
void SetTextSizeDirty()
Definition: svdotext.hxx:276
The transformation of a rectangle into a polygon, by using angle parameters from GeoStat.
Definition: svdtrans.hxx:201
static bool IsFuzzing()
constexpr Point BottomLeft() const
OUString SvxResId(TranslateId aId)
Definition: dialmgr.cxx:24
virtual bool IsReallyEdited() const
returns true only if we are in edit mode and the user actually changed anything
Definition: svdotext.cxx:1687
const SfxItemSet & GetObjectItemSet() const
Definition: svdobj.cxx:1976
constexpr TypedWhichId< SdrTextAniDirectionItem > SDRATTR_TEXT_ANIDIRECTION(SDRATTR_MISC_FIRST+15)
SfxStyleSheet * GetStyleSheet() const
Definition: svdobj.cxx:2228
bool mbNoShear
Definition: svdotext.hxx:220
oslFileHandle & pOut
tools::Rectangle maRect
Definition: svdotext.hxx:170
constexpr tools::Long GetWidth() const
bool mbDisableAutoWidthOnDragging
Definition: svdotext.hxx:233
void SetFixedCellHeight(bool bUseFixedCellHeight)
css::drawing::TextFitToSizeType GetFitToSize() const
Definition: svdotext.cxx:1434
virtual void onEditOutlinerStatusEvent(EditStatus *pEditStatus)
called from the SdrObjEditView during text edit when the status of the edit outliner changes ...
Definition: svdotext.cxx:1875
tools::Long GetMaxTextFrameWidth() const
Definition: svdotext.cxx:1714
bool IsUnderflow() const
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdotext.cxx:60
EEControlBits GetControlWord() const
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
Definition: sdtagitm.hxx:30
void SetObjectItem(const SfxPoolItem &rItem)
Definition: svdobj.cxx:1986
virtual bool IsAutoGrowWidth() const
Definition: svdotext.cxx:329
tools::Rectangle maSnapRect
Definition: svdoattr.hxx:41
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_SHADOW(SDRATTR_SHADOW_FIRST+0)
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_LOWERDIST(SDRATTR_MISC_FIRST+7)
void SetTextColumnsNumber(sal_Int16 nColumns)
Definition: svdotext.cxx:1777
double mfTanShearAngle
Definition: svdtrans.hxx:205
OutputDevice * GetRefDevice() const
constexpr TypedWhichId< XFormTextStyleItem > XATTR_FORMTXTSTYLE(XATTR_TEXT_FIRST)
virtual void SetBoundAndSnapRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:511
bool GetPreventChainable() const
Definition: svdotext.cxx:2044
ErrCode Read(SvStream &rInput, const OUString &rBaseURL, EETextFormat, SvKeyValueIterator *pHTTPHeaderAttrs=nullptr)
constexpr bool IsEmpty() const
constexpr void SetLeft(tools::Long v)
#define SAL_N_ELEMENTS(arr)
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdotext.cxx:439
virtual SdrTextObj * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdotext.cxx:1071
DocumentType eType
SdrObjKind meTextKind
Definition: svdotext.hxx:192
void NbcSetOutlinerParaObjectForText(std::optional< OutlinerParaObject > pTextObject, SdrText *pText)
Definition: svdotext.cxx:1353
OUTDEV_PRINTER
const SfxPoolItem & GetObjectItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:2011
SdrTextHorzAdjust GetTextHorizontalAdjust() const
Definition: svdotext.cxx:356
bool mbTextFrame
Definition: svdotext.hxx:219
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)
constexpr TypedWhichId< SdrTextFitToSizeTypeItem > SDRATTR_TEXT_FITTOSIZE(SDRATTR_MISC_FIRST+3)
const EditTextObject & GetTextObject() const
void SetMinColumnWrapHeight(tools::Long nVal)
virtual void RestoreGeoData(const SdrObjGeoData &rGeo)
Definition: svdobj.cxx:1930
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage) override
Definition: svdotext.cxx:490
UNDERLYING_TYPE get() const
SdrTextVertAdjust GetTextVerticalAdjust() const
Definition: svdotext.cxx:388
bool mbSupportTextIndentingOnLineWidthChange
Definition: svdobj.hxx:913
void UpdateOutlinerFormatting(SdrOutliner &rOutl, tools::Rectangle &rPaintRect) const
Update given Outliner equivalently to SdrTextObj::Paint()
Definition: svdotext.cxx:1306
void SetText(const OutlinerParaObject &)
int i
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Size maTextSize
Definition: svdotext.hxx:179
bool IsWriter() const
Definition: svdmodel.hxx:582
bool IsFitToSize() const
returns true if the old feature for fitting shape content should into shape is enabled. implies IsAutoFit()==false!
Definition: svdotext.cxx:1858
OUString sName
SdrOutliner * mpEditingOutliner
Definition: svdotext.hxx:184
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
void SetGlobalCharStretching(sal_uInt16 nX=100, sal_uInt16 nY=100)
void rotate(double fRadiant)
tools::Long FRound(double fVal)
void SetVertical(bool bNew)
#define LANGUAGE_SYSTEM
void ExecuteOverflow(SdrOutliner *, SdrOutliner *)
SdrMetricItem makeSdrEckenradiusItem(tools::Long nRadius)
Definition: sderitm.hxx:25
void SetSize(const Size &rSize)
void BroadcastObjectChange() const
Definition: svdobj.cxx:1010
constexpr TypedWhichId< SdrTextVertAdjustItem > SDRATTR_TEXT_VERTADJUST(SDRATTR_MISC_FIRST+8)
virtual OUString GetText(sal_Int32 nPara) const =0
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_LEFTDIST(SDRATTR_MISC_FIRST+4)
void ActionChanged() const
Definition: svdobj.cxx:264
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_MAXFRAMEHEIGHT(SDRATTR_MISC_FIRST+9)
virtual void SaveGeoData(SdrObjGeoData &rGeo) const
Definition: svdobj.cxx:1907
void SetText(const OUString &rStr)
Definition: svdotext.cxx:251
constexpr tools::Long Right() const
static void ImpUpdateChainLinks(SdrTextObj *pTextObj, std::u16string_view aNextLinkName)
Definition: svdotext.cxx:1919
TitleText, special text object for StarDraw.
EditStatusFlags
float u
bool mbIsUnchainableClone
Definition: svdotext.hxx:208
virtual basegfx::B2DPolyPolygon TakeContour() const
contour for TextToContour
Definition: svdobj.cxx:1137
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_MINFRAMEWIDTH(SDRATTR_MISC_FIRST+10)
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:280
SdrObjUserCall * m_pUserCall
Definition: svdobj.hxx:888
void transform(const basegfx::B2DHomMatrix &rMatrix)
bool IsModified() const
virtual void TakeTextAnchorRect(::tools::Rectangle &rAnchorRect) const
Definition: svdotext.cxx:667
bool IsHideContour() const
Definition: svdotext.cxx:1725
sal_Int16 GetTextColumnsNumber() const
Definition: svdotext.cxx:1772
bool mbInDownScale
Definition: svdotext.hxx:239
sal_uInt16 GetFontScaleY() const
Definition: svdotext.cxx:1211
constexpr tools::Long Top() const
virtual void SetLogicRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1703
tools::Polygon Rect2Poly(const tools::Rectangle &rRect, const GeoStat &rGeo)
Definition: svdtrans.cxx:467
double toRadians(D x)
virtual void Move(const Size &rSiz)
Definition: svdobj.cxx:1538
constexpr void SetRight(tools::Long v)
void SetMergedItem(const SfxPoolItem &rItem)
Definition: svdobj.cxx:1991
OUString GetText(Paragraph const *pPara, sal_Int32 nParaCount=1) const
constexpr TypedWhichId< SfxStringItem > SDRATTR_TEXT_CHAINNEXTNAME(SDRATTR_MISC_FIRST+25)
constexpr void SetBottom(tools::Long v)
bool IsTopToBottom() const
virtual void AdaptTextMinSize()
Definition: svdotext.cxx:517
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_MINFRAMEHEIGHT(SDRATTR_MISC_FIRST+1)
::basegfx::B2DPolygon getB2DPolygon() const
virtual SdrText * getActiveText() const
returns the currently active text.
Definition: svdotext.cxx:2065
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:2016
void WindStart()
std::optional< OutlinerParaObject > CreateParaObject(sal_Int32 nStartPara=0, sal_Int32 nParaCount=EE_PARA_ALL) const
void flushViewObjectContacts(bool bWithHierarchy=true)
bool IsContourTextFrame() const
Definition: svdotext.cxx:1731
Abstract DrawObject.
Definition: svdobj.hxx:260
virtual basegfx::B2DPolyPolygon TakeContour() const override
contour for TextToContour
Definition: svdotext.cxx:1087
SfxItemPool * GetPool() const
void ImpCheckShear()
Definition: svdotext.cxx:430
void Draw(OutputDevice &rOutDev, const tools::Rectangle &rOutRect)
void ForceOutlinerParaObject(OutlinerMode nOutlMode)
Definition: svdtext.cxx:118
virtual void Mirror(const Point &rRef1, const Point &rRef2)
Definition: svdobj.cxx:1594
constexpr void SetTop(tools::Long v)
OUString GetName() const
Definition: svdobj.cxx:803
#define Y
SVX_DLLPRIVATE void ImpRegisterLink()
Definition: svdotxln.cxx:254
Degree100 NormAngle36000(Degree100 a)
Normalize angle to -180.00..179.99.
Definition: svdtrans.cxx:408
tools::Long GetMinTextFrameWidth() const
Definition: svdotext.cxx:1709
constexpr Point Center() const
constexpr Point TopLeft() const
constexpr T & temporary(T &&x)
SdrTextObj * GetNextLinkInChain() const
Definition: svdotext.cxx:1994
Paragraph * GetParagraph(sal_Int32 nAbsPos) const
tools::Long AdjustTop(tools::Long nVertMoveDelta)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_UPPERDIST(SDRATTR_MISC_FIRST+6)
bool HasTextColumnsNumber() const
Definition: svdotext.cxx:1767
void NbcSetEckenradius(tools::Long nRad)
Definition: svdotext.cxx:510
constexpr tools::Long Bottom() const
bool IsPause() const
bool CanCreateEditOutlinerParaObject() const
Definition: svdotext.cxx:864
tools::Long GetTextRightDistance() const
Right inner spacing to borders.
Definition: svdotext.cxx:1742
void setY(double fY)
void SetObjectItemNoBroadcast(const SfxPoolItem &rItem)
Definition: svdotext.cxx:2105
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
void SetPolygon(const basegfx::B2DPolyPolygon &rPolyPolygon)
virtual const tools::Rectangle & GetLastBoundRect() const
Definition: svdobj.cxx:972
sal_Int16 GetMaxScale() const
Definition: sdtfsitm.hxx:59
void RotatePoint(Point &rPnt, const Point &rRef, double sn, double cs)
Definition: svdtrans.hxx:101
bool IsEffectivelyVertical() const
constexpr Size GetSize() const
EditStatusFlags GetStatusWord() const
virtual bool IsVerticalWriting() const
Definition: svdotext.cxx:1470
tools::Long GetTextUpperDistance() const
Top inner spacing to borders.
Definition: svdotext.cxx:1747
void SetMaxAutoPaperSize(const Size &rSz)
void Pause(bool bPause)
void GetGlobalCharStretching(sal_uInt16 &rX, sal_uInt16 &rY) const
virtual void TakeTextRect(SdrOutliner &rOutliner, tools::Rectangle &rTextRect, bool bNoEditText, tools::Rectangle *pAnchorRect, bool bLineWidth=true) const
Definition: svdotext.cxx:691
void ReformatText()
Definition: svdtext.cxx:62
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_RIGHTDIST(SDRATTR_MISC_FIRST+5)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
constexpr tools::Long Height() const
virtual OutlinerParaObject * GetOutlinerParaObject() const override
Definition: svdotext.cxx:1330
void RecalcSinCos()
Definition: svdtrans.cxx:444
OString stripStart(std::string_view rIn, char c)
virtual bool AdjustTextFrameWidthAndHeight()
Definition: svdotxat.cxx:256
void SetObjectItemSet(const SfxItemSet &rSet)
Definition: svdobj.cxx:2001
SdrMetricItem makeSdrTextMinFrameHeightItem(tools::Long mnHeight)
Definition: sdtmfitm.hxx:25
void SetFont(const vcl::Font &rNewFont)
GeoStat maGeo
Definition: svdotext.hxx:173
tools::Long GetTextHeight() const
Degree100 nRotationAngle
Definition: svdtrans.hxx:203
#define SAL_INFO(area, stream)
OUString aName
constexpr Point TopRight() const
void SetMinAutoPaperSize(const Size &rSz)
void NbcSetText(const OUString &rStr)
Definition: svdotext.cxx:241
double mfCosRotationAngle
Definition: svdtrans.hxx:207
constexpr TypedWhichId< SdrTextAniKindItem > SDRATTR_TEXT_ANIKIND(SDRATTR_MISC_FIRST+14)
bool IsTopToBottom() const
Definition: svdotext.cxx:1553
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
void ImpSetTextStyleSheetListeners()
Definition: svdotxat.cxx:297
void onChainingEvent()
called from the SdrObjEditView during text edit when a chain of boxes is to be updated ...
Definition: svdotext.cxx:1964
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
Definition: svdotext.cxx:1425
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:98
SdrOnOffItem makeSdrShadowItem(bool bShadow)
Definition: sdshitm.hxx:25
virtual SdrObjectUniquePtr getFullDragClone() const
Definition: svdobj.cxx:1341
bool SetUpdateLayout(bool bUpdate)
SdrTextAniDirection GetTextAniDirection() const
Definition: svdotext.cxx:1762
SdrTextAniDirection
Definition: sdtaditm.hxx:29
constexpr TypedWhichId< SdrTextFixedCellHeightItem > SDRATTR_TEXT_USEFIXEDCELLHEIGHT(SDRATTR_MISC_FIRST+23)
const Point & GetAnchorPos() const
Definition: svdobj.cxx:1660
void SetStyleSheet(sal_Int32 nPara, SfxStyleSheet *pStyle)
constexpr TypedWhichId< SfxInt16Item > SDRATTR_TEXTCOLUMNS_NUMBER(SDRATTR_TEXTCOLUMNS_FIRST+0)
bool IsOutlText() const
Definition: svdotext.hxx:335
virtual void Rotate(const Point &rRef, Degree100 nAngle, double sn, double cs)
Definition: svdobj.cxx:1583
void AdjustRectToTextDistance(tools::Rectangle &rAnchorRect) const
Definition: svdotext.cxx:634
bool IsVertical() const
constexpr Point BottomRight() const
std::optional< OutlinerParaObject > CreateEditOutlinerParaObject() const
Definition: svdotext.cxx:873
Size CalcTextSizeNTP()
virtual Point GetSnapPoint(sal_uInt32 i) const override
Definition: svdotext.cxx:1129
virtual void SetSnapRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1694
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
bool HasTextColumnsSpacing() const
Definition: svdotext.cxx:1782
bool IsAutoFit() const
returns true if the PPT autofit of text into shape bounds is enabled. implies IsFitToSize()==false! ...
Definition: svdotext.cxx:1853
virtual sal_Int32 getTextCount() const override
returns the number of texts available for this object.
Definition: svdotext.cxx:2089
void SetTextObj(const SdrTextObj *pObj)
Definition: svdoutl.cxx:40
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
double getX() const
virtual void SetOutlinerParaObject(std::optional< OutlinerParaObject > pTextObject)
Definition: svdtext.cxx:73
virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix &rMatrix, basegfx::B2DPolyPolygon &rPolyPolygon) const override
Definition: svdotext.cxx:1572
bool LineGeometryUsageIsNecessary() const
Definition: svdobj.cxx:1067
tools::Rectangle GetBoundRect() const
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:373
sal_Int32 GetTextColumnsSpacing() const
Definition: svdotext.cxx:1787
const SdrTextObj * GetTextObj() const
Definition: svdoutl.cxx:87
void Clear()
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
Definition: svdotxtr.cxx:74
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdotext.cxx:66
virtual void SetChanged()
Definition: svdobj.cxx:1034
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
Definition: svdotext.cxx:1076
virtual void TakeUnrotatedSnapRect(tools::Rectangle &rRect) const
Definition: svdotext.cxx:628
SdrTextObj * mpNextInChain
Definition: svdotext.hxx:211
SdrTextObj * GetPrevLinkInChain() const
Definition: svdotext.cxx:2032
static void ImpJustifyRect(tools::Rectangle &rRect)
Definition: svdotext.cxx:421
SdrOutliner & ImpGetDrawOutliner() const
Definition: svdotext.cxx:1164
aStr
Size CalcTextSize()
Degree100 nShearAngle
Definition: svdtrans.hxx:204
static bool HasTextImpl(SdrOutliner const *pOutliner)
returns false if the given pointer is NULL or if the given SdrOutliner contains no text...
Definition: svdotext.cxx:468
virtual void SetVerticalWriting(bool bVertical)
Definition: svdotext.cxx:1486
const tools::Rectangle & GetGeoRect() const
Definition: svdotext.cxx:1444
SdrTextVertAdjust
Definition: sdtaitm.hxx:29
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
Definition: svdobj.cxx:2748
bool mbTextSizeDirty
Definition: svdotext.hxx:221
virtual bool IsFontwork() const
Definition: svdotext.cxx:1719
virtual std::unique_ptr< SdrObjGeoData > NewGeoData() const override
A derived class must override these 3 methods if it has own geometric data that must be saved for Und...
Definition: svdotext.cxx:1412
scroll back and forth
static void ImpSetCharStretching(SdrOutliner &rOutliner, const Size &rTextSize, const Size &rShapeSize, Fraction &rFitXCorrection)
Definition: svdotext.cxx:884
void ImpAutoFitText(SdrOutliner &rOutliner) const
Definition: svdotext.cxx:1222
void SetTextAnimationAllowed(bool bNew)
Definition: svdotext.cxx:1865
void ClearPolygon()
constexpr tools::Long GetHeight() const
virtual OUString TakeObjNamePlural() const override
Definition: svdotext.cxx:1053
const Size & GetPaperSize() const
virtual void CheckForFlowEvents(SdrOutliner *) override