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