LibreOffice Module svx (master)  1
svdocapt.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 #include <sal/config.h>
21 
22 #include <cassert>
23 
29 #include <tools/bigint.hxx>
30 #include <tools/helpers.hxx>
31 #include <rtl/ustrbuf.hxx>
32 
33 #include <svx/dialmgr.hxx>
34 #include <svx/strings.hrc>
35 
38 #include <svx/sdrhittesthelper.hxx>
39 #include <svx/sdooitm.hxx>
40 #include <svx/svddrag.hxx>
41 #include <svx/svdhdl.hxx>
42 #include <svx/svdmodel.hxx>
43 #include <svx/svdocapt.hxx>
44 #include <svx/svdopath.hxx>
45 #include <svx/svdogrp.hxx>
46 #include <svx/svdpage.hxx>
47 #include <svx/svdtrans.hxx>
48 #include <svx/svdview.hxx>
49 #include <svx/sxcecitm.hxx>
50 #include <svx/sxcgitm.hxx>
51 #include <svx/sxcllitm.hxx>
52 #include <svx/sxctitm.hxx>
53 #include <vcl/canvastools.hxx>
54 #include <vcl/ptrstyle.hxx>
55 
56 namespace {
57 
58 enum EscDir {LKS,RTS,OBN,UNT};
59 
60 }
61 
63 {
64 public:
72  bool bEscRel;
74 
75 public:
77  : eType(SdrCaptionType::Type3),
78  nGap(0), nEscRel(5000), nEscAbs(0),
79  nLineLen(0), eEscDir(SdrCaptionEscDir::Horizontal),
80  bFitLineLen(true), bEscRel(true), bFixedAngle(false)
81  {
82  }
83  void CalcEscPos(const Point& rTail, const tools::Rectangle& rRect, Point& rPt, EscDir& rDir) const;
84 };
85 
86 void ImpCaptParams::CalcEscPos(const Point& rTailPt, const tools::Rectangle& rRect, Point& rPt, EscDir& rDir) const
87 {
88  Point aTl(rTailPt); // copy locally for performance reasons
89  tools::Long nX,nY;
90  if (bEscRel) {
91  nX=rRect.Right()-rRect.Left();
92  nX=BigMulDiv(nX,nEscRel,10000);
93  nY=rRect.Bottom()-rRect.Top();
94  nY=BigMulDiv(nY,nEscRel,10000);
95  } else {
96  nX=nEscAbs;
97  nY=nEscAbs;
98  }
99  nX+=rRect.Left();
100  nY+=rRect.Top();
101  Point aBestPt;
102  EscDir eBestDir=LKS;
104  if (!bTryH) {
107  } else {
109  }
110  }
112  if (!bTryV) {
115  } else {
117  }
118  }
119 
120  if (bTryH) {
121  Point aLft(rRect.Left()-nGap,nY);
122  Point aRgt(rRect.Right()+nGap,nY);
123  bool bLft=(aTl.X()-aLft.X()<aRgt.X()-aTl.X());
124  if (bLft) {
125  eBestDir=LKS;
126  aBestPt=aLft;
127  } else {
128  eBestDir=RTS;
129  aBestPt=aRgt;
130  }
131  }
132  if (bTryV) {
133  Point aTop(nX,rRect.Top()-nGap);
134  Point aBtm(nX,rRect.Bottom()+nGap);
135  bool bTop=(aTl.Y()-aTop.Y()<aBtm.Y()-aTl.Y());
136  Point aBest2;
137  EscDir eBest2;
138  if (bTop) {
139  eBest2=OBN;
140  aBest2=aTop;
141  } else {
142  eBest2=UNT;
143  aBest2=aBtm;
144  }
145  bool bTakeIt=eEscDir!=SdrCaptionEscDir::BestFit;
146  if (!bTakeIt) {
147  BigInt aHorX(aBestPt.X()-aTl.X()); aHorX*=aHorX;
148  BigInt aHorY(aBestPt.Y()-aTl.Y()); aHorY*=aHorY;
149  BigInt aVerX(aBest2.X()-aTl.X()); aVerX*=aVerX;
150  BigInt aVerY(aBest2.Y()-aTl.Y()); aVerY*=aVerY;
152  bTakeIt=aVerX+aVerY<aHorX+aHorY;
153  } else {
154  bTakeIt=aVerX+aVerY>=aHorX+aHorY;
155  }
156  }
157  if (bTakeIt) {
158  aBestPt=aBest2;
159  eBestDir=eBest2;
160  }
161  }
162  rPt=aBestPt;
163  rDir=eBestDir;
164 }
165 
166 
167 // BaseProperties section
168 
169 std::unique_ptr<sdr::properties::BaseProperties> SdrCaptionObj::CreateObjectSpecificProperties()
170 {
171  return std::make_unique<sdr::properties::CaptionProperties>(*this);
172 }
173 
174 
175 // DrawContact section
176 
177 std::unique_ptr<sdr::contact::ViewContact> SdrCaptionObj::CreateObjectSpecificViewContact()
178 {
179  return std::make_unique<sdr::contact::ViewContactOfSdrCaptionObj>(*this);
180 }
181 
182 
184 : SdrRectObj(rSdrModel, OBJ_TEXT),
185  aTailPoly(3), // default size: 3 points = 2 lines
186  mbSpecialTextBoxShadow(false),
187  mbFixedTail(false),
188  mbSuppressGetBitmap(false)
189 {
190 }
191 
193 : SdrRectObj(rSdrModel, rSource),
194  mbSuppressGetBitmap(false)
195 {
196  aTailPoly = rSource.aTailPoly;
198  mbFixedTail = rSource.mbFixedTail;
199  maFixedTailPos = rSource.maFixedTailPos;
200 }
201 
203  SdrModel& rSdrModel,
204  const tools::Rectangle& rRect,
205  const Point& rTail)
206 : SdrRectObj(rSdrModel, OBJ_TEXT,rRect),
207  aTailPoly(3), // default size: 3 points = 2 lines
208  mbSpecialTextBoxShadow(false),
209  mbFixedTail(false),
210  mbSuppressGetBitmap(false)
211 {
212  aTailPoly[0]=maFixedTailPos=rTail;
213 }
214 
216 {
217 }
218 
220 {
221  rInfo.bRotateFreeAllowed=false;
222  rInfo.bRotate90Allowed =false;
223  rInfo.bMirrorFreeAllowed=false;
224  rInfo.bMirror45Allowed =false;
225  rInfo.bMirror90Allowed =false;
226  rInfo.bTransparenceAllowed = false;
227  rInfo.bShearAllowed =false;
228  rInfo.bEdgeRadiusAllowed=false;
229  rInfo.bCanConvToPath =true;
230  rInfo.bCanConvToPoly =true;
231  rInfo.bCanConvToPathLineToArea=false;
232  rInfo.bCanConvToPolyLineToArea=false;
234 }
235 
237 {
238  return OBJ_CAPTION;
239 }
240 
242 {
243  return new SdrCaptionObj(rTargetModel, *this);
244 }
245 
247 {
248  OUString sName(SvxResId(STR_ObjNameSingulCAPTION));
249 
250  OUString aName(GetName());
251  if (!aName.isEmpty())
252  sName += " '" + aName + "'";
253 
254  return sName;
255 }
256 
258 {
259  return SvxResId(STR_ObjNamePluralCAPTION);
260 }
261 
263 {
265  aPolyPoly.append(aTailPoly.getB2DPolygon());
266 
267  return aPolyPoly;
268 }
269 
270 sal_uInt32 SdrCaptionObj::GetHdlCount() const
271 {
272  sal_uInt32 nCount1(SdrRectObj::GetHdlCount());
273  // Currently only dragging the tail's end is implemented.
274  return nCount1 + 1;
275 }
276 
278 {
279  SdrRectObj::AddToHdlList(rHdlList);
280  // Currently only dragging the tail's end is implemented.
281  std::unique_ptr<SdrHdl> pHdl(new SdrHdl(aTailPoly.GetPoint(0), SdrHdlKind::Poly));
282  pHdl->SetPolyNum(1);
283  pHdl->SetPointNum(0);
284  rHdlList.AddHdl(std::move(pHdl));
285 }
286 
288 {
289  return true;
290 }
291 
293 {
294  const SdrHdl* pHdl = rDrag.GetHdl();
295  rDrag.SetEndDragChangesAttributes(true);
297 
298  if(pHdl && 0 == pHdl->GetPolyNum())
299  {
300  return SdrRectObj::beginSpecialDrag(rDrag);
301  }
302  else
303  {
304  rDrag.SetOrtho8Possible();
305 
306  if(!pHdl)
307  {
308  if (m_bMovProt)
309  return false;
310 
311  rDrag.SetNoSnap();
312  rDrag.SetActionRect(maRect);
313 
314  Point aHit(rDrag.GetStart());
315 
316  if(rDrag.GetPageView() && SdrObjectPrimitiveHit(*this, aHit, 0, *rDrag.GetPageView(), nullptr, false))
317  {
318  return true;
319  }
320  }
321  else
322  {
323  if((1 == pHdl->GetPolyNum()) && (0 == pHdl->GetPointNum()))
324  return true;
325  }
326  }
327 
328  return false;
329 }
330 
332 {
333  const SdrHdl* pHdl = rDrag.GetHdl();
334 
335  if(pHdl && 0 == pHdl->GetPolyNum())
336  {
337  const bool bRet(SdrRectObj::applySpecialDrag(rDrag));
338  ImpRecalcTail();
339  ActionChanged();
340 
341  return bRet;
342  }
343  else
344  {
345  Point aDelt(rDrag.GetNow()-rDrag.GetStart());
346 
347  if(!pHdl)
348  {
349  maRect.Move(aDelt.X(),aDelt.Y());
350  }
351  else
352  {
353  aTailPoly[0] += aDelt;
354  }
355 
356  ImpRecalcTail();
357  ActionChanged();
358 
359  return true;
360  }
361 }
362 
364 {
365  const bool bCreateComment(rDrag.GetView() && this == rDrag.GetView()->GetCreateObj());
366 
367  if(bCreateComment)
368  {
369  return OUString();
370  }
371  else
372  {
373  const SdrHdl* pHdl = rDrag.GetHdl();
374 
375  if(pHdl && 0 == pHdl->GetPolyNum())
376  {
377  return SdrRectObj::getSpecialDragComment(rDrag);
378  }
379  else
380  {
381  if(!pHdl)
382  {
383  return ImpGetDescriptionStr(STR_DragCaptFram);
384  }
385  else
386  {
387  return ImpGetDescriptionStr(STR_DragCaptTail);
388  }
389  }
390  }
391 }
392 
393 
395 {
396  const SfxItemSet& rSet = GetObjectItemSet();
397  rPara.eType =rSet.Get(SDRATTR_CAPTIONTYPE ).GetValue();
398  rPara.bFixedAngle=rSet.Get(SDRATTR_CAPTIONFIXEDANGLE).GetValue();
399  rPara.nGap =static_cast<const SdrCaptionGapItem&> (rSet.Get(SDRATTR_CAPTIONGAP )).GetValue();
400  rPara.eEscDir =rSet.Get(SDRATTR_CAPTIONESCDIR ).GetValue();
401  rPara.bEscRel =rSet.Get(SDRATTR_CAPTIONESCISREL ).GetValue();
402  rPara.nEscRel =rSet.Get(SDRATTR_CAPTIONESCREL ).GetValue();
403  rPara.nEscAbs =rSet.Get(SDRATTR_CAPTIONESCABS ).GetValue();
404  rPara.nLineLen =rSet.Get(SDRATTR_CAPTIONLINELEN ).GetValue();
405  rPara.bFitLineLen=rSet.Get(SDRATTR_CAPTIONFITLINELEN).GetValue();
406 }
407 
409 {
410  ImpCaptParams aPara;
411  ImpGetCaptParams(aPara);
412  ImpCalcTail(aPara, aTailPoly, maRect);
414  SetXPolyDirty();
415 }
416 
417 // #i35971#
418 // SdrCaptionObj::ImpCalcTail1 does move the object(!). What a hack.
419 // I really wonder why this had not triggered problems before. I am
420 // sure there are some places where SetTailPos() is called at least
421 // twice or SetSnapRect after it again just to work around this.
422 // Changed this method to not do that.
423 // Also found why this has been done: For interactive dragging of the
424 // tail end pos for SdrCaptionType::Type1. This sure was the simplest method
425 // to achieve this, at the cost of making a whole group of const methods
426 // of this object implicitly change the object's position.
428 {
429  tools::Polygon aPol(2);
430  Point aTl(rPoly[0]);
431 
432  aPol[0] = aTl;
433  aPol[1] = aTl;
434 
435  EscDir eEscDir;
436  Point aEscPos;
437 
438  rPara.CalcEscPos(aTl, rRect, aEscPos, eEscDir);
439  aPol[1] = aEscPos;
440 
441  if(eEscDir==LKS || eEscDir==RTS)
442  {
443  aPol[0].setX( aEscPos.X() );
444  }
445  else
446  {
447  aPol[0].setY( aEscPos.Y() );
448  }
449 
450  rPoly = aPol;
451 }
452 
454 { // Gap/EscDir/EscPos/Angle
455  tools::Polygon aPol(2);
456  Point aTl(rPoly[0]);
457  aPol[0]=aTl;
458 
459  EscDir eEscDir;
460  Point aEscPos;
461  rPara.CalcEscPos(aTl,rRect,aEscPos,eEscDir);
462  aPol[1]=aEscPos;
463 
464  if (!rPara.bFixedAngle) {
465  // TODO: Implementation missing.
466  }
467  rPoly=aPol;
468 }
469 
471 { // Gap/EscDir/EscPos/Angle/LineLen
472  tools::Polygon aPol(3);
473  Point aTl(rPoly[0]);
474  aPol[0]=aTl;
475 
476  EscDir eEscDir;
477  Point aEscPos;
478  rPara.CalcEscPos(aTl,rRect,aEscPos,eEscDir);
479  aPol[1]=aEscPos;
480  aPol[2]=aEscPos;
481 
482  if (eEscDir==LKS || eEscDir==RTS) {
483  if (rPara.bFitLineLen) {
484  aPol[1].setX((aTl.X()+aEscPos.X())/2 );
485  } else {
486  if (eEscDir==LKS) aPol[1].AdjustX( -(rPara.nLineLen) );
487  else aPol[1].AdjustX(rPara.nLineLen );
488  }
489  } else {
490  if (rPara.bFitLineLen) {
491  aPol[1].setY((aTl.Y()+aEscPos.Y())/2 );
492  } else {
493  if (eEscDir==OBN) aPol[1].AdjustY( -(rPara.nLineLen) );
494  else aPol[1].AdjustY(rPara.nLineLen );
495  }
496  }
497  if (!rPara.bFixedAngle) {
498  // TODO: Implementation missing.
499  }
500  rPoly=aPol;
501 }
502 
504 {
505  switch (rPara.eType) {
506  case SdrCaptionType::Type1: ImpCalcTail1(rPara,rPoly,rRect); break;
507  case SdrCaptionType::Type2: ImpCalcTail2(rPara,rPoly,rRect); break;
508  case SdrCaptionType::Type3: ImpCalcTail3(rPara,rPoly,rRect); break;
509  case SdrCaptionType::Type4: ImpCalcTail3(rPara,rPoly,rRect); break;
510  }
511 }
512 
514 {
515  if (maRect.IsEmpty()) return false; // Create currently only works with the given Rect
516 
517  ImpCaptParams aPara;
518  ImpGetCaptParams(aPara);
519  maRect.SetPos(rStat.GetNow());
520  aTailPoly[0]=rStat.GetStart();
522  rStat.SetActionRect(maRect);
523  return true;
524 }
525 
527 {
528  ImpCaptParams aPara;
529  ImpGetCaptParams(aPara);
530  maRect.SetPos(rStat.GetNow());
532  rStat.SetActionRect(maRect);
534  m_bSnapRectDirty=true;
535  return true;
536 }
537 
539 {
540  ImpCaptParams aPara;
541  ImpGetCaptParams(aPara);
542  maRect.SetPos(rStat.GetNow());
545  return (eCmd==SdrCreateCmd::ForceEnd || rStat.GetPointCount()>=2);
546 }
547 
549 {
550  return false;
551 }
552 
554 {
555 }
556 
558 {
559  basegfx::B2DPolyPolygon aRetval;
562  aRetval.append(aTailPoly.getB2DPolygon());
563  return aRetval;
564 }
565 
567 {
568  return PointerStyle::DrawCaption;
569 }
570 
571 void SdrCaptionObj::NbcMove(const Size& rSiz)
572 {
573  SdrRectObj::NbcMove(rSiz);
574  MovePoly(aTailPoly,rSiz);
575  if(mbFixedTail)
577 }
578 
579 void SdrCaptionObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
580 {
581  SdrRectObj::NbcResize(rRef,xFact,yFact);
582  ResizePoly(aTailPoly,rRef,xFact,yFact);
583  ImpRecalcTail();
584  if(mbFixedTail)
586 }
587 
588 void SdrCaptionObj::NbcSetRelativePos(const Point& rPnt)
589 {
590  Point aRelPos0(aTailPoly.GetPoint(0)-m_aAnchor);
591  Size aSiz(rPnt.X()-aRelPos0.X(),rPnt.Y()-aRelPos0.Y());
592  NbcMove(aSiz); // This also calls SetRectsDirty()
593 }
594 
596 {
597  return aTailPoly.GetPoint(0)-m_aAnchor;
598 }
599 
601 {
602  return maRect;
603 }
604 
606 {
608  ImpRecalcTail();
609 }
610 
612 {
613  return aTailPoly[0];
614 }
615 
616 void SdrCaptionObj::SetTailPos(const Point& rPos)
617 {
618  if (aTailPoly.GetSize()==0 || aTailPoly[0]!=rPos) {
619  tools::Rectangle aBoundRect0; if (m_pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
620  NbcSetTailPos(rPos);
621  SetChanged();
624  }
625 }
626 
627 void SdrCaptionObj::NbcSetTailPos(const Point& rPos)
628 {
629  aTailPoly[0]=rPos;
630  ImpRecalcTail();
631 }
632 
634 {
635  // TODO: Implementation missing.
636  return 0;
637 }
638 
639 Point SdrCaptionObj::GetSnapPoint(sal_uInt32 /*i*/) const
640 {
641  // TODO: Implementation missing.
642  return Point(0,0);
643 }
644 
646 {
647  SdrRectObj::Notify(rBC,rHint);
648  ImpRecalcTail();
649 }
650 
651 std::unique_ptr<SdrObjGeoData> SdrCaptionObj::NewGeoData() const
652 {
653  return std::make_unique<SdrCaptObjGeoData>();
654 }
655 
657 {
659  SdrCaptObjGeoData& rCGeo=static_cast<SdrCaptObjGeoData&>(rGeo);
660  rCGeo.aTailPoly=aTailPoly;
661 }
662 
664 {
666  const SdrCaptObjGeoData& rCGeo=static_cast<const SdrCaptObjGeoData&>(rGeo);
667  aTailPoly=rCGeo.aTailPoly;
668 }
669 
670 SdrObjectUniquePtr SdrCaptionObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
671 {
672  SdrObjectUniquePtr pRect = SdrRectObj::DoConvertToPolyObj(bBezier, bAddText);
674  SdrObjectUniquePtr pRet;
675  if (pTail && !pRect)
676  pRet = std::move(pTail);
677  else if (pRect && !pTail)
678  pRet = std::move(pRect);
679  else if (pTail && pRect)
680  {
681  if (pTail->GetSubList())
682  {
683  pTail->GetSubList()->NbcInsertObject(pRect.release());
684  pRet = std::move(pTail);
685  }
686  else if (pRect->GetSubList())
687  {
688  pRect->GetSubList()->NbcInsertObject(pTail.release(),0);
689  pRet = std::move(pRect);
690  }
691  else
692  {
694  pGrp->GetSubList()->NbcInsertObject(pRect.release());
695  pGrp->GetSubList()->NbcInsertObject(pTail.release(),0);
696  pRet.reset(pGrp);
697  }
698  }
699  return pRet;
700 }
701 
702 namespace {
703 
704 void handleNegativeScale(basegfx::B2DTuple & scale, double * rotate) {
705  assert(rotate != nullptr);
706 
707  // #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings
708  // in X and Y which equal a 180 degree rotation. Recognize it and react accordingly
709  if(basegfx::fTools::less(scale.getX(), 0.0) && basegfx::fTools::less(scale.getY(), 0.0))
710  {
711  scale.setX(fabs(scale.getX()));
712  scale.setY(fabs(scale.getY()));
713  *rotate = fmod(*rotate + M_PI, 2 * M_PI);
714  }
715 }
716 
717 }
718 
719 // #i32599#
720 // Add own implementation for TRSetBaseGeometry to handle TailPos over changes.
722 {
723  // break up matrix
724  basegfx::B2DTuple aScale;
725  basegfx::B2DTuple aTranslate;
726  double fRotate, fShearX;
727  rMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
728 
729  handleNegativeScale(aScale, &fRotate);
730 
731  // if anchor is used, make position relative to it
732  if(getSdrModelFromSdrObject().IsWriter())
733  {
734  if(GetAnchorPos().X() || GetAnchorPos().Y())
735  {
736  aTranslate += basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
737  }
738  }
739 
740  // build BaseRect
741  Point aPoint(FRound(aTranslate.getX()), FRound(aTranslate.getY()));
742  tools::Rectangle aBaseRect(aPoint, Size(FRound(aScale.getX()), FRound(aScale.getY())));
743 
744  // set BaseRect, but rescue TailPos over this call
745  const Point aTailPoint = GetTailPos();
746  SetSnapRect(aBaseRect);
747  SetTailPos(aTailPoint);
748  ImpRecalcTail();
749 }
750 
751 // geometry access
753 {
754  return aTailPoly.getB2DPolygon();
755 }
756 
757 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdorect.cxx:446
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
Definition: svdorect.cxx:362
virtual SdrObjKind GetObjIdentifier() const override
Definition: svdocapt.cxx:236
void SetPos(const Point &rPoint)
double getY() const
SdrCaptionType eType
Definition: svdocapt.cxx:65
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
Definition: svdorect.cxx:562
SdrPageView * GetPageView() const
Definition: svddrag.hxx:98
sal_uInt32 GetPolyNum() const
Definition: svdhdl.hxx:219
virtual ~SdrCaptionObj() override
Definition: svdocapt.cxx:215
tools::Long nEscRel
Definition: svdocapt.cxx:67
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
Definition: svdorect.cxx:391
std::string GetValue
constexpr tools::Long Left() const
const Point & GetStart() const
Definition: svddrag.hxx:102
SVX_DLLPRIVATE void ImpGetCaptParams(ImpCaptParams &rPara) const
Definition: svdocapt.cxx:394
void ResizePoly(tools::Polygon &rPoly, const Point &rRef, const Fraction &xFact, const Fraction &yFact)
Definition: svdtrans.cxx:65
bool mbSpecialTextBoxShadow
Definition: svdocapt.hxx:59
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdocapt.cxx:169
tools::Long nLineLen
Definition: svdocapt.cxx:69
Point maFixedTailPos
Definition: svdocapt.hxx:62
SdrCaptionObj(SdrModel &rSdrModel)
Definition: svdocapt.cxx:183
void SetTailPos(const Point &rPos)
Definition: svdocapt.cxx:616
long Long
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdocapt.cxx:656
virtual void NbcInsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
Definition: svdpage.cxx:283
tools::Long nGap
Definition: svdocapt.cxx:66
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix &rMatrix, const basegfx::B2DPolyPolygon &rPolyPolygon) override
Definition: svdocapt.cxx:721
constexpr TypedWhichId< SdrCaptionLineLenItem > SDRATTR_CAPTIONLINELEN(SDRATTR_CAPTION_FIRST+8)
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
Definition: svdocapt.cxx:645
virtual const tools::Rectangle & GetLogicRect() const override
Definition: svdocapt.cxx:600
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
Definition: svdocapt.cxx:292
virtual Point GetRelativePos() const override
Definition: svdocapt.cxx:595
bool mbFixedTail
Definition: svdocapt.hxx:60
sal_uInt32 GetPointNum() const
Definition: svdhdl.hxx:222
virtual void SetBoundRectDirty()
Definition: svdobj.cxx:316
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
Definition: svdocapt.cxx:538
::basegfx::B2DPolygon getTailPolygon() const
Definition: svdocapt.cxx:752
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: svdocapt.cxx:277
virtual bool BckCreate(SdrDragStat &rStat) override
Definition: svdocapt.cxx:548
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
Definition: svdorect.cxx:253
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const override
Polygon dragged by the user when creating the object.
Definition: svdocapt.cxx:557
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:174
SdrCaptionEscDir
Definition: sxcecitm.hxx:28
virtual Point GetSnapPoint(sal_uInt32 i) const override
Definition: svdocapt.cxx:639
SdrObjKind
Definition: svdobjkind.hxx:24
void setX(double fX)
virtual void NbcSetRelativePos(const Point &rPnt) override
The relative position of a SdrObject is the distance of the upper left corner of the logic bounding r...
Definition: svdocapt.cxx:588
void SetOrtho8Possible(bool bOn=true)
Definition: svddrag.hxx:139
bool bFitLineLen
Definition: svdocapt.cxx:71
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:38
Provides information about various ZObject properties.
Definition: svdobj.hxx:196
const SdrHdl * GetHdl() const
Definition: svddrag.hxx:111
static SVX_DLLPRIVATE void ImpCalcTail1(const ImpCaptParams &rPara, tools::Polygon &rPoly, tools::Rectangle const &rRect)
Definition: svdocapt.cxx:427
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: svdocapt.cxx:670
void CalcEscPos(const Point &rTail, const tools::Rectangle &rRect, Point &rPt, EscDir &rDir) const
Definition: svdocapt.cxx:86
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_CAPTIONFIXEDANGLE(SDRATTR_CAPTION_FIRST+1)
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
Definition: svdorect.cxx:348
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdotext.cxx:1407
OUString SvxResId(TranslateId aId)
Definition: dialmgr.cxx:24
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: svdorect.cxx:528
bool m_bMovProt
Definition: svdobj.hxx:886
constexpr TypedWhichId< SdrCaptionEscDirItem > SDRATTR_CAPTIONESCDIR(SDRATTR_CAPTION_FIRST+4)
const SfxItemSet & GetObjectItemSet() const
Definition: svdobj.cxx:1973
SdrObject * SdrObjectPrimitiveHit(const SdrObject &rObject, const Point &rPnt, sal_uInt16 nTol, const SdrPageView &rSdrPageView, const SdrLayerIDSet *pVisiLayer, bool bTextOnly, drawinglayer::primitive2d::Primitive2DContainer *pHitContainer)
tools::Rectangle maRect
Definition: svdotext.hxx:170
SdrCaptionType
Definition: sxctitm.hxx:26
tools::Long BigMulDiv(tools::Long nVal, tools::Long nMul, tools::Long nDiv)
Definition: svdtrans.cxx:560
static SVX_DLLPRIVATE void ImpCalcTail(const ImpCaptParams &rPara, tools::Polygon &rPoly, tools::Rectangle const &rRect)
Definition: svdocapt.cxx:503
static SVX_DLLPRIVATE void ImpCalcTail3(const ImpCaptParams &rPara, tools::Polygon &rPoly, tools::Rectangle const &rRect)
Definition: svdocapt.cxx:470
tools::Polygon aTailPoly
Definition: svdocapt.hxx:37
virtual void SetBoundAndSnapRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:510
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
Definition: svdocapt.cxx:363
constexpr bool IsEmpty() const
constexpr TypedWhichId< SdrCaptionEscRelItem > SDRATTR_CAPTIONESCREL(SDRATTR_CAPTION_FIRST+6)
virtual std::unique_ptr< SdrObjGeoData > NewGeoData() const override
A derived class must override these 3 methods if it has own geometric data that must be saved for Und...
Definition: svdocapt.cxx:651
void SetNoSnap(bool bOn=true)
Definition: svddrag.hxx:131
void SetEndDragChangesGeoAndAttributes(bool bOn)
Definition: svddrag.hxx:145
constexpr TypedWhichId< SdrCaptionEscAbsItem > SDRATTR_CAPTIONESCABS(SDRATTR_CAPTION_FIRST+7)
SVX_DLLPRIVATE void ImpRecalcTail()
Definition: svdocapt.cxx:408
OUString sName
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
SdrObject * GetCreateObj() const
Definition: svdcrtv.hxx:120
tools::Long FRound(double fVal)
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
Definition: svdocapt.cxx:331
class SdrCaptionGapItem Distance of the line start from the Rect
Definition: sxcgitm.hxx:29
constexpr TypedWhichId< SdrMetricItem > SDRATTR_CAPTIONGAP(SDRATTR_CAPTION_FIRST+3)
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdorect.cxx:282
tools::Long nEscAbs
Definition: svdocapt.cxx:68
SdrPathObjUniquePtr ImpConvertMakeObj(const basegfx::B2DPolyPolygon &rPolyPolygon, bool bClosed, bool bBezier) const
Definition: svdotxtr.cxx:429
virtual SdrCaptionObj * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdocapt.cxx:241
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdocapt.cxx:270
void BroadcastObjectChange() const
Definition: svdobj.cxx:1008
connector object
Definition: svdobjkind.hxx:48
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
sal_Int32 GetPointCount() const
Definition: svddrag.hxx:101
OUString ImpGetDescriptionStr(TranslateId pStrCacheID) const
Definition: svdobj.cxx:1097
void ActionChanged() const
Definition: svdobj.cxx:263
SdrView * GetView() const
Definition: svddrag.hxx:96
void SetXPolyDirty()
Definition: svdorect.cxx:102
constexpr tools::Long Right() const
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:279
SdrObjUserCall * m_pUserCall
Definition: svdobj.hxx:879
constexpr tools::Long Top() const
sal_uInt16 GetSize() const
virtual SdrObjList * GetSubList() const override
Definition: svdogrp.cxx:190
void SetEndDragChangesAttributes(bool bOn)
Definition: svddrag.hxx:143
::basegfx::B2DPolygon getB2DPolygon() const
OUString GetName() const
Definition: svdobj.cxx:802
#define Y
tools::Polygon aTailPoly
Definition: svdocapt.hxx:58
basegfx::B2DRange b2DRectangleFromRectangle(const ::tools::Rectangle &rRect)
constexpr tools::Long Bottom() const
constexpr TypedWhichId< SdrCaptionTypeItem > SDRATTR_CAPTIONTYPE(SDRATTR_CAPTION_FIRST+0)
virtual OUString TakeObjNamePlural() const override
Definition: svdocapt.cxx:257
const Point & GetPoint(sal_uInt16 nPos) const
void setY(double fY)
void MovePoly(tools::Polygon &rPoly, const Size &S)
Definition: svdtrans.hxx:38
Point m_aAnchor
Definition: svdobj.hxx:878
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
Definition: svdorect.cxx:276
virtual const tools::Rectangle & GetLastBoundRect() const
Definition: svdobj.cxx:971
virtual bool MovCreate(SdrDragStat &rStat) override
Definition: svdocapt.cxx:526
void SetActionRect(const tools::Rectangle &rR)
Definition: svddrag.hxx:167
virtual PointerStyle GetCreatePointer() const override
get the cursor/pointer that signals creating this object
Definition: svdocapt.cxx:566
virtual OUString TakeObjNameSingul() const override
Definition: svdocapt.cxx:246
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdocapt.cxx:177
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdorect.cxx:452
bool less(const T &rfValA, const T &rfValB)
OUString aName
virtual void BrkCreate(SdrDragStat &rStat) override
Definition: svdocapt.cxx:553
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdocapt.cxx:571
constexpr TypedWhichId< SdrCaptionFitLineLenItem > SDRATTR_CAPTIONFITLINELEN(SDRATTR_CAPTION_FIRST+9)
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:98
const Point & GetNow() const
Definition: svddrag.hxx:105
PointerStyle
const Point & GetAnchorPos() const
Definition: svdobj.cxx:1657
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdocapt.cxx:219
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: svdorect.cxx:287
virtual bool hasSpecialDrag() const override
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
Definition: svdocapt.cxx:287
virtual void SetSnapRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1691
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
EscDir
Definition: svdocapt.cxx:58
double getX() const
bool LineGeometryUsageIsNecessary() const
Definition: svdobj.cxx:1065
constexpr TypedWhichId< SdrCaptionEscIsRelItem > SDRATTR_CAPTIONESCISREL(SDRATTR_CAPTION_FIRST+5)
void NbcSetTailPos(const Point &rPos)
Definition: svdocapt.cxx:627
bool m_bSnapRectDirty
Definition: svdobj.hxx:884
SdrCreateCmd
Definition: svdtypes.hxx:26
virtual void SetChanged()
Definition: svdobj.cxx:1032
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdocapt.cxx:579
periodic cubic Spline (ni)
Definition: svdobjkind.hxx:42
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
Definition: svdocapt.cxx:663
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
Definition: svdocapt.cxx:262
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
Definition: svdocapt.cxx:605
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
Definition: svdobj.cxx:2739
SdrCaptionEscDir eEscDir
Definition: svdocapt.cxx:70
static SVX_DLLPRIVATE void ImpCalcTail2(const ImpCaptParams &rPara, tools::Polygon &rPoly, tools::Rectangle const &rRect)
Definition: svdocapt.cxx:453
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
Definition: svdhdl.cxx:2289
const Point & GetFixedTailPos() const
Definition: svdocapt.hxx:148
const Point & GetTailPos() const
Definition: svdocapt.cxx:611
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
Definition: svdorect.cxx:556
virtual sal_uInt32 GetSnapPointCount() const override
snap to special points of an Object (polygon points, center of circle)
Definition: svdocapt.cxx:633
virtual bool BegCreate(SdrDragStat &rStat) override
Every object must be able to create itself interactively.
Definition: svdocapt.cxx:513
bool bFixedAngle
Definition: svdocapt.cxx:73