Version 3.6.0.2, tag libreoffice-3.6.0.2
[LibreOffice.git] / svx / source / svdraw / svdoattr.cxx
blobee79f42dd8d9e3e572148ee291824f8a43053e1b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include <svx/svdoattr.hxx>
31 #include <svx/xpool.hxx>
32 #include "svx/svditext.hxx"
33 #include <svx/svdmodel.hxx>
34 #include <svx/svdpage.hxx>
35 #include <svx/svdattr.hxx>
36 #include <svx/svdattrx.hxx>
37 #include <svx/svdpool.hxx>
38 #include <svx/svdotext.hxx>
39 #include <svx/svdocapt.hxx>
40 #include <svx/svdograf.hxx>
41 #include <svx/svdoole2.hxx>
42 #include <svx/svdorect.hxx>
43 #include <svx/svdocirc.hxx>
44 #include <svx/svdomeas.hxx>
45 #include <svl/smplhint.hxx>
46 #include <svl/itemiter.hxx>
47 #include <svx/xenum.hxx>
48 #include <svx/xlineit0.hxx>
49 #include <svx/xlnstwit.hxx>
50 #include <svx/xlnedwit.hxx>
51 #include <svx/xfillit0.hxx>
52 #include <svx/xflbmtit.hxx>
53 #include <svx/xtextit0.hxx>
54 #include <svx/xflbstit.hxx>
55 #include <svx/xflbtoxy.hxx>
56 #include <svx/xftshit.hxx>
59 #include <editeng/colritem.hxx>
60 #include "editeng/fontitem.hxx"
61 #include <editeng/fhgtitem.hxx>
63 #include <svx/xlnstcit.hxx>
64 #include <svx/xlnwtit.hxx>
65 #include <svl/style.hxx>
66 #include <svl/whiter.hxx>
67 #include <svx/xlnclit.hxx>
68 #include <svx/xflclit.hxx>
69 #include <svx/xlntrit.hxx>
70 #include <svx/xfltrit.hxx>
71 #include <svx/xlnedcit.hxx>
72 #include <editeng/adjitem.hxx>
73 #include <svx/xflbckit.hxx>
74 #include <svx/xtable.hxx>
75 #include <svx/xbtmpit.hxx>
76 #include <svx/xlndsit.hxx>
77 #include <svx/xlnedit.hxx>
78 #include <svx/xflgrit.hxx>
79 #include <svx/xflftrit.hxx>
80 #include <svx/xflhtit.hxx>
81 #include <svx/xlnstit.hxx>
82 #include <svx/sdr/properties/attributeproperties.hxx>
83 #include <basegfx/polygon/b2dpolygon.hxx>
84 #include "svx/xlinjoit.hxx"
86 //////////////////////////////////////////////////////////////////////////////
88 sdr::properties::BaseProperties* SdrAttrObj::CreateObjectSpecificProperties()
90 return new sdr::properties::AttributeProperties(*this);
93 ////////////////////////////////////////////////////////////////////////////////////////////////////
95 TYPEINIT1(SdrAttrObj,SdrObject);
97 SdrAttrObj::SdrAttrObj()
101 SdrAttrObj::~SdrAttrObj()
105 const Rectangle& SdrAttrObj::GetSnapRect() const
107 if(bSnapRectDirty)
109 ((SdrAttrObj*)this)->RecalcSnapRect();
110 ((SdrAttrObj*)this)->bSnapRectDirty = false;
113 return maSnapRect;
116 void SdrAttrObj::SetModel(SdrModel* pNewModel)
118 SdrModel* pOldModel = pModel;
120 // test for correct pool in ItemSet; move to new pool if necessary
121 if(pNewModel && GetObjectItemPool() && GetObjectItemPool() != &pNewModel->GetItemPool())
123 MigrateItemPool(GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
126 // call parent
127 SdrObject::SetModel(pNewModel);
129 // modify properties
130 GetProperties().SetModel(pOldModel, pNewModel);
133 ////////////////////////////////////////////////////////////////////////////////////////////////////
134 // syntactical sugar for ItemSet accesses
136 void SdrAttrObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
138 SfxSimpleHint *pSimple = PTR_CAST(SfxSimpleHint, &rHint);
139 sal_Bool bDataChg(pSimple && SFX_HINT_DATACHANGED == pSimple->GetId());
141 if(bDataChg)
143 Rectangle aBoundRect = GetLastBoundRect();
144 SetBoundRectDirty();
145 SetRectsDirty(sal_True);
147 // This may have led to object change
148 SetChanged();
149 BroadcastObjectChange();
150 SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect);
154 sal_Int32 SdrAttrObj::ImpGetLineWdt() const
156 sal_Int32 nRetval(0);
158 if(XLINE_NONE != ((XLineStyleItem&)(GetObjectItem(XATTR_LINESTYLE))).GetValue())
160 nRetval = ((XLineWidthItem&)(GetObjectItem(XATTR_LINEWIDTH))).GetValue();
163 return nRetval;
166 sal_Bool SdrAttrObj::HasFill() const
168 return bClosedObj && ((XFillStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_FILLSTYLE))).GetValue()!=XFILL_NONE;
171 sal_Bool SdrAttrObj::HasLine() const
173 return ((XLineStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_LINESTYLE))).GetValue()!=XLINE_NONE;
176 // eof
178 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */