xref: /aoo4110/main/svx/inc/svx/svdocirc.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVDOCIRC_HXX
25 #define _SVDOCIRC_HXX
26 
27 #include <svx/svdorect.hxx>
28 #include "svx/svxdllapi.h"
29 
30 //************************************************************
31 //   Vorausdeklarationen
32 //************************************************************
33 
34 namespace sdr {	namespace properties {
35 	class CircleProperties;
36 }}
37 
38 //************************************************************
39 //   Hilfsklasse SdrCircObjGeoData
40 //************************************************************
41 
42 // #109872#
43 class SdrCircObjGeoData : public SdrTextObjGeoData
44 {
45 public:
46 	long						nStartWink;
47 	long						nEndWink;
48 };
49 
50 //************************************************************
51 //   SdrCircObj
52 //************************************************************
53 
54 class SVX_DLLPUBLIC SdrCircObj : public SdrRectObj
55 {
56 private:
57 	// to allow sdr::properties::CircleProperties access to ImpSetAttrToCircInfo()
58 	friend class sdr::properties::CircleProperties;
59 
60 	// only for SdrCircleAttributes
GetCircleKind() const61 	SdrObjKind GetCircleKind() const { return meCircleKind; }
62 
63 protected:
64 	virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
65 	virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
66 
67     SdrObjKind					meCircleKind;
68 	long						nStartWink;
69 	long						nEndWink;
70 
71 	// bitfield
72 	unsigned					mbPolygonIsLine : 1;
73 
74 private:
75  	SVX_DLLPRIVATE basegfx::B2DPolygon ImpCalcXPolyCirc(const SdrObjKind eKind, const Rectangle& rRect1, long nStart, long nEnd) const;
76 	SVX_DLLPRIVATE void ImpSetCreateParams(SdrDragStat& rStat) const;
77 	SVX_DLLPRIVATE void ImpSetAttrToCircInfo(); // Werte vom Pool kopieren
78 	SVX_DLLPRIVATE void ImpSetCircInfoToAttr(); // Werte in den Pool kopieren
79 
80 	// Liefert sal_True, wenn das Painten ein XPolygon erfordert.
81 	SVX_DLLPRIVATE FASTBOOL PaintNeedsXPolyCirc() const; // PaintNeedsXPoly-> PaintNeedsXPolyCirc
82 	SVX_DLLPRIVATE virtual void RecalcXPoly();
83 
84 protected:
85 	virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
86 
87 public:
88 	TYPEINFO();
89 	SdrCircObj(SdrObjKind eNewKind); // Circ, CArc, Sect oder CCut
90 	SdrCircObj(SdrObjKind eNewKind, const Rectangle& rRect);
91 
92 	// 0=0.00Deg=3h 9000=90.00Deg=12h 18000=180.00Deg=9h 27000=270.00Deg=6h
93 	// Der Verlauf des Kreises von StartWink nach EndWink ist immer entgegen
94 	// dem Uhrzeigersinn.
95 	// Wenn nNewStartWink==nNewEndWink hat der Kreisbogen einen Verlaufswinkel
96 	// von 0 Grad. Bei nNewStartWink+36000==nNewEndWink ist der Verlaufswinkel
97 	// 360.00 Grad.
98 	SdrCircObj(SdrObjKind eNewKind, const Rectangle& rRect, long nNewStartWink, long nNewEndWink);
99 	virtual ~SdrCircObj();
100 
101 	virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
102 	virtual sal_uInt16 GetObjIdentifier() const;
103 	virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
104 
105 	virtual void TakeObjNameSingul(String& rName) const;
106 	virtual void TakeObjNamePlural(String& rName) const;
107 
108 	virtual void operator=(const SdrObject& rObj);
109 	virtual void RecalcSnapRect();
110 	virtual void NbcSetSnapRect(const Rectangle& rRect);
111 	virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
112 
113 	virtual sal_uInt32 GetSnapPointCount() const;
114 	virtual Point GetSnapPoint(sal_uInt32 i) const;
115 
116 	virtual sal_uInt32 GetHdlCount() const;
117 	virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
118 
119     // special drag methods
120     virtual bool hasSpecialDrag() const;
121 	virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
122 	virtual bool applySpecialDrag(SdrDragStat& rDrag);
123 	virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
124 
125     virtual FASTBOOL BegCreate(SdrDragStat& rStat);
126 	virtual FASTBOOL MovCreate(SdrDragStat& rStat);
127 	virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
128 	virtual FASTBOOL BckCreate(SdrDragStat& rStat);
129 	virtual void BrkCreate(SdrDragStat& rStat);
130 	virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
131 	virtual Pointer GetCreatePointer() const;
132 	virtual void NbcMove(const Size& aSiz);
133 	virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
134 	virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
135 	virtual void NbcShear (const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
136 	virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const;
137 
138 protected:
139 	virtual SdrObjGeoData* NewGeoData() const;
140 	virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
141 	virtual void RestGeoData(const SdrObjGeoData& rGeo);
142 public:
GetStartWink() const143 	long GetStartWink() const { return nStartWink; }
GetEndWink() const144 	long GetEndWink() const { return nEndWink; }
145 
146 };
147 
148 #endif //_SVDOCIRC_HXX
149 
150