1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: circleproperties.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #include <svx/sdr/properties/circleproperties.hxx>
34 #include <svtools/itemset.hxx>
35 #include <svtools/style.hxx>
36 #include <svx/svddef.hxx>
37 #include <svx/eeitem.hxx>
38 #include <svx/svdocirc.hxx>
39 #include <svx/sxcikitm.hxx>
40 #include <svx/sxciaitm.hxx>
41 #include <svx/sxciaitm.hxx>
43 //////////////////////////////////////////////////////////////////////////////
49 // create a new itemset
50 SfxItemSet
& CircleProperties::CreateObjectSpecificItemSet(SfxItemPool
& rPool
)
52 return *(new SfxItemSet(rPool
,
54 // range from SdrAttrObj
55 SDRATTR_START
, SDRATTR_SHADOW_LAST
,
56 SDRATTR_MISC_FIRST
, SDRATTR_MISC_LAST
,
57 SDRATTR_TEXTDIRECTION
, SDRATTR_TEXTDIRECTION
,
59 // range from SdrCircObj
60 SDRATTR_CIRC_FIRST
, SDRATTR_CIRC_LAST
,
62 // range from SdrTextObj
63 EE_ITEMS_START
, EE_ITEMS_END
,
69 CircleProperties::CircleProperties(SdrObject
& rObj
)
70 : RectangleProperties(rObj
)
74 CircleProperties::CircleProperties(const CircleProperties
& rProps
, SdrObject
& rObj
)
75 : RectangleProperties(rProps
, rObj
)
79 CircleProperties::~CircleProperties()
83 BaseProperties
& CircleProperties::Clone(SdrObject
& rObj
) const
85 return *(new CircleProperties(*this, rObj
));
88 void CircleProperties::ItemSetChanged(const SfxItemSet
& rSet
)
90 SdrCircObj
& rObj
= (SdrCircObj
&)GetSdrObject();
93 RectangleProperties::ItemSetChanged(rSet
);
96 rObj
.ImpSetAttrToCircInfo();
99 void CircleProperties::SetStyleSheet(SfxStyleSheet
* pNewStyleSheet
, sal_Bool bDontRemoveHardAttr
)
101 SdrCircObj
& rObj
= (SdrCircObj
&)GetSdrObject();
104 rObj
.SetXPolyDirty();
107 RectangleProperties::SetStyleSheet(pNewStyleSheet
, bDontRemoveHardAttr
);
110 rObj
.ImpSetAttrToCircInfo();
113 void CircleProperties::ForceDefaultAttributes()
115 SdrCircObj
& rObj
= (SdrCircObj
&)GetSdrObject();
116 SdrCircKind eKindA
= SDRCIRC_FULL
;
117 SdrObjKind eKind
= rObj
.GetCircleKind();
119 if(eKind
== OBJ_SECT
)
121 eKindA
= SDRCIRC_SECT
;
123 else if(eKind
== OBJ_CARC
)
125 eKindA
= SDRCIRC_ARC
;
127 else if(eKind
== OBJ_CCUT
)
129 eKindA
= SDRCIRC_CUT
;
132 if(eKindA
!= SDRCIRC_FULL
)
137 mpItemSet
->Put(SdrCircKindItem(eKindA
));
139 if(rObj
.GetStartWink())
141 mpItemSet
->Put(SdrCircStartAngleItem(rObj
.GetStartWink()));
144 if(rObj
.GetEndWink() != 36000)
146 mpItemSet
->Put(SdrCircEndAngleItem(rObj
.GetEndWink()));
150 // call parent after SetObjectItem(SdrCircKindItem())
151 // because ForceDefaultAttr() will call
152 // ImpSetAttrToCircInfo() which needs a correct
154 RectangleProperties::ForceDefaultAttributes();
156 } // end of namespace properties
157 } // end of namespace sdr
159 //////////////////////////////////////////////////////////////////////////////