fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / svx / source / sdr / properties / circleproperties.cxx
blob7a916b847eec357a87baab41e119ef36c1f9f667
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <svx/sdr/properties/circleproperties.hxx>
21 #include <svl/itemset.hxx>
22 #include <svl/style.hxx>
23 #include <svx/svddef.hxx>
24 #include <editeng/eeitem.hxx>
25 #include <svx/svdocirc.hxx>
26 #include <svx/sxcikitm.hxx>
27 #include <svx/sxciaitm.hxx>
29 //////////////////////////////////////////////////////////////////////////////
31 namespace sdr
33 namespace properties
35 // create a new itemset
36 SfxItemSet& CircleProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
38 return *(new SfxItemSet(rPool,
40 // range from SdrAttrObj
41 SDRATTR_START, SDRATTR_SHADOW_LAST,
42 SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
43 SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
45 // range from SdrCircObj
46 SDRATTR_CIRC_FIRST, SDRATTR_CIRC_LAST,
48 // range from SdrTextObj
49 EE_ITEMS_START, EE_ITEMS_END,
51 // end
52 0, 0));
55 CircleProperties::CircleProperties(SdrObject& rObj)
56 : RectangleProperties(rObj)
60 CircleProperties::CircleProperties(const CircleProperties& rProps, SdrObject& rObj)
61 : RectangleProperties(rProps, rObj)
65 CircleProperties::~CircleProperties()
69 BaseProperties& CircleProperties::Clone(SdrObject& rObj) const
71 return *(new CircleProperties(*this, rObj));
74 void CircleProperties::ItemSetChanged(const SfxItemSet& rSet)
76 SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
78 // call parent
79 RectangleProperties::ItemSetChanged(rSet);
81 // local changes
82 rObj.ImpSetAttrToCircInfo();
85 void CircleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
87 SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
89 // local changes
90 rObj.SetXPolyDirty();
92 // call parent
93 RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
95 // local changes
96 rObj.ImpSetAttrToCircInfo();
99 void CircleProperties::ForceDefaultAttributes()
101 SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
102 SdrCircKind eKindA = SDRCIRC_FULL;
103 SdrObjKind eKind = rObj.GetCircleKind();
105 if(eKind == OBJ_SECT)
107 eKindA = SDRCIRC_SECT;
109 else if(eKind == OBJ_CARC)
111 eKindA = SDRCIRC_ARC;
113 else if(eKind == OBJ_CCUT)
115 eKindA = SDRCIRC_CUT;
118 if(eKindA != SDRCIRC_FULL)
120 // force ItemSet
121 GetObjectItemSet();
123 mpItemSet->Put(SdrCircKindItem(eKindA));
125 if(rObj.GetStartWink())
127 mpItemSet->Put(SdrCircStartAngleItem(rObj.GetStartWink()));
130 if(rObj.GetEndWink() != 36000)
132 mpItemSet->Put(SdrCircEndAngleItem(rObj.GetEndWink()));
136 // call parent after SetObjectItem(SdrCircKindItem())
137 // because ForceDefaultAttr() will call
138 // ImpSetAttrToCircInfo() which needs a correct
139 // SdrCircKindItem
140 RectangleProperties::ForceDefaultAttributes();
142 } // end of namespace properties
143 } // end of namespace sdr
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */