Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / svx / source / svdraw / svdoattr.cxx
blob2c1b208d314d965b8c6aa33e78c906468beb6eff
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 .
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 <sdr/properties/attributeproperties.hxx>
30 using namespace com::sun::star;
32 std::unique_ptr<sdr::properties::BaseProperties> SdrAttrObj::CreateObjectSpecificProperties()
34 return std::make_unique<sdr::properties::AttributeProperties>(*this);
37 SdrAttrObj::SdrAttrObj(SdrModel& rSdrModel)
38 : SdrObject(rSdrModel)
42 SdrAttrObj::SdrAttrObj(SdrModel& rSdrModel, SdrAttrObj const& rSource)
43 : SdrObject(rSdrModel, rSource)
47 SdrAttrObj::~SdrAttrObj() {}
49 const tools::Rectangle& SdrAttrObj::GetSnapRect() const
51 if (m_bSnapRectDirty)
53 const_cast<SdrAttrObj*>(this)->RecalcSnapRect();
54 const_cast<SdrAttrObj*>(this)->m_bSnapRectDirty = false;
57 return maSnapRect;
60 // syntactical sugar for ItemSet accesses
61 void SdrAttrObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
63 bool bDataChg(SfxHintId::DataChanged == rHint.GetId());
65 if (bDataChg)
67 tools::Rectangle aBoundRect = GetLastBoundRect();
68 SetBoundRectDirty();
69 SetBoundAndSnapRectsDirty(/*bNotMyself*/ true);
71 // This may have led to object change
72 SetChanged();
73 BroadcastObjectChange();
74 SendUserCall(SdrUserCallType::ChangeAttr, aBoundRect);
78 sal_Int32 SdrAttrObj::ImpGetLineWdt() const
80 sal_Int32 nRetval(0);
82 if (drawing::LineStyle_NONE != GetObjectItem(XATTR_LINESTYLE).GetValue())
84 nRetval = GetObjectItem(XATTR_LINEWIDTH).GetValue();
87 return nRetval;
90 bool SdrAttrObj::HasFill() const
92 return m_bClosedObj
93 && GetProperties().GetObjectItemSet().Get(XATTR_FILLSTYLE).GetValue()
94 != drawing::FillStyle_NONE;
97 bool SdrAttrObj::HasLine() const
99 return GetProperties().GetObjectItemSet().Get(XATTR_LINESTYLE).GetValue()
100 != drawing::LineStyle_NONE;
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */