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 (m_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 (m_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  OUString sName(aStr);
1021 
1022  OUString aName(GetName());
1023  if (!aName.isEmpty())
1024  sName += " '" + aName + "'";
1025 
1026  return sName;
1027 }
1028 
1030 {
1031  OUString sName;
1032  switch (eTextKind) {
1033  case OBJ_OUTLINETEXT: sName=SvxResId(STR_ObjNamePluralOUTLINETEXT); break;
1034  case OBJ_TITLETEXT : sName=SvxResId(STR_ObjNamePluralTITLETEXT); break;
1035  default: {
1036  if (IsLinkedText()) {
1037  sName=SvxResId(STR_ObjNamePluralTEXTLNK);
1038  } else {
1039  sName=SvxResId(STR_ObjNamePluralTEXT);
1040  }
1041  } break;
1042  } // switch
1043  return sName;
1044 }
1045 
1047 {
1048  return new SdrTextObj(rTargetModel, *this);
1049 }
1050 
1052 {
1053  tools::Polygon aPol(maRect);
1056 
1057  basegfx::B2DPolyPolygon aRetval;
1058  aRetval.append(aPol.getB2DPolygon());
1059  return aRetval;
1060 }
1061 
1063 {
1065 
1066  // and now add the BoundRect of the text, if necessary
1068  {
1069  // using Clone()-Paint() strategy inside TakeContour() leaves a destroyed
1070  // SdrObject as pointer in DrawOutliner. Set *this again in fetching the outliner
1071  // in every case
1072  SdrOutliner& rOutliner=ImpGetDrawOutliner();
1073 
1074  tools::Rectangle aAnchor2;
1075  tools::Rectangle aR;
1076  TakeTextRect(rOutliner,aR,false,&aAnchor2);
1077  rOutliner.Clear();
1078  bool bFitToSize(IsFitToSize());
1079  if (bFitToSize) aR=aAnchor2;
1080  tools::Polygon aPol(aR);
1082 
1083  aRetval.append(aPol.getB2DPolygon());
1084  }
1085 
1086  return aRetval;
1087 }
1088 
1090 {
1092  {
1093  tools::Polygon aPol(maRect);
1096  maSnapRect=aPol.GetBoundRect();
1097  } else {
1098  maSnapRect = maRect;
1099  }
1100 }
1101 
1103 {
1104  return 4;
1105 }
1106 
1107 Point SdrTextObj::GetSnapPoint(sal_uInt32 i) const
1108 {
1109  Point aP;
1110  switch (i) {
1111  case 0: aP=maRect.TopLeft(); break;
1112  case 1: aP=maRect.TopRight(); break;
1113  case 2: aP=maRect.BottomLeft(); break;
1114  case 3: aP=maRect.BottomRight(); break;
1115  default: aP=maRect.Center(); break;
1116  }
1119  return aP;
1120 }
1121 
1122 // Extracted from ImpGetDrawOutliner()
1124 {
1125  rOutl.SetUpdateMode(false);
1126  OutlinerMode nOutlinerMode = OutlinerMode::OutlineObject;
1127  if ( !IsOutlText() )
1128  nOutlinerMode = OutlinerMode::TextObject;
1129  rOutl.Init( nOutlinerMode );
1130 
1131  rOutl.SetGlobalCharStretching();
1132  EEControlBits nStat=rOutl.GetControlWord();
1133  nStat &= ~EEControlBits(EEControlBits::STRETCHING|EEControlBits::AUTOPAGESIZE);
1134  rOutl.SetControlWord(nStat);
1135  Size aMaxSize(100000,100000);
1136  rOutl.SetMinAutoPaperSize(Size());
1137  rOutl.SetMaxAutoPaperSize(aMaxSize);
1138  rOutl.SetPaperSize(aMaxSize);
1139  rOutl.ClearPolygon();
1140 }
1141 
1143 {
1144  SdrOutliner& rOutl(getSdrModelFromSdrObject().GetDrawOutliner(this));
1145 
1146  // Code extracted to ImpInitDrawOutliner()
1147  ImpInitDrawOutliner( rOutl );
1148 
1149  return rOutl;
1150 }
1151 
1152 // Extracted from Paint()
1154  SdrOutliner& rOutliner,
1155  tools::Rectangle& rTextRect,
1156  tools::Rectangle& rAnchorRect,
1157  tools::Rectangle& rPaintRect,
1158  Fraction& rFitXCorrection ) const
1159 {
1160  if (!bContourFrame)
1161  {
1162  // FitToSize can't be used together with ContourFrame for now
1163  if (IsFitToSize() || IsAutoFit())
1164  {
1165  EEControlBits nStat=rOutliner.GetControlWord();
1166  nStat|=EEControlBits::STRETCHING|EEControlBits::AUTOPAGESIZE;
1167  rOutliner.SetControlWord(nStat);
1168  }
1169  }
1171  TakeTextRect(rOutliner, rTextRect, false, &rAnchorRect);
1172  rPaintRect = rTextRect;
1173 
1174  if (bContourFrame)
1175  return;
1176 
1177  // FitToSize can't be used together with ContourFrame for now
1178  if (IsFitToSize())
1179  {
1180  ImpSetCharStretching(rOutliner,rTextRect.GetSize(),rAnchorRect.GetSize(),rFitXCorrection);
1181  rPaintRect=rAnchorRect;
1182  }
1183  else if (IsAutoFit())
1184  {
1185  ImpAutoFitText(rOutliner);
1186  }
1187 }
1188 
1190 {
1191  SdrText* pText = getActiveText();
1192  if (pText == nullptr || !pText->GetOutlinerParaObject())
1193  return 1.0;
1194 
1195  SdrOutliner& rOutliner = ImpGetDrawOutliner();
1196  const Size aShapeSize = GetSnapRect().GetSize();
1197  const Size aSize(aShapeSize.Width() - GetTextLeftDistance() - GetTextRightDistance(),
1198  aShapeSize.Height() - GetTextUpperDistance() - GetTextLowerDistance());
1199 
1200  rOutliner.SetPaperSize(aSize);
1201  rOutliner.SetUpdateMode(true);
1202  rOutliner.SetText(*pText->GetOutlinerParaObject());
1203  bool bIsVerticalWriting = IsVerticalWriting();
1204 
1205  // Algorithm from SdrTextObj::ImpAutoFitText
1206 
1207  sal_uInt16 nMinStretchX = 0, nMinStretchY = 0;
1208  sal_uInt16 nCurrStretchX = 100, nCurrStretchY = 100;
1209  sal_uInt16 aOldStretchXVals[] = { 0,0,0 };
1210  const size_t aStretchArySize = SAL_N_ELEMENTS(aOldStretchXVals);
1211  for (unsigned int i = 0; i<aStretchArySize; ++i)
1212  {
1213  const Size aCurrTextSize = rOutliner.CalcTextSizeNTP();
1214  double fFactor(1.0);
1215  if (bIsVerticalWriting)
1216  {
1217  if (aCurrTextSize.Width() != 0)
1218  {
1219  fFactor = double(aSize.Width()) / aCurrTextSize.Width();
1220  }
1221  }
1222  else if (aCurrTextSize.Height() != 0)
1223  {
1224  fFactor = double(aSize.Height()) / aCurrTextSize.Height();
1225  }
1226  fFactor = std::sqrt(fFactor);
1227 
1228  rOutliner.GetGlobalCharStretching(nCurrStretchX, nCurrStretchY);
1229 
1230  if (fFactor >= 1.0)
1231  {
1232  nMinStretchX = std::max(nMinStretchX, nCurrStretchX);
1233  nMinStretchY = std::max(nMinStretchY, nCurrStretchY);
1234  }
1235 
1236  aOldStretchXVals[i] = nCurrStretchX;
1237  if (std::find(aOldStretchXVals, aOldStretchXVals + i, nCurrStretchX) != aOldStretchXVals + i)
1238  break; // same value already attained once; algo is looping, exit
1239 
1240  if (fFactor < 1.0 || nCurrStretchX != 100)
1241  {
1242  nCurrStretchX = sal::static_int_cast<sal_uInt16>(nCurrStretchX*fFactor);
1243  nCurrStretchY = sal::static_int_cast<sal_uInt16>(nCurrStretchY*fFactor);
1244  rOutliner.SetGlobalCharStretching(std::min(sal_uInt16(100), nCurrStretchX),
1245  std::min(sal_uInt16(100), nCurrStretchY));
1246  }
1247  }
1248 
1249  return std::min(sal_uInt16(100), nCurrStretchY) / 100.0;
1250 }
1251 
1252 void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner ) const
1253 {
1254  const Size aShapeSize=GetSnapRect().GetSize();
1255  ImpAutoFitText( rOutliner,
1258  IsVerticalWriting() );
1259 }
1260 
1261 void SdrTextObj::ImpAutoFitText(SdrOutliner& rOutliner, const Size& rTextSize,
1262  bool bIsVerticalWriting) const
1263 {
1264  // EditEngine formatting is unstable enough for
1265  // line-breaking text that we need some more samples
1266 
1267  // loop early-exits if we detect an already attained value
1268  sal_uInt16 nMinStretchX=0, nMinStretchY=0;
1269  sal_uInt16 aOldStretchXVals[]={0,0,0,0,0,0,0,0,0,0};
1270  const size_t aStretchArySize=SAL_N_ELEMENTS(aOldStretchXVals);
1271  for(unsigned int i=0; i<aStretchArySize; ++i)
1272  {
1273  const Size aCurrTextSize = rOutliner.CalcTextSizeNTP();
1274  double fFactor(1.0);
1275  if( bIsVerticalWriting )
1276  {
1277  if (aCurrTextSize.Width() != 0)
1278  {
1279  fFactor = double(rTextSize.Width())/aCurrTextSize.Width();
1280  }
1281  }
1282  else if (aCurrTextSize.Height() != 0)
1283  {
1284  fFactor = double(rTextSize.Height())/aCurrTextSize.Height();
1285  }
1286  // fFactor scales in both x and y directions
1287  // - this is fine for bulleted words
1288  // - but it scales too much for a long paragraph
1289  // - taking sqrt scales long paragraphs the best
1290  // - bulleted words will have to go through more iterations
1291  fFactor = std::sqrt(fFactor);
1292 
1293  sal_uInt16 nCurrStretchX, nCurrStretchY;
1294  rOutliner.GetGlobalCharStretching(nCurrStretchX, nCurrStretchY);
1295 
1296  if (fFactor >= 1.0 )
1297  {
1298  // resulting text area fits into available shape rect -
1299  // err on the larger stretching, to optimally fill area
1300  nMinStretchX = std::max(nMinStretchX,nCurrStretchX);
1301  nMinStretchY = std::max(nMinStretchY,nCurrStretchY);
1302  }
1303 
1304  aOldStretchXVals[i] = nCurrStretchX;
1305  if( std::find(aOldStretchXVals, aOldStretchXVals+i, nCurrStretchX) != aOldStretchXVals+i )
1306  break; // same value already attained once; algo is looping, exit
1307 
1308  if (fFactor < 1.0 || nCurrStretchX != 100)
1309  {
1310  nCurrStretchX = sal::static_int_cast<sal_uInt16>(nCurrStretchX*fFactor);
1311  nCurrStretchY = sal::static_int_cast<sal_uInt16>(nCurrStretchY*fFactor);
1312  rOutliner.SetGlobalCharStretching(std::min(sal_uInt16(100),nCurrStretchX),
1313  std::min(sal_uInt16(100),nCurrStretchY));
1314  SAL_INFO("svx", "zoom is " << nCurrStretchX);
1315  }
1316  }
1317 
1319  if (rItem.GetMaxScale() > 0)
1320  {
1321  nMinStretchX = std::min<sal_uInt16>(rItem.GetMaxScale(), nMinStretchX);
1322  nMinStretchY = std::min<sal_uInt16>(rItem.GetMaxScale(), nMinStretchY);
1323  }
1324 
1325  SAL_INFO("svx", "final zoom is " << nMinStretchX);
1326  rOutliner.SetGlobalCharStretching(std::min(sal_uInt16(100),nMinStretchX),
1327  std::min(sal_uInt16(100),nMinStretchY));
1328 }
1329 
1331 {
1332  ImpInitDrawOutliner( rOutl );
1333  UpdateOutlinerFormatting( rOutl, rPaintRect );
1334 }
1335 
1337 {
1338  tools::Rectangle aTextRect;
1339  tools::Rectangle aAnchorRect;
1340  Fraction aFitXCorrection(1,1);
1341 
1342  const bool bContourFrame(IsContourTextFrame());
1343  const MapMode aMapMode(
1344  getSdrModelFromSdrObject().GetScaleUnit(),
1345  Point(0,0),
1346  getSdrModelFromSdrObject().GetScaleFraction(),
1347  getSdrModelFromSdrObject().GetScaleFraction());
1348 
1349  rOutl.SetRefMapMode(aMapMode);
1351  bContourFrame,
1352  rOutl,
1353  aTextRect,
1354  aAnchorRect,
1355  rPaintRect,
1356  aFitXCorrection);
1357 }
1358 
1359 
1361 {
1362  SdrText* pText = getActiveText();
1363  if( pText )
1364  return pText->GetOutlinerParaObject();
1365  else
1366  return nullptr;
1367 }
1368 
1369 void SdrTextObj::NbcSetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject)
1370 {
1371  NbcSetOutlinerParaObjectForText( std::move(pTextObject), getActiveText() );
1372 }
1373 
1374 void SdrTextObj::NbcSetOutlinerParaObjectForText( std::unique_ptr<OutlinerParaObject> pTextObject, SdrText* pText )
1375 {
1376  if( pText )
1377  pText->SetOutlinerParaObject( std::move(pTextObject) );
1378 
1379  if (pText && pText->GetOutlinerParaObject())
1380  {
1382  ? css::text::WritingMode_TB_RL
1383  : css::text::WritingMode_LR_TB,
1385  GetProperties().SetObjectItemDirect(aWritingMode);
1386  }
1387 
1388  SetTextSizeDirty();
1389  if (IsTextFrame() && (IsAutoGrowHeight() || IsAutoGrowWidth()))
1390  { // adapt text frame!
1392  }
1393  if (!IsTextFrame())
1394  {
1395  // the SnapRect keeps its size
1396  SetRectsDirty(true);
1397  }
1398 
1399  // always invalidate BoundRect on change
1401  ActionChanged();
1402 
1404 }
1405 
1407 {
1408  SdrText* pText = getActiveText();
1409  if( !(pText && pText->GetOutlinerParaObject()) )
1410  return;
1411 
1412  pText->ReformatText();
1413  if (bTextFrame)
1414  {
1416  }
1417  else
1418  {
1419  // the SnapRect keeps its size
1421  SetRectsDirty(true);
1422  }
1423  SetTextSizeDirty();
1424  ActionChanged();
1425  // i22396
1426  // Necessary here since we have no compare operator at the outliner
1427  // para object which may detect changes regarding the combination
1428  // of outliner para data and configuration (e.g., change of
1429  // formatting of text numerals)
1431 }
1432 
1433 std::unique_ptr<SdrObjGeoData> SdrTextObj::NewGeoData() const
1434 {
1435  return std::make_unique<SdrTextObjGeoData>();
1436 }
1437 
1439 {
1441  SdrTextObjGeoData& rTGeo=static_cast<SdrTextObjGeoData&>(rGeo);
1442  rTGeo.aRect = maRect;
1443  rTGeo.aGeo =aGeo;
1444 }
1445 
1447 { // RectsDirty is called by SdrObject
1449  const SdrTextObjGeoData& rTGeo=static_cast<const SdrTextObjGeoData&>(rGeo);
1450  NbcSetLogicRect(rTGeo.aRect);
1451  aGeo =rTGeo.aGeo;
1452  SetTextSizeDirty();
1453 }
1454 
1455 drawing::TextFitToSizeType SdrTextObj::GetFitToSize() const
1456 {
1457  drawing::TextFitToSizeType eType = drawing::TextFitToSizeType_NONE;
1458 
1459  if(!IsAutoGrowWidth())
1460  eType = GetObjectItem(SDRATTR_TEXT_FITTOSIZE).GetValue();
1461 
1462  return eType;
1463 }
1464 
1466 {
1467  return maRect;
1468 }
1469 
1471 {
1472  SdrText* pText = getActiveText();
1473  if( pText && (pText->GetOutlinerParaObject() == nullptr) )
1474  {
1475  OutlinerMode nOutlMode = OutlinerMode::TextObject;
1476  if( IsTextFrame() && eTextKind == OBJ_OUTLINETEXT )
1477  nOutlMode = OutlinerMode::OutlineObject;
1478 
1479  pText->ForceOutlinerParaObject( nOutlMode );
1480  }
1481 }
1482 
1484 {
1485  //if (!IsChainable())
1486  // return NULL;
1487 
1489 }
1490 
1492 {
1493  if(pEdtOutl)
1494  {
1495  return pEdtOutl->IsVertical();
1496  }
1497 
1498  OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
1499  if(pOutlinerParaObject)
1500  {
1501  return pOutlinerParaObject->IsVertical();
1502  }
1503 
1504  return false;
1505 }
1506 
1508 {
1509  OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
1510 
1511  if( !pOutlinerParaObject && bVertical )
1512  {
1513  // we only need to force an outliner para object if the default of
1514  // horizontal text is changed
1516  pOutlinerParaObject = GetOutlinerParaObject();
1517  }
1518 
1519  if (!pOutlinerParaObject ||
1520  (pOutlinerParaObject->IsVertical() == bVertical))
1521  return;
1522 
1523  // get item settings
1524  const SfxItemSet& rSet = GetObjectItemSet();
1525  bool bAutoGrowWidth = rSet.Get(SDRATTR_TEXT_AUTOGROWWIDTH).GetValue();
1526  bool bAutoGrowHeight = rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue();
1527 
1528  // Also exchange hor/ver adjust items
1529  SdrTextHorzAdjust eHorz = rSet.Get(SDRATTR_TEXT_HORZADJUST).GetValue();
1530  SdrTextVertAdjust eVert = rSet.Get(SDRATTR_TEXT_VERTADJUST).GetValue();
1531 
1532  // rescue object size
1533  tools::Rectangle aObjectRect = GetSnapRect();
1534 
1535  // prepare ItemSet to set exchanged width and height items
1536  SfxItemSet aNewSet(*rSet.GetPool(),
1538  // Expanded item ranges to also support hor and ver adjust.
1541 
1542  aNewSet.Put(rSet);
1543  aNewSet.Put(makeSdrTextAutoGrowWidthItem(bAutoGrowHeight));
1544  aNewSet.Put(makeSdrTextAutoGrowHeightItem(bAutoGrowWidth));
1545 
1546  // Exchange horz and vert adjusts
1547  switch (eVert)
1548  {
1553  }
1554  switch (eHorz)
1555  {
1560  }
1561 
1562  SetObjectItemSet(aNewSet);
1563 
1564  pOutlinerParaObject = GetOutlinerParaObject();
1565  if (pOutlinerParaObject)
1566  {
1567  // set ParaObject orientation accordingly
1568  pOutlinerParaObject->SetVertical(bVertical);
1569  }
1570 
1571  // restore object size
1572  SetSnapRect(aObjectRect);
1573 }
1574 
1575 // transformation interface for StarOfficeAPI. This implements support for
1576 // homogeneous 3x3 matrices containing the transformation of the SdrObject. At the
1577 // moment it contains a shearX, rotation and translation, but for setting all linear
1578 // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
1579 
1580 
1581 // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
1582 // with the base geometry and returns TRUE. Otherwise it returns FALSE.
1584 {
1585  // get turn and shear
1586  double fRotate = basegfx::deg2rad(aGeo.nRotationAngle.get() / 100.0);
1587  double fShearX = basegfx::deg2rad(aGeo.nShearAngle.get() / 100.0);
1588 
1589  // get aRect, this is the unrotated snaprect
1590  tools::Rectangle aRectangle(maRect);
1591 
1592  // fill other values
1593  basegfx::B2DTuple aScale(aRectangle.GetWidth(), aRectangle.GetHeight());
1594  basegfx::B2DTuple aTranslate(aRectangle.Left(), aRectangle.Top());
1595 
1596  // position maybe relative to anchorpos, convert
1598  {
1599  if(GetAnchorPos().X() || GetAnchorPos().Y())
1600  {
1601  aTranslate -= basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
1602  }
1603  }
1604 
1605  // build matrix
1607  aScale,
1608  basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX),
1609  basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate,
1610  aTranslate);
1611 
1612  return false;
1613 }
1614 
1615 // sets the base geometry of the object using infos contained in the homogeneous 3x3 matrix.
1616 // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
1617 // to use (0,0) as upper left and will be scaled to the given size in the matrix.
1619 {
1620  // break up matrix
1621  basegfx::B2DTuple aScale;
1622  basegfx::B2DTuple aTranslate;
1623  double fRotate(0.0);
1624  double fShearX(0.0);
1625  rMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
1626 
1627  // flip?
1628  bool bFlipX = aScale.getX() < 0.0,
1629  bFlipY = aScale.getY() < 0.0;
1630  if (bFlipX)
1631  {
1632  aScale.setX(fabs(aScale.getX()));
1633  }
1634  if (bFlipY)
1635  {
1636  aScale.setY(fabs(aScale.getY()));
1637  }
1638 
1639  // reset object shear and rotations
1640  aGeo.nRotationAngle = 0_deg100;
1641  aGeo.RecalcSinCos();
1642  aGeo.nShearAngle = 0_deg100;
1643  aGeo.RecalcTan();
1644 
1645  // if anchor is used, make position relative to it
1646  if( getSdrModelFromSdrObject().IsWriter() )
1647  {
1648  if(GetAnchorPos().X() || GetAnchorPos().Y())
1649  {
1650  aTranslate += basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
1651  }
1652  }
1653 
1654  // build and set BaseRect (use scale)
1655  Size aSize(FRound(aScale.getX()), FRound(aScale.getY()));
1656  tools::Rectangle aBaseRect(Point(), aSize);
1657  SetSnapRect(aBaseRect);
1658 
1659  // flip?
1660  if (bFlipX)
1661  {
1662  Mirror(Point(), Point(0, 1));
1663  }
1664  if (bFlipY)
1665  {
1666  Mirror(Point(), Point(1, 0));
1667  }
1668 
1669  // shear?
1670  if(!basegfx::fTools::equalZero(fShearX))
1671  {
1672  GeoStat aGeoStat;
1673  aGeoStat.nShearAngle = Degree100(FRound(basegfx::rad2deg(atan(fShearX)) * 100.0));
1674  aGeoStat.RecalcTan();
1675  Shear(Point(), aGeoStat.nShearAngle, aGeoStat.mfTanShearAngle, false);
1676  }
1677 
1678  // rotation?
1679  if(!basegfx::fTools::equalZero(fRotate))
1680  {
1681  GeoStat aGeoStat;
1682 
1683  // #i78696#
1684  // fRotate is matematically correct, but aGeoStat.nRotationAngle is
1685  // mirrored -> mirror value here
1686  aGeoStat.nRotationAngle = NormAngle36000(Degree100(FRound(-fRotate / F_PI18000)));
1687  aGeoStat.RecalcSinCos();
1688  Rotate(Point(), aGeoStat.nRotationAngle, aGeoStat.mfSinRotationAngle, aGeoStat.mfCosRotationAngle);
1689  }
1690 
1691  // translate?
1692  if(!aTranslate.equalZero())
1693  {
1694  Move(Size(FRound(aTranslate.getX()), FRound(aTranslate.getY())));
1695  }
1696 }
1697 
1699 {
1700  return pEdtOutl && pEdtOutl->IsModified();
1701 }
1702 
1703 // moved inlines here form hxx
1704 
1706 {
1707  return GetObjectItemSet().Get(SDRATTR_CORNER_RADIUS).GetValue();
1708 }
1709 
1711 {
1712  return GetObjectItemSet().Get(SDRATTR_TEXT_MINFRAMEHEIGHT).GetValue();
1713 }
1714 
1716 {
1717  return GetObjectItemSet().Get(SDRATTR_TEXT_MAXFRAMEHEIGHT).GetValue();
1718 }
1719 
1721 {
1722  return GetObjectItemSet().Get(SDRATTR_TEXT_MINFRAMEWIDTH).GetValue();
1723 }
1724 
1726 {
1727  return GetObjectItemSet().Get(SDRATTR_TEXT_MAXFRAMEWIDTH).GetValue();
1728 }
1729 
1731 {
1732  return !bTextFrame // Default is FALSE
1734 }
1735 
1737 {
1738  return !bTextFrame // Default is: no, don't HideContour; HideContour not together with TextFrames
1739  && GetObjectItemSet().Get(XATTR_FORMTXTHIDEFORM).GetValue();
1740 }
1741 
1743 {
1744  return !bTextFrame // ContourFrame not together with normal TextFrames
1746 }
1747 
1749 {
1750  return GetObjectItemSet().Get(SDRATTR_TEXT_LEFTDIST).GetValue();
1751 }
1752 
1754 {
1755  return GetObjectItemSet().Get(SDRATTR_TEXT_RIGHTDIST).GetValue();
1756 }
1757 
1759 {
1760  return GetObjectItemSet().Get(SDRATTR_TEXT_UPPERDIST).GetValue();
1761 }
1762 
1764 {
1765  return GetObjectItemSet().Get(SDRATTR_TEXT_LOWERDIST).GetValue();
1766 }
1767 
1769 {
1770  return GetObjectItemSet().Get(SDRATTR_TEXT_ANIKIND).GetValue();
1771 }
1772 
1774 {
1775  return GetObjectItemSet().Get(SDRATTR_TEXT_ANIDIRECTION).GetValue();
1776 }
1777 
1778 // Get necessary data for text scroll animation. ATM base it on a Text-Metafile and a
1779 // painting rectangle. Rotation is excluded from the returned values.
1781  tools::Rectangle& rScrollRectangle, tools::Rectangle& rPaintRectangle)
1782 {
1783  GDIMetaFile* pRetval = nullptr;
1784  SdrOutliner& rOutliner = ImpGetDrawOutliner();
1785  tools::Rectangle aTextRect;
1786  tools::Rectangle aAnchorRect;
1787  tools::Rectangle aPaintRect;
1788  Fraction aFitXCorrection(1,1);
1789  bool bContourFrame(IsContourTextFrame());
1790 
1791  // get outliner set up. To avoid getting a somehow rotated MetaFile,
1792  // temporarily disable object rotation.
1793  Degree100 nAngle(aGeo.nRotationAngle);
1794  aGeo.nRotationAngle = 0_deg100;
1795  ImpSetupDrawOutlinerForPaint( bContourFrame, rOutliner, aTextRect, aAnchorRect, aPaintRect, aFitXCorrection );
1796  aGeo.nRotationAngle = nAngle;
1797 
1798  tools::Rectangle aScrollFrameRect(aPaintRect);
1799  const SfxItemSet& rSet = GetObjectItemSet();
1800  SdrTextAniDirection eDirection = rSet.Get(SDRATTR_TEXT_ANIDIRECTION).GetValue();
1801 
1802  if(SdrTextAniDirection::Left == eDirection || SdrTextAniDirection::Right == eDirection)
1803  {
1804  aScrollFrameRect.SetLeft( aAnchorRect.Left() );
1805  aScrollFrameRect.SetRight( aAnchorRect.Right() );
1806  }
1807 
1808  if(SdrTextAniDirection::Up == eDirection || SdrTextAniDirection::Down == eDirection)
1809  {
1810  aScrollFrameRect.SetTop( aAnchorRect.Top() );
1811  aScrollFrameRect.SetBottom( aAnchorRect.Bottom() );
1812  }
1813 
1814  // create the MetaFile
1815  pRetval = new GDIMetaFile;
1817  pBlackHole->EnableOutput(false);
1818  pRetval->Record(pBlackHole);
1819  Point aPaintPos = aPaintRect.TopLeft();
1820 
1821  rOutliner.Draw(pBlackHole, aPaintPos);
1822 
1823  pRetval->Stop();
1824  pRetval->WindStart();
1825 
1826  // return PaintRectanglePixel and pRetval;
1827  rScrollRectangle = aScrollFrameRect;
1828  rPaintRectangle = aPaintRect;
1829 
1830  return pRetval;
1831 }
1832 
1833 // Access to TextAnimationAllowed flag
1835 {
1836  return GetFitToSize() == drawing::TextFitToSizeType_AUTOFIT;
1837 }
1838 
1840 {
1841  const drawing::TextFitToSizeType eFit = GetFitToSize();
1842  return (eFit == drawing::TextFitToSizeType_PROPORTIONAL
1843  || eFit == drawing::TextFitToSizeType_ALLLINES);
1844 }
1845 
1847 {
1848  if(mbTextAnimationAllowed != bNew)
1849  {
1850  mbTextAnimationAllowed = bNew;
1851  ActionChanged();
1852  }
1853 }
1854 
1857 {
1858  const EditStatusFlags nStat = pEditStatus->GetStatusWord();
1859  const bool bGrowX = bool(nStat & EditStatusFlags::TEXTWIDTHCHANGED);
1860  const bool bGrowY = bool(nStat & EditStatusFlags::TextHeightChanged);
1861  if(!(bTextFrame && (bGrowX || bGrowY)))
1862  return;
1863 
1864  if ((bGrowX && IsAutoGrowWidth()) || (bGrowY && IsAutoGrowHeight()))
1865  {
1867  }
1868  else if ( (IsAutoFit() || IsFitToSize()) && !mbInDownScale)
1869  {
1870  assert(pEdtOutl);
1871  mbInDownScale = true;
1872 
1873  // sucks that we cannot disable paints via
1874  // pEdtOutl->SetUpdateMode(FALSE) - but EditEngine skips
1875  // formatting as well, then.
1877  mbInDownScale = false;
1878  }
1879 }
1880 
1881 /* Begin chaining code */
1882 
1883 // XXX: Make it a method somewhere?
1884 static SdrObject *ImpGetObjByName(SdrObjList const *pObjList, std::u16string_view aObjName)
1885 {
1886  // scan the whole list
1887  size_t nObjCount = pObjList->GetObjCount();
1888  for (size_t i = 0; i < nObjCount; i++) {
1889  SdrObject *pCurObj = pObjList->GetObj(i);
1890 
1891  if (pCurObj->GetName() == aObjName) {
1892  return pCurObj;
1893  }
1894  }
1895  // not found
1896  return nullptr;
1897 }
1898 
1899 // XXX: Make it a (private) method of SdrTextObj
1900 static void ImpUpdateChainLinks(SdrTextObj *pTextObj, std::u16string_view aNextLinkName)
1901 {
1902  // XXX: Current implementation constraints text boxes to be on the same page
1903 
1904  // No next link
1905  if (aNextLinkName.empty()) {
1906  pTextObj->SetNextLinkInChain(nullptr);
1907  return;
1908  }
1909 
1910  SdrPage *pPage(pTextObj->getSdrPageFromSdrObject());
1911  assert(pPage);
1912  SdrTextObj *pNextTextObj = dynamic_cast< SdrTextObj * >
1913  (ImpGetObjByName(pPage, aNextLinkName));
1914  if (!pNextTextObj) {
1915  SAL_INFO("svx.chaining", "[CHAINING] Can't find object as next link.");
1916  return;
1917  }
1918 
1919  pTextObj->SetNextLinkInChain(pNextTextObj);
1920 }
1921 
1923 {
1924  // Read it as item
1925  const SfxItemSet& rSet = GetObjectItemSet();
1926  OUString aNextLinkName = rSet.Get(SDRATTR_TEXT_CHAINNEXTNAME).GetValue();
1927 
1928  // Update links if any inconsistency is found
1929  bool bNextLinkUnsetYet = !aNextLinkName.isEmpty() && !mpNextInChain;
1930  bool bInconsistentNextLink = mpNextInChain && mpNextInChain->GetName() != aNextLinkName;
1931  // if the link is not set despite there should be one OR if it has changed
1932  if (bNextLinkUnsetYet || bInconsistentNextLink) {
1933  ImpUpdateChainLinks(const_cast<SdrTextObj *>(this), aNextLinkName);
1934  }
1935 
1936  return !aNextLinkName.isEmpty(); // XXX: Should we also check for GetNilChainingEvent? (see old code below)
1937 
1938 /*
1939  // Check that no overflow is going on
1940  if (!GetTextChain() || GetTextChain()->GetNilChainingEvent(this))
1941  return false;
1942 */
1943 }
1944 
1946 {
1947  if (!pEdtOutl)
1948  return;
1949 
1950  // Outliner for text transfer
1951  SdrOutliner &aDrawOutliner = ImpGetDrawOutliner();
1952 
1953  EditingTextChainFlow aTxtChainFlow(this);
1954  aTxtChainFlow.CheckForFlowEvents(pEdtOutl);
1955 
1956  if (aTxtChainFlow.IsOverflow()) {
1957  SAL_INFO("svx.chaining", "[CHAINING] Overflow going on");
1958  // One outliner is for non-overflowing text, the other for overflowing text
1959  // We remove text directly from the editing outliner
1960  aTxtChainFlow.ExecuteOverflow(pEdtOutl, &aDrawOutliner);
1961  } else if (aTxtChainFlow.IsUnderflow()) {
1962  SAL_INFO("svx.chaining", "[CHAINING] Underflow going on");
1963  // underflow-induced overflow
1964  aTxtChainFlow.ExecuteUnderflow(&aDrawOutliner);
1965  bool bIsOverflowFromUnderflow = aTxtChainFlow.IsOverflow();
1966  // handle overflow
1967  if (bIsOverflowFromUnderflow) {
1968  SAL_INFO("svx.chaining", "[CHAINING] Overflow going on (underflow induced)");
1969  // prevents infinite loops when setting text for editing outliner
1970  aTxtChainFlow.ExecuteOverflow(&aDrawOutliner, &aDrawOutliner);
1971  }
1972  }
1973 }
1974 
1976 {
1977  /*
1978  if (GetTextChain())
1979  return GetTextChain()->GetNextLink(this);
1980 
1981  return NULL;
1982  */
1983 
1984  return mpNextInChain;
1985 }
1986 
1988 {
1989  // Basically a doubly linked list implementation
1990 
1991  SdrTextObj *pOldNextObj = mpNextInChain;
1992 
1993  // Replace next link
1994  mpNextInChain = pNextObj;
1995  // Deal with old next link's prev link
1996  if (pOldNextObj) {
1997  pOldNextObj->mpPrevInChain = nullptr;
1998  }
1999 
2000  // Deal with new next link's prev link
2001  if (mpNextInChain) {
2002  // If there is a prev already at all and this is not already the current object
2004  mpNextInChain->mpPrevInChain != this)
2006  mpNextInChain->mpPrevInChain = this;
2007  }
2008 
2009  // TODO: Introduce check for circular chains
2010 
2011 }
2012 
2014 {
2015  /*
2016  if (GetTextChain())
2017  return GetTextChain()->GetPrevLink(this);
2018 
2019  return NULL;
2020  */
2021 
2022  return mpPrevInChain;
2023 }
2024 
2026 {
2027  // Prevent chaining it 1) during dragging && 2) when we are editing next link
2029 }
2030 
2032 {
2034  SdrTextObj *pTextObjClone = dynamic_cast<SdrTextObj *>(pClone.get());
2035  if (pTextObjClone != nullptr) {
2036  // Avoid transferring of text for chainable object during dragging
2037  pTextObjClone->mbIsUnchainableClone = true;
2038  }
2039 
2040  return pClone;
2041  }
2042 
2043 /* End chaining code */
2044 
2047 {
2048  if( !mpText )
2049  return getText( 0 );
2050  else
2051  return mpText.get();
2052 }
2053 
2055 SdrText* SdrTextObj::getText( sal_Int32 nIndex ) const
2056 {
2057  if( nIndex == 0 )
2058  {
2059  if( !mpText )
2060  const_cast< SdrTextObj* >(this)->mpText.reset( new SdrText( *const_cast< SdrTextObj* >(this) ) );
2061  return mpText.get();
2062  }
2063  else
2064  {
2065  return nullptr;
2066  }
2067 }
2068 
2070 sal_Int32 SdrTextObj::getTextCount() const
2071 {
2072  return 1;
2073 }
2074 
2076 void SdrTextObj::setActiveText( sal_Int32 /*nIndex*/ )
2077 {
2078 }
2079 
2081 sal_Int32 SdrTextObj::CheckTextHit(const Point& /*rPnt*/) const
2082 {
2083  return 0;
2084 }
2085 
2087 {
2089 }
2090 
2091 
2092 // The concept of the text object:
2093 // ~~~~~~~~~~~~~~~~~~~~~~~~
2094 // Attributes/Variations:
2095 // - bool text frame / graphics object with caption
2096 // - bool FontWork (if it is not a text frame and not a ContourTextFrame)
2097 // - bool ContourTextFrame (if it is not a text frame and not Fontwork)
2098 // - long rotation angle (if it is not FontWork)
2099 // - long text frame margins (if it is not FontWork)
2100 // - bool FitToSize (if it is not FontWork)
2101 // - bool AutoGrowingWidth/Height (if it is not FitToSize and not FontWork)
2102 // - long Min/MaxFrameWidth/Height (if AutoGrowingWidth/Height)
2103 // - enum horizontal text anchoring left,center,right,justify/block,Stretch(ni)
2104 // - enum vertical text anchoring top, middle, bottom, block, stretch(ni)
2105 // - enum ticker text (if it is not FontWork)
2106 
2107 // Every derived object is either a text frame (bTextFrame=true)
2108 // or a drawing object with a caption (bTextFrame=false).
2109 
2110 // Default anchoring for text frames:
2111 // SDRTEXTHORZADJUST_BLOCK, SDRTEXTVERTADJUST_TOP
2112 // = static Pool defaults
2113 // Default anchoring for drawing objects with a caption:
2114 // SDRTEXTHORZADJUST_CENTER, SDRTEXTVERTADJUST_CENTER
2115 // via "hard" attribution of SdrAttrObj
2116 
2117 // Every object derived from SdrTextObj must return an "UnrotatedSnapRect"
2118 // (->TakeUnrotatedSnapRect()) (the reference point for the rotation is the top
2119 // left of the rectangle (aGeo.nRotationAngle)) which is the basis for anchoring
2120 // text. We then subtract the text frame margins from this rectangle, as a re-
2121 // sult we get the anchoring area (->TakeTextAnchorRect()). Within this area, we
2122 // calculate the anchoring point and the painting area, depending on the hori-
2123 // zontal and vertical adjustment of the text (SdrTextVertAdjust,
2124 // SdrTextHorzAdjust).
2125 // In the case of drawing objects with a caption the painting area might well
2126 // be larger than the anchoring area, for text frames on the other hand, it is
2127 // always of the same or a smaller size (except when there are negative text
2128 // frame margins).
2129 
2130 // FitToSize takes priority over text anchoring and AutoGrowHeight/Width. When
2131 // FitToSize is turned on, the painting area is always equal to the anchoring
2132 // area. Additionally, FitToSize doesn't allow automatic line breaks.
2133 
2134 // ContourTextFrame:
2135 // - long rotation angle
2136 // - long text frame margins (maybe later)
2137 // - bool FitToSize (maybe later)
2138 // - bool AutoGrowingWidth/Height (maybe much later)
2139 // - long Min/MaxFrameWidth/Height (maybe much later)
2140 // - enum horizontal text anchoring (maybe later, for now: left, centered)
2141 // - enum vertical text anchoring (maybe later, for now: top)
2142 // - enum ticker text (maybe later, maybe even with correct clipping)
2143 
2144 // When making changes, check these:
2145 // - Paint
2146 // - HitTest
2147 // - ConvertToPoly
2148 // - Edit
2149 // - Printing, Saving, Painting in neighboring View while editing
2150 // - ModelChanged (e. g. through a neighboring View or rulers) while editing
2151 // - FillColorChanged while editing
2152 // - and many more...
2153 
2154 
2155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Shear(const Point &rRef, Degree100 nAngle, double tn, bool bVShear)
Definition: svdobj.cxx:1574
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:1763
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:2081
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:1853
GDIMetaFile * GetTextScrollMetaFileAndRectangle(tools::Rectangle &rScrollRectangle, tools::Rectangle &rPaintRectangle)
Definition: svdotext.cxx:1780
OutlinerMode
virtual bool NbcAdjustTextFrameWidthAndHeight(bool bHgt=true, bool bWdt=true)
Definition: svdotxat.cxx:239
double GetFontScaleY() const
Definition: svdotext.cxx:1189
bool IsChainable() const
Definition: svdotext.cxx:1922
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:1330
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:1102
virtual SdrObjKind GetObjIdentifier() const override
Definition: svdotext.cxx:464
void SetNextLinkInChain(SdrTextObj *)
Definition: svdotext.cxx:1987
void ForceOutlinerParaObject()
Definition: svdotext.cxx:1470
std::string GetValue
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage)
Definition: svdobj.cxx:523
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:2055
GeoStat aGeo
Definition: svdotext.hxx:185
static SdrObject * ImpGetObjByName(SdrObjList const *pObjList, std::u16string_view aObjName)
Definition: svdotext.cxx:1884
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:1748
SdrTextHorzAdjust
Definition: sdtaitm.hxx:53
tools::Long GetEckenradius() const
Definition: svdotext.cxx:1705
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:770
SVX_DLLPRIVATE void ImpInitDrawOutliner(SdrOutliner &rOutl) const
Definition: svdotext.cxx:1123
size_t GetObjCount() const
Definition: svdpage.cxx:764
virtual void SetBoundRectDirty()
Definition: svdobj.cxx:313
void Draw(OutputDevice *pOutDev, const tools::Rectangle &rOutRect)
bool IsInEditMode() const
Definition: svdotext.hxx:326
SdrTextAniKind GetTextAniKind() const
Definition: svdotext.cxx:1768
double getY() 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:1153
GDIMetaFile * GetConnectMetaFile() const
sal_Int32 GetParagraphCount() const
SVX_DLLPRIVATE void ImpDeregisterLink()
Definition: svdotxln.cxx:266
tools::Long GetMinTextFrameHeight() const
Definition: svdotext.cxx:1710
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:2076
bool IsRecord() const
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix &rMatrix, const basegfx::B2DPolyPolygon &rPolyPolygon) override
Definition: svdotext.cxx:1618
virtual void NbcReformatText() override
Definition: svdotext.cxx:1406
static void Free(SdrObject *&_rpObject)
Definition: svdobj.cxx:470
void RecalcTan()
Definition: svdtrans.cxx:465
virtual sdr::properties::BaseProperties & GetProperties() const
Definition: svdobj.cxx:207
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:2031
virtual void RecalcSnapRect() override
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
Definition: svdotext.cxx:1089
EEControlBits
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:172
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:248
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
TextChain * GetTextChain() const
Definition: svdotext.cxx:1483
tools::Long GetMaxTextFrameHeight() const
Definition: svdotext.cxx:1715
constexpr tools::Long Width() const
Provides information about various ZObject properties.
Definition: svdobj.hxx:194
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:266
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:1438
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:1698
const SfxItemSet & GetObjectItemSet() const
Definition: svdobj.cxx:1947
constexpr TypedWhichId< SdrTextAniDirectionItem > SDRATTR_TEXT_ANIDIRECTION(SDRATTR_MISC_FIRST+15)
SfxStyleSheet * GetStyleSheet() const
Definition: svdobj.cxx:2199
oslFileHandle & pOut
tools::Rectangle maRect
Definition: svdotext.hxx:182
constexpr tools::Long GetWidth() const
void SetFixedCellHeight(bool bUseFixedCellHeight)
css::drawing::TextFitToSizeType GetFitToSize() const
Definition: svdotext.cxx:1455
virtual void onEditOutlinerStatusEvent(EditStatus *pEditStatus)
called from the SdrObjEditView during text edit when the status of the edit outliner changes ...
Definition: svdotext.cxx:1856
bool bNoShear
Definition: svdotext.hxx:232
tools::Long GetMaxTextFrameWidth() const
Definition: svdotext.cxx:1725
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:1957
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:2025
ErrCode Read(SvStream &rInput, const OUString &rBaseURL, EETextFormat, SvKeyValueIterator *pHTTPHeaderAttrs=nullptr)
constexpr bool IsEmpty() const
#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:1046
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:1982
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:1901
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:899
void UpdateOutlinerFormatting(SdrOutliner &rOutl, tools::Rectangle &rPaintRect) const
Update given Outliner equivalently to SdrTextObj::Paint()
Definition: svdotext.cxx:1336
void SetText(const OutlinerParaObject &)
int i
bool IsWriter() const
Definition: svdmodel.hxx:571
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:1839
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:982
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:260
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_MAXFRAMEHEIGHT(SDRATTR_MISC_FIRST+9)
virtual void SaveGeoData(SdrObjGeoData &rGeo) const
Definition: svdobj.cxx:1878
static bool equalZero(const double &rfVal)
void SetText(const OUString &rStr)
Definition: svdotext.cxx:253
static void ImpUpdateChainLinks(SdrTextObj *pTextObj, std::u16string_view aNextLinkName)
Definition: svdotext.cxx:1900
EditStatusFlags
float u
bool mbIsUnchainableClone
Definition: svdotext.hxx:220
virtual basegfx::B2DPolyPolygon TakeContour() const
contour for TextToContour
Definition: svdobj.cxx:1109
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_MINFRAMEWIDTH(SDRATTR_MISC_FIRST+10)
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:276
SdrObjUserCall * m_pUserCall
Definition: svdobj.hxx:874
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:1736
bool mbInDownScale
Definition: svdotext.hxx:251
constexpr double deg2rad(double v)
virtual void SetLogicRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1674
void SetTop(tools::Long v)
virtual void Move(const Size &rSiz)
Definition: svdobj.cxx:1509
void SetMergedItem(const SfxPoolItem &rItem)
Definition: svdobj.cxx:1962
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:2046
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:1987
void WindStart()
void flushViewObjectContacts(bool bWithHierarchy=true)
bool IsContourTextFrame() const
Definition: svdotext.cxx:1742
tools::Long Top() const
Abstract DrawObject.
Definition: svdobj.hxx:258
SdrObjKind eTextKind
Definition: svdotext.hxx:204
virtual basegfx::B2DPolyPolygon TakeContour() const override
contour for TextToContour
Definition: svdotext.cxx:1062
SfxItemPool * GetPool() const
void ImpCheckShear()
Definition: svdotext.cxx:432
void ForceOutlinerParaObject(OutlinerMode nOutlMode)
Definition: svdtext.cxx:111
virtual void Mirror(const Point &rRef1, const Point &rRef2)
Definition: svdobj.cxx:1565
OUString GetName() const
Definition: svdobj.cxx:775
#define Y
SVX_DLLPRIVATE void ImpRegisterLink()
Definition: svdotxln.cxx:254
tools::Long GetMinTextFrameWidth() const
Definition: svdotext.cxx:1720
bool bTextFrame
Definition: svdotext.hxx:231
constexpr Point TopLeft() const
SdrTextObj * GetNextLinkInChain() const
Definition: svdotext.cxx:1975
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:1753
void SetObjectItemNoBroadcast(const SfxPoolItem &rItem)
Definition: svdotext.cxx:2086
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:1369
virtual const tools::Rectangle & GetLastBoundRect() const
Definition: svdobj.cxx:945
void CheckPortionInfo(SdrOutliner &rOutliner)
Definition: svdtext.cxx:42
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
constexpr Size GetSize() const
EditStatusFlags GetStatusWord() const
virtual bool IsVerticalWriting() const
Definition: svdotext.cxx:1491
tools::Long GetTextUpperDistance() const
Top inner spacing to borders.
Definition: svdotext.cxx:1758
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:62
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
constexpr tools::Long Height() const
virtual OutlinerParaObject * GetOutlinerParaObject() const override
Definition: svdotext.cxx:1360
void RecalcSinCos()
Definition: svdtrans.cxx:453
OString stripStart(std::string_view rIn, char c)
virtual bool AdjustTextFrameWidthAndHeight()
Definition: svdotxat.cxx:255
void SetObjectItemSet(const SfxItemSet &rSet)
Definition: svdobj.cxx:1972
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:1374
tools::Long GetTextHeight() const
Degree100 nRotationAngle
Definition: svdtrans.hxx:217
#define SAL_INFO(area, stream)
OUString aName
constexpr Point TopRight() const
void SetMinAutoPaperSize(const Size &rSz)
virtual void SetOutlinerParaObject(std::unique_ptr< OutlinerParaObject > pTextObject)
Definition: svdtext.cxx:73
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
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:1945
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
Definition: svdotext.cxx:1446
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:96
SdrOnOffItem makeSdrShadowItem(bool bShadow)
Definition: sdshitm.hxx:25
virtual SdrObjectUniquePtr getFullDragClone() const
Definition: svdobj.cxx:1312
SdrTextAniDirection GetTextAniDirection() const
Definition: svdotext.cxx:1773
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:1631
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:1554
virtual void SetRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:509
bool IsVertical() const
Size CalcTextSizeNTP()
virtual Point GetSnapPoint(sal_uInt32 i) const override
Definition: svdotext.cxx:1107
virtual void SetSnapRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1665
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:1834
virtual sal_Int32 getTextCount() const override
returns the number of texts available for this object.
Definition: svdotext.cxx:2070
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:1583
bool LineGeometryUsageIsNecessary() const
Definition: svdobj.cxx:1039
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:89
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:1006
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:1051
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:2013
static void ImpJustifyRect(tools::Rectangle &rRect)
Definition: svdotext.cxx:423
SdrOutliner & ImpGetDrawOutliner() const
Definition: svdotext.cxx:1142
aStr
Size CalcTextSize()
Degree100 nShearAngle
Definition: svdtrans.hxx:218
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:1507
tools::Long Right() const
const tools::Rectangle & GetGeoRect() const
Definition: svdotext.cxx:1465
SdrTextVertAdjust
Definition: sdtaitm.hxx:29
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
Definition: svdobj.cxx:2713
Point Center() const
virtual bool IsFontwork() const
Definition: svdotext.cxx:1730
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:1433
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:1252
void SetTextAnimationAllowed(bool bNew)
Definition: svdotext.cxx:1846
void ClearPolygon()
constexpr tools::Long GetHeight() const
virtual OUString TakeObjNamePlural() const override
Definition: svdotext.cxx:1029
const Size & GetPaperSize() const
virtual void CheckForFlowEvents(SdrOutliner *) override