1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_svx.hxx" 30 #include <svx/sdr/properties/circleproperties.hxx> 31 #include <svl/itemset.hxx> 32 #include <svl/style.hxx> 33 #include <svx/svddef.hxx> 34 #include <editeng/eeitem.hxx> 35 #include <svx/svdocirc.hxx> 36 #include <svx/sxcikitm.hxx> 37 #include <svx/sxciaitm.hxx> 38 #include <svx/sxciaitm.hxx> 39 40 ////////////////////////////////////////////////////////////////////////////// 41 42 namespace sdr 43 { 44 namespace properties 45 { 46 // create a new itemset 47 SfxItemSet& CircleProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) 48 { 49 return *(new SfxItemSet(rPool, 50 51 // range from SdrAttrObj 52 SDRATTR_START, SDRATTR_SHADOW_LAST, 53 SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, 54 SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, 55 56 // range from SdrCircObj 57 SDRATTR_CIRC_FIRST, SDRATTR_CIRC_LAST, 58 59 // range from SdrTextObj 60 EE_ITEMS_START, EE_ITEMS_END, 61 62 // end 63 0, 0)); 64 } 65 66 CircleProperties::CircleProperties(SdrObject& rObj) 67 : RectangleProperties(rObj) 68 { 69 } 70 71 CircleProperties::CircleProperties(const CircleProperties& rProps, SdrObject& rObj) 72 : RectangleProperties(rProps, rObj) 73 { 74 } 75 76 CircleProperties::~CircleProperties() 77 { 78 } 79 80 BaseProperties& CircleProperties::Clone(SdrObject& rObj) const 81 { 82 return *(new CircleProperties(*this, rObj)); 83 } 84 85 void CircleProperties::ItemSetChanged(const SfxItemSet& rSet) 86 { 87 SdrCircObj& rObj = (SdrCircObj&)GetSdrObject(); 88 89 // call parent 90 RectangleProperties::ItemSetChanged(rSet); 91 92 // local changes 93 rObj.ImpSetAttrToCircInfo(); 94 } 95 96 void CircleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr) 97 { 98 SdrCircObj& rObj = (SdrCircObj&)GetSdrObject(); 99 100 // local changes 101 rObj.SetXPolyDirty(); 102 103 // call parent 104 RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr); 105 106 // local changes 107 rObj.ImpSetAttrToCircInfo(); 108 } 109 110 void CircleProperties::ForceDefaultAttributes() 111 { 112 SdrCircObj& rObj = (SdrCircObj&)GetSdrObject(); 113 SdrCircKind eKindA = SDRCIRC_FULL; 114 SdrObjKind eKind = rObj.GetCircleKind(); 115 116 if(eKind == OBJ_SECT) 117 { 118 eKindA = SDRCIRC_SECT; 119 } 120 else if(eKind == OBJ_CARC) 121 { 122 eKindA = SDRCIRC_ARC; 123 } 124 else if(eKind == OBJ_CCUT) 125 { 126 eKindA = SDRCIRC_CUT; 127 } 128 129 if(eKindA != SDRCIRC_FULL) 130 { 131 // force ItemSet 132 GetObjectItemSet(); 133 134 mpItemSet->Put(SdrCircKindItem(eKindA)); 135 136 if(rObj.GetStartWink()) 137 { 138 mpItemSet->Put(SdrCircStartAngleItem(rObj.GetStartWink())); 139 } 140 141 if(rObj.GetEndWink() != 36000) 142 { 143 mpItemSet->Put(SdrCircEndAngleItem(rObj.GetEndWink())); 144 } 145 } 146 147 // call parent after SetObjectItem(SdrCircKindItem()) 148 // because ForceDefaultAttr() will call 149 // ImpSetAttrToCircInfo() which needs a correct 150 // SdrCircKindItem 151 RectangleProperties::ForceDefaultAttributes(); 152 } 153 } // end of namespace properties 154 } // end of namespace sdr 155 156 ////////////////////////////////////////////////////////////////////////////// 157 // eof 158