1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_SVDOCIRC_HXX
21 #define INCLUDED_SVX_SVDOCIRC_HXX
23 #include <svx/svdorect.hxx>
24 #include <svx/svxdllapi.h>
26 namespace sdr
{ namespace properties
{
27 class CircleProperties
;
30 // Helper class SdrCircObjGeoData
32 class SdrCircObjGeoData
: public SdrTextObjGeoData
41 class SVX_DLLPUBLIC SdrCircObj
: public SdrRectObj
44 // to allow sdr::properties::CircleProperties access to ImpSetAttrToCircInfo()
45 friend class sdr::properties::CircleProperties
;
47 // only for SdrCircleAttributes
48 SdrObjKind
GetCircleKind() const { return meCircleKind
; }
51 virtual sdr::contact::ViewContact
* CreateObjectSpecificViewContact() override
;
52 virtual sdr::properties::BaseProperties
* CreateObjectSpecificProperties() override
;
54 SdrObjKind meCircleKind
;
58 SVX_DLLPRIVATE
basegfx::B2DPolygon
ImpCalcXPolyCirc(const SdrObjKind eKind
, const tools::Rectangle
& rRect1
, long nStart
, long nEnd
) const;
59 SVX_DLLPRIVATE
static void ImpSetCreateParams(SdrDragStat
& rStat
);
60 SVX_DLLPRIVATE
void ImpSetAttrToCircInfo(); // copy values from pool
61 SVX_DLLPRIVATE
void ImpSetCircInfoToAttr(); // copy values into pool
63 // returns sal_True if paint requires a XPolygon
64 SVX_DLLPRIVATE
bool PaintNeedsXPolyCirc() const; // PaintNeedsXPoly-> PaintNeedsXPolyCirc
65 SVX_DLLPRIVATE
virtual void RecalcXPoly() override
;
68 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
71 SdrCircObj(SdrObjKind eNewKind
); // Circ, CArc, Sect or CCut
72 SdrCircObj(SdrObjKind eNewKind
, const tools::Rectangle
& rRect
);
74 // 0=0.00Deg=3h 9000=90.00Deg=12h 18000=180.00Deg=9h 27000=270.00Deg=6h
75 // The circle is build up from StartAngle to EndWink anti-clockwise.
76 // If nNewStartAngle==nNewEndWink, then arc has an angle of 0 degrees.
77 // If nNewStartAngle+36000==nNewEndWink, then the arc has angle of 360 degrees.
78 SdrCircObj(SdrObjKind eNewKind
, const tools::Rectangle
& rRect
, long nNewStartAngle
, long nNewEndWink
);
79 virtual ~SdrCircObj() override
;
81 virtual void TakeObjInfo(SdrObjTransformInfoRec
& rInfo
) const override
;
82 virtual sal_uInt16
GetObjIdentifier() const override
;
83 virtual void TakeUnrotatedSnapRect(tools::Rectangle
& rRect
) const override
;
85 virtual OUString
TakeObjNameSingul() const override
;
86 virtual OUString
TakeObjNamePlural() const override
;
88 virtual SdrCircObj
* Clone() const override
;
89 virtual void RecalcSnapRect() override
;
90 virtual void NbcSetSnapRect(const tools::Rectangle
& rRect
) override
;
91 virtual basegfx::B2DPolyPolygon
TakeXorPoly() const override
;
93 virtual sal_uInt32
GetSnapPointCount() const override
;
94 virtual Point
GetSnapPoint(sal_uInt32 i
) const override
;
96 virtual sal_uInt32
GetHdlCount() const override
;
97 virtual SdrHdl
* GetHdl(sal_uInt32 nHdlNum
) const override
;
99 // special drag methods
100 virtual bool hasSpecialDrag() const override
;
101 virtual bool beginSpecialDrag(SdrDragStat
& rDrag
) const override
;
102 virtual bool applySpecialDrag(SdrDragStat
& rDrag
) override
;
103 virtual OUString
getSpecialDragComment(const SdrDragStat
& rDrag
) const override
;
105 virtual bool BegCreate(SdrDragStat
& rStat
) override
;
106 virtual bool MovCreate(SdrDragStat
& rStat
) override
;
107 virtual bool EndCreate(SdrDragStat
& rStat
, SdrCreateCmd eCmd
) override
;
108 virtual bool BckCreate(SdrDragStat
& rStat
) override
;
109 virtual void BrkCreate(SdrDragStat
& rStat
) override
;
110 virtual basegfx::B2DPolyPolygon
TakeCreatePoly(const SdrDragStat
& rDrag
) const override
;
111 virtual Pointer
GetCreatePointer() const override
;
112 virtual void NbcMove(const Size
& aSiz
) override
;
113 virtual void NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
) override
;
114 virtual void NbcMirror(const Point
& rRef1
, const Point
& rRef2
) override
;
115 virtual void NbcShear (const Point
& rRef
, long nAngle
, double tn
, bool bVShear
) override
;
116 virtual SdrObject
* DoConvertToPolyObj(bool bBezier
, bool bAddText
) const override
;
119 virtual SdrObjGeoData
* NewGeoData() const override
;
120 virtual void SaveGeoData(SdrObjGeoData
& rGeo
) const override
;
121 virtual void RestGeoData(const SdrObjGeoData
& rGeo
) override
;
123 long GetStartAngle() const { return nStartAngle
; }
124 long GetEndAngle() const { return nEndAngle
; }
128 #endif // INCLUDED_SVX_SVDOCIRC_HXX
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */