Line data Source code
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 :
20 : #ifndef INCLUDED_SVX_SVDOCIRC_HXX
21 : #define INCLUDED_SVX_SVDOCIRC_HXX
22 :
23 : #include <svx/svdorect.hxx>
24 : #include <svx/svxdllapi.h>
25 :
26 : namespace sdr { namespace properties {
27 : class CircleProperties;
28 : }}
29 :
30 : // Helper class SdrCircObjGeoData
31 :
32 : // #109872#
33 0 : class SdrCircObjGeoData : public SdrTextObjGeoData
34 : {
35 : public:
36 : long nStartWink;
37 : long nEndWink;
38 : };
39 :
40 : // class SdrCircObj
41 :
42 2 : class SVX_DLLPUBLIC SdrCircObj : public SdrRectObj
43 : {
44 : private:
45 : // to allow sdr::properties::CircleProperties access to ImpSetAttrToCircInfo()
46 : friend class sdr::properties::CircleProperties;
47 :
48 : // only for SdrCircleAttributes
49 186 : SdrObjKind GetCircleKind() const { return meCircleKind; }
50 :
51 : protected:
52 : virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() SAL_OVERRIDE;
53 : virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() SAL_OVERRIDE;
54 :
55 : SdrObjKind meCircleKind;
56 : long nStartWink;
57 : long nEndWink;
58 : private:
59 : SVX_DLLPRIVATE basegfx::B2DPolygon ImpCalcXPolyCirc(const SdrObjKind eKind, const Rectangle& rRect1, long nStart, long nEnd) const;
60 : SVX_DLLPRIVATE void ImpSetCreateParams(SdrDragStat& rStat) const;
61 : SVX_DLLPRIVATE void ImpSetAttrToCircInfo(); // copy values from pool
62 : SVX_DLLPRIVATE void ImpSetCircInfoToAttr(); // copy values into pool
63 :
64 : // returns sal_True if paint requires a XPolygon
65 : SVX_DLLPRIVATE bool PaintNeedsXPolyCirc() const; // PaintNeedsXPoly-> PaintNeedsXPolyCirc
66 : SVX_DLLPRIVATE virtual void RecalcXPoly() SAL_OVERRIDE;
67 :
68 : protected:
69 : virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) SAL_OVERRIDE;
70 :
71 : public:
72 : TYPEINFO_OVERRIDE();
73 : SdrCircObj(SdrObjKind eNewKind); // Circ, CArc, Sect or CCut
74 : SdrCircObj(SdrObjKind eNewKind, const Rectangle& rRect);
75 :
76 : // 0=0.00Deg=3h 9000=90.00Deg=12h 18000=180.00Deg=9h 27000=270.00Deg=6h
77 : // The circle is build up from StartWink to EndWink anti-clockwise.
78 : // If nNewStartWink==nNewEndWink, then arc has an angle of 0 degrees.
79 : // If nNewStartWink+36000==nNewEndWink, then the arc has angle of 360 degrees.
80 : SdrCircObj(SdrObjKind eNewKind, const Rectangle& rRect, long nNewStartWink, long nNewEndWink);
81 : virtual ~SdrCircObj();
82 :
83 : virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const SAL_OVERRIDE;
84 : virtual sal_uInt16 GetObjIdentifier() const SAL_OVERRIDE;
85 : virtual void TakeUnrotatedSnapRect(Rectangle& rRect) const SAL_OVERRIDE;
86 :
87 : virtual OUString TakeObjNameSingul() const SAL_OVERRIDE;
88 : virtual OUString TakeObjNamePlural() const SAL_OVERRIDE;
89 :
90 : virtual SdrCircObj* Clone() const SAL_OVERRIDE;
91 : virtual void RecalcSnapRect() SAL_OVERRIDE;
92 : virtual void NbcSetSnapRect(const Rectangle& rRect) SAL_OVERRIDE;
93 : virtual basegfx::B2DPolyPolygon TakeXorPoly() const SAL_OVERRIDE;
94 :
95 : virtual sal_uInt32 GetSnapPointCount() const SAL_OVERRIDE;
96 : virtual Point GetSnapPoint(sal_uInt32 i) const SAL_OVERRIDE;
97 :
98 : virtual sal_uInt32 GetHdlCount() const SAL_OVERRIDE;
99 : virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const SAL_OVERRIDE;
100 :
101 : // special drag methods
102 : virtual bool hasSpecialDrag() const SAL_OVERRIDE;
103 : virtual bool beginSpecialDrag(SdrDragStat& rDrag) const SAL_OVERRIDE;
104 : virtual bool applySpecialDrag(SdrDragStat& rDrag) SAL_OVERRIDE;
105 : virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const SAL_OVERRIDE;
106 :
107 : virtual bool BegCreate(SdrDragStat& rStat) SAL_OVERRIDE;
108 : virtual bool MovCreate(SdrDragStat& rStat) SAL_OVERRIDE;
109 : virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) SAL_OVERRIDE;
110 : virtual bool BckCreate(SdrDragStat& rStat) SAL_OVERRIDE;
111 : virtual void BrkCreate(SdrDragStat& rStat) SAL_OVERRIDE;
112 : virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const SAL_OVERRIDE;
113 : virtual Pointer GetCreatePointer() const SAL_OVERRIDE;
114 : virtual void NbcMove(const Size& aSiz) SAL_OVERRIDE;
115 : virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
116 : virtual void NbcMirror(const Point& rRef1, const Point& rRef2) SAL_OVERRIDE;
117 : virtual void NbcShear (const Point& rRef, long nWink, double tn, bool bVShear) SAL_OVERRIDE;
118 : virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const SAL_OVERRIDE;
119 :
120 : protected:
121 : virtual SdrObjGeoData* NewGeoData() const SAL_OVERRIDE;
122 : virtual void SaveGeoData(SdrObjGeoData& rGeo) const SAL_OVERRIDE;
123 : virtual void RestGeoData(const SdrObjGeoData& rGeo) SAL_OVERRIDE;
124 : public:
125 0 : long GetStartWink() const { return nStartWink; }
126 0 : long GetEndWink() const { return nEndWink; }
127 :
128 : };
129 :
130 : #endif // INCLUDED_SVX_SVDOCIRC_HXX
131 :
132 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|