LibreOffice Module svx (master)  1
svdocirc.hxx
Go to the documentation of this file.
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 
33 {
34 public:
36  long nEndAngle;
37 };
38 
39 enum class SdrCircKind { Full, Section, Cut, Arc };
40 
42 
43 
45 {
46 private:
47  // to allow sdr::properties::CircleProperties access to ImpSetAttrToCircInfo()
49 
50  virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
51  virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
52 
55  long nEndAngle;
56 
57  SVX_DLLPRIVATE basegfx::B2DPolygon ImpCalcXPolyCirc(const SdrCircKind eKind, const tools::Rectangle& rRect1, long nStart, long nEnd) const;
58  SVX_DLLPRIVATE static void ImpSetCreateParams(SdrDragStat& rStat);
59  SVX_DLLPRIVATE void ImpSetAttrToCircInfo(); // copy values from pool
60  SVX_DLLPRIVATE void ImpSetCircInfoToAttr(); // copy values into pool
61 
62  // returns sal_True if paint requires a XPolygon
63  SVX_DLLPRIVATE bool PaintNeedsXPolyCirc() const; // PaintNeedsXPoly-> PaintNeedsXPolyCirc
64  SVX_DLLPRIVATE virtual void RecalcXPoly() override;
65 
66  virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
67 
68 private:
69  // protected destructor - due to final, make private
70  virtual ~SdrCircObj() override;
71 
72 public:
73  SdrCircObj(
74  SdrModel& rSdrModel,
75  SdrCircKind eNewKind);
76  SdrCircObj(
77  SdrModel& rSdrModel,
78  SdrCircKind eNewKind,
79  const tools::Rectangle& rRect);
80 
81  // 0=0.00Deg=3h 9000=90.00Deg=12h 18000=180.00Deg=9h 27000=270.00Deg=6h
82  // The circle is build up from StartAngle to EndWink anti-clockwise.
83  // If nNewStartAngle==nNewEndWink, then arc has an angle of 0 degrees.
84  // If nNewStartAngle+36000==nNewEndWink, then the arc has angle of 360 degrees.
85  SdrCircObj(
86  SdrModel& rSdrModel,
87  SdrCircKind eNewKind,
88  const tools::Rectangle& rRect,
89  long nNewStartAngle,
90  long nNewEndWink);
91 
92  SdrCircKind GetCircleKind() const { return meCircleKind; }
93 
94  virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
95  virtual sal_uInt16 GetObjIdentifier() const override;
96  virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override;
97 
98  virtual OUString TakeObjNameSingul() const override;
99  virtual OUString TakeObjNamePlural() const override;
100 
101  virtual SdrCircObj* CloneSdrObject(SdrModel& rTargetModel) const override;
102 
103  // implemented mainly for the purposes of Clone()
104  SdrCircObj& operator=(const SdrCircObj& rObj);
105 
106  virtual void RecalcSnapRect() override;
107  virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
108  virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
109 
110  virtual sal_uInt32 GetSnapPointCount() const override;
111  virtual Point GetSnapPoint(sal_uInt32 i) const override;
112 
113  virtual sal_uInt32 GetHdlCount() const override;
114  virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
115 
116  // special drag methods
117  virtual bool hasSpecialDrag() const override;
118  virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
119  virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
120  virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const override;
121 
122  virtual bool BegCreate(SdrDragStat& rStat) override;
123  virtual bool MovCreate(SdrDragStat& rStat) override;
124  virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
125  virtual bool BckCreate(SdrDragStat& rStat) override;
126  virtual void BrkCreate(SdrDragStat& rStat) override;
127  virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
128  virtual PointerStyle GetCreatePointer() const override;
129  virtual void NbcMove(const Size& aSiz) override;
130  virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
131  virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
132  virtual void NbcShear (const Point& rRef, long nAngle, double tn, bool bVShear) override;
133  virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
134 
135 private:
136  virtual SdrObjGeoData* NewGeoData() const override;
137  virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
138  virtual void RestGeoData(const SdrObjGeoData& rGeo) override;
139 public:
140  long GetStartAngle() const { return nStartAngle; }
141  long GetEndAngle() const { return nEndAngle; }
142 
143 };
144 
145 #endif // INCLUDED_SVX_SVDOCIRC_HXX
146 
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SdrCircKind
Definition: svdocirc.hxx:39
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdorect.cxx:473
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
Definition: svdorect.cxx:387
long GetEndAngle() const
Definition: svdocirc.hxx:141
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdorect.cxx:51
virtual sal_uInt32 GetSnapPointCount() const override
snap to special points of an Object (polygon points, center of circle)
Definition: svdotext.cxx:1121
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: svdorect.cxx:497
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
Definition: svdorect.cxx:416
virtual void RecalcSnapRect() override
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
Definition: svdorect.cxx:285
long GetStartAngle() const
Definition: svdocirc.hxx:140
virtual OUString TakeObjNameSingul() const override
Definition: svdorect.cxx:204
SVXCORE_DLLPUBLIC SdrCircKind ToSdrCircKind(SdrObjKind)
Definition: svdocirc.cxx:110
virtual void TakeUnrotatedSnapRect(tools::Rectangle &rRect) const override
Definition: svdorect.cxx:182
SdrCircKind GetCircleKind() const
Definition: svdocirc.hxx:92
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
Definition: svdorect.cxx:278
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const override
Polygon dragged by the user when creating the object.
Definition: svdorect.cxx:456
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:226
virtual bool BegCreate(SdrDragStat &rStat) override
Every object must be able to create itself interactively.
Definition: svdotxdr.cxx:182
virtual void RecalcXPoly()
Subclasses should override RecalcXPoly() by creating an XPolygon instance with new and assigning it t...
Definition: svdorect.cxx:135
virtual SdrObjGeoData * NewGeoData() const override
A derived class must override these 3 methods if it has own geometric data that must be saved for Und...
Definition: svdotext.cxx:1444
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:39
Provides information about various ZObject properties.
Definition: svdobj.hxx:248
virtual bool hasSpecialDrag() const override
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
Definition: svdorect.cxx:368
long nEndAngle
Definition: svdocirc.hxx:55
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
Definition: svdorect.cxx:373
virtual bool BckCreate(SdrDragStat &rStat) override
Definition: svdotxdr.cxx:225
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdotext.cxx:1449
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: svdorect.cxx:555
SdrCircKind meCircleKind
Definition: svdocirc.hxx:53
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdorect.cxx:307
virtual void BrkCreate(SdrDragStat &rStat) override
Definition: svdotxdr.cxx:221
virtual PointerStyle GetCreatePointer() const override
get the cursor/pointer that signals creating this object
Definition: svdorect.cxx:467
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdorect.cxx:150
long nStartAngle
Definition: svdocirc.hxx:54
virtual SdrRectObj * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdorect.cxx:258
virtual void NbcShear(const Point &rRef, long nAngle, double tn, bool bVShear) override
Definition: svdorect.cxx:491
SdrRectObj & operator=(const SdrRectObj &rCopy)
Definition: svdorect.cxx:263
virtual sal_uInt16 GetObjIdentifier() const override
Definition: svdorect.cxx:176
SdrObjKind
Definition: svdobj.hxx:116
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdorect.cxx:59
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdorect.cxx:479
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:114
PointerStyle
virtual void RestGeoData(const SdrObjGeoData &rGeo) override
Definition: svdorect.cxx:589
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: svdorect.cxx:312
virtual Point GetSnapPoint(sal_uInt32 i) const override
Definition: svdotext.cxx:1126
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
Definition: svdotxdr.cxx:207
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
Definition: svdorect.cxx:295
SdrCreateCmd
Definition: svdtypes.hxx:27
virtual bool MovCreate(SdrDragStat &rStat) override
Definition: svdotxdr.cxx:192
#define SVX_DLLPRIVATE
Definition: svxdllapi.h:30
virtual OUString TakeObjNamePlural() const override
Definition: svdorect.cxx:237
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
Definition: svdorect.cxx:583