xref: /trunk/main/svx/source/sdr/properties/circleproperties.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f6e50924SAndrew Rist  * distributed with this work for additional information
6*f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f6e50924SAndrew Rist  * specific language governing permissions and limitations
18*f6e50924SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*f6e50924SAndrew Rist  *************************************************************/
21*f6e50924SAndrew Rist 
22*f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir #include <svx/sdr/properties/circleproperties.hxx>
27cdf0e10cSrcweir #include <svl/itemset.hxx>
28cdf0e10cSrcweir #include <svl/style.hxx>
29cdf0e10cSrcweir #include <svx/svddef.hxx>
30cdf0e10cSrcweir #include <editeng/eeitem.hxx>
31cdf0e10cSrcweir #include <svx/svdocirc.hxx>
32cdf0e10cSrcweir #include <svx/sxcikitm.hxx>
33cdf0e10cSrcweir #include <svx/sxciaitm.hxx>
34cdf0e10cSrcweir #include <svx/sxciaitm.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
37cdf0e10cSrcweir 
38cdf0e10cSrcweir namespace sdr
39cdf0e10cSrcweir {
40cdf0e10cSrcweir     namespace properties
41cdf0e10cSrcweir     {
42cdf0e10cSrcweir         // create a new itemset
CreateObjectSpecificItemSet(SfxItemPool & rPool)43cdf0e10cSrcweir         SfxItemSet& CircleProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
44cdf0e10cSrcweir         {
45cdf0e10cSrcweir             return *(new SfxItemSet(rPool,
46cdf0e10cSrcweir 
47cdf0e10cSrcweir                 // range from SdrAttrObj
48cdf0e10cSrcweir                 SDRATTR_START, SDRATTR_SHADOW_LAST,
49cdf0e10cSrcweir                 SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
50cdf0e10cSrcweir                 SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
51cdf0e10cSrcweir 
52cdf0e10cSrcweir                 // range from SdrCircObj
53cdf0e10cSrcweir                 SDRATTR_CIRC_FIRST, SDRATTR_CIRC_LAST,
54cdf0e10cSrcweir 
55cdf0e10cSrcweir                 // range from SdrTextObj
56cdf0e10cSrcweir                 EE_ITEMS_START, EE_ITEMS_END,
57cdf0e10cSrcweir 
58cdf0e10cSrcweir                 // end
59cdf0e10cSrcweir                 0, 0));
60cdf0e10cSrcweir         }
61cdf0e10cSrcweir 
CircleProperties(SdrObject & rObj)62cdf0e10cSrcweir         CircleProperties::CircleProperties(SdrObject& rObj)
63cdf0e10cSrcweir         :   RectangleProperties(rObj)
64cdf0e10cSrcweir         {
65cdf0e10cSrcweir         }
66cdf0e10cSrcweir 
CircleProperties(const CircleProperties & rProps,SdrObject & rObj)67cdf0e10cSrcweir         CircleProperties::CircleProperties(const CircleProperties& rProps, SdrObject& rObj)
68cdf0e10cSrcweir         :   RectangleProperties(rProps, rObj)
69cdf0e10cSrcweir         {
70cdf0e10cSrcweir         }
71cdf0e10cSrcweir 
~CircleProperties()72cdf0e10cSrcweir         CircleProperties::~CircleProperties()
73cdf0e10cSrcweir         {
74cdf0e10cSrcweir         }
75cdf0e10cSrcweir 
Clone(SdrObject & rObj) const76cdf0e10cSrcweir         BaseProperties& CircleProperties::Clone(SdrObject& rObj) const
77cdf0e10cSrcweir         {
78cdf0e10cSrcweir             return *(new CircleProperties(*this, rObj));
79cdf0e10cSrcweir         }
80cdf0e10cSrcweir 
ItemSetChanged(const SfxItemSet & rSet)81cdf0e10cSrcweir         void CircleProperties::ItemSetChanged(const SfxItemSet& rSet)
82cdf0e10cSrcweir         {
83cdf0e10cSrcweir             SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
84cdf0e10cSrcweir 
85cdf0e10cSrcweir             // call parent
86cdf0e10cSrcweir             RectangleProperties::ItemSetChanged(rSet);
87cdf0e10cSrcweir 
88cdf0e10cSrcweir             // local changes
89cdf0e10cSrcweir             rObj.ImpSetAttrToCircInfo();
90cdf0e10cSrcweir         }
91cdf0e10cSrcweir 
SetStyleSheet(SfxStyleSheet * pNewStyleSheet,sal_Bool bDontRemoveHardAttr)92cdf0e10cSrcweir         void CircleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
93cdf0e10cSrcweir         {
94cdf0e10cSrcweir             SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
95cdf0e10cSrcweir 
96cdf0e10cSrcweir             // local changes
97cdf0e10cSrcweir             rObj.SetXPolyDirty();
98cdf0e10cSrcweir 
99cdf0e10cSrcweir             // call parent
100cdf0e10cSrcweir             RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
101cdf0e10cSrcweir 
102cdf0e10cSrcweir             // local changes
103cdf0e10cSrcweir             rObj.ImpSetAttrToCircInfo();
104cdf0e10cSrcweir         }
105cdf0e10cSrcweir 
ForceDefaultAttributes()106cdf0e10cSrcweir         void CircleProperties::ForceDefaultAttributes()
107cdf0e10cSrcweir         {
108cdf0e10cSrcweir             SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
109cdf0e10cSrcweir             SdrCircKind eKindA = SDRCIRC_FULL;
110cdf0e10cSrcweir             SdrObjKind eKind = rObj.GetCircleKind();
111cdf0e10cSrcweir 
112cdf0e10cSrcweir             if(eKind == OBJ_SECT)
113cdf0e10cSrcweir             {
114cdf0e10cSrcweir                 eKindA = SDRCIRC_SECT;
115cdf0e10cSrcweir             }
116cdf0e10cSrcweir             else if(eKind == OBJ_CARC)
117cdf0e10cSrcweir             {
118cdf0e10cSrcweir                 eKindA = SDRCIRC_ARC;
119cdf0e10cSrcweir             }
120cdf0e10cSrcweir             else if(eKind == OBJ_CCUT)
121cdf0e10cSrcweir             {
122cdf0e10cSrcweir                 eKindA = SDRCIRC_CUT;
123cdf0e10cSrcweir             }
124cdf0e10cSrcweir 
125cdf0e10cSrcweir             if(eKindA != SDRCIRC_FULL)
126cdf0e10cSrcweir             {
127cdf0e10cSrcweir                 // force ItemSet
128cdf0e10cSrcweir                 GetObjectItemSet();
129cdf0e10cSrcweir 
130cdf0e10cSrcweir                 mpItemSet->Put(SdrCircKindItem(eKindA));
131cdf0e10cSrcweir 
132cdf0e10cSrcweir                 if(rObj.GetStartWink())
133cdf0e10cSrcweir                 {
134cdf0e10cSrcweir                     mpItemSet->Put(SdrCircStartAngleItem(rObj.GetStartWink()));
135cdf0e10cSrcweir                 }
136cdf0e10cSrcweir 
137cdf0e10cSrcweir                 if(rObj.GetEndWink() != 36000)
138cdf0e10cSrcweir                 {
139cdf0e10cSrcweir                     mpItemSet->Put(SdrCircEndAngleItem(rObj.GetEndWink()));
140cdf0e10cSrcweir                 }
141cdf0e10cSrcweir             }
142cdf0e10cSrcweir 
143cdf0e10cSrcweir             // call parent after SetObjectItem(SdrCircKindItem())
144cdf0e10cSrcweir             // because ForceDefaultAttr() will call
145cdf0e10cSrcweir             // ImpSetAttrToCircInfo() which needs a correct
146cdf0e10cSrcweir             // SdrCircKindItem
147cdf0e10cSrcweir             RectangleProperties::ForceDefaultAttributes();
148cdf0e10cSrcweir         }
149cdf0e10cSrcweir     } // end of namespace properties
150cdf0e10cSrcweir } // end of namespace sdr
151cdf0e10cSrcweir 
152cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
153cdf0e10cSrcweir // eof
154