LibreOffice Module svx (master)  1
svdocirc.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 
25 #include <editeng/eeitem.hxx>
26 #include <math.h>
27 #include <svl/style.hxx>
28 
29 #include <svx/dialmgr.hxx>
30 #include <svx/strings.hrc>
31 
34 #include <svx/svddrag.hxx>
35 #include <svx/svdetc.hxx>
36 #include <svx/svdmodel.hxx>
37 #include <svx/svdocirc.hxx>
38 #include <svx/svdopath.hxx>
39 #include <svx/svdpage.hxx>
40 #include <svx/svdpool.hxx>
41 #include <svx/svdtrans.hxx>
42 #include <svx/svdview.hxx>
43 #include <svx/sxciaitm.hxx>
44 #include <sxcikitm.hxx>
45 #include <svx/xfillit0.hxx>
46 #include <svx/xlineit0.hxx>
47 #include <svx/xlnedit.hxx>
48 #include <svx/xlnedwit.hxx>
49 #include <svx/xlnstit.hxx>
50 #include <svx/xlnstwit.hxx>
51 #include <svx/xlnwtit.hxx>
52 #include <svx/xpool.hxx>
53 #include <vcl/canvastools.hxx>
54 #include <vcl/ptrstyle.hxx>
55 
56 using namespace com::sun::star;
57 
58 static Point GetAnglePnt(const tools::Rectangle& rR, long nAngle)
59 {
60  Point aCenter(rR.Center());
61  long nWdt=rR.Right()-rR.Left();
62  long nHgt=rR.Bottom()-rR.Top();
63  long nMaxRad=(std::max(nWdt,nHgt)+1) /2;
64  double a;
65  a = nAngle * F_PI18000;
66  Point aRetval(FRound(cos(a)*nMaxRad),-FRound(sin(a)*nMaxRad));
67  if (nWdt==0) aRetval.setX(0 );
68  if (nHgt==0) aRetval.setY(0 );
69  if (nWdt!=nHgt) {
70  if (nWdt>nHgt) {
71  if (nWdt!=0) {
72  // stop possible overruns for very large objects
73  if (std::abs(nHgt)>32767 || std::abs(aRetval.Y())>32767) {
74  aRetval.setY(BigMulDiv(aRetval.Y(),nHgt,nWdt) );
75  } else {
76  aRetval.setY(aRetval.Y()*nHgt/nWdt );
77  }
78  }
79  } else {
80  if (nHgt!=0) {
81  // stop possible overruns for very large objects
82  if (std::abs(nWdt)>32767 || std::abs(aRetval.X())>32767) {
83  aRetval.setX(BigMulDiv(aRetval.X(),nWdt,nHgt) );
84  } else {
85  aRetval.setX(aRetval.X()*nWdt/nHgt );
86  }
87  }
88  }
89  }
90  aRetval+=aCenter;
91  return aRetval;
92 }
93 
94 
95 // BaseProperties section
96 
97 std::unique_ptr<sdr::properties::BaseProperties> SdrCircObj::CreateObjectSpecificProperties()
98 {
99  return std::make_unique<sdr::properties::CircleProperties>(*this);
100 }
101 
102 
103 // DrawContact section
104 
105 std::unique_ptr<sdr::contact::ViewContact> SdrCircObj::CreateObjectSpecificViewContact()
106 {
107  return std::make_unique<sdr::contact::ViewContactOfSdrCircObj>(*this);
108 }
109 
111 {
112  switch (eKind)
113  {
114  case OBJ_CIRC: return SdrCircKind::Full;
115  case OBJ_SECT: return SdrCircKind::Section;
116  case OBJ_CARC: return SdrCircKind::Arc;
117  case OBJ_CCUT: return SdrCircKind::Cut;
118  default: assert(false);
119  }
120  return SdrCircKind::Full;
121 }
122 
124  SdrModel& rSdrModel,
125  SdrCircKind eNewKind)
126 : SdrRectObj(rSdrModel)
127 {
128  nStartAngle=0;
129  nEndAngle=36000;
130  meCircleKind=eNewKind;
131  bClosedObj=eNewKind!=SdrCircKind::Arc;
132 }
133 
135  SdrModel& rSdrModel,
136  SdrCircKind eNewKind,
137  const tools::Rectangle& rRect)
138 : SdrRectObj(rSdrModel, rRect)
139 {
140  nStartAngle=0;
141  nEndAngle=36000;
142  meCircleKind=eNewKind;
143  bClosedObj=eNewKind!=SdrCircKind::Arc;
144 }
145 
147  SdrModel& rSdrModel,
148  SdrCircKind eNewKind,
149  const tools::Rectangle& rRect,
150  long nNewStartWink,
151  long nNewEndWink)
152 : SdrRectObj(rSdrModel, rRect)
153 {
154  long nAngleDif=nNewEndWink-nNewStartWink;
155  nStartAngle=NormAngle36000(nNewStartWink);
156  nEndAngle=NormAngle36000(nNewEndWink);
157  if (nAngleDif==36000) nEndAngle+=nAngleDif; // full circle
158  meCircleKind=eNewKind;
159  bClosedObj=eNewKind!=SdrCircKind::Arc;
160 }
161 
163 {
164 }
165 
167 {
168  bool bCanConv=!HasText() || ImpCanConvTextToCurve();
169  rInfo.bEdgeRadiusAllowed = false;
170  rInfo.bCanConvToPath=bCanConv;
171  rInfo.bCanConvToPoly=bCanConv;
173 }
174 
176 {
177  switch (meCircleKind)
178  {
179  case SdrCircKind::Full: return OBJ_CIRC;
180  case SdrCircKind::Section: return OBJ_SECT;
181  case SdrCircKind::Cut: return OBJ_CCUT;
182  case SdrCircKind::Arc: return OBJ_CARC;
183  default: assert(false);
184  }
185  return OBJ_CIRC;
186 }
187 
189 {
190  // XPoly is necessary for all rotated ellipse objects, circle and
191  // ellipse segments.
192  // If not WIN, then (for now) also for circle/ellipse segments and circle/
193  // ellipse arcs (for precision)
195  // If not WIN, then for everything except full circle (for now!)
196  if (meCircleKind!=SdrCircKind::Full) bNeed = true;
197 
198  const SfxItemSet& rSet = GetObjectItemSet();
199  if(!bNeed)
200  {
201  // XPoly is necessary for everything that isn't LineSolid or LineNone
202  drawing::LineStyle eLine = rSet.Get(XATTR_LINESTYLE).GetValue();
203  bNeed = eLine != drawing::LineStyle_NONE && eLine != drawing::LineStyle_SOLID;
204 
205  // XPoly is necessary for thick lines
206  if(!bNeed && eLine != drawing::LineStyle_NONE)
207  bNeed = rSet.Get(XATTR_LINEWIDTH).GetValue() != 0;
208 
209  // XPoly is necessary for circle arcs with line ends
210  if(!bNeed && meCircleKind == SdrCircKind::Arc)
211  {
212  // start of the line is here if StartPolygon, StartWidth!=0
213  bNeed=rSet.Get(XATTR_LINESTART).GetLineStartValue().count() != 0 &&
214  rSet.Get(XATTR_LINESTARTWIDTH).GetValue() != 0;
215 
216  if(!bNeed)
217  {
218  // end of the line is here if EndPolygon, EndWidth!=0
219  bNeed = rSet.Get(XATTR_LINEEND).GetLineEndValue().count() != 0 &&
220  rSet.Get(XATTR_LINEENDWIDTH).GetValue() != 0;
221  }
222  }
223  }
224 
225  // XPoly is necessary if Fill !=None and !=Solid
226  if(!bNeed && meCircleKind != SdrCircKind::Arc)
227  {
228  drawing::FillStyle eFill=rSet.Get(XATTR_FILLSTYLE).GetValue();
229  bNeed = eFill != drawing::FillStyle_NONE && eFill != drawing::FillStyle_SOLID;
230  }
231 
232  if(!bNeed && meCircleKind != SdrCircKind::Full && nStartAngle == nEndAngle)
233  bNeed = true; // otherwise we're drawing a full circle
234 
235  return bNeed;
236 }
237 
238 basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrCircKind eCicrleKind, const tools::Rectangle& rRect1, long nStart, long nEnd) const
239 {
241  basegfx::B2DPolygon aCircPolygon;
242 
243  if(SdrCircKind::Full == eCicrleKind)
244  {
245  // create full circle. Do not use createPolygonFromEllipse; it's necessary
246  // to get the start point to the bottom of the circle to keep compatible to
247  // old geometry creation
249 
250  // needs own scaling and translation from unit circle to target size (same as
251  // would be in createPolygonFromEllipse)
252  const basegfx::B2DPoint aCenter(aRange.getCenter());
254  aRange.getWidth() / 2.0, aRange.getHeight() / 2.0,
255  aCenter.getX(), aCenter.getY()));
256  aCircPolygon.transform(aMatrix);
257  }
258  else
259  {
260  // mirror start, end for geometry creation since model coordinate system is mirrored in Y
261  // #i111715# increase numerical correctness by first dividing and not using F_PI1800
262  const double fStart((((36000 - nEnd) % 36000) / 18000.0) * F_PI);
263  const double fEnd((((36000 - nStart) % 36000) / 18000.0) * F_PI);
264 
265  // create circle segment. This is not closed by default
267  aRange.getCenter(), aRange.getWidth() / 2.0, aRange.getHeight() / 2.0,
268  fStart, fEnd);
269 
270  // check closing states
271  const bool bCloseSegment(SdrCircKind::Arc != eCicrleKind);
272  const bool bCloseUsingCenter(SdrCircKind::Section == eCicrleKind);
273 
274  if(bCloseSegment)
275  {
276  if(bCloseUsingCenter)
277  {
278  // add center point at start (for historical reasons)
279  basegfx::B2DPolygon aSector;
280  aSector.append(aRange.getCenter());
281  aSector.append(aCircPolygon);
282  aCircPolygon = aSector;
283  }
284 
285  // close
286  aCircPolygon.setClosed(true);
287  }
288  }
289 
290  // #i76950#
292  {
293  // translate top left to (0,0)
294  const basegfx::B2DPoint aTopLeft(aRange.getMinimum());
296  -aTopLeft.getX(), -aTopLeft.getY()));
297 
298  // shear, rotate and back to top left (if needed)
300  aGeo.nShearAngle ? tan((36000 - aGeo.nShearAngle) * F_PI18000) : 0.0,
301  aGeo.nRotationAngle ? (36000 - aGeo.nRotationAngle) * F_PI18000 : 0.0,
302  aTopLeft) * aMatrix;
303 
304  // apply transformation
305  aCircPolygon.transform(aMatrix);
306  }
307 
308  return aCircPolygon;
309 }
310 
312 {
314  mpXPoly.reset( new XPolygon(aPolyCirc) );
315 }
316 
318 {
319  const char* pID=STR_ObjNameSingulCIRC;
320  if (maRect.GetWidth() == maRect.GetHeight() && aGeo.nShearAngle==0)
321  {
322  switch (meCircleKind) {
323  case SdrCircKind::Full: pID=STR_ObjNameSingulCIRC; break;
324  case SdrCircKind::Section: pID=STR_ObjNameSingulSECT; break;
325  case SdrCircKind::Arc: pID=STR_ObjNameSingulCARC; break;
326  case SdrCircKind::Cut: pID=STR_ObjNameSingulCCUT; break;
327  default: break;
328  }
329  } else {
330  switch (meCircleKind) {
331  case SdrCircKind::Full: pID=STR_ObjNameSingulCIRCE; break;
332  case SdrCircKind::Section: pID=STR_ObjNameSingulSECTE; break;
333  case SdrCircKind::Arc: pID=STR_ObjNameSingulCARCE; break;
334  case SdrCircKind::Cut: pID=STR_ObjNameSingulCCUTE; break;
335  default: break;
336  }
337  }
338  OUStringBuffer sName(SvxResId(pID));
339 
340  OUString aName(GetName());
341  if (!aName.isEmpty())
342  {
343  sName.append(' ');
344  sName.append('\'');
345  sName.append(aName);
346  sName.append('\'');
347  }
348  return sName.makeStringAndClear();
349 }
350 
352 {
353  const char* pID=STR_ObjNamePluralCIRC;
354  if (maRect.GetWidth() == maRect.GetHeight() && aGeo.nShearAngle==0)
355  {
356  switch (meCircleKind) {
357  case SdrCircKind::Full: pID=STR_ObjNamePluralCIRC; break;
358  case SdrCircKind::Section: pID=STR_ObjNamePluralSECT; break;
359  case SdrCircKind::Arc: pID=STR_ObjNamePluralCARC; break;
360  case SdrCircKind::Cut: pID=STR_ObjNamePluralCCUT; break;
361  default: break;
362  }
363  } else {
364  switch (meCircleKind) {
365  case SdrCircKind::Full: pID=STR_ObjNamePluralCIRCE; break;
366  case SdrCircKind::Section: pID=STR_ObjNamePluralSECTE; break;
367  case SdrCircKind::Arc: pID=STR_ObjNamePluralCARCE; break;
368  case SdrCircKind::Cut: pID=STR_ObjNamePluralCCUTE; break;
369  default: break;
370  }
371  }
372  return SvxResId(pID);
373 }
374 
376 {
377  return CloneHelper< SdrCircObj >(rTargetModel);
378 }
379 
381 {
382  if( this == &rObj )
383  return *this;
384  SdrRectObj::operator=(rObj);
385 
386  meCircleKind = rObj.meCircleKind;
387  nStartAngle = rObj.nStartAngle;
388  nEndAngle = rObj.nEndAngle;
389 
390  return *this;
391 }
392 
394 {
396  return basegfx::B2DPolyPolygon(aCircPolygon);
397 }
398 
399 namespace {
400 
401 struct ImpCircUser : public SdrDragStatUserData
402 {
403  tools::Rectangle aR;
404  Point aCenter;
405  Point aP1;
406  long nHgt;
407  long nWdt;
408  long nStart;
409  long nEnd;
410 
411 public:
412  ImpCircUser()
413  : nHgt(0),
414  nWdt(0),
415  nStart(0),
416  nEnd(0)
417  {}
418  void SetCreateParams(SdrDragStat const & rStat);
419 };
420 
421 }
422 
423 sal_uInt32 SdrCircObj::GetHdlCount() const
424 {
426  {
427  return 10L;
428  }
429  else
430  {
431  return 8L;
432  }
433 }
434 
436 {
437  for (sal_uInt32 nHdlNum=(SdrCircKind::Full==meCircleKind)?2:0; nHdlNum<=9; ++nHdlNum)
438  {
439  Point aPnt;
440  SdrHdlKind eLocalKind(SdrHdlKind::Move);
441  sal_uInt32 nPNum(0);
442 
443  switch (nHdlNum)
444  {
445  case 0:
447  eLocalKind = SdrHdlKind::Circle;
448  nPNum = 1;
449  break;
450  case 1:
451  aPnt = GetAnglePnt(maRect,nEndAngle);
452  eLocalKind = SdrHdlKind::Circle;
453  nPNum = 2;
454  break;
455  case 2:
456  aPnt = maRect.TopLeft();
457  eLocalKind = SdrHdlKind::UpperLeft;
458  break;
459  case 3:
460  aPnt = maRect.TopCenter();
461  eLocalKind = SdrHdlKind::Upper;
462  break;
463  case 4:
464  aPnt = maRect.TopRight();
465  eLocalKind = SdrHdlKind::UpperRight;
466  break;
467  case 5:
468  aPnt = maRect.LeftCenter();
469  eLocalKind = SdrHdlKind::Left;
470  break;
471  case 6:
472  aPnt = maRect.RightCenter();
473  eLocalKind = SdrHdlKind::Right;
474  break;
475  case 7:
476  aPnt = maRect.BottomLeft();
477  eLocalKind = SdrHdlKind::LowerLeft;
478  break;
479  case 8:
480  aPnt = maRect.BottomCenter();
481  eLocalKind = SdrHdlKind::Lower;
482  break;
483  case 9:
484  aPnt = maRect.BottomRight();
485  eLocalKind = SdrHdlKind::LowerRight;
486  break;
487  }
488 
489  if (aGeo.nShearAngle)
490  {
492  }
493 
494  if (aGeo.nRotationAngle)
495  {
497  }
498 
499  std::unique_ptr<SdrHdl> pH(new SdrHdl(aPnt,eLocalKind));
500  pH->SetPointNum(nPNum);
501  pH->SetObj(const_cast<SdrCircObj*>(this));
502  pH->SetRotationAngle(aGeo.nRotationAngle);
503  rHdlList.AddHdl(std::move(pH));
504  }
505 }
506 
507 
509 {
510  return true;
511 }
512 
514 {
515  const bool bAngle(rDrag.GetHdl() && SdrHdlKind::Circle == rDrag.GetHdl()->GetKind());
516 
517  if(bAngle)
518  {
519  if(1 == rDrag.GetHdl()->GetPointNum() || 2 == rDrag.GetHdl()->GetPointNum())
520  {
521  rDrag.SetNoSnap();
522  }
523 
524  return true;
525  }
526 
527  return SdrTextObj::beginSpecialDrag(rDrag);
528 }
529 
531 {
532  const bool bAngle(rDrag.GetHdl() && SdrHdlKind::Circle == rDrag.GetHdl()->GetKind());
533 
534  if(bAngle)
535  {
536  Point aPt(rDrag.GetNow());
537 
538  if (aGeo.nRotationAngle!=0)
540 
541  if (aGeo.nShearAngle!=0)
543 
544  aPt -= maRect.Center();
545 
546  long nWdt = maRect.Right() - maRect.Left();
547  long nHgt = maRect.Bottom() - maRect.Top();
548 
549  if(nWdt>=nHgt)
550  {
551  aPt.setY(BigMulDiv(aPt.Y(),nWdt,nHgt) );
552  }
553  else
554  {
555  aPt.setX(BigMulDiv(aPt.X(),nHgt,nWdt) );
556  }
557 
558  long nAngle=NormAngle36000(GetAngle(aPt));
559 
560  if (rDrag.GetView() && rDrag.GetView()->IsAngleSnapEnabled())
561  {
562  long nSA=rDrag.GetView()->GetSnapAngle();
563 
564  if (nSA!=0)
565  {
566  nAngle+=nSA/2;
567  nAngle/=nSA;
568  nAngle*=nSA;
569  nAngle=NormAngle36000(nAngle);
570  }
571  }
572 
573  if(1 == rDrag.GetHdl()->GetPointNum())
574  {
575  nStartAngle = nAngle;
576  }
577  else if(2 == rDrag.GetHdl()->GetPointNum())
578  {
579  nEndAngle = nAngle;
580  }
581 
582  SetRectsDirty();
583  SetXPolyDirty();
585  SetChanged();
586 
587  return true;
588  }
589  else
590  {
591  return SdrTextObj::applySpecialDrag(rDrag);
592  }
593 }
594 
595 OUString SdrCircObj::getSpecialDragComment(const SdrDragStat& rDrag) const
596 {
597  const bool bCreateComment(rDrag.GetView() && this == rDrag.GetView()->GetCreateObj());
598 
599  if(bCreateComment)
600  {
601  OUStringBuffer aBuf(ImpGetDescriptionStr(STR_ViewCreateObj));
602  const sal_uInt32 nPointCount(rDrag.GetPointCount());
603 
604  if(SdrCircKind::Full != meCircleKind && nPointCount > 2)
605  {
606  const ImpCircUser* pU = static_cast<const ImpCircUser*>(rDrag.GetUser());
607  sal_Int32 nAngle;
608 
609  aBuf.append(" (");
610 
611  if(3 == nPointCount)
612  {
613  nAngle = pU->nStart;
614  }
615  else
616  {
617  nAngle = pU->nEnd;
618  }
619 
620  aBuf.append(SdrModel::GetAngleString(nAngle));
621  aBuf.append(')');
622  }
623 
624  return aBuf.makeStringAndClear();
625  }
626  else
627  {
628  const bool bAngle(rDrag.GetHdl() && SdrHdlKind::Circle == rDrag.GetHdl()->GetKind());
629 
630  if(bAngle)
631  {
632  const sal_Int32 nAngle(1 == rDrag.GetHdl()->GetPointNum() ? nStartAngle : nEndAngle);
633 
634  OUStringBuffer aBuf(ImpGetDescriptionStr(STR_DragCircAngle));
635  aBuf.append(" (");
636  aBuf.append(SdrModel::GetAngleString(nAngle));
637  aBuf.append(')');
638 
639  return aBuf.makeStringAndClear();
640  }
641  else
642  {
643  return SdrTextObj::getSpecialDragComment(rDrag);
644  }
645  }
646 }
647 
648 
649 void ImpCircUser::SetCreateParams(SdrDragStat const & rStat)
650 {
651  rStat.TakeCreateRect(aR);
652  aR.Justify();
653  aCenter=aR.Center();
654  nWdt=aR.Right()-aR.Left();
655  nHgt=aR.Bottom()-aR.Top();
656  nStart=0;
657  nEnd=36000;
658  if (rStat.GetPointCount()>2) {
659  Point aP(rStat.GetPoint(2)-aCenter);
660  if (nWdt==0) aP.setX(0 );
661  if (nHgt==0) aP.setY(0 );
662  if (nWdt>=nHgt) {
663  if (nHgt!=0) aP.setY(aP.Y()*nWdt/nHgt );
664  } else {
665  if (nWdt!=0) aP.setX(aP.X()*nHgt/nWdt );
666  }
667  nStart=NormAngle36000(GetAngle(aP));
668  if (rStat.GetView()!=nullptr && rStat.GetView()->IsAngleSnapEnabled()) {
669  long nSA=rStat.GetView()->GetSnapAngle();
670  if (nSA!=0) { // angle snapping
671  nStart+=nSA/2;
672  nStart/=nSA;
673  nStart*=nSA;
674  nStart=NormAngle36000(nStart);
675  }
676  }
677  aP1 = GetAnglePnt(aR,nStart);
678  nEnd=nStart;
679  } else aP1=aCenter;
680  if (rStat.GetPointCount()>3) {
681  Point aP(rStat.GetPoint(3)-aCenter);
682  if (nWdt>=nHgt) {
683  aP.setY(BigMulDiv(aP.Y(),nWdt,nHgt) );
684  } else {
685  aP.setX(BigMulDiv(aP.X(),nHgt,nWdt) );
686  }
687  nEnd=NormAngle36000(GetAngle(aP));
688  if (rStat.GetView()!=nullptr && rStat.GetView()->IsAngleSnapEnabled()) {
689  long nSA=rStat.GetView()->GetSnapAngle();
690  if (nSA!=0) { // angle snapping
691  nEnd+=nSA/2;
692  nEnd/=nSA;
693  nEnd*=nSA;
694  nEnd=NormAngle36000(nEnd);
695  }
696  }
697  }
698 }
699 
701 {
702  ImpCircUser* pU=static_cast<ImpCircUser*>(rStat.GetUser());
703  if (pU==nullptr) {
704  pU=new ImpCircUser;
705  rStat.SetUser(std::unique_ptr<ImpCircUser>(pU));
706  }
707  pU->SetCreateParams(rStat);
708 }
709 
711 {
712  rStat.SetOrtho4Possible();
713  tools::Rectangle aRect1(rStat.GetStart(), rStat.GetNow());
714  aRect1.Justify();
715  rStat.SetActionRect(aRect1);
716  maRect = aRect1;
717  ImpSetCreateParams(rStat);
718  return true;
719 }
720 
722 {
723  ImpSetCreateParams(rStat);
724  ImpCircUser* pU=static_cast<ImpCircUser*>(rStat.GetUser());
725  rStat.SetActionRect(pU->aR);
726  maRect = pU->aR; // for ObjName
728  nStartAngle=pU->nStart;
729  nEndAngle=pU->nEnd;
731  bSnapRectDirty=true;
732  SetXPolyDirty();
733 
734  // #i103058# push current angle settings to ItemSet to
735  // allow FullDrag visualisation
736  if(rStat.GetPointCount() >= 4)
737  {
739  }
740 
741  return true;
742 }
743 
745 {
746  ImpSetCreateParams(rStat);
747  ImpCircUser* pU=static_cast<ImpCircUser*>(rStat.GetUser());
748  bool bRet = false;
751  bRet=rStat.GetPointCount()>=2;
752  if (bRet) {
753  maRect = pU->aR;
755  }
756  } else {
757  rStat.SetNoSnap(rStat.GetPointCount()>=2);
758  rStat.SetOrtho4Possible(rStat.GetPointCount()<2);
759  bRet=rStat.GetPointCount()>=4;
760  if (bRet) {
761  maRect = pU->aR;
763  nStartAngle=pU->nStart;
764  nEndAngle=pU->nEnd;
765  }
766  }
768  SetRectsDirty();
769  SetXPolyDirty();
771  if (bRet)
772  rStat.SetUser(nullptr);
773  return bRet;
774 }
775 
777 {
778  rStat.SetUser(nullptr);
779 }
780 
782 {
783  rStat.SetNoSnap(rStat.GetPointCount()>=3);
784  rStat.SetOrtho4Possible(rStat.GetPointCount()<3);
786 }
787 
789 {
790  const ImpCircUser* pU = static_cast<const ImpCircUser*>(rDrag.GetUser());
791 
792  if(rDrag.GetPointCount() < 4)
793  {
794  // force to OBJ_CIRC to get full visualisation
795  basegfx::B2DPolyPolygon aRetval(ImpCalcXPolyCirc(SdrCircKind::Full, pU->aR, pU->nStart, pU->nEnd));
796 
797  if(3 == rDrag.GetPointCount())
798  {
799  // add edge to first point on ellipse
800  basegfx::B2DPolygon aNew;
801 
802  aNew.append(basegfx::B2DPoint(pU->aCenter.X(), pU->aCenter.Y()));
803  aNew.append(basegfx::B2DPoint(pU->aP1.X(), pU->aP1.Y()));
804  aRetval.append(aNew);
805  }
806 
807  return aRetval;
808  }
809  else
810  {
811  return basegfx::B2DPolyPolygon(ImpCalcXPolyCirc(meCircleKind, pU->aR, pU->nStart, pU->nEnd));
812  }
813 }
814 
816 {
817  switch (meCircleKind) {
818  case SdrCircKind::Full: return PointerStyle::DrawEllipse;
819  case SdrCircKind::Section: return PointerStyle::DrawPie;
820  case SdrCircKind::Arc: return PointerStyle::DrawArc;
821  case SdrCircKind::Cut: return PointerStyle::DrawCircleCut;
822  default: break;
823  } // switch
824  return PointerStyle::Cross;
825 }
826 
827 void SdrCircObj::NbcMove(const Size& aSiz)
828 {
829  maRect.Move(aSiz);
830  aOutRect.Move(aSiz);
831  maSnapRect.Move(aSiz);
832  SetXPolyDirty();
833  SetRectsDirty(true);
834 }
835 
836 void SdrCircObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
837 {
838  long nAngle0=aGeo.nRotationAngle;
839  bool bNoShearRota=(aGeo.nRotationAngle==0 && aGeo.nShearAngle==0);
840  SdrTextObj::NbcResize(rRef,xFact,yFact);
841  bNoShearRota|=(aGeo.nRotationAngle==0 && aGeo.nShearAngle==0);
843  bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
844  bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
845  if (bXMirr || bYMirr) {
846  // At bXMirr!=bYMirr we should actually swap both line ends.
847  // That, however, is pretty bad (because of forced "hard" formatting).
848  // Alternatively, we could implement a bMirrored flag (maybe even
849  // a more general one, e. g. for mirrored text, ...).
850  long nS0=nStartAngle;
851  long nE0=nEndAngle;
852  if (bNoShearRota) {
853  // the RectObj already mirrors at VMirror because of a 180deg rotation
854  if (! (bXMirr && bYMirr)) {
855  long nTmp=nS0;
856  nS0=18000-nE0;
857  nE0=18000-nTmp;
858  }
859  } else { // mirror contorted ellipses
860  if (bXMirr!=bYMirr) {
861  nS0+=nAngle0;
862  nE0+=nAngle0;
863  if (bXMirr) {
864  long nTmp=nS0;
865  nS0=18000-nE0;
866  nE0=18000-nTmp;
867  }
868  if (bYMirr) {
869  long nTmp=nS0;
870  nS0=-nE0;
871  nE0=-nTmp;
872  }
873  nS0-=aGeo.nRotationAngle;
874  nE0-=aGeo.nRotationAngle;
875  }
876  }
877  long nAngleDif=nE0-nS0;
880  if (nAngleDif==36000) nEndAngle+=nAngleDif; // full circle
881  }
882  }
883  SetXPolyDirty();
885 }
886 
887 void SdrCircObj::NbcShear(const Point& rRef, long nAngle, double tn, bool bVShear)
888 {
889  SdrTextObj::NbcShear(rRef,nAngle,tn,bVShear);
890  SetXPolyDirty();
892 }
893 
894 void SdrCircObj::NbcMirror(const Point& rRef1, const Point& rRef2)
895 {
896  bool bFreeMirr=meCircleKind!=SdrCircKind::Full;
897  Point aTmpPt1;
898  Point aTmpPt2;
899  if (bFreeMirr) { // some preparations for using an arbitrary axis of reflection
900  Point aCenter(maRect.Center());
901  long nWdt=maRect.GetWidth()-1;
902  long nHgt=maRect.GetHeight()-1;
903  long nMaxRad=(std::max(nWdt,nHgt)+1) /2;
904  double a;
905  // starting point
906  a = nStartAngle * F_PI18000;
907  aTmpPt1=Point(FRound(cos(a)*nMaxRad),-FRound(sin(a)*nMaxRad));
908  if (nWdt==0) aTmpPt1.setX(0 );
909  if (nHgt==0) aTmpPt1.setY(0 );
910  aTmpPt1+=aCenter;
911  // finishing point
912  a = nEndAngle * F_PI18000;
913  aTmpPt2=Point(FRound(cos(a)*nMaxRad),-FRound(sin(a)*nMaxRad));
914  if (nWdt==0) aTmpPt2.setX(0 );
915  if (nHgt==0) aTmpPt2.setY(0 );
916  aTmpPt2+=aCenter;
917  if (aGeo.nRotationAngle!=0) {
920  }
921  if (aGeo.nShearAngle!=0) {
922  ShearPoint(aTmpPt1,maRect.TopLeft(),aGeo.nTan);
923  ShearPoint(aTmpPt2,maRect.TopLeft(),aGeo.nTan);
924  }
925  }
926  SdrTextObj::NbcMirror(rRef1,rRef2);
927  if (meCircleKind!=SdrCircKind::Full) { // adapt starting and finishing angle
928  MirrorPoint(aTmpPt1,rRef1,rRef2);
929  MirrorPoint(aTmpPt2,rRef1,rRef2);
930  // unrotate:
931  if (aGeo.nRotationAngle!=0) {
932  RotatePoint(aTmpPt1,maRect.TopLeft(),-aGeo.nSin,aGeo.nCos); // -sin for reversion
933  RotatePoint(aTmpPt2,maRect.TopLeft(),-aGeo.nSin,aGeo.nCos); // -sin for reversion
934  }
935  // unshear:
936  if (aGeo.nShearAngle!=0) {
937  ShearPoint(aTmpPt1,maRect.TopLeft(),-aGeo.nTan); // -tan for reversion
938  ShearPoint(aTmpPt2,maRect.TopLeft(),-aGeo.nTan); // -tan for reversion
939  }
940  Point aCenter(maRect.Center());
941  aTmpPt1-=aCenter;
942  aTmpPt2-=aCenter;
943  // because it's mirrored, the angles are swapped, too
944  nStartAngle=GetAngle(aTmpPt2);
945  nEndAngle =GetAngle(aTmpPt1);
946  long nAngleDif=nEndAngle-nStartAngle;
947  nStartAngle=NormAngle36000(nStartAngle);
949  if (nAngleDif==36000) nEndAngle+=nAngleDif; // full circle
950  }
951  SetXPolyDirty();
953 }
954 
956 {
957  return new SdrCircObjGeoData;
958 }
959 
961 {
963  SdrCircObjGeoData& rCGeo=static_cast<SdrCircObjGeoData&>(rGeo);
964  rCGeo.nStartAngle=nStartAngle;
965  rCGeo.nEndAngle =nEndAngle;
966 }
967 
969 {
971  const SdrCircObjGeoData& rCGeo=static_cast<const SdrCircObjGeoData&>(rGeo);
972  nStartAngle=rCGeo.nStartAngle;
973  nEndAngle =rCGeo.nEndAngle;
974  SetXPolyDirty();
976 }
977 
978 static void Union(tools::Rectangle& rR, const Point& rP)
979 {
980  if (rP.X()<rR.Left ()) rR.SetLeft(rP.X() );
981  if (rP.X()>rR.Right ()) rR.SetRight(rP.X() );
982  if (rP.Y()<rR.Top ()) rR.SetTop(rP.Y() );
983  if (rP.Y()>rR.Bottom()) rR.SetBottom(rP.Y() );
984 }
985 
987 {
988  rRect = maRect;
990  const Point aPntStart(GetAnglePnt(maRect,nStartAngle));
991  const Point aPntEnd(GetAnglePnt(maRect,nEndAngle));
992  long a=nStartAngle;
993  long e=nEndAngle;
994  rRect.SetLeft(maRect.Right() );
995  rRect.SetRight(maRect.Left() );
996  rRect.SetTop(maRect.Bottom() );
997  rRect.SetBottom(maRect.Top() );
998  Union(rRect,aPntStart);
999  Union(rRect,aPntEnd);
1000  if ((a<=18000 && e>=18000) || (a>e && (a<=18000 || e>=18000))) {
1001  Union(rRect,maRect.LeftCenter());
1002  }
1003  if ((a<=27000 && e>=27000) || (a>e && (a<=27000 || e>=27000))) {
1004  Union(rRect,maRect.BottomCenter());
1005  }
1006  if (a>e) {
1007  Union(rRect,maRect.RightCenter());
1008  }
1009  if ((a<=9000 && e>=9000) || (a>e && (a<=9000 || e>=9000))) {
1010  Union(rRect,maRect.TopCenter());
1011  }
1013  Union(rRect,maRect.Center());
1014  }
1015  if (aGeo.nRotationAngle!=0) {
1016  Point aDst(rRect.TopLeft());
1017  aDst-=maRect.TopLeft();
1018  Point aDst0(aDst);
1019  RotatePoint(aDst,Point(),aGeo.nSin,aGeo.nCos);
1020  aDst-=aDst0;
1021  rRect.Move(aDst.X(),aDst.Y());
1022  }
1023  }
1024  if (aGeo.nShearAngle!=0) {
1025  long nDst=FRound((rRect.Bottom()-rRect.Top())*aGeo.nTan);
1026  if (aGeo.nShearAngle>0) {
1027  Point aRef(rRect.TopLeft());
1028  rRect.AdjustLeft( -nDst );
1029  Point aTmpPt(rRect.TopLeft());
1030  RotatePoint(aTmpPt,aRef,aGeo.nSin,aGeo.nCos);
1031  aTmpPt-=rRect.TopLeft();
1032  rRect.Move(aTmpPt.X(),aTmpPt.Y());
1033  } else {
1034  rRect.AdjustRight( -nDst );
1035  }
1036  }
1037 }
1038 
1040 {
1041  if (PaintNeedsXPolyCirc()) {
1043  } else {
1045  }
1046 }
1047 
1049 {
1051  tools::Rectangle aSR0(GetSnapRect());
1052  long nWdt0=aSR0.Right()-aSR0.Left();
1053  long nHgt0=aSR0.Bottom()-aSR0.Top();
1054  long nWdt1=rRect.Right()-rRect.Left();
1055  long nHgt1=rRect.Bottom()-rRect.Top();
1056  NbcResize(maSnapRect.TopLeft(),Fraction(nWdt1,nWdt0),Fraction(nHgt1,nHgt0));
1057  NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top()));
1058  } else {
1059  maRect=rRect;
1061  }
1062  SetRectsDirty();
1063  SetXPolyDirty();
1065 }
1066 
1068 {
1070  return 1;
1071  } else {
1072  return 3;
1073  }
1074 }
1075 
1076 Point SdrCircObj::GetSnapPoint(sal_uInt32 i) const
1077 {
1078  switch (i) {
1079  case 1 : return GetAnglePnt(maRect,nStartAngle);
1080  case 2 : return GetAnglePnt(maRect,nEndAngle);
1081  default: return maRect.Center();
1082  }
1083 }
1084 
1086 {
1087  SetXPolyDirty();
1088  SdrRectObj::Notify(rBC,rHint);
1090 }
1091 
1092 
1094 {
1095  const SfxItemSet& rSet = GetObjectItemSet();
1096  SdrCircKind eNewKind = rSet.Get(SDRATTR_CIRCKIND).GetValue();
1097 
1098  sal_Int32 nNewStart = rSet.Get(SDRATTR_CIRCSTARTANGLE).GetValue();
1099  sal_Int32 nNewEnd = rSet.Get(SDRATTR_CIRCENDANGLE).GetValue();
1100 
1101  bool bKindChg = meCircleKind != eNewKind;
1102  bool bAngleChg = nNewStart != nStartAngle || nNewEnd != nEndAngle;
1103 
1104  if(bKindChg || bAngleChg)
1105  {
1106  meCircleKind = eNewKind;
1107  nStartAngle = nNewStart;
1108  nEndAngle = nNewEnd;
1109 
1110  if(bKindChg || (meCircleKind != SdrCircKind::Full && bAngleChg))
1111  {
1112  SetXPolyDirty();
1113  SetRectsDirty();
1114  }
1115  }
1116 }
1117 
1119 {
1120  const SfxItemSet& rSet = GetObjectItemSet();
1121 
1122  SdrCircKind eOldKindA = rSet.Get(SDRATTR_CIRCKIND).GetValue();
1123  sal_Int32 nOldStartAngle = rSet.Get(SDRATTR_CIRCSTARTANGLE).GetValue();
1124  sal_Int32 nOldEndAngle = rSet.Get(SDRATTR_CIRCENDANGLE).GetValue();
1125 
1126  if(meCircleKind != eOldKindA || nStartAngle != nOldStartAngle || nEndAngle != nOldEndAngle)
1127  {
1128  // since SetItem() implicitly calls ImpSetAttrToCircInfo()
1129  // setting the item directly is necessary here.
1130  if(meCircleKind != eOldKindA)
1131  {
1133  }
1134 
1135  if(nStartAngle != nOldStartAngle)
1136  {
1138  }
1139 
1140  if(nEndAngle != nOldEndAngle)
1141  {
1143  }
1144 
1145  SetXPolyDirty();
1147  }
1148 }
1149 
1150 SdrObjectUniquePtr SdrCircObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
1151 {
1152  const bool bFill(meCircleKind != SdrCircKind::Arc);
1154  SdrObjectUniquePtr pRet = ImpConvertMakeObj(basegfx::B2DPolyPolygon(aCircPolygon), bFill, bBezier);
1155 
1156  if(bAddText)
1157  {
1158  pRet = ImpConvertAddText(std::move(pRet), bBezier);
1159  }
1160 
1161  return pRet;
1162 }
1163 
1164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SdrCircKind
Definition: svdocirc.hxx:39
Point TopLeft() const
B2DPolygon const & createPolygonFromUnitCircle(sal_uInt32 nStartQuadrant=0)
static SVX_DLLPRIVATE void ImpSetCreateParams(SdrDragStat &rStat)
Definition: svdocirc.cxx:700
long GetWidth() const
B2DPoint getCenter() const
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdotxtr.cxx:106
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
Definition: svdocirc.cxx:1085
tools::Rectangle GetBoundRect() const
Definition: _xpoly.cxx:401
long GetHeight() const
SdrCircObj & operator=(const SdrCircObj &rObj)
Definition: svdocirc.cxx:380
virtual void SetObjectItemDirect(const SfxPoolItem &rItem)=0
virtual sal_uInt16 GetObjIdentifier() const override
Definition: svdocirc.cxx:175
void ShearPoint(Point &rPnt, const Point &rRef, double tn, bool bVShear=false)
Definition: svdtrans.hxx:122
double getHeight() const
long FRound(double fVal)
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: svdocirc.cxx:955
#define XATTR_LINEENDWIDTH
Definition: xdef.hxx:97
virtual OUString TakeObjNameSingul() const override
Definition: svdocirc.cxx:317
double nSin
Definition: svdtrans.hxx:219
const Point & GetStart() const
Definition: svddrag.hxx:92
Point BottomLeft() const
GeoStat aGeo
Definition: svdotext.hxx:185
SdrHdlKind
Definition: svdhdl.hxx:52
long AdjustLeft(long nHorzMoveDelta)
bool ImpCanConvTextToCurve() const
Definition: svdotxtr.cxx:428
SVX_DLLPRIVATE basegfx::B2DPolygon ImpCalcXPolyCirc(const SdrCircKind eKind, const tools::Rectangle &rRect1, long nStart, long nEnd) const
Definition: svdocirc.cxx:238
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
Definition: svdocirc.cxx:393
long nRotationAngle
Definition: svdtrans.hxx:216
sal_uInt32 GetPointNum() const
Definition: svdhdl.hxx:222
virtual void SetBoundRectDirty()
Definition: svdobj.cxx:336
aBuf
virtual void RecalcSnapRect() override
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
Definition: svdocirc.cxx:1039
static void Union(tools::Rectangle &rR, const Point &rP)
Definition: svdocirc.cxx:978
SdrObjectUniquePtr ImpConvertAddText(SdrObjectUniquePtr pObj, bool bBezier) const
Definition: svdotxtr.cxx:467
const Point & GetPoint(sal_Int32 nNum) const
Definition: svddrag.hxx:90
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
Definition: svdocirc.cxx:530
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: svdocirc.cxx:1150
virtual sdr::properties::BaseProperties & GetProperties() const
Definition: svdobj.cxx:230
virtual void TakeUnrotatedSnapRect(tools::Rectangle &rRect) const override
Definition: svdocirc.cxx:986
virtual const tools::Rectangle & GetSnapRect() const override
Definition: svdoattr.cxx:91
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:226
long NormAngle36000(long a)
Normalize angle to -180.00..179.99.
Definition: svdtrans.cxx:407
virtual bool HasText() const override
Definition: svdotxat.cxx:429
SdrCircKind ToSdrCircKind(SdrObjKind eKind)
Definition: svdocirc.cxx:110
void Move(long nHorzMoveDelta, long nVertMoveDelta)
bool bSnapRectDirty
Definition: svdobj.hxx:928
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: svdotxtr.cxx:236
Point RightCenter() const
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:39
Provides information about various ZObject properties.
Definition: svdobj.hxx:248
const SdrHdl * GetHdl() const
Definition: svddrag.hxx:101
static OUString GetAngleString(long nAngle)
Definition: svdmodel.cxx:1218
virtual void BrkCreate(SdrDragStat &rStat) override
Definition: svdocirc.cxx:776
virtual bool hasSpecialDrag() const override
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
Definition: svdocirc.cxx:508
long nEndAngle
Definition: svdocirc.hxx:55
long Right() const
double getWidth() const
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
void setX(long nX)
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdotext.cxx:1440
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdocirc.cxx:166
virtual bool MovCreate(SdrDragStat &rStat) override
Definition: svdocirc.cxx:721
#define SDRATTR_CIRCENDANGLE
Definition: svddef.hxx:263
Point BottomCenter() const
virtual Point GetSnapPoint(sal_uInt32 i) const override
Definition: svdocirc.cxx:1076
const SfxItemSet & GetObjectItemSet() const
Definition: svdobj.cxx:1906
SdrAngleItem makeSdrCircEndAngleItem(long nAngle)
Definition: sxciaitm.hxx:29
virtual bool BckCreate(SdrDragStat &rStat) override
Definition: svdocirc.cxx:781
tools::Rectangle maRect
Definition: svdotext.hxx:182
void SetOrtho4Possible(bool bOn=true)
Definition: svddrag.hxx:126
void TakeCreateRect(tools::Rectangle &rRect) const
Definition: svddrag.cxx:115
B2DHomMatrix createScaleTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fTranslateX, double fTranslateY)
bool bClosedObj
Definition: svdobj.hxx:941
long Top() const
tools::Rectangle maSnapRect
Definition: svdoattr.hxx:42
Point LeftCenter() const
void setY(long nY)
circle, ellipse
Definition: svdobj.hxx:122
virtual sal_uInt32 GetSnapPointCount() const override
snap to special points of an Object (polygon points, center of circle)
Definition: svdocirc.cxx:1067
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: svdocirc.cxx:435
SdrCircKind meCircleKind
Definition: svdocirc.hxx:53
SVX_DLLPRIVATE void ImpSetCircInfoToAttr()
Definition: svdocirc.cxx:1118
Point BottomRight() const
void SetNoSnap(bool bOn=true)
Definition: svddrag.hxx:121
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
Definition: svdotxdr.cxx:149
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
Definition: svdotxdr.cxx:174
const XPolygon & GetXPoly() const
Definition: svdorect.cxx:140
#define F_PI
double nCos
Definition: svdtrans.hxx:220
void SetTop(long v)
uno_Any a
OUString sName
SdrObject * GetCreateObj() const
Definition: svdcrtv.hxx:119
tools::Rectangle aOutRect
Definition: svdobj.hxx:921
SdrPathObjUniquePtr ImpConvertMakeObj(const basegfx::B2DPolyPolygon &rPolyPolygon, bool bClosed, bool bBezier) const
Definition: svdotxtr.cxx:433
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdocirc.cxx:97
sal_Int32 GetPointCount() const
Definition: svddrag.hxx:91
void MirrorPoint(Point &rPnt, const Point &rRef1, const Point &rRef2)
Definition: svdtrans.cxx:103
void SetRight(long v)
double nTan
Definition: svdtrans.hxx:218
SdrView * GetView() const
Definition: svddrag.hxx:86
bool IsAngleSnapEnabled() const
Definition: svdsnpv.hxx:222
void SetXPolyDirty()
Definition: svdorect.cxx:106
long Bottom() const
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdocirc.cxx:960
long GetSnapAngle() const
Definition: svdsnpv.hxx:224
#define XATTR_LINESTYLE
Definition: xdef.hxx:90
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdocirc.cxx:836
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
Definition: svdocirc.cxx:513
#define XATTR_FILLSTYLE
Definition: xdef.hxx:107
virtual bool BegCreate(SdrDragStat &rStat) override
Every object must be able to create itself interactively.
Definition: svdocirc.cxx:710
virtual ~SdrCircObj() override
Definition: svdocirc.cxx:162
long X() const
OUString GetName() const
Definition: svdobj.cxx:725
long nShearAngle
Definition: svdtrans.hxx:217
SdrAngleItem makeSdrCircStartAngleItem(long nAngle)
Definition: sxciaitm.hxx:25
long BigMulDiv(long nVal, long nMul, long nDiv)
Definition: svdtrans.cxx:558
void transform(const basegfx::B2DHomMatrix &rMatrix)
basegfx::B2DRange b2DRectangleFromRectangle(const ::tools::Rectangle &rRect)
#define XATTR_LINEWIDTH
Definition: xdef.hxx:92
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
long nStartAngle
Definition: svdocirc.hxx:54
circle section
Definition: svdobj.hxx:123
SdrRectObj & operator=(const SdrRectObj &rCopy)
Definition: svdorect.cxx:263
void setClosed(bool bNew)
void RotatePoint(Point &rPnt, const Point &rRef, double sn, double cs)
Definition: svdtrans.hxx:114
void SetActionRect(const tools::Rectangle &rR)
Definition: svddrag.hxx:157
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
Definition: svdocirc.cxx:595
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const override
Polygon dragged by the user when creating the object.
Definition: svdocirc.cxx:788
long AdjustRight(long nHorzMoveDelta)
sal_Int32 GetDenominator() const
circle arc
Definition: svdobj.hxx:124
SdrObjKind
Definition: svdobj.hxx:116
virtual void RestGeoData(const SdrObjGeoData &rGeo) override
Definition: svdocirc.cxx:968
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual SVX_DLLPRIVATE void RecalcXPoly() override
Subclasses should override RecalcXPoly() by creating an XPolygon instance with new and assigning it t...
Definition: svdocirc.cxx:311
virtual OUString TakeObjNamePlural() const override
Definition: svdocirc.cxx:351
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: svdocirc.cxx:894
OUString ImpGetDescriptionStr(const char *pStrCacheID) const
Definition: svdobj.cxx:1065
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdocirc.cxx:423
#define XATTR_LINEEND
Definition: xdef.hxx:95
OUString aName
B2DPolygon createPolygonFromEllipseSegment(const B2DPoint &rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd)
void SetUser(std::unique_ptr< SdrDragStatUserData > pU)
Definition: svddrag.hxx:104
virtual void NbcShear(const Point &rRef, long nAngle, double tn, bool bVShear) override
Definition: svdocirc.cxx:887
void SetBottom(long v)
#define F_PI18000
std::unique_ptr< XPolygon > mpXPoly
Definition: svdorect.hxx:50
B2DPoint getMinimum() const
virtual PointerStyle GetCreatePointer() const override
get the cursor/pointer that signals creating this object
Definition: svdocirc.cxx:815
sal_Int32 GetNumerator() const
static Point GetAnglePnt(const tools::Rectangle &rR, long nAngle)
Definition: svdocirc.cxx:58
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
Definition: svdocirc.cxx:744
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:114
SdrCircObj(SdrModel &rSdrModel, SdrCircKind eNewKind)
Definition: svdocirc.cxx:123
const Point & GetNow() const
Definition: svddrag.hxx:95
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const
Definition: svdobj.cxx:1312
long GetAngle(const Point &rPnt)
The Y axis points down! The function negates the Y axis, when calculating the angle, such that GetAngle(Point(0,-1))=90 deg.
Definition: svdtrans.cxx:385
long Left() const
PointerStyle
SVX_DLLPRIVATE void ImpSetAttrToCircInfo()
Definition: svdocirc.cxx:1093
virtual void RestGeoData(const SdrObjGeoData &rGeo) override
Definition: svdorect.cxx:589
virtual void SetRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:462
virtual void NbcMove(const Size &aSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdocirc.cxx:827
#define SDRATTR_CIRCSTARTANGLE
Definition: svddef.hxx:262
void SetLeft(long v)
#define XATTR_LINESTARTWIDTH
Definition: xdef.hxx:96
bool LineGeometryUsageIsNecessary() const
Definition: svdobj.cxx:989
#define SDRATTR_CIRCKIND
Definition: svddef.hxx:261
SVX_DLLPRIVATE bool PaintNeedsXPolyCirc() const
Definition: svdocirc.cxx:188
SdrDragStatUserData * GetUser() const
Definition: svddrag.hxx:103
B2DHomMatrix createShearXRotateTranslateB2DHomMatrix(double fShearX, double fRadiant, double fTranslateX, double fTranslateY)
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
Definition: svdocirc.cxx:1048
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
SdrCreateCmd
Definition: svdtypes.hxx:27
virtual void SetChanged()
Definition: svdobj.cxx:956
virtual void NbcShear(const Point &rRef, long nAngle, double tn, bool bVShear) override
Definition: svdotxtr.cxx:214
static void ImpJustifyRect(tools::Rectangle &rRect)
Definition: svdotext.cxx:391
Point TopRight() const
Point Center() const
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
Definition: svdhdl.cxx:2299
long Y() const
virtual bool IsFontwork() const
Definition: svdotext.cxx:1732
Point TopCenter() const
virtual SdrCircObj * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdocirc.cxx:375
SdrHdlKind GetKind() const
Definition: svdhdl.hxx:194
#define XATTR_LINESTART
Definition: xdef.hxx:94
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
Definition: svdorect.cxx:583
rectangle (round corners optional)
Definition: svdobj.hxx:121
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdocirc.cxx:105