Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 :
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>
46 :
47 : #include <editeng/editdata.hxx>
48 : #include <editeng/colritem.hxx>
49 : #include "editeng/fontitem.hxx"
50 : #include <editeng/fhgtitem.hxx>
51 :
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"
74 :
75 :
76 :
77 0 : sdr::properties::BaseProperties* SdrAttrObj::CreateObjectSpecificProperties()
78 : {
79 0 : return new sdr::properties::AttributeProperties(*this);
80 : }
81 :
82 :
83 :
84 0 : TYPEINIT1(SdrAttrObj,SdrObject);
85 :
86 0 : SdrAttrObj::SdrAttrObj()
87 : {
88 0 : }
89 :
90 0 : SdrAttrObj::~SdrAttrObj()
91 : {
92 0 : }
93 :
94 0 : const Rectangle& SdrAttrObj::GetSnapRect() const
95 : {
96 0 : if(bSnapRectDirty)
97 : {
98 0 : ((SdrAttrObj*)this)->RecalcSnapRect();
99 0 : ((SdrAttrObj*)this)->bSnapRectDirty = false;
100 : }
101 :
102 0 : return maSnapRect;
103 : }
104 :
105 0 : void SdrAttrObj::SetModel(SdrModel* pNewModel)
106 : {
107 0 : SdrModel* pOldModel = pModel;
108 :
109 : // test for correct pool in ItemSet; move to new pool if necessary
110 0 : if(pNewModel && GetObjectItemPool() && GetObjectItemPool() != &pNewModel->GetItemPool())
111 : {
112 0 : MigrateItemPool(GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
113 : }
114 :
115 : // call parent
116 0 : SdrObject::SetModel(pNewModel);
117 :
118 : // modify properties
119 0 : GetProperties().SetModel(pOldModel, pNewModel);
120 0 : }
121 :
122 :
123 : // syntactical sugar for ItemSet accesses
124 :
125 0 : void SdrAttrObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
126 : {
127 0 : SfxSimpleHint *pSimple = PTR_CAST(SfxSimpleHint, &rHint);
128 0 : bool bDataChg(pSimple && SFX_HINT_DATACHANGED == pSimple->GetId());
129 :
130 0 : if(bDataChg)
131 : {
132 0 : Rectangle aBoundRect = GetLastBoundRect();
133 0 : SetBoundRectDirty();
134 0 : SetRectsDirty(true);
135 :
136 : // This may have led to object change
137 0 : SetChanged();
138 0 : BroadcastObjectChange();
139 0 : SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect);
140 : }
141 0 : }
142 :
143 0 : sal_Int32 SdrAttrObj::ImpGetLineWdt() const
144 : {
145 0 : sal_Int32 nRetval(0);
146 :
147 0 : if(XLINE_NONE != ((XLineStyleItem&)(GetObjectItem(XATTR_LINESTYLE))).GetValue())
148 : {
149 0 : nRetval = ((XLineWidthItem&)(GetObjectItem(XATTR_LINEWIDTH))).GetValue();
150 : }
151 :
152 0 : return nRetval;
153 : }
154 :
155 0 : bool SdrAttrObj::HasFill() const
156 : {
157 0 : return bClosedObj && ((XFillStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_FILLSTYLE))).GetValue()!=XFILL_NONE;
158 : }
159 :
160 0 : bool SdrAttrObj::HasLine() const
161 : {
162 0 : return ((XLineStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_LINESTYLE))).GetValue()!=XLINE_NONE;
163 : }
164 :
165 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|