/src/libreoffice/svx/source/svdraw/svdoattr.cxx
Line | Count | Source |
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 | | #include <svx/svdoattr.hxx> |
21 | | #include <svx/svdmodel.hxx> |
22 | | #include <svl/hint.hxx> |
23 | | #include <svl/itemset.hxx> |
24 | | #include <svx/xdef.hxx> |
25 | | #include <svx/xlineit0.hxx> |
26 | | #include <svx/xfillit0.hxx> |
27 | | #include <svx/xlnwtit.hxx> |
28 | | #include <svx/sdr/properties/properties.hxx> |
29 | | |
30 | | using namespace com::sun::star; |
31 | | |
32 | | SdrAttrObj::SdrAttrObj(SdrModel& rSdrModel) |
33 | 1.47M | : SdrObject(rSdrModel) |
34 | 1.47M | { |
35 | 1.47M | } |
36 | | |
37 | | SdrAttrObj::SdrAttrObj(SdrModel& rSdrModel, SdrAttrObj const& rSource) |
38 | 22.9k | : SdrObject(rSdrModel, rSource) |
39 | 22.9k | { |
40 | 22.9k | } |
41 | | |
42 | 1.50M | SdrAttrObj::~SdrAttrObj() {} |
43 | | |
44 | | const tools::Rectangle& SdrAttrObj::GetSnapRect() const |
45 | 3.35M | { |
46 | 3.35M | if (m_bSnapRectDirty) |
47 | 426k | { |
48 | 426k | const_cast<SdrAttrObj*>(this)->RecalcSnapRect(); |
49 | 426k | const_cast<SdrAttrObj*>(this)->m_bSnapRectDirty = false; |
50 | 426k | } |
51 | | |
52 | 3.35M | return maSnapRect; |
53 | 3.35M | } |
54 | | |
55 | | // syntactical sugar for ItemSet accesses |
56 | | void SdrAttrObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) |
57 | 17.4M | { |
58 | 17.4M | bool bDataChg(SfxHintId::DataChanged == rHint.GetId()); |
59 | | |
60 | 17.4M | if (bDataChg) |
61 | 579k | { |
62 | 579k | tools::Rectangle aBoundRect = GetLastBoundRect(); |
63 | 579k | SetBoundRectDirty(); |
64 | 579k | SetBoundAndSnapRectsDirty(/*bNotMyself*/ true); |
65 | | |
66 | | // This may have led to object change |
67 | 579k | SetChanged(); |
68 | 579k | BroadcastObjectChange(); |
69 | 579k | SendUserCall(SdrUserCallType::ChangeAttr, aBoundRect); |
70 | 579k | } |
71 | 17.4M | } |
72 | | |
73 | | sal_Int32 SdrAttrObj::ImpGetLineWdt() const |
74 | 2.29k | { |
75 | 2.29k | sal_Int32 nRetval(0); |
76 | | |
77 | 2.29k | if (drawing::LineStyle_NONE != GetObjectItem(XATTR_LINESTYLE).GetValue()) |
78 | 200 | { |
79 | 200 | nRetval = GetObjectItem(XATTR_LINEWIDTH).GetValue(); |
80 | 200 | } |
81 | | |
82 | 2.29k | return nRetval; |
83 | 2.29k | } |
84 | | |
85 | | bool SdrAttrObj::HasFill() const |
86 | 0 | { |
87 | 0 | return m_bClosedObj |
88 | 0 | && GetProperties().GetObjectItemSet().Get(XATTR_FILLSTYLE).GetValue() |
89 | 0 | != drawing::FillStyle_NONE; |
90 | 0 | } |
91 | | |
92 | | bool SdrAttrObj::HasLine() const |
93 | 0 | { |
94 | 0 | return GetProperties().GetObjectItemSet().Get(XATTR_LINESTYLE).GetValue() |
95 | 0 | != drawing::LineStyle_NONE; |
96 | 0 | } |
97 | | |
98 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |