Branch data Line data Source code
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 : : #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>
28 : :
29 : : //////////////////////////////////////////////////////////////////////////////
30 : :
31 : : namespace sdr
32 : : {
33 : : namespace properties
34 : : {
35 : : // create a new itemset
36 : 63 : SfxItemSet& CircleProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
37 : : {
38 : : return *(new SfxItemSet(rPool,
39 : :
40 : : // range from SdrAttrObj
41 : : SDRATTR_START, SDRATTR_SHADOW_LAST,
42 : : SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
43 : : SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
44 : :
45 : : // range from SdrCircObj
46 : : SDRATTR_CIRC_FIRST, SDRATTR_CIRC_LAST,
47 : :
48 : : // range from SdrTextObj
49 : : EE_ITEMS_START, EE_ITEMS_END,
50 : :
51 : : // end
52 [ + - ]: 63 : 0, 0));
53 : : }
54 : :
55 : 63 : CircleProperties::CircleProperties(SdrObject& rObj)
56 : 63 : : RectangleProperties(rObj)
57 : : {
58 : 63 : }
59 : :
60 : 0 : CircleProperties::CircleProperties(const CircleProperties& rProps, SdrObject& rObj)
61 : 0 : : RectangleProperties(rProps, rObj)
62 : : {
63 : 0 : }
64 : :
65 : 60 : CircleProperties::~CircleProperties()
66 : : {
67 [ - + ]: 120 : }
68 : :
69 : 0 : BaseProperties& CircleProperties::Clone(SdrObject& rObj) const
70 : : {
71 [ # # ]: 0 : return *(new CircleProperties(*this, rObj));
72 : : }
73 : :
74 : 71 : void CircleProperties::ItemSetChanged(const SfxItemSet& rSet)
75 : : {
76 : 71 : SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
77 : :
78 : : // call parent
79 : 71 : RectangleProperties::ItemSetChanged(rSet);
80 : :
81 : : // local changes
82 : 71 : rObj.ImpSetAttrToCircInfo();
83 : 71 : }
84 : :
85 : 105 : void CircleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
86 : : {
87 : 105 : SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
88 : :
89 : : // local changes
90 : 105 : rObj.SetXPolyDirty();
91 : :
92 : : // call parent
93 : 105 : RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
94 : :
95 : : // local changes
96 : 105 : rObj.ImpSetAttrToCircInfo();
97 : 105 : }
98 : :
99 : 63 : void CircleProperties::ForceDefaultAttributes()
100 : : {
101 : 63 : SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
102 : 63 : SdrCircKind eKindA = SDRCIRC_FULL;
103 : 63 : SdrObjKind eKind = rObj.GetCircleKind();
104 : :
105 [ - + ]: 63 : if(eKind == OBJ_SECT)
106 : : {
107 : 0 : eKindA = SDRCIRC_SECT;
108 : : }
109 [ - + ]: 63 : else if(eKind == OBJ_CARC)
110 : : {
111 : 0 : eKindA = SDRCIRC_ARC;
112 : : }
113 [ - + ]: 63 : else if(eKind == OBJ_CCUT)
114 : : {
115 : 0 : eKindA = SDRCIRC_CUT;
116 : : }
117 : :
118 [ - + ]: 63 : if(eKindA != SDRCIRC_FULL)
119 : : {
120 : : // force ItemSet
121 : 0 : GetObjectItemSet();
122 : :
123 [ # # ]: 0 : mpItemSet->Put(SdrCircKindItem(eKindA));
124 : :
125 [ # # ]: 0 : if(rObj.GetStartWink())
126 : : {
127 [ # # ]: 0 : mpItemSet->Put(SdrCircStartAngleItem(rObj.GetStartWink()));
128 : : }
129 : :
130 [ # # ]: 0 : if(rObj.GetEndWink() != 36000)
131 : : {
132 [ # # ]: 0 : mpItemSet->Put(SdrCircEndAngleItem(rObj.GetEndWink()));
133 : : }
134 : : }
135 : :
136 : : // call parent after SetObjectItem(SdrCircKindItem())
137 : : // because ForceDefaultAttr() will call
138 : : // ImpSetAttrToCircInfo() which needs a correct
139 : : // SdrCircKindItem
140 : 63 : RectangleProperties::ForceDefaultAttributes();
141 : 63 : }
142 : : } // end of namespace properties
143 : : } // end of namespace sdr
144 : :
145 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|