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