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 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.
495  const tools::Long nW = std::max<tools::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.
510  const tools::Long nH = std::max<tools::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  tools::Long nLeftDist=GetTextLeftDistance();
589  tools::Long nRightDist=GetTextRightDistance();
590  tools::Long nUpperDist=GetTextUpperDistance();
591  tools::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  tools::Long nAnkWdt=aAnkRect.GetWidth();
647  tools::Long nAnkHgt=aAnkRect.GetHeight();
648  if (bFrame)
649  {
650  tools::Long nWdt=nAnkWdt;
651  tools::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  tools::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  tools::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  tools::Long nXDiff0=0x7FFFFFFF;
856  tools::Long nWantWdt=rShapeSize.Width();
857  tools::Long nIsWdt=rTextSize.Width();
858  if (nIsWdt==0) nIsWdt=1;
859 
860  tools::Long nWantHgt=rShapeSize.Height();
861  tools::Long nIsHgt=rTextSize.Height();
862  if (nIsHgt==0) nIsHgt=1;
863 
864  tools::Long nXTolPl=nWantWdt/100; // tolerance: +1%
865  tools::Long nXTolMi=nWantWdt/25; // tolerance: -4%
866  tools::Long nXCorr =nWantWdt/20; // correction scale: 5%
867 
868  tools::Long nX=(nWantWdt*100) /nIsWdt; // calculate X stretching
869  tools::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  tools::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  tools::Long nMul=nWantWdt;
909  tools::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 = OUString::Concat(aStr2.subView(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  return;
1178 
1179  // FitToSize can't be used together with ContourFrame for now
1180  if (IsFitToSize())
1181  {
1182  ImpSetCharStretching(rOutliner,rTextRect.GetSize(),rAnchorRect.GetSize(),rFitXCorrection);
1183  rPaintRect=rAnchorRect;
1184  }
1185  else if (IsAutoFit())
1186  {
1187  ImpAutoFitText(rOutliner);
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,
1264  bool bIsVerticalWriting) const
1265 {
1266  // EditEngine formatting is unstable enough for
1267  // line-breaking text that we need some more samples
1268 
1269  // loop early-exits if we detect an already attained value
1270  sal_uInt16 nMinStretchX=0, nMinStretchY=0;
1271  sal_uInt16 aOldStretchXVals[]={0,0,0,0,0,0,0,0,0,0};
1272  const size_t aStretchArySize=SAL_N_ELEMENTS(aOldStretchXVals);
1273  for(unsigned int i=0; i<aStretchArySize; ++i)
1274  {
1275  const Size aCurrTextSize = rOutliner.CalcTextSizeNTP();
1276  double fFactor(1.0);
1277  if( bIsVerticalWriting )
1278  {
1279  if (aCurrTextSize.Width() != 0)
1280  {
1281  fFactor = double(rTextSize.Width())/aCurrTextSize.Width();
1282  }
1283  }
1284  else if (aCurrTextSize.Height() != 0)
1285  {
1286  fFactor = double(rTextSize.Height())/aCurrTextSize.Height();
1287  }
1288  // fFactor scales in both x and y directions
1289  // - this is fine for bulleted words
1290  // - but it scales too much for a long paragraph
1291  // - taking sqrt scales long paragraphs the best
1292  // - bulleted words will have to go through more iterations
1293  fFactor = std::sqrt(fFactor);
1294 
1295  sal_uInt16 nCurrStretchX, nCurrStretchY;
1296  rOutliner.GetGlobalCharStretching(nCurrStretchX, nCurrStretchY);
1297 
1298  if (fFactor >= 1.0 )
1299  {
1300  // resulting text area fits into available shape rect -
1301  // err on the larger stretching, to optimally fill area
1302  nMinStretchX = std::max(nMinStretchX,nCurrStretchX);
1303  nMinStretchY = std::max(nMinStretchY,nCurrStretchY);
1304  }
1305 
1306  aOldStretchXVals[i] = nCurrStretchX;
1307  if( std::find(aOldStretchXVals, aOldStretchXVals+i, nCurrStretchX) != aOldStretchXVals+i )
1308  break; // same value already attained once; algo is looping, exit
1309 
1310  if (fFactor < 1.0 || nCurrStretchX != 100)
1311  {
1312  nCurrStretchX = sal::static_int_cast<sal_uInt16>(nCurrStretchX*fFactor);
1313  nCurrStretchY = sal::static_int_cast<sal_uInt16>(nCurrStretchY*fFactor);
1314  rOutliner.SetGlobalCharStretching(std::min(sal_uInt16(100),nCurrStretchX),
1315  std::min(sal_uInt16(100),nCurrStretchY));
1316  SAL_INFO("svx", "zoom is " << nCurrStretchX);
1317  }
1318  }
1319 
1321  if (rItem.GetMaxScale() > 0)
1322  {
1323  nMinStretchX = std::min<sal_uInt16>(rItem.GetMaxScale(), nMinStretchX);
1324  nMinStretchY = std::min<sal_uInt16>(rItem.GetMaxScale(), nMinStretchY);
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  return;
1413 
1414  pText->ReformatText();
1415  if (bTextFrame)
1416  {
1418  }
1419  else
1420  {
1421  // the SnapRect keeps its size
1423  SetRectsDirty(true);
1424  }
1425  SetTextSizeDirty();
1426  ActionChanged();
1427  // i22396
1428  // Necessary here since we have no compare operator at the outliner
1429  // para object which may detect changes regarding the combination
1430  // of outliner para data and configuration (e.g., change of
1431  // formatting of text numerals)
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  return;
1865 
1866  if ((bGrowX && IsAutoGrowWidth()) || (bGrowY && IsAutoGrowHeight()))
1867  {
1869  }
1870  else if ( (IsAutoFit() || IsFitToSize()) && !mbInDownScale)
1871  {
1872  assert(pEdtOutl);
1873  mbInDownScale = true;
1874 
1875  // sucks that we cannot disable paints via
1876  // pEdtOutl->SetUpdateMode(FALSE) - but EditEngine skips
1877  // formatting as well, then.
1879  mbInDownScale = false;
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
constexpr TypedWhichId< XFormTextHideFormItem > XATTR_FORMTXTHIDEFORM(XATTR_TEXT_FIRST+10)
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_AUTOGROWHEIGHT(SDRATTR_MISC_FIRST+2)
tools::Long GetTextLowerDistance() const
Bottom inner spacing to borders.
Definition: svdotext.cxx:1765
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
void FitFrameToTextSize()
Definition: svdotext.cxx:165
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)
constexpr TypedWhichId< SdrTextHorzAdjustItem > SDRATTR_TEXT_HORZADJUST(SDRATTR_MISC_FIRST+13)
TextChain * GetTextChain() const
Definition: svdmodel.cxx:1925
GDIMetaFile * GetTextScrollMetaFileAndRectangle(tools::Rectangle &rScrollRectangle, tools::Rectangle &rPaintRectangle)
Definition: svdotext.cxx:1782
OutlinerMode
virtual bool NbcAdjustTextFrameWidthAndHeight(bool bHgt=true, bool bWdt=true)
Definition: svdotxat.cxx:239
double GetFontScaleY() const
Definition: svdotext.cxx:1191
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
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
virtual sal_uInt32 GetSnapPointCount() const override
snap to special points of an Object (polygon points, center of circle)
Definition: svdotext.cxx:1104
virtual SdrObjKind GetObjIdentifier() const override
Definition: svdotext.cxx:415
void SetNextLinkInChain(SdrTextObj *)
Definition: svdotext.cxx:1989
SdrObjUserCall * pUserCall
Definition: svdobj.hxx:874
void ForceOutlinerParaObject()
Definition: svdotext.cxx:1472
std::string GetValue
virtual void handlePageChange(SdrPage *pOldPage, SdrPage *pNewPage)
Definition: svdobj.cxx:449
double nSin
Definition: svdtrans.hxx:219
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_AUTOGROWWIDTH(SDRATTR_MISC_FIRST+12)
Point BottomLeft() const
virtual SdrText * getText(sal_Int32 nIndex) const override
returns the nth available text.
Definition: svdotext.cxx:2057
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
tools::Long GetTextLeftDistance() const
Left inner spacing to borders.
Definition: svdotext.cxx:1750
SdrTextHorzAdjust
Definition: sdtaitm.hxx:53
tools::Long GetEckenradius() const
Definition: svdotext.cxx:1707
long Long
tools::Long nRotationAngle
Definition: svdtrans.hxx:216
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_TEXT_CONTOURFRAME(SDRATTR_MISC_FIRST+21)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_MAXFRAMEWIDTH(SDRATTR_MISC_FIRST+11)
bool ImpCanConvTextToCurve() const
Definition: svdotxtr.cxx:424
SdrOutliner * pEdtOutl
Definition: svdotext.hxx:196
bool IsTextFrame() const
Definition: svdotext.hxx:343
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:758
SVX_DLLPRIVATE void ImpInitDrawOutliner(SdrOutliner &rOutl) const
Definition: svdotext.cxx:1125
size_t GetObjCount() const
Definition: svdpage.cxx:752
virtual void SetBoundRectDirty()
Definition: svdobj.cxx:310
void Draw(OutputDevice *pOutDev, const tools::Rectangle &rOutRect)
bool IsInEditMode() const
Definition: svdotext.hxx:323
SdrTextAniKind GetTextAniKind() const
Definition: svdotext.cxx:1770
double getY() const
tools::Long GetWidth() 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:80
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
tools::Long GetMinTextFrameHeight() const
Definition: svdotext.cxx:1712
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: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:396
void RecalcTan()
Definition: svdtrans.cxx:463
virtual sdr::properties::BaseProperties & GetProperties() const
Definition: svdobj.cxx:204
void SetRefMapMode(const MapMode &)
virtual const tools::Rectangle & GetSnapRect() const override
Definition: svdoattr.cxx:44
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:1091
EEControlBits
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:174
constexpr double rad2deg(double v)
SdrObjKind
Definition: svdobjkind.hxx:24
void SetRight(tools::Long v)
virtual bool HasText() const override
Definition: svdotxat.cxx:413
sdr::contact::ViewContact & GetViewContact() const
Definition: svdobj.cxx:245
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
Definition: sdtagitm.hxx:25
SdrTextAniKind
Animation type for text frame.
Definition: sdtakitm.hxx:29
bool mbInEditMode
Definition: svdotext.hxx:235
EETextFormat
void ShearPoly(tools::Polygon &rPoly, const Point &rRef, double tn)
Definition: svdtrans.cxx:146
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
tools::Long GetMaxTextFrameHeight() const
Definition: svdotext.cxx:1717
Provides information about various ZObject properties.
Definition: svdobj.hxx:196
virtual ~SdrTextObj() override
Definition: svdotext.cxx:156
SdrMetricItem makeSdrTextMinFrameWidthItem(tools::Long mnWidth)
Definition: sdtmfitm.hxx:35
void Record(OutputDevice *pOutDev)
void SetControlWord(EEControlBits nWord)
SdrTextObj * mpPrevInChain
Definition: svdotext.hxx:224
tools::Long Left() const
SdrPage * getSdrPageFromSdrObject() const
Definition: svdobj.cxx:263
void SetLeft(tools::Long v)
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:25
SdrTextObj(SdrModel &rSdrModel)
Definition: svdotext.cxx:69
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
const vcl::Font & GetFont() const
#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
tools::Long Bottom() const
virtual bool IsReallyEdited() const
returns true only if we are in edit mode and the user actually changed anything
Definition: svdotext.cxx:1700
const SfxItemSet & GetObjectItemSet() const
Definition: svdobj.cxx:1885
constexpr TypedWhichId< SdrTextAniDirectionItem > SDRATTR_TEXT_ANIDIRECTION(SDRATTR_MISC_FIRST+15)
SfxStyleSheet * GetStyleSheet() const
Definition: svdobj.cxx:2141
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
tools::Long GetMaxTextFrameWidth() const
Definition: svdotext.cxx:1727
bool IsUnderflow() const
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdotext.cxx:58
SdrAttrObj & operator=(SdrAttrObj const &)=default
EEControlBits GetControlWord() const
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
Definition: sdtagitm.hxx:30
void SetObjectItem(const SfxPoolItem &rItem)
Definition: svdobj.cxx:1895
virtual bool IsAutoGrowWidth() const
Definition: svdotext.cxx:282
tools::Rectangle maSnapRect
Definition: svdoattr.hxx:42
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_SHADOW(SDRATTR_SHADOW_FIRST+0)
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_LOWERDIST(SDRATTR_MISC_FIRST+7)
OutputDevice * GetRefDevice() const
constexpr TypedWhichId< XFormTextStyleItem > XATTR_FORMTXTSTYLE(XATTR_TEXT_FIRST)
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: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:1920
SdrTextHorzAdjust GetTextHorizontalAdjust() const
Definition: svdotext.cxx:309
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)
constexpr TypedWhichId< SdrTextFitToSizeTypeItem > SDRATTR_TEXT_FITTOSIZE(SDRATTR_MISC_FIRST+3)
const EditTextObject & GetTextObject() const
virtual void 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:899
double nCos
Definition: svdtrans.hxx:220
void UpdateOutlinerFormatting(SdrOutliner &rOutl, tools::Rectangle &rPaintRect) const
Update given Outliner equivalently to SdrTextObj::Paint()
Definition: svdotext.cxx:1338
virtual void Rotate(const Point &rRef, tools::Long nAngle, double sn, double cs)
Definition: svdobj.cxx:1512
void SetText(const OutlinerParaObject &)
int i
bool IsWriter() const
Definition: svdmodel.hxx:575
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)
tools::Long FRound(double fVal)
void SetVertical(bool bNew)
#define LANGUAGE_SYSTEM
void ExecuteOverflow(SdrOutliner *, SdrOutliner *)
SdrMetricItem makeSdrEckenradiusItem(tools::Long nRadius)
Definition: sderitm.hxx:25
void SetSize(const Size &rSize)
void BroadcastObjectChange() const
Definition: svdobj.cxx:905
constexpr TypedWhichId< SdrTextVertAdjustItem > SDRATTR_TEXT_VERTADJUST(SDRATTR_MISC_FIRST+8)
static SdrObject * ImpGetObjByName(SdrObjList const *pObjList, OUString const &aObjName)
Definition: svdotext.cxx:1886
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_LEFTDIST(SDRATTR_MISC_FIRST+4)
SdrTextObj & operator=(const SdrTextObj &rObj)
Definition: svdotext.cxx:1007
void ActionChanged() const
Definition: svdobj.cxx:257
double nTan
Definition: svdtrans.hxx:218
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_MAXFRAMEHEIGHT(SDRATTR_MISC_FIRST+9)
virtual void SaveGeoData(SdrObjGeoData &rGeo) const
Definition: svdobj.cxx:1816
static bool equalZero(const double &rfVal)
void SetText(const OUString &rStr)
Definition: svdotext.cxx:204
tools::Long Width() const
EditStatusFlags
float u
bool mbIsUnchainableClone
Definition: svdotext.hxx:220
virtual basegfx::B2DPolyPolygon TakeContour() const
contour for TextToContour
Definition: svdobj.cxx:1076
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_MINFRAMEWIDTH(SDRATTR_MISC_FIRST+10)
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:273
void transform(const basegfx::B2DHomMatrix &rMatrix)
bool IsModified() const
virtual void TakeTextAnchorRect(::tools::Rectangle &rAnchorRect) const
Definition: svdotext.cxx:586
bool IsHideContour() const
Definition: svdotext.cxx:1738
bool mbInDownScale
Definition: svdotext.hxx:251
constexpr double deg2rad(double v)
virtual void SetLogicRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1632
void SetTop(tools::Long v)
virtual void Move(const Size &rSiz)
Definition: svdobj.cxx:1467
void SetMergedItem(const SfxPoolItem &rItem)
Definition: svdobj.cxx:1900
void SetBottom(tools::Long v)
OUString GetText(Paragraph const *pPara, sal_Int32 nParaCount=1) const
constexpr TypedWhichId< SfxStringItem > SDRATTR_TEXT_CHAINNEXTNAME(SDRATTR_MISC_FIRST+25)
virtual void AdaptTextMinSize()
Definition: svdotext.cxx:469
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_MINFRAMEHEIGHT(SDRATTR_MISC_FIRST+1)
::basegfx::B2DPolygon getB2DPolygon() const
virtual SdrText * getActiveText() const
returns the currently active text.
Definition: svdotext.cxx:2048
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:1925
void WindStart()
void flushViewObjectContacts(bool bWithHierarchy=true)
bool IsContourTextFrame() const
Definition: svdotext.cxx:1744
tools::Long Top() const
Abstract DrawObject.
Definition: svdobj.hxx:260
SdrObjKind eTextKind
Definition: svdotext.hxx:204
virtual basegfx::B2DPolyPolygon TakeContour() const override
contour for TextToContour
Definition: svdotext.cxx: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:1523
OUString GetName() const
Definition: svdobj.cxx:698
Size GetSize() const
#define Y
SVX_DLLPRIVATE void ImpRegisterLink()
Definition: svdotxln.cxx:254
tools::Long GetMinTextFrameWidth() const
Definition: svdotext.cxx:1722
bool bTextFrame
Definition: svdotext.hxx:231
SdrTextObj * GetNextLinkInChain() const
Definition: svdotext.cxx:1977
Paragraph * GetParagraph(sal_Int32 nAbsPos) const
tools::Long AdjustTop(tools::Long nVertMoveDelta)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_UPPERDIST(SDRATTR_MISC_FIRST+6)
void NbcSetEckenradius(tools::Long nRad)
Definition: svdotext.cxx:462
bool IsPause() const
bool CanCreateEditOutlinerParaObject() const
Definition: svdotext.cxx:791
tools::Long GetTextRightDistance() const
Right inner spacing to borders.
Definition: svdotext.cxx:1755
void SetObjectItemNoBroadcast(const SfxPoolItem &rItem)
Definition: svdotext.cxx:2088
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
void SetPolygon(const basegfx::B2DPolyPolygon &rPolyPolygon)
virtual void RestGeoData(const SdrObjGeoData &rGeo)
Definition: svdobj.cxx:1839
virtual void NbcSetOutlinerParaObject(std::unique_ptr< OutlinerParaObject > pTextObject) override
Definition: svdotext.cxx:1371
virtual const tools::Rectangle & GetLastBoundRect() const
Definition: svdobj.cxx:868
void CheckPortionInfo(SdrOutliner &rOutliner)
Definition: svdtext.cxx:41
sal_Int16 GetMaxScale() const
Definition: sdtfsitm.hxx:59
void RotatePoint(Point &rPnt, const Point &rRef, double sn, double cs)
Definition: svdtrans.hxx: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
tools::Long GetTextUpperDistance() const
Top inner spacing to borders.
Definition: svdotext.cxx:1760
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:621
void ReformatText()
Definition: svdtext.cxx:61
void setY(double fY)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_TEXT_RIGHTDIST(SDRATTR_MISC_FIRST+5)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
bool equalZero() const
virtual OutlinerParaObject * GetOutlinerParaObject() const override
Definition: svdotext.cxx:1362
void RecalcSinCos()
Definition: svdtrans.cxx:451
virtual bool AdjustTextFrameWidthAndHeight()
Definition: svdotxat.cxx:255
void SetObjectItemSet(const SfxItemSet &rSet)
Definition: svdobj.cxx:1910
SdrMetricItem makeSdrTextMinFrameHeightItem(tools::Long mnHeight)
Definition: sdtmfitm.hxx:25
void SetFont(const vcl::Font &rNewFont)
void NbcSetOutlinerParaObjectForText(std::unique_ptr< OutlinerParaObject > pTextObject, SdrText *pText)
Definition: svdotext.cxx:1376
tools::Long GetTextHeight() const
#define SAL_INFO(area, stream)
OUString aName
virtual void SetOutlinerParaObject(std::unique_ptr< OutlinerParaObject > pTextObject)
Definition: svdtext.cxx:72
void SetMinAutoPaperSize(const Size &rSz)
tools::Long NormAngle36000(tools::Long a)
Normalize angle to -180.00..179.99.
Definition: svdtrans.cxx:408
void NbcSetText(const OUString &rStr)
Definition: svdotext.cxx:190
constexpr TypedWhichId< SdrTextAniKindItem > SDRATTR_TEXT_ANIKIND(SDRATTR_MISC_FIRST+14)
#define F_PI18000
void Init(OutlinerMode nOutlinerMode)
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
tools::Long Height() const
Size aTextSize
Definition: svdotext.hxx:191
void ImpSetTextStyleSheetListeners()
Definition: svdotxat.cxx:293
void onChainingEvent()
called from the SdrObjEditView during text edit when a chain of boxes is to be updated ...
Definition: svdotext.cxx:1947
OString stripStart(const OString &rIn, char c)
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:98
SdrOnOffItem makeSdrShadowItem(bool bShadow)
Definition: sdshitm.hxx:25
virtual SdrObjectUniquePtr getFullDragClone() const
Definition: svdobj.cxx:1279
SdrTextAniDirection GetTextAniDirection() const
Definition: svdotext.cxx:1775
void SetUpdateMode(bool bUpdate)
SdrTextAniDirection
Definition: sdtaditm.hxx:29
constexpr TypedWhichId< SdrTextFixedCellHeightItem > SDRATTR_TEXT_USEFIXEDCELLHEIGHT(SDRATTR_MISC_FIRST+23)
const Point & GetAnchorPos() const
Definition: svdobj.cxx:1589
void SetStyleSheet(sal_Int32 nPara, SfxStyleSheet *pStyle)
text object
Definition: svdobjkind.hxx:43
bool IsOutlText() const
Definition: svdotext.hxx:344
virtual void SetRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:435
bool IsVertical() const
Size CalcTextSizeNTP()
tools::Long GetHeight() const
virtual Point GetSnapPoint(sal_uInt32 i) const override
Definition: svdotext.cxx:1109
virtual void SetSnapRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1623
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
bool IsAutoFit() const
returns true if the PPT autofit of text into shape bounds is enabled. implies IsFitToSize()==false! ...
Definition: svdotext.cxx:1836
virtual sal_Int32 getTextCount() const override
returns the number of texts available for this object.
Definition: svdotext.cxx:2072
void SetTextObj(const SdrTextObj *pObj)
Definition: svdoutl.cxx:40
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
virtual bool TRGetBaseGeometry(basegfx::B2DHomMatrix &rMatrix, basegfx::B2DPolyPolygon &rPolyPolygon) const override
Definition: svdotext.cxx:1585
bool LineGeometryUsageIsNecessary() const
Definition: svdobj.cxx:962
tools::Rectangle GetBoundRect() const
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:365
virtual void Shear(const Point &rRef, tools::Long nAngle, double tn, bool bVShear)
Definition: svdobj.cxx:1532
tools::Long nShearAngle
Definition: svdtrans.hxx:217
const SdrTextObj * GetTextObj() const
Definition: svdoutl.cxx:86
void Clear()
OutlinerParaObject * GetOutlinerParaObject() const
Definition: svdtext.cxx:88
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
Definition: svdotxtr.cxx:74
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdotext.cxx:64
virtual void SetChanged()
Definition: svdobj.cxx:929
TitleText, special text object for StarDraw.
Definition: svdobjkind.hxx:44
constexpr TypedWhichId< SdrMetricItem > SDRATTR_ECKENRADIUS(SDRATTR_MISC_FIRST+0)
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
Definition: svdotext.cxx:1053
virtual void TakeUnrotatedSnapRect(tools::Rectangle &rRect) const
Definition: svdotext.cxx:581
periodic cubic Spline (ni)
Definition: svdobjkind.hxx:42
SdrTextObj * mpNextInChain
Definition: svdotext.hxx:223
SdrTextObj * GetPrevLinkInChain() const
Definition: svdotext.cxx:2015
static void ImpJustifyRect(tools::Rectangle &rRect)
Definition: svdotext.cxx:374
SdrOutliner & ImpGetDrawOutliner() const
Definition: svdotext.cxx:1144
aStr
Size CalcTextSize()
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:1509
tools::Long Right() const
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:2655
Point Center() 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:811
void ImpAutoFitText(SdrOutliner &rOutliner) const
Definition: svdotext.cxx:1254
void SetTextAnimationAllowed(bool bNew)
Definition: svdotext.cxx:1848
void ClearPolygon()
virtual OUString TakeObjNamePlural() const override
Definition: svdotext.cxx:985
const Size & GetPaperSize() const
virtual void CheckForFlowEvents(SdrOutliner *) override