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