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