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 0 : 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 0 : 0, 0));
53 : }
54 :
55 0 : CircleProperties::CircleProperties(SdrObject& rObj)
56 0 : : RectangleProperties(rObj)
57 : {
58 0 : }
59 :
60 0 : CircleProperties::CircleProperties(const CircleProperties& rProps, SdrObject& rObj)
61 0 : : RectangleProperties(rProps, rObj)
62 : {
63 0 : }
64 :
65 0 : CircleProperties::~CircleProperties()
66 : {
67 0 : }
68 :
69 0 : BaseProperties& CircleProperties::Clone(SdrObject& rObj) const
70 : {
71 0 : return *(new CircleProperties(*this, rObj));
72 : }
73 :
74 0 : void CircleProperties::ItemSetChanged(const SfxItemSet& rSet)
75 : {
76 0 : SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
77 :
78 : // call parent
79 0 : RectangleProperties::ItemSetChanged(rSet);
80 :
81 : // local changes
82 0 : rObj.ImpSetAttrToCircInfo();
83 0 : }
84 :
85 0 : void CircleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
86 : {
87 0 : SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
88 :
89 : // local changes
90 0 : rObj.SetXPolyDirty();
91 :
92 : // call parent
93 0 : RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
94 :
95 : // local changes
96 0 : rObj.ImpSetAttrToCircInfo();
97 0 : }
98 :
99 0 : void CircleProperties::ForceDefaultAttributes()
100 : {
101 0 : SdrCircObj& rObj = (SdrCircObj&)GetSdrObject();
102 0 : SdrCircKind eKindA = SDRCIRC_FULL;
103 0 : SdrObjKind eKind = rObj.GetCircleKind();
104 :
105 0 : if(eKind == OBJ_SECT)
106 : {
107 0 : eKindA = SDRCIRC_SECT;
108 : }
109 0 : else if(eKind == OBJ_CARC)
110 : {
111 0 : eKindA = SDRCIRC_ARC;
112 : }
113 0 : else if(eKind == OBJ_CCUT)
114 : {
115 0 : eKindA = SDRCIRC_CUT;
116 : }
117 :
118 0 : 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 0 : RectangleProperties::ForceDefaultAttributes();
141 0 : }
142 : } // end of namespace properties
143 : } // end of namespace sdr
144 :
145 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|