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
51using namespace com::sun::star;
52
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
91std::unique_ptr<sdr::properties::BaseProperties> SdrCircObj::CreateObjectSpecificProperties()
92{
93 return std::make_unique<sdr::properties::CircleProperties>(*this);
94}
95
96
97// DrawContact section
98
99std::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;
126}
127
128SdrCircObj::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;
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;
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
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
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.m_nRotationAngle ? toRadians(36000_deg100 - maGeo.m_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 (getRectangle().GetWidth() == getRectangle().GetHeight() && maGeo.m_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 (getRectangle().GetWidth() == getRectangle().GetHeight() && maGeo.m_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
383namespace {
384
385struct ImpCircUser : public SdrDragStatUserData
386{
388 Point aCenter;
389 Point aP1;
390 tools::Long nHgt;
391 tools::Long nWdt;
392 Degree100 nStart;
393 Degree100 nEnd;
394
395public:
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
407sal_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 tools::Rectangle aRectangle = getRectangle();
427 switch (nHdlNum)
428 {
429 case 0:
430 aPnt = GetAnglePnt(aRectangle, nStartAngle);
431 eLocalKind = SdrHdlKind::Circle;
432 nPNum = 1;
433 break;
434 case 1:
435 aPnt = GetAnglePnt(aRectangle, nEndAngle);
436 eLocalKind = SdrHdlKind::Circle;
437 nPNum = 2;
438 break;
439 case 2:
440 aPnt = aRectangle.TopLeft();
441 eLocalKind = SdrHdlKind::UpperLeft;
442 break;
443 case 3:
444 aPnt = aRectangle.TopCenter();
445 eLocalKind = SdrHdlKind::Upper;
446 break;
447 case 4:
448 aPnt = aRectangle.TopRight();
449 eLocalKind = SdrHdlKind::UpperRight;
450 break;
451 case 5:
452 aPnt = aRectangle.LeftCenter();
453 eLocalKind = SdrHdlKind::Left;
454 break;
455 case 6:
456 aPnt = aRectangle.RightCenter();
457 eLocalKind = SdrHdlKind::Right;
458 break;
459 case 7:
460 aPnt = aRectangle.BottomLeft();
461 eLocalKind = SdrHdlKind::LowerLeft;
462 break;
463 case 8:
464 aPnt = aRectangle.BottomCenter();
465 eLocalKind = SdrHdlKind::Lower;
466 break;
467 case 9:
468 aPnt = aRectangle.BottomRight();
469 eLocalKind = SdrHdlKind::LowerRight;
470 break;
471 }
472
474 {
475 ShearPoint(aPnt, aRectangle.TopLeft(), maGeo.mfTanShearAngle);
476 }
477
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.m_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
524
527
528 aPt -= getRectangle().Center();
529
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
569 SetChanged();
570
571 return true;
572 }
573 else
574 {
575 return SdrTextObj::applySpecialDrag(rDrag);
576 }
577}
578
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 " (" +
621 ")";
622 }
623 else
624 {
626 }
627 }
628}
629
630
631void ImpCircUser::SetCreateParams(SdrDragStat const & rStat)
632{
633 rStat.TakeCreateRect(aR);
634 aR.Normalize();
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.Normalize();
698 rStat.SetActionRect(aRect1);
699 setRectangle(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 setRectangle(pU->aR); // for ObjName
711 nStartAngle=pU->nStart;
712 nEndAngle=pU->nEnd;
714 m_bSnapRectDirty=true;
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 tools::Rectangle aRectangle(pU->aR);
737 ImpJustifyRect(aRectangle);
738 setRectangle(aRectangle);
739 }
740 } else {
741 rStat.SetNoSnap(rStat.GetPointCount()>=2);
742 rStat.SetOrtho4Possible(rStat.GetPointCount()<2);
743 bRet=rStat.GetPointCount()>=4;
744 if (bRet) {
745 tools::Rectangle aRectangle(pU->aR);
746 ImpJustifyRect(aRectangle);
747 setRectangle(aRectangle);
748 nStartAngle=pU->nStart;
749 nEndAngle=pU->nEnd;
750 }
751 }
756 if (bRet)
757 rStat.SetUser(nullptr);
758 return bRet;
759}
760
762{
763 rStat.SetUser(nullptr);
764}
765
767{
768 rStat.SetNoSnap(rStat.GetPointCount()>=3);
769 rStat.SetOrtho4Possible(rStat.GetPointCount()<3);
771}
772
774{
775 const ImpCircUser* pU = static_cast<const ImpCircUser*>(rDrag.GetUser());
776
777 if(rDrag.GetPointCount() < 4)
778 {
779 // force to OBJ_CIRC to get full visualisation
780 basegfx::B2DPolyPolygon aRetval(ImpCalcXPolyCirc(SdrCircKind::Full, pU->aR, pU->nStart, pU->nEnd));
781
782 if(3 == rDrag.GetPointCount())
783 {
784 // add edge to first point on ellipse
786
787 aNew.append(basegfx::B2DPoint(pU->aCenter.X(), pU->aCenter.Y()));
788 aNew.append(basegfx::B2DPoint(pU->aP1.X(), pU->aP1.Y()));
789 aRetval.append(aNew);
790 }
791
792 return aRetval;
793 }
794 else
795 {
796 return basegfx::B2DPolyPolygon(ImpCalcXPolyCirc(meCircleKind, pU->aR, pU->nStart, pU->nEnd));
797 }
798}
799
801{
802 switch (meCircleKind) {
803 case SdrCircKind::Full: return PointerStyle::DrawEllipse;
804 case SdrCircKind::Section: return PointerStyle::DrawPie;
805 case SdrCircKind::Arc: return PointerStyle::DrawArc;
806 case SdrCircKind::Cut: return PointerStyle::DrawCircleCut;
807 default: break;
808 } // switch
809 return PointerStyle::Cross;
810}
811
812void SdrCircObj::NbcMove(const Size& aSize)
813{
814 moveRectangle(aSize.Width(), aSize.Height());
815 moveOutRectangle(aSize.Width(), aSize.Height());
816 maSnapRect.Move(aSize);
819}
820
821void SdrCircObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
822{
824 bool bNoShearRota = (maGeo.m_nRotationAngle == 0_deg100 && maGeo.m_nShearAngle == 0_deg100);
825 SdrTextObj::NbcResize(rRef,xFact,yFact);
826 bNoShearRota |= (maGeo.m_nRotationAngle == 0_deg100 && maGeo.m_nShearAngle == 0_deg100);
828 bool bXMirr=(xFact.GetNumerator()<0) != (xFact.GetDenominator()<0);
829 bool bYMirr=(yFact.GetNumerator()<0) != (yFact.GetDenominator()<0);
830 if (bXMirr || bYMirr) {
831 // At bXMirr!=bYMirr we should actually swap both line ends.
832 // That, however, is pretty bad (because of forced "hard" formatting).
833 // Alternatively, we could implement a bMirrored flag (maybe even
834 // a more general one, e. g. for mirrored text, ...).
837 if (bNoShearRota) {
838 // the RectObj already mirrors at VMirror because of a 180deg rotation
839 if (! (bXMirr && bYMirr)) {
840 Degree100 nTmp=nS0;
841 nS0=18000_deg100-nE0;
842 nE0=18000_deg100-nTmp;
843 }
844 } else { // mirror contorted ellipses
845 if (bXMirr!=bYMirr) {
846 nS0+=nAngle0;
847 nE0+=nAngle0;
848 if (bXMirr) {
849 Degree100 nTmp=nS0;
850 nS0=18000_deg100-nE0;
851 nE0=18000_deg100-nTmp;
852 }
853 if (bYMirr) {
854 Degree100 nTmp=nS0;
855 nS0=-nE0;
856 nE0=-nTmp;
857 }
858 nS0 -= maGeo.m_nRotationAngle;
859 nE0 -= maGeo.m_nRotationAngle;
860 }
861 }
862 Degree100 nAngleDif=nE0-nS0;
865 if (nAngleDif==36000_deg100) nEndAngle+=nAngleDif; // full circle
866 }
867 }
870}
871
872void SdrCircObj::NbcShear(const Point& rRef, Degree100 nAngle, double tn, bool bVShear)
873{
874 SdrTextObj::NbcShear(rRef,nAngle,tn,bVShear);
877}
878
879void SdrCircObj::NbcMirror(const Point& rRef1, const Point& rRef2)
880{
881 bool bFreeMirr=meCircleKind!=SdrCircKind::Full;
882 Point aTmpPt1;
883 Point aTmpPt2;
884 if (bFreeMirr) { // some preparations for using an arbitrary axis of reflection
885 Point aCenter(getRectangle().Center());
886 tools::Long nWdt = getRectangle().GetWidth() - 1;
887 tools::Long nHgt = getRectangle().GetHeight() - 1;
888 tools::Long nMaxRad=(std::max(nWdt,nHgt)+1) /2;
889 // starting point
890 double a = toRadians(nStartAngle);
891 aTmpPt1=Point(FRound(cos(a)*nMaxRad),-FRound(sin(a)*nMaxRad));
892 if (nWdt==0) aTmpPt1.setX(0 );
893 if (nHgt==0) aTmpPt1.setY(0 );
894 aTmpPt1+=aCenter;
895 // finishing point
897 aTmpPt2=Point(FRound(cos(a)*nMaxRad),-FRound(sin(a)*nMaxRad));
898 if (nWdt==0) aTmpPt2.setX(0 );
899 if (nHgt==0) aTmpPt2.setY(0 );
900 aTmpPt2+=aCenter;
902 {
905 }
907 {
910 }
911 }
912 SdrTextObj::NbcMirror(rRef1,rRef2);
913 if (meCircleKind!=SdrCircKind::Full) { // adapt starting and finishing angle
914 MirrorPoint(aTmpPt1,rRef1,rRef2);
915 MirrorPoint(aTmpPt2,rRef1,rRef2);
916 // unrotate:
918 {
919 RotatePoint(aTmpPt1, getRectangle().TopLeft(), -maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle); // -sin for reversion
920 RotatePoint(aTmpPt2, getRectangle().TopLeft(), -maGeo.mfSinRotationAngle, maGeo.mfCosRotationAngle); // -sin for reversion
921 }
922 // unshear:
924 {
925 ShearPoint(aTmpPt1, getRectangle().TopLeft(), -maGeo.mfTanShearAngle); // -tan for reversion
926 ShearPoint(aTmpPt2, getRectangle().TopLeft(), -maGeo.mfTanShearAngle); // -tan for reversion
927 }
928 Point aCenter(getRectangle().Center());
929 aTmpPt1-=aCenter;
930 aTmpPt2-=aCenter;
931 // because it's mirrored, the angles are swapped, too
932 nStartAngle=GetAngle(aTmpPt2);
933 nEndAngle =GetAngle(aTmpPt1);
937 if (nAngleDif==36000_deg100) nEndAngle+=nAngleDif; // full circle
938 }
941}
942
943std::unique_ptr<SdrObjGeoData> SdrCircObj::NewGeoData() const
944{
945 return std::make_unique<SdrCircObjGeoData>();
946}
947
949{
951 SdrCircObjGeoData& rCGeo=static_cast<SdrCircObjGeoData&>(rGeo);
953 rCGeo.nEndAngle =nEndAngle;
954}
955
957{
959 const SdrCircObjGeoData& rCGeo=static_cast<const SdrCircObjGeoData&>(rGeo);
961 nEndAngle =rCGeo.nEndAngle;
964}
965
966static void Union(tools::Rectangle& rR, const Point& rP)
967{
968 if (rP.X()<rR.Left ()) rR.SetLeft(rP.X() );
969 if (rP.X()>rR.Right ()) rR.SetRight(rP.X() );
970 if (rP.Y()<rR.Top ()) rR.SetTop(rP.Y() );
971 if (rP.Y()>rR.Bottom()) rR.SetBottom(rP.Y() );
972}
973
975{
976 rRect = getRectangle();
978 const Point aPntStart(GetAnglePnt(getRectangle(), nStartAngle));
979 const Point aPntEnd(GetAnglePnt(getRectangle(), nEndAngle));
982 rRect.SetLeft(getRectangle().Right() );
983 rRect.SetRight(getRectangle().Left() );
984 rRect.SetTop(getRectangle().Bottom() );
985 rRect.SetBottom(getRectangle().Top() );
986 Union(rRect,aPntStart);
987 Union(rRect,aPntEnd);
988 if ((a<=18000_deg100 && e>=18000_deg100) || (a>e && (a<=18000_deg100 || e>=18000_deg100))) {
989 Union(rRect, getRectangle().LeftCenter());
990 }
991 if ((a<=27000_deg100 && e>=27000_deg100) || (a>e && (a<=27000_deg100 || e>=27000_deg100))) {
992 Union(rRect, getRectangle().BottomCenter());
993 }
994 if (a>e) {
995 Union(rRect, getRectangle().RightCenter());
996 }
997 if ((a<=9000_deg100 && e>=9000_deg100) || (a>e && (a<=9000_deg100 || e>=9000_deg100))) {
998 Union(rRect, getRectangle().TopCenter());
999 }
1001 Union(rRect, getRectangle().Center());
1002 }
1004 {
1005 Point aDst(rRect.TopLeft());
1006 aDst -= getRectangle().TopLeft();
1007 Point aDst0(aDst);
1009 aDst-=aDst0;
1010 rRect.Move(aDst.X(),aDst.Y());
1011 }
1012 }
1013 if (maGeo.m_nShearAngle==0_deg100)
1014 return;
1015
1016 tools::Long nDst = FRound((rRect.Bottom() - rRect.Top()) * maGeo.mfTanShearAngle);
1017 if (maGeo.m_nShearAngle > 0_deg100)
1018 {
1019 Point aRef(rRect.TopLeft());
1020 rRect.AdjustLeft( -nDst );
1021 Point aTmpPt(rRect.TopLeft());
1023 aTmpPt-=rRect.TopLeft();
1024 rRect.Move(aTmpPt.X(),aTmpPt.Y());
1025 } else {
1026 rRect.AdjustRight( -nDst );
1027 }
1028}
1029
1031{
1032 if (PaintNeedsXPolyCirc()) {
1034 } else {
1036 }
1037}
1038
1040{
1042 {
1044 tools::Long nWdt0=aSR0.Right()-aSR0.Left();
1045 tools::Long nHgt0=aSR0.Bottom()-aSR0.Top();
1046 tools::Long nWdt1=rRect.Right()-rRect.Left();
1047 tools::Long nHgt1=rRect.Bottom()-rRect.Top();
1048 NbcResize(maSnapRect.TopLeft(),Fraction(nWdt1,nWdt0),Fraction(nHgt1,nHgt0));
1049 NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top()));
1050 } else {
1051 setRectangle(rRect);
1053 }
1055 SetXPolyDirty();
1057}
1058
1060{
1062 return 1;
1063 } else {
1064 return 3;
1065 }
1066}
1067
1069{
1070 switch (i)
1071 {
1072 case 1 : return GetAnglePnt(getRectangle(), nStartAngle);
1073 case 2 : return GetAnglePnt(getRectangle(), nEndAngle);
1074 default: return getRectangle().Center();
1075 }
1076}
1077
1079{
1080 SetXPolyDirty();
1081 SdrRectObj::Notify(rBC,rHint);
1083}
1084
1085
1087{
1088 const SfxItemSet& rSet = GetObjectItemSet();
1089 SdrCircKind eNewKind = rSet.Get(SDRATTR_CIRCKIND).GetValue();
1090
1091 Degree100 nNewStart = rSet.Get(SDRATTR_CIRCSTARTANGLE).GetValue();
1092 Degree100 nNewEnd = rSet.Get(SDRATTR_CIRCENDANGLE).GetValue();
1093
1094 bool bKindChg = meCircleKind != eNewKind;
1095 bool bAngleChg = nNewStart != nStartAngle || nNewEnd != nEndAngle;
1096
1097 if(bKindChg || bAngleChg)
1098 {
1099 meCircleKind = eNewKind;
1100 nStartAngle = nNewStart;
1101 nEndAngle = nNewEnd;
1102
1103 if(bKindChg || (meCircleKind != SdrCircKind::Full && bAngleChg))
1104 {
1105 SetXPolyDirty();
1107 }
1108 }
1109}
1110
1112{
1113 const SfxItemSet& rSet = GetObjectItemSet();
1114
1115 SdrCircKind eOldKindA = rSet.Get(SDRATTR_CIRCKIND).GetValue();
1116 Degree100 nOldStartAngle = rSet.Get(SDRATTR_CIRCSTARTANGLE).GetValue();
1117 Degree100 nOldEndAngle = rSet.Get(SDRATTR_CIRCENDANGLE).GetValue();
1118
1119 if(meCircleKind == eOldKindA && nStartAngle == nOldStartAngle && nEndAngle == nOldEndAngle)
1120 return;
1121
1122 // since SetItem() implicitly calls ImpSetAttrToCircInfo()
1123 // setting the item directly is necessary here.
1124 if(meCircleKind != eOldKindA)
1125 {
1127 }
1128
1129 if(nStartAngle != nOldStartAngle)
1130 {
1132 }
1133
1134 if(nEndAngle != nOldEndAngle)
1135 {
1137 }
1138
1139 SetXPolyDirty();
1141}
1142
1144{
1145 const bool bFill(meCircleKind != SdrCircKind::Arc);
1147 rtl::Reference<SdrObject> pRet = ImpConvertMakeObj(basegfx::B2DPolyPolygon(aCircPolygon), bFill, bBezier);
1148
1149 if(bAddText)
1150 {
1151 pRet = ImpConvertAddText(std::move(pRet), bBezier);
1152 }
1153
1154 return pRet;
1155}
1156
1157/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 GetNumerator() const
sal_Int32 GetDenominator() const
double mfTanShearAngle
Definition: svdtrans.hxx:205
double mfCosRotationAngle
Definition: svdtrans.hxx:207
double mfSinRotationAngle
Definition: svdtrans.hxx:206
Degree100 m_nShearAngle
Definition: svdtrans.hxx:204
Degree100 m_nRotationAngle
Definition: svdtrans.hxx:203
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long X() const
virtual const tools::Rectangle & GetSnapRect() const override
Definition: svdoattr.cxx:49
tools::Rectangle maSnapRect
Definition: svdoattr.hxx:41
Degree100 nStartAngle
Definition: svdocirc.hxx:34
Degree100 nEndAngle
Definition: svdocirc.hxx:35
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdocirc.cxx:821
virtual bool hasSpecialDrag() const override
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
Definition: svdocirc.cxx:492
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
Definition: svdocirc.cxx:1039
virtual bool BckCreate(SdrDragStat &rStat) override
Definition: svdocirc.cxx:766
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdocirc.cxx:91
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdocirc.cxx:99
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: svdocirc.cxx:879
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdocirc.cxx:372
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdocirc.cxx:407
virtual bool BegCreate(SdrDragStat &rStat) override
Every object must be able to create itself interactively.
Definition: svdocirc.cxx:693
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 bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
Definition: svdocirc.cxx:727
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdocirc.cxx:948
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: svdocirc.cxx:419
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
Definition: svdocirc.cxx:1078
SdrCircKind meCircleKind
Definition: svdocirc.hxx:52
virtual void TakeUnrotatedSnapRect(tools::Rectangle &rRect) const override
Definition: svdocirc.cxx:974
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const override
Polygon dragged by the user when creating the object.
Definition: svdocirc.cxx:773
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
Definition: svdocirc.cxx:579
Degree100 nStartAngle
Definition: svdocirc.hxx:53
static SVX_DLLPRIVATE void ImpSetCreateParams(SdrDragStat &rStat)
Definition: svdocirc.cxx:683
virtual void RecalcSnapRect() override
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
Definition: svdocirc.cxx:1030
SVX_DLLPRIVATE void ImpSetCircInfoToAttr()
Definition: svdocirc.cxx:1111
virtual void NbcShear(const Point &rRef, Degree100 nAngle, double tn, bool bVShear) override
Definition: svdocirc.cxx:872
virtual OUString TakeObjNameSingul() const override
Definition: svdocirc.cxx:319
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
Definition: svdocirc.cxx:956
virtual Point GetSnapPoint(sal_uInt32 i) const override
Definition: svdocirc.cxx:1068
virtual rtl::Reference< SdrObject > DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: svdocirc.cxx:1143
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
Definition: svdocirc.cxx:497
virtual void BrkCreate(SdrDragStat &rStat) override
Definition: svdocirc.cxx:761
Degree100 nEndAngle
Definition: svdocirc.hxx:54
SVX_DLLPRIVATE void ImpSetAttrToCircInfo()
Definition: svdocirc.cxx:1086
virtual OUString TakeObjNamePlural() const override
Definition: svdocirc.cxx:348
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdocirc.cxx:169
virtual PointerStyle GetCreatePointer() const override
get the cursor/pointer that signals creating this object
Definition: svdocirc.cxx:800
SVX_DLLPRIVATE bool PaintNeedsXPolyCirc() const
Definition: svdocirc.cxx:191
virtual ~SdrCircObj() override
Definition: svdocirc.cxx:165
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
Definition: svdocirc.cxx:514
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:943
virtual SdrObjKind GetObjIdentifier() const override
Definition: svdocirc.cxx:178
virtual bool MovCreate(SdrDragStat &rStat) override
Definition: svdocirc.cxx:704
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
Definition: svdocirc.cxx:377
SVX_DLLPRIVATE basegfx::B2DPolygon ImpCalcXPolyCirc(const SdrCircKind eKind, const tools::Rectangle &rRect1, Degree100 nStart, Degree100 nEnd) const
Definition: svdocirc.cxx:241
SdrCircObj(SdrModel &rSdrModel, SdrCircKind eNewKind)
Definition: svdocirc.cxx:117
virtual sal_uInt32 GetSnapPointCount() const override
snap to special points of an Object (polygon points, center of circle)
Definition: svdocirc.cxx:1059
virtual void NbcMove(const Size &aSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdocirc.cxx:812
SdrObject * GetCreateObj() const
Definition: svdcrtv.hxx:120
const Point & GetPoint(sal_Int32 nNum) const
Definition: svddrag.hxx:100
void SetUser(std::unique_ptr< SdrDragStatUserData > pU)
Definition: svddrag.hxx:114
void SetActionRect(const tools::Rectangle &rR)
Definition: svddrag.hxx:167
sal_Int32 GetPointCount() const
Definition: svddrag.hxx:101
SdrDragStatUserData * GetUser() const
Definition: svddrag.hxx:113
void TakeCreateRect(tools::Rectangle &rRect) const
Definition: svddrag.cxx:115
void SetOrtho4Possible(bool bOn=true)
Definition: svddrag.hxx:136
const Point & GetStart() const
Definition: svddrag.hxx:102
SdrView * GetView() const
Definition: svddrag.hxx:96
const SdrHdl * GetHdl() const
Definition: svddrag.hxx:111
const Point & GetNow() const
Definition: svddrag.hxx:105
void SetNoSnap(bool bOn=true)
Definition: svddrag.hxx:131
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
Definition: svdhdl.cxx:2291
SdrHdlKind GetKind() const
Definition: svdhdl.hxx:194
sal_uInt32 GetPointNum() const
Definition: svdhdl.hxx:222
static OUString GetAngleString(Degree100 nAngle)
Definition: svdmodel.cxx:1087
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:174
Provides information about various ZObject properties.
Definition: svdobj.hxx:196
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const
Definition: svdobj.cxx:1347
void moveOutRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta)
Definition: svdobj.cxx:3193
virtual sdr::properties::BaseProperties & GetProperties() const
Definition: svdobj.cxx:220
bool LineGeometryUsageIsNecessary() const
Definition: svdobj.cxx:1075
bool m_bSnapRectDirty
Definition: svdobj.hxx:902
virtual const OUString & GetName() const
Definition: svdobj.cxx:771
virtual void SetChanged()
Definition: svdobj.cxx:1042
OUString ImpGetDescriptionStr(TranslateId pStrCacheID) const
Definition: svdobj.cxx:1102
bool m_bClosedObj
Definition: svdobj.hxx:915
virtual void SetBoundRectDirty()
Definition: svdobj.cxx:329
virtual void SetBoundAndSnapRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:509
const SfxItemSet & GetObjectItemSet() const
Definition: svdobj.cxx:1969
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:39
void SetXPolyDirty()
Definition: svdorect.cxx:101
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
Definition: svdorect.cxx:561
const XPolygon & GetXPoly() const
Definition: svdorect.cxx:135
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
Definition: svdorect.cxx:567
std::optional< XPolygon > mpXPoly
Definition: svdorect.hxx:49
bool IsAngleSnapEnabled() const
Definition: svdsnpv.hxx:222
Degree100 GetSnapAngle() const
Definition: svdsnpv.hxx:224
GeoStat maGeo
Definition: svdotext.hxx:196
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
Definition: svdotxdr.cxx:177
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdotext.cxx:1499
tools::Rectangle const & getRectangle() const
Definition: svdotext.hxx:170
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: svdotxtr.cxx:238
virtual void NbcShear(const Point &rRef, Degree100 nAngle, double tn, bool bVShear) override
Definition: svdotxtr.cxx:214
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
Definition: svdotxdr.cxx:152
void moveRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta)
Definition: svdotext.hxx:185
tools::Rectangle maRectangle
Definition: svdotext.hxx:168
rtl::Reference< SdrPathObj > ImpConvertMakeObj(const basegfx::B2DPolyPolygon &rPolyPolygon, bool bClosed, bool bBezier) const
Definition: svdotxtr.cxx:425
bool ImpCanConvTextToCurve() const
Definition: svdotxtr.cxx:420
virtual bool IsFontwork() const
Definition: svdotext.cxx:1801
static void ImpJustifyRect(tools::Rectangle &rRect)
Definition: svdotext.cxx:411
virtual bool HasText() const override
Definition: svdotxat.cxx:420
rtl::Reference< SdrObject > ImpConvertAddText(rtl::Reference< SdrObject > pObj, bool bBezier) const
Definition: svdotxtr.cxx:459
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdotxtr.cxx:103
void setRectangle(tools::Rectangle const &rRectangle)
Definition: svdotext.hxx:175
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
tools::Rectangle GetBoundRect() const
Definition: _xpoly.cxx:396
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
void transform(const basegfx::B2DHomMatrix &rMatrix)
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void setClosed(bool bNew)
B2DPoint getCenter() const
B2DPoint getMinimum() const
TYPE getWidth() const
TYPE getHeight() const
TYPE getX() const
TYPE getY() const
virtual void SetObjectItemDirect(const SfxPoolItem &rItem)=0
constexpr Point Center() const
constexpr tools::Long GetWidth() const
constexpr void SetLeft(tools::Long v)
constexpr void SetTop(tools::Long v)
constexpr tools::Long Top() const
constexpr Point TopLeft() const
constexpr void SetRight(tools::Long v)
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
constexpr tools::Long Right() const
constexpr Point RightCenter() const
constexpr Point BottomCenter() const
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
constexpr void SetBottom(tools::Long v)
constexpr Point BottomRight() const
constexpr Point TopRight() const
constexpr tools::Long GetHeight() const
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
constexpr Point LeftCenter() const
constexpr Point TopCenter() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
constexpr Point BottomLeft() const
double toRadians(D x)
OUString SvxResId(TranslateId aId)
Definition: dialmgr.cxx:24
OUString sName
tools::Long FRound(double fVal)
OUString aName
uno_Any a
aBuf
B2DHomMatrix createScaleTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fTranslateX, double fTranslateY)
B2DPolygon const & createPolygonFromUnitCircle(sal_uInt32 nStartQuadrant=0)
B2DPolygon createPolygonFromEllipseSegment(const B2DPoint &rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd)
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
B2DHomMatrix createShearXRotateTranslateB2DHomMatrix(double fShearX, double fRadiant, double fTranslateX, double fTranslateY)
int i
long Long
basegfx::B2DRange b2DRectangleFromRectangle(const ::tools::Rectangle &rRect)
PointerStyle
static SfxItemSet & rSet
constexpr TypedWhichId< SdrAngleItem > SDRATTR_CIRCSTARTANGLE(SDRATTR_CIRC_FIRST+1)
constexpr TypedWhichId< SdrCircKindItem > SDRATTR_CIRCKIND(SDRATTR_CIRC_FIRST+0)
constexpr TypedWhichId< SdrAngleItem > SDRATTR_CIRCENDANGLE(SDRATTR_CIRC_FIRST+2)
SdrHdlKind
Definition: svdhdl.hxx:53
SdrObjKind
Definition: svdobjkind.hxx:25
@ CircleOrEllipse
rectangle (round corners optional)
@ CircleCut
circle arc
@ CircleSection
circle, ellipse
@ CircleArc
circle section
static void Union(tools::Rectangle &rR, const Point &rP)
Definition: svdocirc.cxx:966
SdrCircKind ToSdrCircKind(SdrObjKind eKind)
Definition: svdocirc.cxx:104
static Point GetAnglePnt(const tools::Rectangle &rR, Degree100 nAngle)
Definition: svdocirc.cxx:53
SdrCircKind
Definition: svdocirc.hxx:38
Degree100 GetAngle(const Point &rPnt)
The Y axis points down! The function negates the Y axis, when calculating the angle,...
Definition: svdtrans.cxx:387
void MirrorPoint(Point &rPnt, const Point &rRef1, const Point &rRef2)
Definition: svdtrans.cxx:105
tools::Long BigMulDiv(tools::Long nVal, tools::Long nMul, tools::Long nDiv)
Definition: svdtrans.cxx:567
Degree100 NormAngle36000(Degree100 a)
Normalize angle to -180.00..179.99.
Definition: svdtrans.cxx:408
void ShearPoint(Point &rPnt, const Point &rRef, double tn, bool bVShear=false)
Definition: svdtrans.hxx:109
void RotatePoint(Point &rPnt, const Point &rRef, double sn, double cs)
Definition: svdtrans.hxx:101
SdrCreateCmd
Definition: svdtypes.hxx:27
SdrAngleItem makeSdrCircStartAngleItem(Degree100 nAngle)
Definition: sxciaitm.hxx:25
SdrAngleItem makeSdrCircEndAngleItem(Degree100 nAngle)
Definition: sxciaitm.hxx:30
Left
Center
Right
constexpr TypedWhichId< XLineStartWidthItem > XATTR_LINESTARTWIDTH(XATTR_LINE_FIRST+6)
constexpr TypedWhichId< XLineWidthItem > XATTR_LINEWIDTH(XATTR_LINE_FIRST+2)
constexpr TypedWhichId< XLineEndItem > XATTR_LINEEND(XATTR_LINE_FIRST+5)
constexpr TypedWhichId< XLineStartItem > XATTR_LINESTART(XATTR_LINE_FIRST+4)
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
constexpr TypedWhichId< XLineEndWidthItem > XATTR_LINEENDWIDTH(XATTR_LINE_FIRST+7)