Bump version to 6.4-15
[LibreOffice.git] / svx / source / sdr / properties / circleproperties.cxx
blob0ce76a2371f972800890708aa58daa4358c4aea9
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 <sal/config.h>
22 #include <sdr/properties/circleproperties.hxx>
23 #include <svl/itemset.hxx>
24 #include <svl/style.hxx>
25 #include <svx/svddef.hxx>
26 #include <editeng/eeitem.hxx>
27 #include <svx/svdocirc.hxx>
28 #include <sxcikitm.hxx>
29 #include <svx/sxciaitm.hxx>
32 namespace sdr
34 namespace properties
36 // create a new itemset
37 std::unique_ptr<SfxItemSet> CircleProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
39 return std::make_unique<SfxItemSet>(
40 rPool,
41 svl::Items<
42 // Ranges from SdrAttrObj, SdrCircObj
43 SDRATTR_START, SDRATTR_SHADOW_LAST,
44 SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
45 SDRATTR_CIRC_FIRST, SDRATTR_CIRC_LAST,
46 SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
47 // Range from SdrTextObj:
48 EE_ITEMS_START, EE_ITEMS_END>{});
51 CircleProperties::CircleProperties(SdrObject& rObj)
52 : RectangleProperties(rObj)
56 CircleProperties::CircleProperties(const CircleProperties& rProps, SdrObject& rObj)
57 : RectangleProperties(rProps, rObj)
61 CircleProperties::~CircleProperties()
65 std::unique_ptr<BaseProperties> CircleProperties::Clone(SdrObject& rObj) const
67 return std::unique_ptr<BaseProperties>(new CircleProperties(*this, rObj));
70 void CircleProperties::ItemSetChanged(const SfxItemSet& rSet)
72 SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
74 // call parent
75 RectangleProperties::ItemSetChanged(rSet);
77 // local changes
78 rObj.ImpSetAttrToCircInfo();
81 void CircleProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
83 // call parent (always first thing to do, may create the SfxItemSet)
84 RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
86 // local changes
87 SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
88 rObj.SetXPolyDirty();
90 // local changes
91 rObj.ImpSetAttrToCircInfo();
94 void CircleProperties::ForceDefaultAttributes()
96 SdrCircObj& rObj = static_cast<SdrCircObj&>(GetSdrObject());
97 SdrCircKind eKind = rObj.GetCircleKind();
99 if(eKind != SdrCircKind::Full)
101 // force ItemSet
102 GetObjectItemSet();
104 mpItemSet->Put(SdrCircKindItem(eKind));
106 if(rObj.GetStartAngle())
108 mpItemSet->Put(makeSdrCircStartAngleItem(rObj.GetStartAngle()));
111 if(rObj.GetEndAngle() != 36000)
113 mpItemSet->Put(makeSdrCircEndAngleItem(rObj.GetEndAngle()));
117 // call parent after SetObjectItem(SdrCircKindItem())
118 // because ForceDefaultAttr() will call
119 // ImpSetAttrToCircInfo() which needs a correct
120 // SdrCircKindItem
121 RectangleProperties::ForceDefaultAttributes();
123 } // end of namespace properties
124 } // end of namespace sdr
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */