1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: svdoattr.cxx,v $
10 * $Revision: 1.53.18.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #include <svx/svdoattr.hxx>
35 #include <svx/xpool.hxx>
36 #include "svditext.hxx"
37 #include <svx/svdmodel.hxx>
38 #include <svx/svdpage.hxx>
39 #include <svx/svdattr.hxx>
40 #include <svx/svdattrx.hxx>
41 #include <svx/svdpool.hxx>
42 #include <svx/svdotext.hxx>
43 #include <svx/svdocapt.hxx>
44 #include <svx/svdograf.hxx>
45 #include <svx/svdoole2.hxx>
46 #include <svx/svdorect.hxx>
47 #include <svx/svdocirc.hxx>
48 #include <svx/svdomeas.hxx>
49 #include <svtools/smplhint.hxx>
50 #include <svtools/itemiter.hxx>
51 #include <svx/xenum.hxx>
52 #include <svx/xlineit0.hxx>
53 #include <svx/xlnstwit.hxx>
54 #include <svx/xlnedwit.hxx>
55 #include <svx/xfillit0.hxx>
56 #include <svx/xflbmtit.hxx>
57 #include <svx/xtextit0.hxx>
58 #include <svx/xflbstit.hxx>
59 #include <svx/xflbtoxy.hxx>
60 #include <svx/xftshit.hxx>
63 #include <svx/colritem.hxx>
64 #include "fontitem.hxx"
65 #include <svx/fhgtitem.hxx>
67 //#include <svx/charscaleitem.hxx>
68 #include <svx/xlnstcit.hxx>
69 #include <svx/xlnwtit.hxx>
70 #include <svtools/style.hxx>
71 #include <svtools/style.hxx>
72 #include <svtools/whiter.hxx>
73 #include <svx/xlnclit.hxx>
74 #include <svx/xflclit.hxx>
75 #include <svx/xlntrit.hxx>
76 #include <svx/xfltrit.hxx>
77 #include <svx/xlnedcit.hxx>
78 #include <svx/adjitem.hxx>
79 #include <svx/xflbckit.hxx>
80 #include <svx/xtable.hxx>
81 #include <svx/xbtmpit.hxx>
82 #include <svx/xlndsit.hxx>
83 #include <svx/xlnedit.hxx>
84 #include <svx/xflgrit.hxx>
85 #include <svx/xflftrit.hxx>
86 #include <svx/xflhtit.hxx>
87 #include <svx/xlnstit.hxx>
88 #include <svx/sdr/properties/attributeproperties.hxx>
89 #include <basegfx/polygon/b2dpolygon.hxx>
90 #include "xlinjoit.hxx"
91 #include <svdoimp.hxx>
93 //////////////////////////////////////////////////////////////////////////////
95 sdr::properties::BaseProperties
* SdrAttrObj::CreateObjectSpecificProperties()
97 return new sdr::properties::AttributeProperties(*this);
100 ////////////////////////////////////////////////////////////////////////////////////////////////////
102 TYPEINIT1(SdrAttrObj
,SdrObject
);
104 SdrAttrObj::SdrAttrObj()
108 SdrAttrObj::~SdrAttrObj()
112 const Rectangle
& SdrAttrObj::GetSnapRect() const
116 ((SdrAttrObj
*)this)->RecalcSnapRect();
117 ((SdrAttrObj
*)this)->bSnapRectDirty
= false;
123 void SdrAttrObj::SetModel(SdrModel
* pNewModel
)
125 SdrModel
* pOldModel
= pModel
;
127 // test for correct pool in ItemSet; move to new pool if necessary
128 if(pNewModel
&& GetObjectItemPool() && GetObjectItemPool() != &pNewModel
->GetItemPool())
130 MigrateItemPool(GetObjectItemPool(), &pNewModel
->GetItemPool(), pNewModel
);
134 SdrObject::SetModel(pNewModel
);
137 GetProperties().SetModel(pOldModel
, pNewModel
);
140 ////////////////////////////////////////////////////////////////////////////////////////////////////
141 // syntactical sugar for ItemSet accesses
143 void __EXPORT
SdrAttrObj::Notify(SfxBroadcaster
& /*rBC*/, const SfxHint
& rHint
)
145 SfxSimpleHint
*pSimple
= PTR_CAST(SfxSimpleHint
, &rHint
);
146 BOOL
bDataChg(pSimple
&& SFX_HINT_DATACHANGED
== pSimple
->GetId());
150 Rectangle aBoundRect
= GetLastBoundRect();
152 SetRectsDirty(sal_True
);
154 // This may have lead to object change
156 BroadcastObjectChange();
157 SendUserCall(SDRUSERCALL_CHGATTR
, aBoundRect
);
161 sal_Int32
SdrAttrObj::ImpGetLineWdt() const
163 sal_Int32
nRetval(0);
165 if(XLINE_NONE
!= ((XLineStyleItem
&)(GetObjectItem(XATTR_LINESTYLE
))).GetValue())
167 nRetval
= ((XLineWidthItem
&)(GetObjectItem(XATTR_LINEWIDTH
))).GetValue();
173 BOOL
SdrAttrObj::HasFill() const
175 return bClosedObj
&& ((XFillStyleItem
&)(GetProperties().GetObjectItemSet().Get(XATTR_FILLSTYLE
))).GetValue()!=XFILL_NONE
;
178 BOOL
SdrAttrObj::HasLine() const
180 return ((XLineStyleItem
&)(GetProperties().GetObjectItemSet().Get(XATTR_LINESTYLE
))).GetValue()!=XLINE_NONE
;