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 
808 std::unique_ptr<OutlinerParaObject> SdrTextObj::GetEditOutlinerParaObject() const
809 {
810  std::unique_ptr<OutlinerParaObject> pPara;
811  if( HasTextImpl( pEdtOutl ) )
812  {
813  sal_Int32 nParaCount = pEdtOutl->GetParagraphCount();
814  pPara = pEdtOutl->CreateParaObject(0, nParaCount);
815  }
816  return pPara;
817 }
818 
819 void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, Fraction& rFitXCorrection)
820 {
821  OutputDevice* pOut = rOutliner.GetRefDevice();
822  bool bNoStretching(false);
823 
824  if(pOut && pOut->GetOutDevType() == OUTDEV_PRINTER)
825  {
826  // check whether CharStretching is possible at all
827  GDIMetaFile* pMtf = pOut->GetConnectMetaFile();
828  OUString aTestString(u'J');
829 
830  if(pMtf && (!pMtf->IsRecord() || pMtf->IsPause()))
831  pMtf = nullptr;
832 
833  if(pMtf)
834  pMtf->Pause(true);
835 
836  vcl::Font aOriginalFont(pOut->GetFont());
837  vcl::Font aTmpFont( OutputDevice::GetDefaultFont( DefaultFontType::SERIF, LANGUAGE_SYSTEM, GetDefaultFontFlags::OnlyOne ) );
838 
839  aTmpFont.SetFontSize(Size(0,100));
840  pOut->SetFont(aTmpFont);
841  Size aSize1(pOut->GetTextWidth(aTestString), pOut->GetTextHeight());
842  aTmpFont.SetFontSize(Size(800,100));
843  pOut->SetFont(aTmpFont);
844  Size aSize2(pOut->GetTextWidth(aTestString), pOut->GetTextHeight());
845  pOut->SetFont(aOriginalFont);
846 
847  if(pMtf)
848  pMtf->Pause(false);
849 
850  bNoStretching = (aSize1 == aSize2);
851 
852 #ifdef _WIN32
853  // Windows zooms the font proportionally when using Size(100,500),
854  // we don't like that.
855  if(aSize2.Height() >= aSize1.Height() * 2)
856  {
857  bNoStretching = true;
858  }
859 #endif
860  }
861  unsigned nLoopCount=0;
862  bool bNoMoreLoop = false;
863  long nXDiff0=0x7FFFFFFF;
864  long nWantWdt=rShapeSize.Width();
865  long nIsWdt=rTextSize.Width();
866  if (nIsWdt==0) nIsWdt=1;
867 
868  long nWantHgt=rShapeSize.Height();
869  long nIsHgt=rTextSize.Height();
870  if (nIsHgt==0) nIsHgt=1;
871 
872  long nXTolPl=nWantWdt/100; // tolerance: +1%
873  long nXTolMi=nWantWdt/25; // tolerance: -4%
874  long nXCorr =nWantWdt/20; // correction scale: 5%
875 
876  long nX=(nWantWdt*100) /nIsWdt; // calculate X stretching
877  long nY=(nWantHgt*100) /nIsHgt; // calculate Y stretching
878  bool bChkX = true;
879  if (bNoStretching) { // might only be possible proportionally
880  if (nX>nY) { nX=nY; bChkX=false; }
881  else { nY=nX; }
882  }
883 
884  while (nLoopCount<5 && !bNoMoreLoop) {
885  if (nX<0) nX=-nX;
886  if (nX<1) { nX=1; bNoMoreLoop = true; }
887  if (nX>65535) { nX=65535; bNoMoreLoop = true; }
888 
889  if (nY<0) nY=-nY;
890  if (nY<1) { nY=1; bNoMoreLoop = true; }
891  if (nY>65535) { nY=65535; bNoMoreLoop = true; }
892 
893  // exception, there is no text yet (horizontal case)
894  if(nIsWdt <= 1)
895  {
896  nX = nY;
897  bNoMoreLoop = true;
898  }
899 
900  // exception, there is no text yet (vertical case)
901  if(nIsHgt <= 1)
902  {
903  nY = nX;
904  bNoMoreLoop = true;
905  }
906 
907  rOutliner.SetGlobalCharStretching(static_cast<sal_uInt16>(nX),static_cast<sal_uInt16>(nY));
908  nLoopCount++;
909  Size aSiz(rOutliner.CalcTextSize());
910  long nXDiff=aSiz.Width()-nWantWdt;
911  rFitXCorrection=Fraction(nWantWdt,aSiz.Width());
912  if (((nXDiff>=nXTolMi || !bChkX) && nXDiff<=nXTolPl) || nXDiff==nXDiff0) {
913  bNoMoreLoop = true;
914  } else {
915  // correct stretching factors
916  long nMul=nWantWdt;
917  long nDiv=aSiz.Width();
918  if (std::abs(nXDiff)<=2*nXCorr) {
919  if (nMul>nDiv) nDiv+=(nMul-nDiv)/2; // but only add half of what we calculated,
920  else nMul+=(nDiv-nMul)/2; // because the EditEngine calculates wrongly later on
921  }
922  nX=nX*nMul/nDiv;
923  if (bNoStretching) nY=nX;
924  }
925  nXDiff0=nXDiff;
926  }
927 }
928 
930 {
931  OUString aStr;
932 
933  switch(eTextKind)
934  {
935  case OBJ_OUTLINETEXT:
936  {
937  aStr = SvxResId(STR_ObjNameSingulOUTLINETEXT);
938  break;
939  }
940 
941  case OBJ_TITLETEXT :
942  {
943  aStr = SvxResId(STR_ObjNameSingulTITLETEXT);
944  break;
945  }
946 
947  default:
948  {
949  if(IsLinkedText())
950  aStr = SvxResId(STR_ObjNameSingulTEXTLNK);
951  else
952  aStr = SvxResId(STR_ObjNameSingulTEXT);
953  break;
954  }
955  }
956 
957  OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
958  if(pOutlinerParaObject && eTextKind != OBJ_OUTLINETEXT)
959  {
960  // shouldn't currently cause any problems at OUTLINETEXT
961  OUString aStr2(comphelper::string::stripStart(pOutlinerParaObject->GetTextObject().GetText(0), ' '));
962 
963  // avoid non expanded text portions in object name
964  // (second condition is new)
965  if(!aStr2.isEmpty() && aStr2.indexOf(u'\x00FF') == -1)
966  {
967  // space between ResStr and content text
968  aStr += " \'";
969 
970  if(aStr2.getLength() > 10)
971  {
972  aStr2 = aStr2.copy(0, 8) + "...";
973  }
974 
975  aStr += aStr2 + "\'";
976  }
977  }
978 
979  OUStringBuffer sName(aStr);
980 
981  OUString aName(GetName());
982  if (!aName.isEmpty())
983  {
984  sName.append(' ');
985  sName.append('\'');
986  sName.append(aName);
987  sName.append('\'');
988  }
989 
990  return sName.makeStringAndClear();
991 }
992 
994 {
995  OUString sName;
996  switch (eTextKind) {
997  case OBJ_OUTLINETEXT: sName=SvxResId(STR_ObjNamePluralOUTLINETEXT); break;
998  case OBJ_TITLETEXT : sName=SvxResId(STR_ObjNamePluralTITLETEXT); break;
999  default: {
1000  if (IsLinkedText()) {
1001  sName=SvxResId(STR_ObjNamePluralTEXTLNK);
1002  } else {
1003  sName=SvxResId(STR_ObjNamePluralTEXT);
1004  }
1005  } break;
1006  } // switch
1007  return sName;
1008 }
1009 
1011 {
1012  return CloneHelper< SdrTextObj >(rTargetModel);
1013 }
1014 
1016 {
1017  if( this == &rObj )
1018  return *this;
1019 
1020  // call parent. tdf#116979: use the correct parent class
1021  SdrAttrObj::operator=(rObj);
1022 
1023  maRect = rObj.maRect;
1024  aGeo =rObj.aGeo;
1025  eTextKind =rObj.eTextKind;
1026  bTextFrame=rObj.bTextFrame;
1027  aTextSize=rObj.aTextSize;
1029 
1030  // Not all of the necessary parameters were copied yet.
1031  bNoShear = rObj.bNoShear;
1033  SdrText* pText = getActiveText();
1034 
1035  if( pText && rObj.HasText() )
1036  {
1037  // before pNewOutlinerParaObject was created the same, but
1038  // set at mpText (outside this scope), but mpText might be
1039  // empty (this operator== seems not prepared for MultiText
1040  // objects). In the current form it makes only sense to
1041  // create locally and use locally on a known existing SdrText
1042  const Outliner* pEO=rObj.pEdtOutl;
1043  std::unique_ptr<OutlinerParaObject> pNewOutlinerParaObject;
1044 
1045  if (pEO!=nullptr)
1046  {
1047  pNewOutlinerParaObject = pEO->CreateParaObject();
1048  }
1049  else if (nullptr != rObj.getActiveText()->GetOutlinerParaObject())
1050  {
1051  pNewOutlinerParaObject.reset( new OutlinerParaObject(*rObj.getActiveText()->GetOutlinerParaObject()) );
1052  }
1053 
1054  pText->SetOutlinerParaObject( std::move(pNewOutlinerParaObject) );
1055  }
1056 
1058  return *this;
1059 }
1060 
1062 {
1063  tools::Polygon aPol(maRect);
1064  if (aGeo.nShearAngle!=0) ShearPoly(aPol,maRect.TopLeft(),aGeo.nTan);
1066 
1067  basegfx::B2DPolyPolygon aRetval;
1068  aRetval.append(aPol.getB2DPolygon());
1069  return aRetval;
1070 }
1071 
1073 {
1075 
1076  // and now add the BoundRect of the text, if necessary
1078  {
1079  // using Clone()-Paint() strategy inside TakeContour() leaves a destroyed
1080  // SdrObject as pointer in DrawOutliner. Set *this again in fetching the outliner
1081  // in every case
1082  SdrOutliner& rOutliner=ImpGetDrawOutliner();
1083 
1084  tools::Rectangle aAnchor2;
1085  tools::Rectangle aR;
1086  TakeTextRect(rOutliner,aR,false,&aAnchor2);
1087  rOutliner.Clear();
1088  bool bFitToSize(IsFitToSize());
1089  if (bFitToSize) aR=aAnchor2;
1090  tools::Polygon aPol(aR);
1091  if (aGeo.nRotationAngle!=0) RotatePoly(aPol,aR.TopLeft(),aGeo.nSin,aGeo.nCos);
1092 
1093  aRetval.append(aPol.getB2DPolygon());
1094  }
1095 
1096  return aRetval;
1097 }
1098 
1100 {
1101  if (aGeo.nRotationAngle!=0 || aGeo.nShearAngle!=0)
1102  {
1103  tools::Polygon aPol(maRect);
1104  if (aGeo.nShearAngle!=0) ShearPoly(aPol,maRect.TopLeft(),aGeo.nTan);
1106  maSnapRect=aPol.GetBoundRect();
1107  } else {
1108  maSnapRect = maRect;
1109  }
1110 }
1111 
1113 {
1114  return 4L;
1115 }
1116 
1117 Point SdrTextObj::GetSnapPoint(sal_uInt32 i) const
1118 {
1119  Point aP;
1120  switch (i) {
1121  case 0: aP=maRect.TopLeft(); break;
1122  case 1: aP=maRect.TopRight(); break;
1123  case 2: aP=maRect.BottomLeft(); break;
1124  case 3: aP=maRect.BottomRight(); break;
1125  default: aP=maRect.Center(); break;
1126  }
1129  return aP;
1130 }
1131 
1132 // Extracted from ImpGetDrawOutliner()
1134 {
1135  rOutl.SetUpdateMode(false);
1136  OutlinerMode nOutlinerMode = OutlinerMode::OutlineObject;
1137  if ( !IsOutlText() )
1138  nOutlinerMode = OutlinerMode::TextObject;
1139  rOutl.Init( nOutlinerMode );
1140 
1141  rOutl.SetGlobalCharStretching();
1142  EEControlBits nStat=rOutl.GetControlWord();
1143  nStat &= ~EEControlBits(EEControlBits::STRETCHING|EEControlBits::AUTOPAGESIZE);
1144  rOutl.SetControlWord(nStat);
1145  Size aMaxSize(100000,100000);
1146  rOutl.SetMinAutoPaperSize(Size());
1147  rOutl.SetMaxAutoPaperSize(aMaxSize);
1148  rOutl.SetPaperSize(aMaxSize);
1149  rOutl.ClearPolygon();
1150 }
1151 
1153 {
1154  SdrOutliner& rOutl(getSdrModelFromSdrObject().GetDrawOutliner(this));
1155 
1156  // Code extracted to ImpInitDrawOutliner()
1157  ImpInitDrawOutliner( rOutl );
1158 
1159  return rOutl;
1160 }
1161 
1162 // Extracted from Paint()
1164  SdrOutliner& rOutliner,
1165  tools::Rectangle& rTextRect,
1166  tools::Rectangle& rAnchorRect,
1167  tools::Rectangle& rPaintRect,
1168  Fraction& rFitXCorrection ) const
1169 {
1170  if (!bContourFrame)
1171  {
1172  // FitToSize can't be used together with ContourFrame for now
1173  if (IsFitToSize() || IsAutoFit())
1174  {
1175  EEControlBits nStat=rOutliner.GetControlWord();
1176  nStat|=EEControlBits::STRETCHING|EEControlBits::AUTOPAGESIZE;
1177  rOutliner.SetControlWord(nStat);
1178  }
1179  }
1181  TakeTextRect(rOutliner, rTextRect, false, &rAnchorRect);
1182  rPaintRect = rTextRect;
1183 
1184  if (!bContourFrame)
1185  {
1186  // FitToSize can't be used together with ContourFrame for now
1187  if (IsFitToSize())
1188  {
1189  ImpSetCharStretching(rOutliner,rTextRect.GetSize(),rAnchorRect.GetSize(),rFitXCorrection);
1190  rPaintRect=rAnchorRect;
1191  }
1192  else if (IsAutoFit())
1193  {
1194  ImpAutoFitText(rOutliner);
1195  }
1196  }
1197 }
1198 
1200 {
1201  SdrText* pText = getActiveText();
1202  if (pText == nullptr || !pText->GetOutlinerParaObject())
1203  return 1.0;
1204 
1205  SdrOutliner& rOutliner = ImpGetDrawOutliner();
1206  const Size aShapeSize = GetSnapRect().GetSize();
1207  const Size aSize(aShapeSize.Width() - GetTextLeftDistance() - GetTextRightDistance(),
1208  aShapeSize.Height() - GetTextUpperDistance() - GetTextLowerDistance());
1209 
1210  rOutliner.SetPaperSize(aSize);
1211  rOutliner.SetUpdateMode(true);
1212  rOutliner.SetText(*pText->GetOutlinerParaObject());
1213  bool bIsVerticalWriting = IsVerticalWriting();
1214 
1215  // Algorithm from SdrTextObj::ImpAutoFitText
1216 
1217  sal_uInt16 nMinStretchX = 0, nMinStretchY = 0;
1218  sal_uInt16 nCurrStretchX = 100, nCurrStretchY = 100;
1219  sal_uInt16 aOldStretchXVals[] = { 0,0,0 };
1220  const size_t aStretchArySize = SAL_N_ELEMENTS(aOldStretchXVals);
1221  for (unsigned int i = 0; i<aStretchArySize; ++i)
1222  {
1223  const Size aCurrTextSize = rOutliner.CalcTextSizeNTP();
1224  double fFactor(1.0);
1225  if (bIsVerticalWriting)
1226  {
1227  if (aCurrTextSize.Width() != 0)
1228  {
1229  fFactor = double(aSize.Width()) / aCurrTextSize.Width();
1230  }
1231  }
1232  else if (aCurrTextSize.Height() != 0)
1233  {
1234  fFactor = double(aSize.Height()) / aCurrTextSize.Height();
1235  }
1236  fFactor = std::sqrt(fFactor);
1237 
1238  rOutliner.GetGlobalCharStretching(nCurrStretchX, nCurrStretchY);
1239 
1240  if (fFactor >= 1.0)
1241  {
1242  nMinStretchX = std::max(nMinStretchX, nCurrStretchX);
1243  nMinStretchY = std::max(nMinStretchY, nCurrStretchY);
1244  }
1245 
1246  aOldStretchXVals[i] = nCurrStretchX;
1247  if (std::find(aOldStretchXVals, aOldStretchXVals + i, nCurrStretchX) != aOldStretchXVals + i)
1248  break; // same value already attained once; algo is looping, exit
1249 
1250  if (fFactor < 1.0 || nCurrStretchX != 100)
1251  {
1252  nCurrStretchX = sal::static_int_cast<sal_uInt16>(nCurrStretchX*fFactor);
1253  nCurrStretchY = sal::static_int_cast<sal_uInt16>(nCurrStretchY*fFactor);
1254  rOutliner.SetGlobalCharStretching(std::min(sal_uInt16(100), nCurrStretchX),
1255  std::min(sal_uInt16(100), nCurrStretchY));
1256  }
1257  }
1258 
1259  return std::min(sal_uInt16(100), nCurrStretchY) / 100.0;
1260 }
1261 
1262 void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner ) const
1263 {
1264  const Size aShapeSize=GetSnapRect().GetSize();
1265  ImpAutoFitText( rOutliner,
1268  IsVerticalWriting() );
1269 }
1270 
1271 void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner, const Size& rTextSize, bool bIsVerticalWriting )
1272 {
1273  // EditEngine formatting is unstable enough for
1274  // line-breaking text that we need some more samples
1275 
1276  // loop early-exits if we detect an already attained value
1277  sal_uInt16 nMinStretchX=0, nMinStretchY=0;
1278  sal_uInt16 aOldStretchXVals[]={0,0,0,0,0,0,0,0,0,0};
1279  const size_t aStretchArySize=SAL_N_ELEMENTS(aOldStretchXVals);
1280  for(unsigned int i=0; i<aStretchArySize; ++i)
1281  {
1282  const Size aCurrTextSize = rOutliner.CalcTextSizeNTP();
1283  double fFactor(1.0);
1284  if( bIsVerticalWriting )
1285  {
1286  if (aCurrTextSize.Width() != 0)
1287  {
1288  fFactor = double(rTextSize.Width())/aCurrTextSize.Width();
1289  }
1290  }
1291  else if (aCurrTextSize.Height() != 0)
1292  {
1293  fFactor = double(rTextSize.Height())/aCurrTextSize.Height();
1294  }
1295  // fFactor scales in both x and y directions
1296  // - this is fine for bulleted words
1297  // - but it scales too much for a long paragraph
1298  // - taking sqrt scales long paragraphs the best
1299  // - bulleted words will have to go through more iterations
1300  fFactor = std::sqrt(fFactor);
1301 
1302  sal_uInt16 nCurrStretchX, nCurrStretchY;
1303  rOutliner.GetGlobalCharStretching(nCurrStretchX, nCurrStretchY);
1304 
1305  if (fFactor >= 1.0 )
1306  {
1307  // resulting text area fits into available shape rect -
1308  // err on the larger stretching, to optimally fill area
1309  nMinStretchX = std::max(nMinStretchX,nCurrStretchX);
1310  nMinStretchY = std::max(nMinStretchY,nCurrStretchY);
1311  }
1312 
1313  aOldStretchXVals[i] = nCurrStretchX;
1314  if( std::find(aOldStretchXVals, aOldStretchXVals+i, nCurrStretchX) != aOldStretchXVals+i )
1315  break; // same value already attained once; algo is looping, exit
1316 
1317  if (fFactor < 1.0 || nCurrStretchX != 100)
1318  {
1319  nCurrStretchX = sal::static_int_cast<sal_uInt16>(nCurrStretchX*fFactor);
1320  nCurrStretchY = sal::static_int_cast<sal_uInt16>(nCurrStretchY*fFactor);
1321  rOutliner.SetGlobalCharStretching(std::min(sal_uInt16(100),nCurrStretchX),
1322  std::min(sal_uInt16(100),nCurrStretchY));
1323  SAL_INFO("svx", "zoom is " << nCurrStretchX);
1324  }
1325  }
1326 
1327  SAL_INFO("svx", "final zoom is " << nMinStretchX);
1328  rOutliner.SetGlobalCharStretching(std::min(sal_uInt16(100),nMinStretchX),
1329  std::min(sal_uInt16(100),nMinStretchY));
1330 }
1331 
1333 {
1334  ImpInitDrawOutliner( rOutl );
1335  UpdateOutlinerFormatting( rOutl, rPaintRect );
1336 }
1337 
1339 {
1340  tools::Rectangle aTextRect;
1341  tools::Rectangle aAnchorRect;
1342  Fraction aFitXCorrection(1,1);
1343 
1344  const bool bContourFrame(IsContourTextFrame());
1345  const MapMode aMapMode(
1346  getSdrModelFromSdrObject().GetScaleUnit(),
1347  Point(0,0),
1348  getSdrModelFromSdrObject().GetScaleFraction(),
1349  getSdrModelFromSdrObject().GetScaleFraction());
1350 
1351  rOutl.SetRefMapMode(aMapMode);
1353  bContourFrame,
1354  rOutl,
1355  aTextRect,
1356  aAnchorRect,
1357  rPaintRect,
1358  aFitXCorrection);
1359 }
1360 
1361 
1363 {
1364  SdrText* pText = getActiveText();
1365  if( pText )
1366  return pText->GetOutlinerParaObject();
1367  else
1368  return nullptr;
1369 }
1370 
1371 void SdrTextObj::NbcSetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextObject)
1372 {
1373  NbcSetOutlinerParaObjectForText( std::move(pTextObject), getActiveText() );
1374 }
1375 
1376 void SdrTextObj::NbcSetOutlinerParaObjectForText( std::unique_ptr<OutlinerParaObject> pTextObject, SdrText* pText )
1377 {
1378  if( pText )
1379  pText->SetOutlinerParaObject( std::move(pTextObject) );
1380 
1381  if (pText && pText->GetOutlinerParaObject())
1382  {
1384  ? css::text::WritingMode_TB_RL
1385  : css::text::WritingMode_LR_TB,
1387  GetProperties().SetObjectItemDirect(aWritingMode);
1388  }
1389 
1390  SetTextSizeDirty();
1391  if (IsTextFrame() && (IsAutoGrowHeight() || IsAutoGrowWidth()))
1392  { // adapt text frame!
1394  }
1395  if (!IsTextFrame())
1396  {
1397  // the SnapRect keeps its size
1398  SetRectsDirty(true);
1399  }
1400 
1401  // always invalidate BoundRect on change
1403  ActionChanged();
1404 
1406 }
1407 
1409 {
1410  SdrText* pText = getActiveText();
1411  if( pText && pText->GetOutlinerParaObject() )
1412  {
1413  pText->ReformatText();
1414  if (bTextFrame)
1415  {
1417  }
1418  else
1419  {
1420  // the SnapRect keeps its size
1422  SetRectsDirty(true);
1423  }
1424  SetTextSizeDirty();
1425  ActionChanged();
1426  // i22396
1427  // Necessary here since we have no compare operator at the outliner
1428  // para object which may detect changes regarding the combination
1429  // of outliner para data and configuration (e.g., change of
1430  // formatting of text numerals)
1432  }
1433 }
1434 
1436 {
1437  return new SdrTextObjGeoData;
1438 }
1439 
1441 {
1443  SdrTextObjGeoData& rTGeo=static_cast<SdrTextObjGeoData&>(rGeo);
1444  rTGeo.aRect = maRect;
1445  rTGeo.aGeo =aGeo;
1446 }
1447 
1449 { // RectsDirty is called by SdrObject
1451  const SdrTextObjGeoData& rTGeo=static_cast<const SdrTextObjGeoData&>(rGeo);
1452  NbcSetLogicRect(rTGeo.aRect);
1453  aGeo =rTGeo.aGeo;
1454  SetTextSizeDirty();
1455 }
1456 
1457 drawing::TextFitToSizeType SdrTextObj::GetFitToSize() const
1458 {
1459  drawing::TextFitToSizeType eType = drawing::TextFitToSizeType_NONE;
1460 
1461  if(!IsAutoGrowWidth())
1462  eType = GetObjectItem(SDRATTR_TEXT_FITTOSIZE).GetValue();
1463 
1464  return eType;
1465 }
1466 
1468 {
1469  return maRect;
1470 }
1471 
1473 {
1474  SdrText* pText = getActiveText();
1475  if( pText && (pText->GetOutlinerParaObject() == nullptr) )
1476  {
1477  OutlinerMode nOutlMode = OutlinerMode::TextObject;
1478  if( IsTextFrame() && eTextKind == OBJ_OUTLINETEXT )
1479  nOutlMode = OutlinerMode::OutlineObject;
1480 
1481  pText->ForceOutlinerParaObject( nOutlMode );
1482  }
1483 }
1484 
1486 {
1487  //if (!IsChainable())
1488  // return NULL;
1489 
1491 }
1492 
1494 {
1495  if(pEdtOutl)
1496  {
1497  return pEdtOutl->IsVertical();
1498  }
1499 
1500  OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
1501  if(pOutlinerParaObject)
1502  {
1503  return pOutlinerParaObject->IsVertical();
1504  }
1505 
1506  return false;
1507 }
1508 
1510 {
1511  OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
1512 
1513  if( !pOutlinerParaObject && bVertical )
1514  {
1515  // we only need to force an outliner para object if the default of
1516  // horizontal text is changed
1518  pOutlinerParaObject = GetOutlinerParaObject();
1519  }
1520 
1521  if (!pOutlinerParaObject ||
1522  (pOutlinerParaObject->IsVertical() == bVertical))
1523  return;
1524 
1525  // get item settings
1526  const SfxItemSet& rSet = GetObjectItemSet();
1527  bool bAutoGrowWidth = rSet.Get(SDRATTR_TEXT_AUTOGROWWIDTH).GetValue();
1528  bool bAutoGrowHeight = rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue();
1529 
1530  // Also exchange hor/ver adjust items
1531  SdrTextHorzAdjust eHorz = rSet.Get(SDRATTR_TEXT_HORZADJUST).GetValue();
1532  SdrTextVertAdjust eVert = rSet.Get(SDRATTR_TEXT_VERTADJUST).GetValue();
1533 
1534  // rescue object size
1535  tools::Rectangle aObjectRect = GetSnapRect();
1536 
1537  // prepare ItemSet to set exchanged width and height items
1538  SfxItemSet aNewSet(*rSet.GetPool(),
1540  // Expanded item ranges to also support hor and ver adjust.
1543 
1544  aNewSet.Put(rSet);
1545  aNewSet.Put(makeSdrTextAutoGrowWidthItem(bAutoGrowHeight));
1546  aNewSet.Put(makeSdrTextAutoGrowHeightItem(bAutoGrowWidth));
1547 
1548  // Exchange horz and vert adjusts
1549  switch (eVert)
1550  {
1555  }
1556  switch (eHorz)
1557  {
1562  }
1563 
1564  SetObjectItemSet(aNewSet);
1565 
1566  pOutlinerParaObject = GetOutlinerParaObject();
1567  if (pOutlinerParaObject)
1568  {
1569  // set ParaObject orientation accordingly
1570  pOutlinerParaObject->SetVertical(bVertical);
1571  }
1572 
1573  // restore object size
1574  SetSnapRect(aObjectRect);
1575 }
1576 
1577 // transformation interface for StarOfficeAPI. This implements support for
1578 // homogeneous 3x3 matrices containing the transformation of the SdrObject. At the
1579 // moment it contains a shearX, rotation and translation, but for setting all linear
1580 // transforms like Scale, ShearX, ShearY, Rotate and Translate are supported.
1581 
1582 
1583 // gets base transformation and rectangle of object. If it's an SdrPathObj it fills the PolyPolygon
1584 // with the base geometry and returns TRUE. Otherwise it returns FALSE.
1586 {
1587  // get turn and shear
1588  double fRotate = basegfx::deg2rad(aGeo.nRotationAngle / 100.0);
1589  double fShearX = basegfx::deg2rad(aGeo.nShearAngle / 100.0);
1590 
1591  // get aRect, this is the unrotated snaprect
1592  tools::Rectangle aRectangle(maRect);
1593 
1594  // fill other values
1595  basegfx::B2DTuple aScale(aRectangle.GetWidth(), aRectangle.GetHeight());
1596  basegfx::B2DTuple aTranslate(aRectangle.Left(), aRectangle.Top());
1597 
1598  // position maybe relative to anchorpos, convert
1600  {
1601  if(GetAnchorPos().X() || GetAnchorPos().Y())
1602  {
1603  aTranslate -= basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
1604  }
1605  }
1606 
1607  // build matrix
1609  aScale,
1610  basegfx::fTools::equalZero(fShearX) ? 0.0 : tan(fShearX),
1611  basegfx::fTools::equalZero(fRotate) ? 0.0 : -fRotate,
1612  aTranslate);
1613 
1614  return false;
1615 }
1616 
1617 // sets the base geometry of the object using infos contained in the homogeneous 3x3 matrix.
1618 // If it's an SdrPathObj it will use the provided geometry information. The Polygon has
1619 // to use (0,0) as upper left and will be scaled to the given size in the matrix.
1621 {
1622  // break up matrix
1623  basegfx::B2DTuple aScale;
1624  basegfx::B2DTuple aTranslate;
1625  double fRotate(0.0);
1626  double fShearX(0.0);
1627  rMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
1628 
1629  // flip?
1630  bool bFlipX = aScale.getX() < 0.0,
1631  bFlipY = aScale.getY() < 0.0;
1632  if (bFlipX)
1633  {
1634  aScale.setX(fabs(aScale.getX()));
1635  }
1636  if (bFlipY)
1637  {
1638  aScale.setY(fabs(aScale.getY()));
1639  }
1640 
1641  // reset object shear and rotations
1642  aGeo.nRotationAngle = 0;
1643  aGeo.RecalcSinCos();
1644  aGeo.nShearAngle = 0;
1645  aGeo.RecalcTan();
1646 
1647  // if anchor is used, make position relative to it
1648  if( getSdrModelFromSdrObject().IsWriter() )
1649  {
1650  if(GetAnchorPos().X() || GetAnchorPos().Y())
1651  {
1652  aTranslate += basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
1653  }
1654  }
1655 
1656  // build and set BaseRect (use scale)
1657  Size aSize(FRound(aScale.getX()), FRound(aScale.getY()));
1658  tools::Rectangle aBaseRect(Point(), aSize);
1659  SetSnapRect(aBaseRect);
1660 
1661  // flip?
1662  if (bFlipX)
1663  {
1664  Mirror(Point(), Point(0, 1));
1665  }
1666  if (bFlipY)
1667  {
1668  Mirror(Point(), Point(1, 0));
1669  }
1670 
1671  // shear?
1672  if(!basegfx::fTools::equalZero(fShearX))
1673  {
1674  GeoStat aGeoStat;
1675  aGeoStat.nShearAngle = FRound(basegfx::rad2deg(atan(fShearX)) * 100.0);
1676  aGeoStat.RecalcTan();
1677  Shear(Point(), aGeoStat.nShearAngle, aGeoStat.nTan, false);
1678  }
1679 
1680  // rotation?
1681  if(!basegfx::fTools::equalZero(fRotate))
1682  {
1683  GeoStat aGeoStat;
1684 
1685  // #i78696#
1686  // fRotate is matematically correct, but aGeoStat.nRotationAngle is
1687  // mirrored -> mirror value here
1688  aGeoStat.nRotationAngle = NormAngle36000(FRound(-fRotate / F_PI18000));
1689  aGeoStat.RecalcSinCos();
1690  Rotate(Point(), aGeoStat.nRotationAngle, aGeoStat.nSin, aGeoStat.nCos);
1691  }
1692 
1693  // translate?
1694  if(!aTranslate.equalZero())
1695  {
1696  Move(Size(FRound(aTranslate.getX()), FRound(aTranslate.getY())));
1697  }
1698 }
1699 
1701 {
1702  return pEdtOutl && pEdtOutl->IsModified();
1703 }
1704 
1705 // moved inlines here form hxx
1706 
1708 {
1709  return GetObjectItemSet().Get(SDRATTR_ECKENRADIUS).GetValue();
1710 }
1711 
1713 {
1714  return GetObjectItemSet().Get(SDRATTR_TEXT_MINFRAMEHEIGHT).GetValue();
1715 }
1716 
1718 {
1719  return GetObjectItemSet().Get(SDRATTR_TEXT_MAXFRAMEHEIGHT).GetValue();
1720 }
1721 
1723 {
1724  return GetObjectItemSet().Get(SDRATTR_TEXT_MINFRAMEWIDTH).GetValue();
1725 }
1726 
1728 {
1729  return GetObjectItemSet().Get(SDRATTR_TEXT_MAXFRAMEWIDTH).GetValue();
1730 }
1731 
1733 {
1734  return !bTextFrame // Default is FALSE
1736 }
1737 
1739 {
1740  return !bTextFrame // Default is: no, don't HideContour; HideContour not together with TextFrames
1741  && GetObjectItemSet().Get(XATTR_FORMTXTHIDEFORM).GetValue();
1742 }
1743 
1745 {
1746  return !bTextFrame // ContourFrame not together with normal TextFrames
1748 }
1749 
1751 {
1752  return GetObjectItemSet().Get(SDRATTR_TEXT_LEFTDIST).GetValue();
1753 }
1754 
1756 {
1757  return GetObjectItemSet().Get(SDRATTR_TEXT_RIGHTDIST).GetValue();
1758 }
1759 
1761 {
1762  return GetObjectItemSet().Get(SDRATTR_TEXT_UPPERDIST).GetValue();
1763 }
1764 
1766 {
1767  return GetObjectItemSet().Get(SDRATTR_TEXT_LOWERDIST).GetValue();
1768 }
1769 
1771 {
1772  return GetObjectItemSet().Get(SDRATTR_TEXT_ANIKIND).GetValue();
1773 }
1774 
1776 {
1777  return GetObjectItemSet().Get(SDRATTR_TEXT_ANIDIRECTION).GetValue();
1778 }
1779 
1780 // Get necessary data for text scroll animation. ATM base it on a Text-Metafile and a
1781 // painting rectangle. Rotation is excluded from the returned values.
1783  tools::Rectangle& rScrollRectangle, tools::Rectangle& rPaintRectangle)
1784 {
1785  GDIMetaFile* pRetval = nullptr;
1786  SdrOutliner& rOutliner = ImpGetDrawOutliner();
1787  tools::Rectangle aTextRect;
1788  tools::Rectangle aAnchorRect;
1789  tools::Rectangle aPaintRect;
1790  Fraction aFitXCorrection(1,1);
1791  bool bContourFrame(IsContourTextFrame());
1792 
1793  // get outliner set up. To avoid getting a somehow rotated MetaFile,
1794  // temporarily disable object rotation.
1795  sal_Int32 nAngle(aGeo.nRotationAngle);
1796  aGeo.nRotationAngle = 0;
1797  ImpSetupDrawOutlinerForPaint( bContourFrame, rOutliner, aTextRect, aAnchorRect, aPaintRect, aFitXCorrection );
1798  aGeo.nRotationAngle = nAngle;
1799 
1800  tools::Rectangle aScrollFrameRect(aPaintRect);
1801  const SfxItemSet& rSet = GetObjectItemSet();
1802  SdrTextAniDirection eDirection = rSet.Get(SDRATTR_TEXT_ANIDIRECTION).GetValue();
1803 
1804  if(SdrTextAniDirection::Left == eDirection || SdrTextAniDirection::Right == eDirection)
1805  {
1806  aScrollFrameRect.SetLeft( aAnchorRect.Left() );
1807  aScrollFrameRect.SetRight( aAnchorRect.Right() );
1808  }
1809 
1810  if(SdrTextAniDirection::Up == eDirection || SdrTextAniDirection::Down == eDirection)
1811  {
1812  aScrollFrameRect.SetTop( aAnchorRect.Top() );
1813  aScrollFrameRect.SetBottom( aAnchorRect.Bottom() );
1814  }
1815 
1816  // create the MetaFile
1817  pRetval = new GDIMetaFile;
1819  pBlackHole->EnableOutput(false);
1820  pRetval->Record(pBlackHole);
1821  Point aPaintPos = aPaintRect.TopLeft();
1822 
1823  rOutliner.Draw(pBlackHole, aPaintPos);
1824 
1825  pRetval->Stop();
1826  pRetval->WindStart();
1827 
1828  // return PaintRectanglePixel and pRetval;
1829  rScrollRectangle = aScrollFrameRect;
1830  rPaintRectangle = aPaintRect;
1831 
1832  return pRetval;
1833 }
1834 
1835 // Access to TextAnimationAllowed flag
1837 {
1838  return GetFitToSize() == drawing::TextFitToSizeType_AUTOFIT;
1839 }
1840 
1842 {
1843  const drawing::TextFitToSizeType eFit = GetFitToSize();
1844  return (eFit == drawing::TextFitToSizeType_PROPORTIONAL
1845  || eFit == drawing::TextFitToSizeType_ALLLINES);
1846 }
1847 
1849 {
1850  if(mbTextAnimationAllowed != bNew)
1851  {
1852  mbTextAnimationAllowed = bNew;
1853  ActionChanged();
1854  }
1855 }
1856 
1859 {
1860  const EditStatusFlags nStat = pEditStatus->GetStatusWord();
1861  const bool bGrowX = bool(nStat & EditStatusFlags::TEXTWIDTHCHANGED);
1862  const bool bGrowY = bool(nStat & EditStatusFlags::TextHeightChanged);
1863  if(bTextFrame && (bGrowX || bGrowY))
1864  {
1865  if ((bGrowX && IsAutoGrowWidth()) || (bGrowY && IsAutoGrowHeight()))
1866  {
1868  }
1869  else if ( (IsAutoFit() || IsFitToSize()) && !mbInDownScale)
1870  {
1871  assert(pEdtOutl);
1872  mbInDownScale = true;
1873 
1874  // sucks that we cannot disable paints via
1875  // pEdtOutl->SetUpdateMode(FALSE) - but EditEngine skips
1876  // formatting as well, then.
1878  mbInDownScale = false;
1879  }
1880  }
1881 }
1882 
1883 /* Begin chaining code */
1884 
1885 // XXX: Make it a method somewhere?
1886 static SdrObject *ImpGetObjByName(SdrObjList const *pObjList, OUString const& aObjName)
1887 {
1888  // scan the whole list
1889  size_t nObjCount = pObjList->GetObjCount();
1890  for (size_t i = 0; i < nObjCount; i++) {
1891  SdrObject *pCurObj = pObjList->GetObj(i);
1892 
1893  if (pCurObj->GetName() == aObjName) {
1894  return pCurObj;
1895  }
1896  }
1897  // not found
1898  return nullptr;
1899 }
1900 
1901 // XXX: Make it a (private) method of SdrTextObj
1902 static void ImpUpdateChainLinks(SdrTextObj *pTextObj, OUString const& aNextLinkName)
1903 {
1904  // XXX: Current implementation constraints text boxes to be on the same page
1905 
1906  // No next link
1907  if (aNextLinkName.isEmpty()) {
1908  pTextObj->SetNextLinkInChain(nullptr);
1909  return;
1910  }
1911 
1912  SdrPage *pPage(pTextObj->getSdrPageFromSdrObject());
1913  assert(pPage);
1914  SdrTextObj *pNextTextObj = dynamic_cast< SdrTextObj * >
1915  (ImpGetObjByName(pPage, aNextLinkName));
1916  if (!pNextTextObj) {
1917  SAL_INFO("svx.chaining", "[CHAINING] Can't find object as next link.");
1918  return;
1919  }
1920 
1921  pTextObj->SetNextLinkInChain(pNextTextObj);
1922 }
1923 
1925 {
1926  // Read it as item
1927  const SfxItemSet& rSet = GetObjectItemSet();
1928  OUString aNextLinkName = rSet.Get(SDRATTR_TEXT_CHAINNEXTNAME).GetValue();
1929 
1930  // Update links if any inconsistency is found
1931  bool bNextLinkUnsetYet = !aNextLinkName.isEmpty() && !mpNextInChain;
1932  bool bInconsistentNextLink = mpNextInChain && mpNextInChain->GetName() != aNextLinkName;
1933  // if the link is not set despite there should be one OR if it has changed
1934  if (bNextLinkUnsetYet || bInconsistentNextLink) {
1935  ImpUpdateChainLinks(const_cast<SdrTextObj *>(this), aNextLinkName);
1936  }
1937 
1938  return !aNextLinkName.isEmpty(); // XXX: Should we also check for GetNilChainingEvent? (see old code below)
1939 
1940 /*
1941  // Check that no overflow is going on
1942  if (!GetTextChain() || GetTextChain()->GetNilChainingEvent(this))
1943  return false;
1944 */
1945 }
1946 
1948 {
1949  if (!pEdtOutl)
1950  return;
1951 
1952  // Outliner for text transfer
1953  SdrOutliner &aDrawOutliner = ImpGetDrawOutliner();
1954 
1955  EditingTextChainFlow aTxtChainFlow(this);
1956  aTxtChainFlow.CheckForFlowEvents(pEdtOutl);
1957 
1958  if (aTxtChainFlow.IsOverflow()) {
1959  SAL_INFO("svx.chaining", "[CHAINING] Overflow going on");
1960  // One outliner is for non-overflowing text, the other for overflowing text
1961  // We remove text directly from the editing outliner
1962  aTxtChainFlow.ExecuteOverflow(pEdtOutl, &aDrawOutliner);
1963  } else if (aTxtChainFlow.IsUnderflow()) {
1964  SAL_INFO("svx.chaining", "[CHAINING] Underflow going on");
1965  // underflow-induced overflow
1966  aTxtChainFlow.ExecuteUnderflow(&aDrawOutliner);
1967  bool bIsOverflowFromUnderflow = aTxtChainFlow.IsOverflow();
1968  // handle overflow
1969  if (bIsOverflowFromUnderflow) {
1970  SAL_INFO("svx.chaining", "[CHAINING] Overflow going on (underflow induced)");
1971  // prevents infinite loops when setting text for editing outliner
1972  aTxtChainFlow.ExecuteOverflow(&aDrawOutliner, &aDrawOutliner);
1973  }
1974  }
1975 }
1976 
1978 {
1979  /*
1980  if (GetTextChain())
1981  return GetTextChain()->GetNextLink(this);
1982 
1983  return NULL;
1984  */
1985 
1986  return mpNextInChain;
1987 }
1988 
1990 {
1991  // Basically a doubly linked list implementation
1992 
1993  SdrTextObj *pOldNextObj = mpNextInChain;
1994 
1995  // Replace next link
1996  mpNextInChain = pNextObj;
1997  // Deal with old next link's prev link
1998  if (pOldNextObj) {
1999  pOldNextObj->mpPrevInChain = nullptr;
2000  }
2001 
2002  // Deal with new next link's prev link
2003  if (mpNextInChain) {
2004  // If there is a prev already at all and this is not already the current object
2006  mpNextInChain->mpPrevInChain != this)
2008  mpNextInChain->mpPrevInChain = this;
2009  }
2010 
2011  // TODO: Introduce check for circular chains
2012 
2013 }
2014 
2016 {
2017  /*
2018  if (GetTextChain())
2019  return GetTextChain()->GetPrevLink(this);
2020 
2021  return NULL;
2022  */
2023 
2024  return mpPrevInChain;
2025 }
2026 
2028 {
2029  // Prevent chaining it 1) during dragging && 2) when we are editing next link
2031 }
2032 
2034 {
2036  SdrTextObj *pTextObjClone = dynamic_cast<SdrTextObj *>(pClone.get());
2037  if (pTextObjClone != nullptr) {
2038  // Avoid transferring of text for chainable object during dragging
2039  pTextObjClone->mbIsUnchainableClone = true;
2040  }
2041 
2042  return pClone;
2043  }
2044 
2045 /* End chaining code */
2046 
2049 {
2050  if( !mpText )
2051  return getText( 0 );
2052  else
2053  return mpText.get();
2054 }
2055 
2057 SdrText* SdrTextObj::getText( sal_Int32 nIndex ) const
2058 {
2059  if( nIndex == 0 )
2060  {
2061  if( !mpText )
2062  const_cast< SdrTextObj* >(this)->mpText.reset( new SdrText( *const_cast< SdrTextObj* >(this) ) );
2063  return mpText.get();
2064  }
2065  else
2066  {
2067  return nullptr;
2068  }
2069 }
2070 
2072 sal_Int32 SdrTextObj::getTextCount() const
2073 {
2074  return 1;
2075 }
2076 
2078 void SdrTextObj::setActiveText( sal_Int32 /*nIndex*/ )
2079 {
2080 }
2081 
2083 sal_Int32 SdrTextObj::CheckTextHit(const Point& /*rPnt*/) const
2084 {
2085  return 0;
2086 }
2087 
2089 {
2091 }
2092 
2093 
2094 // The concept of the text object:
2095 // ~~~~~~~~~~~~~~~~~~~~~~~~
2096 // Attributes/Variations:
2097 // - bool text frame / graphics object with caption
2098 // - bool FontWork (if it is not a text frame and not a ContourTextFrame)
2099 // - bool ContourTextFrame (if it is not a text frame and not Fontwork)
2100 // - long rotation angle (if it is not FontWork)
2101 // - long text frame margins (if it is not FontWork)
2102 // - bool FitToSize (if it is not FontWork)
2103 // - bool AutoGrowingWidth/Height (if it is not FitToSize and not FontWork)
2104 // - long Min/MaxFrameWidth/Height (if AutoGrowingWidth/Height)
2105 // - enum horizontal text anchoring left,center,right,justify/block,Stretch(ni)
2106 // - enum vertical text anchoring top, middle, bottom, block, stretch(ni)
2107 // - enum ticker text (if it is not FontWork)
2108 
2109 // Every derived object is either a text frame (bTextFrame=true)
2110 // or a drawing object with a caption (bTextFrame=false).
2111 
2112 // Default anchoring for text frames:
2113 // SDRTEXTHORZADJUST_BLOCK, SDRTEXTVERTADJUST_TOP
2114 // = static Pool defaults
2115 // Default anchoring for drawing objects with a caption:
2116 // SDRTEXTHORZADJUST_CENTER, SDRTEXTVERTADJUST_CENTER
2117 // via "hard" attribution of SdrAttrObj
2118 
2119 // Every object derived from SdrTextObj must return an "UnrotatedSnapRect"
2120 // (->TakeUnrotatedSnapRect()) (the reference point for the rotation is the top
2121 // left of the rectangle (aGeo.nRotationAngle)) which is the basis for anchoring
2122 // text. We then subtract the text frame margins from this rectangle, as a re-
2123 // sult we get the anchoring area (->TakeTextAnchorRect()). Within this area, we
2124 // calculate the anchoring point and the painting area, depending on the hori-
2125 // zontal and vertical adjustment of the text (SdrTextVertAdjust,
2126 // SdrTextHorzAdjust).
2127 // In the case of drawing objects with a caption the painting area might well
2128 // be larger than the anchoring area, for text frames on the other hand, it is
2129 // always of the same or a smaller size (except when there are negative text
2130 // frame margins).
2131 
2132 // FitToSize takes priority over text anchoring and AutoGrowHeight/Width. When
2133 // FitToSize is turned on, the painting area is always equal to the anchoring
2134 // area. Additionally, FitToSize doesn't allow automatic line breaks.
2135 
2136 // ContourTextFrame:
2137 // - long rotation angle
2138 // - long text frame margins (maybe later)
2139 // - bool FitToSize (maybe later)
2140 // - bool AutoGrowingWidth/Height (maybe much later)
2141 // - long Min/MaxFrameWidth/Height (maybe much later)
2142 // - enum horizontal text anchoring (maybe later, for now: left, centered)
2143 // - enum vertical text anchoring (maybe later, for now: top)
2144 // - enum ticker text (maybe later, maybe even with correct clipping)
2145 
2146 // When making changes, check these:
2147 // - Paint
2148 // - HitTest
2149 // - ConvertToPoly
2150 // - Edit
2151 // - Printing, Saving, Painting in neighboring View while editing
2152 // - ModelChanged (e. g. through a neighboring View or rulers) while editing
2153 // - FillColorChanged while editing
2154 // - and many more...
2155 
2156 
2157 /* 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:2083
bool IsOverflow() const
long GetMinTextFrameHeight() const
Definition: svdotext.cxx:1712
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:1782
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:1199
bool IsChainable() const
Definition: svdotext.cxx:1924
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:1332
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:1112
void SetNextLinkInChain(SdrTextObj *)
Definition: svdotext.cxx:1989
SdrObjUserCall * pUserCall
Definition: svdobj.hxx:923
void ForceOutlinerParaObject()
Definition: svdotext.cxx:1472
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:2057
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:1722
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:1133
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:1770
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:1163
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:929
bool mbTextAnimationAllowed
Definition: svdotext.hxx:248
bool IsTopToBottom() const
virtual void setActiveText(sal_Int32 nIndex)
changes the current active text
Definition: svdotext.cxx:2078
bool IsRecord() const
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix &rMatrix, const basegfx::B2DPolyPolygon &rPolyPolygon) override
Definition: svdotext.cxx:1620
virtual void NbcReformatText() override
Definition: svdotext.cxx:1408
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:2033
virtual void RecalcSnapRect() override
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
Definition: svdotext.cxx:1099
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:1435
bool IsEmpty() const
TextChain * GetTextChain() const
Definition: svdotext.cxx:1485
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:1440
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:1902
virtual bool IsReallyEdited() const
returns true only if we are in edit mode and the user actually changed anything
Definition: svdotext.cxx:1700
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:1457
virtual void onEditOutlinerStatusEvent(EditStatus *pEditStatus)
called from the SdrObjEditView during text edit when the status of the edit outliner changes ...
Definition: svdotext.cxx:1858
bool bNoShear
Definition: svdotext.hxx:232
bool IsUnderflow() const
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdotext.cxx:75
std::unique_ptr< OutlinerParaObject > GetEditOutlinerParaObject() const
Definition: svdotext.cxx:808
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:2027
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:1010
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:1707
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:1338
long GetTextLeftDistance() const
Left inner spacing to borders.
Definition: svdotext.cxx:1750
void SetText(const OutlinerParaObject &)
long GetTextRightDistance() const
Right inner spacing to borders.
Definition: svdotext.cxx:1755
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:1841
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:1886
void SetRight(long v)
SdrTextObj & operator=(const SdrTextObj &rObj)
Definition: svdotext.cxx:1015
void ActionChanged() const
Definition: svdobj.cxx:283
double nTan
Definition: svdtrans.hxx:218
long GetMaxTextFrameHeight() const
Definition: svdotext.cxx:1717
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
OString stripStart(const OString &rIn, sal_Char c)
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:1738
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:2048
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:1744
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:1072
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:1760
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:1977
Paragraph * GetParagraph(sal_Int32 nAbsPos) const
bool IsPause() const
#define SDRATTR_TEXT_UPPERDIST
Definition: svddef.hxx:200
long GetMaxTextFrameWidth() const
Definition: svdotext.cxx:1727
void SetObjectItemNoBroadcast(const SfxPoolItem &rItem)
Definition: svdotext.cxx:2088
#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:1371
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:1493
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:1448
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:1362
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:1376
#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:1947
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:1775
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:1117
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:1836
virtual sal_Int32 getTextCount() const override
returns the number of texts available for this object.
Definition: svdotext.cxx:2072
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:1585
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:1061
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:2015
static void ImpJustifyRect(tools::Rectangle &rRect)
Definition: svdotext.cxx:391
SdrOutliner & ImpGetDrawOutliner() const
Definition: svdotext.cxx:1152
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:1509
const tools::Rectangle & GetGeoRect() const
Definition: svdotext.cxx:1467
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:1765
#define SDRATTR_TEXT_LEFTDIST
Definition: svddef.hxx:198
Point Center() const
long Y() const
virtual bool IsFontwork() const
Definition: svdotext.cxx:1732
scroll back and forth
static void ImpSetCharStretching(SdrOutliner &rOutliner, const Size &rTextSize, const Size &rShapeSize, Fraction &rFitXCorrection)
Definition: svdotext.cxx:819
void ImpAutoFitText(SdrOutliner &rOutliner) const
Definition: svdotext.cxx:1262
void SetTextAnimationAllowed(bool bNew)
Definition: svdotext.cxx:1848
void ClearPolygon()
#define SDRATTR_ECKENRADIUS
Definition: svddef.hxx:194
virtual OUString TakeObjNamePlural() const override
Definition: svdotext.cxx:993
const Size & GetPaperSize() const
virtual void CheckForFlowEvents(SdrOutliner *) override