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 <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 <sxcikitm.hxx>
27 : #include <svx/sxciaitm.hxx>
28 :
29 :
30 :
31 : namespace sdr
32 : {
33 : namespace properties
34 : {
35 : // create a new itemset
36 115 : 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 115 : 0, 0);
53 : }
54 :
55 115 : CircleProperties::CircleProperties(SdrObject& rObj)
56 115 : : RectangleProperties(rObj)
57 : {
58 115 : }
59 :
60 1 : CircleProperties::CircleProperties(const CircleProperties& rProps, SdrObject& rObj)
61 1 : : RectangleProperties(rProps, rObj)
62 : {
63 1 : }
64 :
65 232 : CircleProperties::~CircleProperties()
66 : {
67 232 : }
68 :
69 1 : BaseProperties& CircleProperties::Clone(SdrObject& rObj) const
70 : {
71 1 : return *(new CircleProperties(*this, rObj));
72 : }
73 :
74 459 : void CircleProperties::ItemSetChanged(const SfxItemSet& rSet)
75 : {
76 459 : SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
77 :
78 : // call parent
79 459 : RectangleProperties::ItemSetChanged(rSet);
80 :
81 : // local changes
82 459 : rObj.ImpSetAttrToCircInfo();
83 459 : }
84 :
85 203 : void CircleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
86 : {
87 203 : SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
88 :
89 : // local changes
90 203 : rObj.SetXPolyDirty();
91 :
92 : // call parent
93 203 : RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
94 :
95 : // local changes
96 203 : rObj.ImpSetAttrToCircInfo();
97 203 : }
98 :
99 115 : void CircleProperties::ForceDefaultAttributes()
100 : {
101 115 : SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
102 115 : SdrCircKind eKindA = SDRCIRC_FULL;
103 115 : SdrObjKind eKind = rObj.GetCircleKind();
104 :
105 115 : if(eKind == OBJ_SECT)
106 : {
107 0 : eKindA = SDRCIRC_SECT;
108 : }
109 115 : else if(eKind == OBJ_CARC)
110 : {
111 0 : eKindA = SDRCIRC_ARC;
112 : }
113 115 : else if(eKind == OBJ_CCUT)
114 : {
115 0 : eKindA = SDRCIRC_CUT;
116 : }
117 :
118 115 : if(eKindA != SDRCIRC_FULL)
119 : {
120 : // force ItemSet
121 0 : GetObjectItemSet();
122 :
123 0 : mpItemSet->Put(SdrCircKindItem(eKindA));
124 :
125 0 : if(rObj.GetStartAngle())
126 : {
127 0 : mpItemSet->Put(makeSdrCircStartAngleItem(rObj.GetStartAngle()));
128 : }
129 :
130 0 : if(rObj.GetEndAngle() != 36000)
131 : {
132 0 : mpItemSet->Put(makeSdrCircEndAngleItem(rObj.GetEndAngle()));
133 : }
134 : }
135 :
136 : // call parent after SetObjectItem(SdrCircKindItem())
137 : // because ForceDefaultAttr() will call
138 : // ImpSetAttrToCircInfo() which needs a correct
139 : // SdrCircKindItem
140 115 : RectangleProperties::ForceDefaultAttributes();
141 115 : }
142 : } // end of namespace properties
143 435 : } // end of namespace sdr
144 :
145 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|