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