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#pragma once
21
22#include <svx/svdorect.hxx>
23#include <svx/svxdllapi.h>
24
25namespace sdr::properties {
26 class CircleProperties;
27}
28
29// Helper class SdrCircObjGeoData
30
32{
33public:
36};
37
38enum class SdrCircKind { Full, Section, Cut, Arc };
39
41
42
44{
45private:
46 // to allow sdr::properties::CircleProperties access to ImpSetAttrToCircInfo()
48
49 virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
50 virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
51
55
56 SVX_DLLPRIVATE basegfx::B2DPolygon ImpCalcXPolyCirc(const SdrCircKind eKind, const tools::Rectangle& rRect1, Degree100 nStart, Degree100 nEnd) const;
57 SVX_DLLPRIVATE static void ImpSetCreateParams(SdrDragStat& rStat);
58 SVX_DLLPRIVATE void ImpSetAttrToCircInfo(); // copy values from pool
59 SVX_DLLPRIVATE void ImpSetCircInfoToAttr(); // copy values into pool
60
61 // returns sal_True if paint requires a XPolygon
62 SVX_DLLPRIVATE bool PaintNeedsXPolyCirc() const; // PaintNeedsXPoly-> PaintNeedsXPolyCirc
63 SVX_DLLPRIVATE virtual void RecalcXPoly() override;
64
65 virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
66
67private:
68 // protected destructor - due to final, make private
69 virtual ~SdrCircObj() override;
70
71public:
73 SdrModel& rSdrModel,
74 SdrCircKind eNewKind);
76 SdrModel& rSdrModel,
77 SdrCircKind eNewKind,
78 const tools::Rectangle& rRect);
79 // Copy constructor
80 SdrCircObj(SdrModel& rSdrModel, SdrCircObj const & rSource);
81
82 // 0=0.00Deg=3h 9000=90.00Deg=12h 18000=180.00Deg=9h 27000=270.00Deg=6h
83 // The circle is build up from StartAngle to EndWink anti-clockwise.
84 // If nNewStartAngle==nNewEndWink, then arc has an angle of 0 degrees.
85 // If nNewStartAngle+36000==nNewEndWink, then the arc has angle of 360 degrees.
87 SdrModel& rSdrModel,
88 SdrCircKind eNewKind,
89 const tools::Rectangle& rRect,
90 Degree100 nNewStartAngle,
91 Degree100 nNewEndAngle);
92
93 SdrCircKind GetCircleKind() const { return meCircleKind; }
94
95 virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
96 virtual SdrObjKind GetObjIdentifier() const override;
97 virtual void TakeUnrotatedSnapRect(tools::Rectangle& rRect) const override;
98
99 virtual OUString TakeObjNameSingul() const override;
100 virtual OUString TakeObjNamePlural() const override;
101
102 virtual SdrCircObj* CloneSdrObject(SdrModel& rTargetModel) const override;
103
104 virtual void RecalcSnapRect() override;
105 virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
106 virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
107
108 virtual sal_uInt32 GetSnapPointCount() const override;
109 virtual Point GetSnapPoint(sal_uInt32 i) const override;
110
111 virtual sal_uInt32 GetHdlCount() const override;
112 virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
113
114 // special drag methods
115 virtual bool hasSpecialDrag() const override;
116 virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
117 virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
118 virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const override;
119
120 virtual bool BegCreate(SdrDragStat& rStat) override;
121 virtual bool MovCreate(SdrDragStat& rStat) override;
122 virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
123 virtual bool BckCreate(SdrDragStat& rStat) override;
124 virtual void BrkCreate(SdrDragStat& rStat) override;
125 virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
126 virtual PointerStyle GetCreatePointer() const override;
127 virtual void NbcMove(const Size& aSiz) override;
128 virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
129 virtual void NbcMirror(const Point& rRef1, const Point& rRef2) override;
130 virtual void NbcShear (const Point& rRef, Degree100 nAngle, double tn, bool bVShear) override;
131 virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
132
133private:
134 virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
135 virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
136 virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
137public:
138 Degree100 GetStartAngle() const { return nStartAngle; }
139 Degree100 GetEndAngle() const { return nEndAngle; }
140
141};
142
143/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Degree100 nStartAngle
Definition: svdocirc.hxx:34
Degree100 nEndAngle
Definition: svdocirc.hxx:35
Degree100 GetEndAngle() const
Definition: svdocirc.hxx:139
Degree100 GetStartAngle() const
Definition: svdocirc.hxx:138
SdrCircKind meCircleKind
Definition: svdocirc.hxx:52
Degree100 nStartAngle
Definition: svdocirc.hxx:53
Degree100 nEndAngle
Definition: svdocirc.hxx:54
SdrCircKind GetCircleKind() const
Definition: svdocirc.hxx:93
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:175
Provides information about various ZObject properties.
Definition: svdobj.hxx:197
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:39
virtual void NbcShear(const Point &rRef, Degree100 nAngle, double tn, bool bVShear) override
Definition: svdorect.cxx:463
virtual void TakeUnrotatedSnapRect(tools::Rectangle &rRect) const override
Definition: svdorect.cxx:178
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdorect.cxx:39
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
Definition: svdorect.cxx:269
virtual bool hasSpecialDrag() const override
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
Definition: svdorect.cxx:342
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdorect.cxx:451
virtual SdrRectObj * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdorect.cxx:247
virtual void RecalcXPoly()
Subclasses should override RecalcXPoly() by creating an XPolygon instance with new and assigning it t...
Definition: svdorect.cxx:130
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdorect.cxx:281
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const override
Polygon dragged by the user when creating the object.
Definition: svdorect.cxx:428
virtual SdrObjKind GetObjIdentifier() const override
Definition: svdorect.cxx:171
virtual OUString TakeObjNamePlural() const override
Definition: svdorect.cxx:226
virtual void RecalcSnapRect() override
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
Definition: svdorect.cxx:259
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: svdorect.cxx:527
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
Definition: svdorect.cxx:252
virtual PointerStyle GetCreatePointer() const override
get the cursor/pointer that signals creating this object
Definition: svdorect.cxx:439
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
Definition: svdorect.cxx:390
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdorect.cxx:145
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: svdorect.cxx:286
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
Definition: svdorect.cxx:555
virtual OUString TakeObjNameSingul() const override
Definition: svdorect.cxx:200
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
Definition: svdorect.cxx:561
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdorect.cxx:47
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
Definition: svdorect.cxx:361
virtual void NbcMirror(const Point &rRef1, const Point &rRef2) override
Definition: svdorect.cxx:469
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
Definition: svdorect.cxx:347
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdorect.cxx:445
virtual std::unique_ptr< 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:1412
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdotext.cxx:1417
virtual bool MovCreate(SdrDragStat &rStat) override
Definition: svdotxdr.cxx:192
virtual bool BegCreate(SdrDragStat &rStat) override
Every object must be able to create itself interactively.
Definition: svdotxdr.cxx:182
virtual void BrkCreate(SdrDragStat &rStat) override
Definition: svdotxdr.cxx:221
virtual Point GetSnapPoint(sal_uInt32 i) const override
Definition: svdotext.cxx:1129
virtual sal_uInt32 GetSnapPointCount() const override
snap to special points of an Object (polygon points, center of circle)
Definition: svdotext.cxx:1124
virtual bool BckCreate(SdrDragStat &rStat) override
Definition: svdotxdr.cxx:225
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
Definition: svdotxdr.cxx:207
PointerStyle
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:98
SdrObjKind
Definition: svdobjkind.hxx:25
SdrCircKind
Definition: svdocirc.hxx:38
SVXCORE_DLLPUBLIC SdrCircKind ToSdrCircKind(SdrObjKind)
Definition: svdocirc.cxx:104
SdrCreateCmd
Definition: svdtypes.hxx:27
#define SVX_DLLPRIVATE
Definition: svxdllapi.h:30
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35