xref: /aoo41x/main/svx/inc/svx/svdorect.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SVDORECT_HXX
29 #define _SVDORECT_HXX
30 
31 #include <svx/svdotext.hxx>
32 #include "svx/svxdllapi.h"
33 
34 //************************************************************
35 //   Vorausdeklarationen
36 //************************************************************
37 
38 class XPolygon;
39 
40 namespace sdr {	namespace properties {
41 	class RectangleProperties;
42 }}
43 
44 //************************************************************
45 //   SdrRectObj
46 //
47 // Rechteck-Objekte (Rechteck,Kreis,...)
48 //
49 //************************************************************
50 
51 class SVX_DLLPUBLIC SdrRectObj : public SdrTextObj
52 {
53 private:
54 	// to allow sdr::properties::RectangleProperties access to SetXPolyDirty()
55 	friend class sdr::properties::RectangleProperties;
56 	friend class				SdrTextObj; // wg SetXPolyDirty bei GrowAdjust
57 
58 protected:
59 	virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
60 	virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
61 
62     XPolygon*					mpXPoly;
63 
64 protected:
65 	// Liefert sal_True, wenn das Painten ein Polygon erfordert.
66 	FASTBOOL PaintNeedsXPoly(long nEckRad) const;
67 
68 protected:
69 	XPolygon ImpCalcXPoly(const Rectangle& rRect1, long nRad1) const;
70 	void SetXPolyDirty();
71 
72 	// RecalcXPoly sollte ueberladen werden. Dabei muss dann eine XPolygon
73 	// Instanz generiert (new) und an mpXPoly zugewiesen werden.
74 	virtual void RecalcXPoly();
75 	const XPolygon& GetXPoly() const;
76 	virtual void           RestGeoData(const SdrObjGeoData& rGeo);
77 
78 public:
79 	TYPEINFO();
80 	// Der Eckenradius-Parameter fliegt irgendwann raus. Der Eckenradius
81 	// ist dann (spaeter) ueber SfxItems einzustellen (SetAttributes()).
82 	// Konstruktion eines Rechteck-Zeichenobjekts
83 
84 	SdrRectObj();
85 	SdrRectObj(const Rectangle& rRect);
86 
87 	// Konstruktion eines Textrahmens
88 	SdrRectObj(SdrObjKind eNewTextKind);
89 	SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rRect);
90 	// der sal_uInt16 eFormat nimmt Werte des enum EETextFormat entgegen
91     SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect, SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat);
92 	virtual ~SdrRectObj();
93 
94 	virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
95 	virtual sal_uInt16 GetObjIdentifier() const;
96 	virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const;
97 
98 	virtual void TakeObjNameSingul(String& rName) const;
99 	virtual void TakeObjNamePlural(String& rName) const;
100 
101 	virtual void operator=(const SdrObject& rObj);
102 	virtual void RecalcSnapRect();
103 	virtual void NbcSetSnapRect(const Rectangle& rRect);
104 	virtual void NbcSetLogicRect(const Rectangle& rRect);
105 	virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
106 
107 	virtual sal_uInt32 GetHdlCount() const;
108 	virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
109 
110     // special drag methods
111     virtual bool hasSpecialDrag() const;
112 	virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
113 	virtual bool applySpecialDrag(SdrDragStat& rDrag);
114 	virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
115 
116     virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
117 	virtual Pointer GetCreatePointer() const;
118 
119 	virtual void NbcMove(const Size& rSiz);
120 	virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
121 	virtual void NbcRotate(const Point& rRef, long nWink, double sn, double cs);
122 	virtual void NbcMirror(const Point& rRef1, const Point& rRef2);
123 	virtual void NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear);
124 
125 	virtual FASTBOOL DoMacro(const SdrObjMacroHitRec& rRec);
126 	virtual XubString GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const;
127 
128 	virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const;
129 	virtual SdrGluePoint GetCornerGluePoint(sal_uInt16 nNum) const;
130 
131 	virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const;
132 
133 	virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
134 };
135 
136 #endif //_SVDORECT_HXX
137 
138