bump product version to 4.1.6.2
[LibreOffice.git] / svx / source / svdraw / svdoattr.cxx
blob6806c6d32efde428d14b315f38da2f662912ac83
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/svdattrx.hxx>
27 #include <svx/svdpool.hxx>
28 #include <svx/svdotext.hxx>
29 #include <svx/svdocapt.hxx>
30 #include <svx/svdograf.hxx>
31 #include <svx/svdoole2.hxx>
32 #include <svx/svdorect.hxx>
33 #include <svx/svdocirc.hxx>
34 #include <svx/svdomeas.hxx>
35 #include <svl/smplhint.hxx>
36 #include <svl/itemiter.hxx>
37 #include <svx/xenum.hxx>
38 #include <svx/xlineit0.hxx>
39 #include <svx/xlnstwit.hxx>
40 #include <svx/xlnedwit.hxx>
41 #include <svx/xfillit0.hxx>
42 #include <svx/xflbmtit.hxx>
43 #include <svx/xtextit0.hxx>
44 #include <svx/xflbstit.hxx>
45 #include <svx/xflbtoxy.hxx>
46 #include <svx/xftshit.hxx>
48 #include <editeng/editdata.hxx>
49 #include <editeng/colritem.hxx>
50 #include "editeng/fontitem.hxx"
51 #include <editeng/fhgtitem.hxx>
53 #include <svx/xlnstcit.hxx>
54 #include <svx/xlnwtit.hxx>
55 #include <svl/style.hxx>
56 #include <svl/whiter.hxx>
57 #include <svx/xlnclit.hxx>
58 #include <svx/xflclit.hxx>
59 #include <svx/xlntrit.hxx>
60 #include <svx/xfltrit.hxx>
61 #include <svx/xlnedcit.hxx>
62 #include <editeng/adjustitem.hxx>
63 #include <svx/xflbckit.hxx>
64 #include <svx/xtable.hxx>
65 #include <svx/xbtmpit.hxx>
66 #include <svx/xlndsit.hxx>
67 #include <svx/xlnedit.hxx>
68 #include <svx/xflgrit.hxx>
69 #include <svx/xflftrit.hxx>
70 #include <svx/xflhtit.hxx>
71 #include <svx/xlnstit.hxx>
72 #include <svx/sdr/properties/attributeproperties.hxx>
73 #include <basegfx/polygon/b2dpolygon.hxx>
74 #include "svx/xlinjoit.hxx"
76 //////////////////////////////////////////////////////////////////////////////
78 sdr::properties::BaseProperties* SdrAttrObj::CreateObjectSpecificProperties()
80 return new sdr::properties::AttributeProperties(*this);
83 ////////////////////////////////////////////////////////////////////////////////////////////////////
85 TYPEINIT1(SdrAttrObj,SdrObject);
87 SdrAttrObj::SdrAttrObj()
91 SdrAttrObj::~SdrAttrObj()
95 const Rectangle& SdrAttrObj::GetSnapRect() const
97 if(bSnapRectDirty)
99 ((SdrAttrObj*)this)->RecalcSnapRect();
100 ((SdrAttrObj*)this)->bSnapRectDirty = false;
103 return maSnapRect;
106 void SdrAttrObj::SetModel(SdrModel* pNewModel)
108 SdrModel* pOldModel = pModel;
110 // test for correct pool in ItemSet; move to new pool if necessary
111 if(pNewModel && GetObjectItemPool() && GetObjectItemPool() != &pNewModel->GetItemPool())
113 MigrateItemPool(GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
116 // call parent
117 SdrObject::SetModel(pNewModel);
119 // modify properties
120 GetProperties().SetModel(pOldModel, pNewModel);
123 ////////////////////////////////////////////////////////////////////////////////////////////////////
124 // syntactical sugar for ItemSet accesses
126 void SdrAttrObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
128 SfxSimpleHint *pSimple = PTR_CAST(SfxSimpleHint, &rHint);
129 bool bDataChg(pSimple && SFX_HINT_DATACHANGED == pSimple->GetId());
131 if(bDataChg)
133 Rectangle aBoundRect = GetLastBoundRect();
134 SetBoundRectDirty();
135 SetRectsDirty(sal_True);
137 // This may have led to object change
138 SetChanged();
139 BroadcastObjectChange();
140 SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect);
144 sal_Int32 SdrAttrObj::ImpGetLineWdt() const
146 sal_Int32 nRetval(0);
148 if(XLINE_NONE != ((XLineStyleItem&)(GetObjectItem(XATTR_LINESTYLE))).GetValue())
150 nRetval = ((XLineWidthItem&)(GetObjectItem(XATTR_LINEWIDTH))).GetValue();
153 return nRetval;
156 sal_Bool SdrAttrObj::HasFill() const
158 return bClosedObj && ((XFillStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_FILLSTYLE))).GetValue()!=XFILL_NONE;
161 sal_Bool SdrAttrObj::HasLine() const
163 return ((XLineStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_LINESTYLE))).GetValue()!=XLINE_NONE;
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */