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 <sdr/properties/attributeproperties.hxx>
72 : #include <basegfx/polygon/b2dpolygon.hxx>
73 : #include "svx/xlinjoit.hxx"
74 :
75 : using namespace com::sun::star;
76 :
77 0 : sdr::properties::BaseProperties* SdrAttrObj::CreateObjectSpecificProperties()
78 : {
79 0 : return new sdr::properties::AttributeProperties(*this);
80 : }
81 :
82 :
83 :
84 3407962 : TYPEINIT1(SdrAttrObj,SdrObject);
85 :
86 74336 : SdrAttrObj::SdrAttrObj()
87 : {
88 74336 : }
89 :
90 73563 : SdrAttrObj::~SdrAttrObj()
91 : {
92 73563 : }
93 :
94 1563881 : const Rectangle& SdrAttrObj::GetSnapRect() const
95 : {
96 1563881 : if(bSnapRectDirty)
97 : {
98 119498 : const_cast<SdrAttrObj*>(this)->RecalcSnapRect();
99 119498 : const_cast<SdrAttrObj*>(this)->bSnapRectDirty = false;
100 : }
101 :
102 1563881 : return maSnapRect;
103 : }
104 :
105 125739 : void SdrAttrObj::SetModel(SdrModel* pNewModel)
106 : {
107 125739 : SdrModel* pOldModel = pModel;
108 :
109 : // test for correct pool in ItemSet; move to new pool if necessary
110 125739 : if(pNewModel && &GetObjectItemPool() != &pNewModel->GetItemPool())
111 : {
112 69138 : MigrateItemPool(&GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
113 : }
114 :
115 : // call parent
116 125739 : SdrObject::SetModel(pNewModel);
117 :
118 : // modify properties
119 125739 : GetProperties().SetModel(pOldModel, pNewModel);
120 125739 : }
121 :
122 :
123 : // syntactical sugar for ItemSet accesses
124 :
125 334934 : void SdrAttrObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
126 : {
127 334934 : const SfxSimpleHint* pSimple = dynamic_cast<const SfxSimpleHint*>(&rHint);
128 334934 : bool bDataChg(pSimple && SFX_HINT_DATACHANGED == pSimple->GetId());
129 :
130 334934 : if(bDataChg)
131 : {
132 295880 : Rectangle aBoundRect = GetLastBoundRect();
133 295880 : SetBoundRectDirty();
134 295880 : SetRectsDirty(true);
135 :
136 : // This may have led to object change
137 295880 : SetChanged();
138 295880 : BroadcastObjectChange();
139 295880 : SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect);
140 : }
141 334934 : }
142 :
143 584 : sal_Int32 SdrAttrObj::ImpGetLineWdt() const
144 : {
145 584 : sal_Int32 nRetval(0);
146 :
147 584 : if(drawing::LineStyle_NONE != static_cast<const XLineStyleItem&>(GetObjectItem(XATTR_LINESTYLE)).GetValue())
148 : {
149 36 : nRetval = static_cast<const XLineWidthItem&>(GetObjectItem(XATTR_LINEWIDTH)).GetValue();
150 : }
151 :
152 584 : return nRetval;
153 : }
154 :
155 0 : bool SdrAttrObj::HasFill() const
156 : {
157 0 : return bClosedObj && static_cast<const XFillStyleItem&>(GetProperties().GetObjectItemSet().Get(XATTR_FILLSTYLE)).GetValue() != drawing::FillStyle_NONE;
158 : }
159 :
160 0 : bool SdrAttrObj::HasLine() const
161 : {
162 0 : return static_cast<const XLineStyleItem&>(GetProperties().GetObjectItemSet().Get(XATTR_LINESTYLE)).GetValue() != drawing::LineStyle_NONE;
163 435 : }
164 :
165 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|