26#include <rtl/ustrbuf.hxx>
29#include <svx/strings.hrc>
61 if (nWdt==0) aRetval.
setX(0 );
62 if (nHgt==0) aRetval.
setY(0 );
67 if (std::abs(nHgt)>32767 || std::abs(aRetval.
Y())>32767) {
70 aRetval.
setY(aRetval.
Y()*nHgt/nWdt );
76 if (std::abs(nWdt)>32767 || std::abs(aRetval.
X())>32767) {
79 aRetval.
setX(aRetval.
X()*nWdt/nHgt );
93 return std::make_unique<sdr::properties::CircleProperties>(*
this);
101 return std::make_unique<sdr::contact::ViewContactOfSdrCircObj>(*
this);
112 default: assert(
false);
157 Degree100 nAngleDif=nNewEndAngle-nNewStartAngle;
160 if (nAngleDif==36000_deg100)
nEndAngle+=nAngleDif;
186 default: assert(
false);
206 bNeed = eLine != drawing::LineStyle_NONE && eLine != drawing::LineStyle_SOLID;
209 if(!bNeed && eLine != drawing::LineStyle_NONE)
232 bNeed = eFill != drawing::FillStyle_NONE && eFill != drawing::FillStyle_SOLID;
264 const double fStart(
toRadians((36000_deg100 - nEnd) % 36000_deg100));
265 const double fEnd(
toRadians((36000_deg100 - nStart) % 36000_deg100));
278 if(bCloseUsingCenter)
283 aSector.
append(aCircPolygon);
284 aCircPolygon = aSector;
298 -aTopLeft.
getX(), -aTopLeft.
getY()));
343 if (!
aName.isEmpty())
483 std::unique_ptr<SdrHdl> pH(
new SdrHdl(aPnt,eLocalKind));
484 pH->SetPointNum(nPNum);
487 rHdlList.
AddHdl(std::move(pH));
550 nAngle+=nSA/2_deg100;
590 const ImpCircUser* pU =
static_cast<const ImpCircUser*
>(rDrag.
GetUser());
608 return aBuf.makeStringAndClear();
631void ImpCircUser::SetCreateParams(
SdrDragStat const & rStat)
636 nWdt=aR.Right()-aR.Left();
637 nHgt=aR.Bottom()-aR.Top();
642 if (nWdt==0) aP.setX(0 );
643 if (nHgt==0) aP.setY(0 );
645 if (nHgt!=0) aP.setY(aP.Y()*nWdt/nHgt );
647 if (nWdt!=0) aP.setX(aP.X()*nHgt/nWdt );
653 nStart+=nSA/2_deg100;
685 ImpCircUser* pU=
static_cast<ImpCircUser*
>(rStat.
GetUser());
688 rStat.
SetUser(std::unique_ptr<ImpCircUser>(pU));
690 pU->SetCreateParams(rStat);
707 ImpCircUser* pU=
static_cast<ImpCircUser*
>(rStat.
GetUser());
730 ImpCircUser* pU=
static_cast<ImpCircUser*
>(rStat.
GetUser());
775 const ImpCircUser* pU =
static_cast<const ImpCircUser*
>(rDrag.
GetUser());
809 return PointerStyle::Cross;
830 if (bXMirr || bYMirr) {
839 if (! (bXMirr && bYMirr)) {
841 nS0=18000_deg100-nE0;
842 nE0=18000_deg100-nTmp;
845 if (bXMirr!=bYMirr) {
850 nS0=18000_deg100-nE0;
851 nE0=18000_deg100-nTmp;
865 if (nAngleDif==36000_deg100)
nEndAngle+=nAngleDif;
892 if (nWdt==0) aTmpPt1.
setX(0 );
893 if (nHgt==0) aTmpPt1.
setY(0 );
898 if (nWdt==0) aTmpPt2.
setX(0 );
899 if (nHgt==0) aTmpPt2.
setY(0 );
937 if (nAngleDif==36000_deg100)
nEndAngle+=nAngleDif;
945 return std::make_unique<SdrCircObjGeoData>();
986 Union(rRect,aPntStart);
987 Union(rRect,aPntEnd);
988 if ((a<=18000_deg100 && e>=18000_deg100) || (
a>e && (a<=18000_deg100 || e>=18000_deg100))) {
991 if ((a<=27000_deg100 && e>=27000_deg100) || (
a>e && (a<=27000_deg100 || e>=27000_deg100))) {
997 if ((a<=9000_deg100 && e>=9000_deg100) || (
a>e && (a<=9000_deg100 || e>=9000_deg100))) {
1010 rRect.
Move(aDst.
X(),aDst.
Y());
1024 rRect.
Move(aTmpPt.
X(),aTmpPt.
Y());
1097 if(bKindChg || bAngleChg)
sal_Int32 GetNumerator() const
sal_Int32 GetDenominator() const
double mfCosRotationAngle
double mfSinRotationAngle
Degree100 m_nRotationAngle
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
tools::Rectangle maSnapRect
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
virtual bool hasSpecialDrag() const override
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
virtual bool BckCreate(SdrDragStat &rStat) override
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const override
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
virtual bool BegCreate(SdrDragStat &rStat) override
Every object must be able to create itself interactively.
virtual SVX_DLLPRIVATE void RecalcXPoly() override
Subclasses should override RecalcXPoly() by creating an XPolygon instance with new and assigning it t...
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
virtual void TakeUnrotatedSnapRect(tools::Rectangle &rRect) const override
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const override
Polygon dragged by the user when creating the object.
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
static SVX_DLLPRIVATE void ImpSetCreateParams(SdrDragStat &rStat)
virtual void RecalcSnapRect() override
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
SVX_DLLPRIVATE void ImpSetCircInfoToAttr()
virtual void NbcShear(const Point &rRef, Degree100 nAngle, double tn, bool bVShear) override
virtual OUString TakeObjNameSingul() const override
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
virtual Point GetSnapPoint(sal_uInt32 i) const override
virtual rtl::Reference< SdrObject > DoConvertToPolyObj(bool bBezier, bool bAddText) const override
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
virtual void BrkCreate(SdrDragStat &rStat) override
SVX_DLLPRIVATE void ImpSetAttrToCircInfo()
virtual OUString TakeObjNamePlural() const override
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
virtual PointerStyle GetCreatePointer() const override
get the cursor/pointer that signals creating this object
SVX_DLLPRIVATE bool PaintNeedsXPolyCirc() const
virtual ~SdrCircObj() override
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
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...
virtual SdrObjKind GetObjIdentifier() const override
virtual bool MovCreate(SdrDragStat &rStat) override
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
SVX_DLLPRIVATE basegfx::B2DPolygon ImpCalcXPolyCirc(const SdrCircKind eKind, const tools::Rectangle &rRect1, Degree100 nStart, Degree100 nEnd) const
SdrCircObj(SdrModel &rSdrModel, SdrCircKind eNewKind)
virtual sal_uInt32 GetSnapPointCount() const override
snap to special points of an Object (polygon points, center of circle)
virtual void NbcMove(const Size &aSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
SdrObject * GetCreateObj() const
const Point & GetPoint(sal_Int32 nNum) const
void SetUser(std::unique_ptr< SdrDragStatUserData > pU)
void SetActionRect(const tools::Rectangle &rR)
sal_Int32 GetPointCount() const
SdrDragStatUserData * GetUser() const
void TakeCreateRect(tools::Rectangle &rRect) const
void SetOrtho4Possible(bool bOn=true)
const Point & GetStart() const
SdrView * GetView() const
const SdrHdl * GetHdl() const
const Point & GetNow() const
void SetNoSnap(bool bOn=true)
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
SdrHdlKind GetKind() const
sal_uInt32 GetPointNum() const
static OUString GetAngleString(Degree100 nAngle)
All geometrical data of an arbitrary object for use in undo/redo.
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const
void moveOutRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta)
virtual sdr::properties::BaseProperties & GetProperties() const
bool LineGeometryUsageIsNecessary() const
virtual const OUString & GetName() const
virtual void SetChanged()
OUString ImpGetDescriptionStr(TranslateId pStrCacheID) const
virtual void SetBoundRectDirty()
virtual void SetBoundAndSnapRectsDirty(bool bNotMyself=false, bool bRecursive=true)
const SfxItemSet & GetObjectItemSet() const
Rectangle objects (rectangle, circle, ...)
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
const XPolygon & GetXPoly() const
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
std::optional< XPolygon > mpXPoly
bool IsAngleSnapEnabled() const
Degree100 GetSnapAngle() const
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
tools::Rectangle const & getRectangle() const
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
virtual void NbcShear(const Point &rRef, Degree100 nAngle, double tn, bool bVShear) override
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
void moveRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta)
tools::Rectangle maRectangle
rtl::Reference< SdrPathObj > ImpConvertMakeObj(const basegfx::B2DPolyPolygon &rPolyPolygon, bool bClosed, bool bBezier) const
bool ImpCanConvTextToCurve() const
virtual bool IsFontwork() const
static void ImpJustifyRect(tools::Rectangle &rRect)
virtual bool HasText() const override
rtl::Reference< SdrObject > ImpConvertAddText(rtl::Reference< SdrObject > pObj, bool bBezier) const
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
void setRectangle(tools::Rectangle const &rRectangle)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
tools::Rectangle GetBoundRect() const
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
virtual void SetObjectItemDirect(const SfxPoolItem &rItem)=0
OUString SvxResId(TranslateId aId)
tools::Long FRound(double fVal)
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)
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)
@ CircleOrEllipse
rectangle (round corners optional)
@ CircleSection
circle, ellipse
@ CircleArc
circle section
static void Union(tools::Rectangle &rR, const Point &rP)
SdrCircKind ToSdrCircKind(SdrObjKind eKind)
static Point GetAnglePnt(const tools::Rectangle &rR, Degree100 nAngle)
Degree100 GetAngle(const Point &rPnt)
The Y axis points down! The function negates the Y axis, when calculating the angle,...
void MirrorPoint(Point &rPnt, const Point &rRef1, const Point &rRef2)
tools::Long BigMulDiv(tools::Long nVal, tools::Long nMul, tools::Long nDiv)
Degree100 NormAngle36000(Degree100 a)
Normalize angle to -180.00..179.99.
void ShearPoint(Point &rPnt, const Point &rRef, double tn, bool bVShear=false)
void RotatePoint(Point &rPnt, const Point &rRef, double sn, double cs)
SdrAngleItem makeSdrCircStartAngleItem(Degree100 nAngle)
SdrAngleItem makeSdrCircEndAngleItem(Degree100 nAngle)
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)