LibreOffice Module svx (master)  1
svdoattr.cxx
Go to the documentation of this file.
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/svdpool.hxx>
26 #include <svx/svdotext.hxx>
27 #include <svx/svdocapt.hxx>
28 #include <svx/svdograf.hxx>
29 #include <svx/svdoole2.hxx>
30 #include <svx/svdorect.hxx>
31 #include <svx/svdocirc.hxx>
32 #include <svx/svdomeas.hxx>
33 #include <svl/hint.hxx>
34 #include <svl/itemiter.hxx>
35 #include <svx/xenum.hxx>
36 #include <svx/xlineit0.hxx>
37 #include <svx/xlnstwit.hxx>
38 #include <svx/xlnedwit.hxx>
39 #include <svx/xfillit0.hxx>
40 #include <svx/xflbmtit.hxx>
41 #include <svx/xtextit0.hxx>
42 #include <svx/xflbstit.hxx>
43 #include <svx/xflbtoxy.hxx>
44 #include <svx/xftshit.hxx>
45 
46 #include <editeng/editdata.hxx>
47 #include <editeng/colritem.hxx>
48 #include <editeng/fontitem.hxx>
49 #include <editeng/fhgtitem.hxx>
50 
51 #include <svx/xlnstcit.hxx>
52 #include <svx/xlnwtit.hxx>
53 #include <svl/style.hxx>
54 #include <svl/whiter.hxx>
55 #include <svx/xlnclit.hxx>
56 #include <svx/xflclit.hxx>
57 #include <svx/xlntrit.hxx>
58 #include <svx/xfltrit.hxx>
59 #include <svx/xlnedcit.hxx>
60 #include <editeng/adjustitem.hxx>
61 #include <svx/xflbckit.hxx>
62 #include <svx/xtable.hxx>
63 #include <svx/xbtmpit.hxx>
64 #include <svx/xlndsit.hxx>
65 #include <svx/xlnedit.hxx>
66 #include <svx/xflgrit.hxx>
67 #include <svx/xflftrit.hxx>
68 #include <svx/xflhtit.hxx>
69 #include <svx/xlnstit.hxx>
72 #include <svx/xlinjoit.hxx>
73 
74 using namespace com::sun::star;
75 
76 std::unique_ptr<sdr::properties::BaseProperties> SdrAttrObj::CreateObjectSpecificProperties()
77 {
78  return std::make_unique<sdr::properties::AttributeProperties>(*this);
79 }
80 
81 
83 : SdrObject(rSdrModel)
84 {
85 }
86 
88 {
89 }
90 
92 {
93  if(bSnapRectDirty)
94  {
95  const_cast<SdrAttrObj*>(this)->RecalcSnapRect();
96  const_cast<SdrAttrObj*>(this)->bSnapRectDirty = false;
97  }
98 
99  return maSnapRect;
100 }
101 
102 // syntactical sugar for ItemSet accesses
103 void SdrAttrObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
104 {
105  bool bDataChg(SfxHintId::DataChanged == rHint.GetId());
106 
107  if(bDataChg)
108  {
109  tools::Rectangle aBoundRect = GetLastBoundRect();
111  SetRectsDirty(true);
112 
113  // This may have led to object change
114  SetChanged();
117  }
118 }
119 
120 sal_Int32 SdrAttrObj::ImpGetLineWdt() const
121 {
122  sal_Int32 nRetval(0);
123 
124  if(drawing::LineStyle_NONE != GetObjectItem(XATTR_LINESTYLE).GetValue())
125  {
126  nRetval = GetObjectItem(XATTR_LINEWIDTH).GetValue();
127  }
128 
129  return nRetval;
130 }
131 
133 {
134  return bClosedObj && GetProperties().GetObjectItemSet().Get(XATTR_FILLSTYLE).GetValue() != drawing::FillStyle_NONE;
135 }
136 
138 {
139  return GetProperties().GetObjectItemSet().Get(XATTR_LINESTYLE).GetValue() != drawing::LineStyle_NONE;
140 }
141 
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual const SfxItemSet & GetObjectItemSet() const =0
std::string GetValue
sal_Int32 ImpGetLineWdt() const
Detects the width of the line. No line ->0.
Definition: svdoattr.cxx:120
SdrAttrObj(SdrModel &rSdrModel)
Definition: svdoattr.cxx:82
virtual void SetBoundRectDirty()
Definition: svdobj.cxx:336
virtual sdr::properties::BaseProperties & GetProperties() const
Definition: svdobj.cxx:230
virtual const tools::Rectangle & GetSnapRect() const override
Definition: svdoattr.cxx:91
SfxHintId GetId() const
bool bSnapRectDirty
Definition: svdobj.hxx:928
virtual void RecalcSnapRect()
Snap is not done on the BoundRect but if possible on logic coordinates (i.e.
Definition: svdobj.cxx:1620
bool bClosedObj
Definition: svdobj.hxx:941
tools::Rectangle maSnapRect
Definition: svdoattr.hxx:42
const SfxPoolItem & GetObjectItem(const sal_uInt16 nWhich) const
Definition: svdobj.cxx:1941
void BroadcastObjectChange() const
Definition: svdobj.cxx:932
#define XATTR_LINESTYLE
Definition: xdef.hxx:90
#define XATTR_FILLSTYLE
Definition: xdef.hxx:107
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdoattr.cxx:76
Abstract DrawObject.
Definition: svdobj.hxx:312
#define XATTR_LINEWIDTH
Definition: xdef.hxx:92
virtual const tools::Rectangle & GetLastBoundRect() const
Definition: svdobj.cxx:895
bool HasFill() const
Definition: svdoattr.cxx:132
bool HasLine() const
Definition: svdoattr.cxx:137
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
Definition: svdoattr.cxx:103
virtual ~SdrAttrObj() override
Definition: svdoattr.cxx:87
virtual void SetRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:462
virtual void SetChanged()
Definition: svdobj.cxx:956
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
Definition: svdobj.cxx:2676