1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*f6e50924SAndrew Rist * distributed with this work for additional information
6*f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at
10*f6e50924SAndrew Rist *
11*f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*f6e50924SAndrew Rist *
13*f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist * KIND, either express or implied. See the License for the
17*f6e50924SAndrew Rist * specific language governing permissions and limitations
18*f6e50924SAndrew Rist * under the License.
19*f6e50924SAndrew Rist *
20*f6e50924SAndrew Rist *************************************************************/
21*f6e50924SAndrew Rist
22*f6e50924SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <svx/svdoattr.hxx>
28cdf0e10cSrcweir #include <svx/xpool.hxx>
29cdf0e10cSrcweir #include "svx/svditext.hxx"
30cdf0e10cSrcweir #include <svx/svdmodel.hxx>
31cdf0e10cSrcweir #include <svx/svdpage.hxx>
32cdf0e10cSrcweir #include <svx/svdattr.hxx>
33cdf0e10cSrcweir #include <svx/svdattrx.hxx>
34cdf0e10cSrcweir #include <svx/svdpool.hxx>
35cdf0e10cSrcweir #include <svx/svdotext.hxx>
36cdf0e10cSrcweir #include <svx/svdocapt.hxx>
37cdf0e10cSrcweir #include <svx/svdograf.hxx>
38cdf0e10cSrcweir #include <svx/svdoole2.hxx>
39cdf0e10cSrcweir #include <svx/svdorect.hxx>
40cdf0e10cSrcweir #include <svx/svdocirc.hxx>
41cdf0e10cSrcweir #include <svx/svdomeas.hxx>
42cdf0e10cSrcweir #include <svl/smplhint.hxx>
43cdf0e10cSrcweir #include <svl/itemiter.hxx>
44cdf0e10cSrcweir #include <svx/xenum.hxx>
45cdf0e10cSrcweir #include <svx/xlineit0.hxx>
46cdf0e10cSrcweir #include <svx/xlnstwit.hxx>
47cdf0e10cSrcweir #include <svx/xlnedwit.hxx>
48cdf0e10cSrcweir #include <svx/xfillit0.hxx>
49cdf0e10cSrcweir #include <svx/xflbmtit.hxx>
50cdf0e10cSrcweir #include <svx/xtextit0.hxx>
51cdf0e10cSrcweir #include <svx/xflbstit.hxx>
52cdf0e10cSrcweir #include <svx/xflbtoxy.hxx>
53cdf0e10cSrcweir #include <svx/xftshit.hxx>
54cdf0e10cSrcweir
55cdf0e10cSrcweir
56cdf0e10cSrcweir #include <editeng/colritem.hxx>
57cdf0e10cSrcweir #include "editeng/fontitem.hxx"
58cdf0e10cSrcweir #include <editeng/fhgtitem.hxx>
59cdf0e10cSrcweir
60cdf0e10cSrcweir //#include <editeng/charscaleitem.hxx>
61cdf0e10cSrcweir #include <svx/xlnstcit.hxx>
62cdf0e10cSrcweir #include <svx/xlnwtit.hxx>
63cdf0e10cSrcweir #include <svl/style.hxx>
64cdf0e10cSrcweir #include <svl/style.hxx>
65cdf0e10cSrcweir #include <svl/whiter.hxx>
66cdf0e10cSrcweir #include <svx/xlnclit.hxx>
67cdf0e10cSrcweir #include <svx/xflclit.hxx>
68cdf0e10cSrcweir #include <svx/xlntrit.hxx>
69cdf0e10cSrcweir #include <svx/xfltrit.hxx>
70cdf0e10cSrcweir #include <svx/xlnedcit.hxx>
71cdf0e10cSrcweir #include <editeng/adjitem.hxx>
72cdf0e10cSrcweir #include <svx/xflbckit.hxx>
73cdf0e10cSrcweir #include <svx/xtable.hxx>
74cdf0e10cSrcweir #include <svx/xbtmpit.hxx>
75cdf0e10cSrcweir #include <svx/xlndsit.hxx>
76cdf0e10cSrcweir #include <svx/xlnedit.hxx>
77cdf0e10cSrcweir #include <svx/xflgrit.hxx>
78cdf0e10cSrcweir #include <svx/xflftrit.hxx>
79cdf0e10cSrcweir #include <svx/xflhtit.hxx>
80cdf0e10cSrcweir #include <svx/xlnstit.hxx>
81cdf0e10cSrcweir #include <svx/sdr/properties/attributeproperties.hxx>
82cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
83cdf0e10cSrcweir #include "svx/xlinjoit.hxx"
84cdf0e10cSrcweir #include <svdoimp.hxx>
85cdf0e10cSrcweir
86cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
87cdf0e10cSrcweir
CreateObjectSpecificProperties()88cdf0e10cSrcweir sdr::properties::BaseProperties* SdrAttrObj::CreateObjectSpecificProperties()
89cdf0e10cSrcweir {
90cdf0e10cSrcweir return new sdr::properties::AttributeProperties(*this);
91cdf0e10cSrcweir }
92cdf0e10cSrcweir
93cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
94cdf0e10cSrcweir
95cdf0e10cSrcweir TYPEINIT1(SdrAttrObj,SdrObject);
96cdf0e10cSrcweir
SdrAttrObj()97cdf0e10cSrcweir SdrAttrObj::SdrAttrObj()
98cdf0e10cSrcweir {
99cdf0e10cSrcweir }
100cdf0e10cSrcweir
~SdrAttrObj()101cdf0e10cSrcweir SdrAttrObj::~SdrAttrObj()
102cdf0e10cSrcweir {
103cdf0e10cSrcweir }
104cdf0e10cSrcweir
GetSnapRect() const105cdf0e10cSrcweir const Rectangle& SdrAttrObj::GetSnapRect() const
106cdf0e10cSrcweir {
107cdf0e10cSrcweir if(bSnapRectDirty)
108cdf0e10cSrcweir {
109cdf0e10cSrcweir ((SdrAttrObj*)this)->RecalcSnapRect();
110cdf0e10cSrcweir ((SdrAttrObj*)this)->bSnapRectDirty = false;
111cdf0e10cSrcweir }
112cdf0e10cSrcweir
113cdf0e10cSrcweir return maSnapRect;
114cdf0e10cSrcweir }
115cdf0e10cSrcweir
SetModel(SdrModel * pNewModel)116cdf0e10cSrcweir void SdrAttrObj::SetModel(SdrModel* pNewModel)
117cdf0e10cSrcweir {
118cdf0e10cSrcweir SdrModel* pOldModel = pModel;
119cdf0e10cSrcweir
120cdf0e10cSrcweir // test for correct pool in ItemSet; move to new pool if necessary
121cdf0e10cSrcweir if(pNewModel && GetObjectItemPool() && GetObjectItemPool() != &pNewModel->GetItemPool())
122cdf0e10cSrcweir {
123cdf0e10cSrcweir MigrateItemPool(GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
124cdf0e10cSrcweir }
125cdf0e10cSrcweir
126cdf0e10cSrcweir // call parent
127cdf0e10cSrcweir SdrObject::SetModel(pNewModel);
128cdf0e10cSrcweir
129cdf0e10cSrcweir // modify properties
130cdf0e10cSrcweir GetProperties().SetModel(pOldModel, pNewModel);
131cdf0e10cSrcweir }
132cdf0e10cSrcweir
133cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
134cdf0e10cSrcweir // syntactical sugar for ItemSet accesses
135cdf0e10cSrcweir
Notify(SfxBroadcaster &,const SfxHint & rHint)136cdf0e10cSrcweir void __EXPORT SdrAttrObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
137cdf0e10cSrcweir {
138cdf0e10cSrcweir SfxSimpleHint *pSimple = PTR_CAST(SfxSimpleHint, &rHint);
139cdf0e10cSrcweir sal_Bool bDataChg(pSimple && SFX_HINT_DATACHANGED == pSimple->GetId());
140cdf0e10cSrcweir
141cdf0e10cSrcweir if(bDataChg)
142cdf0e10cSrcweir {
143cdf0e10cSrcweir Rectangle aBoundRect = GetLastBoundRect();
144cdf0e10cSrcweir SetBoundRectDirty();
145cdf0e10cSrcweir SetRectsDirty(sal_True);
146cdf0e10cSrcweir
147cdf0e10cSrcweir // This may have lead to object change
148cdf0e10cSrcweir SetChanged();
149cdf0e10cSrcweir BroadcastObjectChange();
150cdf0e10cSrcweir SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect);
151cdf0e10cSrcweir }
152cdf0e10cSrcweir }
153cdf0e10cSrcweir
ImpGetLineWdt() const154cdf0e10cSrcweir sal_Int32 SdrAttrObj::ImpGetLineWdt() const
155cdf0e10cSrcweir {
156cdf0e10cSrcweir sal_Int32 nRetval(0);
157cdf0e10cSrcweir
158cdf0e10cSrcweir if(XLINE_NONE != ((XLineStyleItem&)(GetObjectItem(XATTR_LINESTYLE))).GetValue())
159cdf0e10cSrcweir {
160cdf0e10cSrcweir nRetval = ((XLineWidthItem&)(GetObjectItem(XATTR_LINEWIDTH))).GetValue();
161cdf0e10cSrcweir }
162cdf0e10cSrcweir
163cdf0e10cSrcweir return nRetval;
164cdf0e10cSrcweir }
165cdf0e10cSrcweir
HasFill() const166cdf0e10cSrcweir sal_Bool SdrAttrObj::HasFill() const
167cdf0e10cSrcweir {
168cdf0e10cSrcweir return bClosedObj && ((XFillStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_FILLSTYLE))).GetValue()!=XFILL_NONE;
169cdf0e10cSrcweir }
170cdf0e10cSrcweir
HasLine() const171cdf0e10cSrcweir sal_Bool SdrAttrObj::HasLine() const
172cdf0e10cSrcweir {
173cdf0e10cSrcweir return ((XLineStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_LINESTYLE))).GetValue()!=XLINE_NONE;
174cdf0e10cSrcweir }
175cdf0e10cSrcweir
176cdf0e10cSrcweir // eof
177