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 5772754 : TYPEINIT1(SdrAttrObj,SdrObject);
85 :
86 64875 : SdrAttrObj::SdrAttrObj()
87 : {
88 64875 : }
89 :
90 63792 : SdrAttrObj::~SdrAttrObj()
91 : {
92 63792 : }
93 :
94 2852921 : const Rectangle& SdrAttrObj::GetSnapRect() const
95 : {
96 2852921 : if(bSnapRectDirty)
97 : {
98 89537 : ((SdrAttrObj*)this)->RecalcSnapRect();
99 89537 : ((SdrAttrObj*)this)->bSnapRectDirty = false;
100 : }
101 :
102 2852921 : return maSnapRect;
103 : }
104 :
105 96581 : void SdrAttrObj::SetModel(SdrModel* pNewModel)
106 : {
107 96581 : SdrModel* pOldModel = pModel;
108 :
109 : // test for correct pool in ItemSet; move to new pool if necessary
110 96581 : if(pNewModel && &GetObjectItemPool() != &pNewModel->GetItemPool())
111 : {
112 55223 : MigrateItemPool(&GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
113 : }
114 :
115 : // call parent
116 96581 : SdrObject::SetModel(pNewModel);
117 :
118 : // modify properties
119 96581 : GetProperties().SetModel(pOldModel, pNewModel);
120 96581 : }
121 :
122 :
123 : // syntactical sugar for ItemSet accesses
124 :
125 376605 : void SdrAttrObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
126 : {
127 376605 : const SfxSimpleHint* pSimple = dynamic_cast<const SfxSimpleHint*>(&rHint);
128 376605 : bool bDataChg(pSimple && SFX_HINT_DATACHANGED == pSimple->GetId());
129 :
130 376605 : if(bDataChg)
131 : {
132 327426 : Rectangle aBoundRect = GetLastBoundRect();
133 327426 : SetBoundRectDirty();
134 327426 : SetRectsDirty(true);
135 :
136 : // This may have led to object change
137 327426 : SetChanged();
138 327426 : BroadcastObjectChange();
139 327426 : SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect);
140 : }
141 376605 : }
142 :
143 480 : sal_Int32 SdrAttrObj::ImpGetLineWdt() const
144 : {
145 480 : sal_Int32 nRetval(0);
146 :
147 480 : if(XLINE_NONE != static_cast<const XLineStyleItem&>(GetObjectItem(XATTR_LINESTYLE)).GetValue())
148 : {
149 48 : nRetval = static_cast<const XLineWidthItem&>(GetObjectItem(XATTR_LINEWIDTH)).GetValue();
150 : }
151 :
152 480 : 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() != XLINE_NONE;
163 651 : }
164 :
165 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|