Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / svx / source / svdraw / svdoattr.cxx
blobba7e8b1aad6e85904bcd6a65e5fa52ec97cab06e
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 .
21 #include <svx/svdoattr.hxx>
22 #include <svx/xpool.hxx>
23 #include <svx/svdmodel.hxx>
24 #include <svx/svdpage.hxx>
25 #include <svx/svdattr.hxx>
26 #include <svx/svdpool.hxx>
27 #include <svx/svdotext.hxx>
28 #include <svx/svdocapt.hxx>
29 #include <svx/svdograf.hxx>
30 #include <svx/svdoole2.hxx>
31 #include <svx/svdorect.hxx>
32 #include <svx/svdocirc.hxx>
33 #include <svx/svdomeas.hxx>
34 #include <svl/smplhint.hxx>
35 #include <svl/itemiter.hxx>
36 #include <svx/xenum.hxx>
37 #include <svx/xlineit0.hxx>
38 #include <svx/xlnstwit.hxx>
39 #include <svx/xlnedwit.hxx>
40 #include <svx/xfillit0.hxx>
41 #include <svx/xflbmtit.hxx>
42 #include <svx/xtextit0.hxx>
43 #include <svx/xflbstit.hxx>
44 #include <svx/xflbtoxy.hxx>
45 #include <svx/xftshit.hxx>
47 #include <editeng/editdata.hxx>
48 #include <editeng/colritem.hxx>
49 #include "editeng/fontitem.hxx"
50 #include <editeng/fhgtitem.hxx>
52 #include <svx/xlnstcit.hxx>
53 #include <svx/xlnwtit.hxx>
54 #include <svl/style.hxx>
55 #include <svl/whiter.hxx>
56 #include <svx/xlnclit.hxx>
57 #include <svx/xflclit.hxx>
58 #include <svx/xlntrit.hxx>
59 #include <svx/xfltrit.hxx>
60 #include <svx/xlnedcit.hxx>
61 #include <editeng/adjustitem.hxx>
62 #include <svx/xflbckit.hxx>
63 #include <svx/xtable.hxx>
64 #include <svx/xbtmpit.hxx>
65 #include <svx/xlndsit.hxx>
66 #include <svx/xlnedit.hxx>
67 #include <svx/xflgrit.hxx>
68 #include <svx/xflftrit.hxx>
69 #include <svx/xflhtit.hxx>
70 #include <svx/xlnstit.hxx>
71 #include <svx/sdr/properties/attributeproperties.hxx>
72 #include <basegfx/polygon/b2dpolygon.hxx>
73 #include "svx/xlinjoit.hxx"
77 sdr::properties::BaseProperties* SdrAttrObj::CreateObjectSpecificProperties()
79 return new sdr::properties::AttributeProperties(*this);
84 TYPEINIT1(SdrAttrObj,SdrObject);
86 SdrAttrObj::SdrAttrObj()
90 SdrAttrObj::~SdrAttrObj()
94 const Rectangle& SdrAttrObj::GetSnapRect() const
96 if(bSnapRectDirty)
98 ((SdrAttrObj*)this)->RecalcSnapRect();
99 ((SdrAttrObj*)this)->bSnapRectDirty = false;
102 return maSnapRect;
105 void SdrAttrObj::SetModel(SdrModel* pNewModel)
107 SdrModel* pOldModel = pModel;
109 // test for correct pool in ItemSet; move to new pool if necessary
110 if(pNewModel && GetObjectItemPool() && GetObjectItemPool() != &pNewModel->GetItemPool())
112 MigrateItemPool(GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
115 // call parent
116 SdrObject::SetModel(pNewModel);
118 // modify properties
119 GetProperties().SetModel(pOldModel, pNewModel);
123 // syntactical sugar for ItemSet accesses
125 void SdrAttrObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
127 SfxSimpleHint *pSimple = PTR_CAST(SfxSimpleHint, &rHint);
128 bool bDataChg(pSimple && SFX_HINT_DATACHANGED == pSimple->GetId());
130 if(bDataChg)
132 Rectangle aBoundRect = GetLastBoundRect();
133 SetBoundRectDirty();
134 SetRectsDirty(true);
136 // This may have led to object change
137 SetChanged();
138 BroadcastObjectChange();
139 SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect);
143 sal_Int32 SdrAttrObj::ImpGetLineWdt() const
145 sal_Int32 nRetval(0);
147 if(XLINE_NONE != ((XLineStyleItem&)(GetObjectItem(XATTR_LINESTYLE))).GetValue())
149 nRetval = ((XLineWidthItem&)(GetObjectItem(XATTR_LINEWIDTH))).GetValue();
152 return nRetval;
155 bool SdrAttrObj::HasFill() const
157 return bClosedObj && ((XFillStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_FILLSTYLE))).GetValue()!=XFILL_NONE;
160 bool SdrAttrObj::HasLine() const
162 return ((XLineStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_LINESTYLE))).GetValue()!=XLINE_NONE;
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */