LibreOffice Module drawinglayer (master) 1
sdrshadowattribute.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
24
25
27{
29 {
30 public:
31 // shadow definitions
32 basegfx::B2DVector maOffset; // shadow offset 1/100th mm
33 basegfx::B2DVector maSize; // [0.0 .. 2.0]
34 double mfTransparence; // [0.0 .. 1.0], 0.0==no transp.
35 sal_Int32 mnBlur; // [0 .. 180], radius of the blur
37 basegfx::BColor maColor; // color of shadow
38
40 const basegfx::B2DVector& rOffset,
41 const basegfx::B2DVector& rSize,
42 double fTransparence,
43 sal_Int32 nBlur,
45 const basegfx::BColor& rColor)
46 : maOffset(rOffset),
47 maSize(rSize),
48 mfTransparence(fTransparence),
49 mnBlur(nBlur),
50 meAlignment(eAlignment),
51 maColor(rColor)
52 {
53 }
54
56 : mfTransparence(0.0),
57 mnBlur(0)
58 {
59 }
60
61 // data read access
62 const basegfx::B2DVector& getOffset() const { return maOffset; }
63 const basegfx::B2DVector& getSize() const { return maSize; }
64 double getTransparence() const { return mfTransparence; }
65 sal_Int32 getBlur() const { return mnBlur; }
66 const basegfx::BColor& getColor() const { return maColor; }
67
68 bool operator==(const ImpSdrShadowAttribute& rCandidate) const
69 {
70 return (getOffset() == rCandidate.getOffset()
71 && getSize() == rCandidate.getSize()
72 && getTransparence() == rCandidate.getTransparence()
73 && getBlur() == rCandidate.getBlur()
74 && meAlignment == rCandidate.meAlignment
75 && getColor() == rCandidate.getColor());
76 }
77 };
78
79 namespace
80 {
81 SdrShadowAttribute::ImplType& theGlobalDefault()
82 {
83 static SdrShadowAttribute::ImplType SINGLETON;
84 return SINGLETON;
85 }
86 }
87
88
90 const basegfx::B2DVector& rOffset,
91 const basegfx::B2DVector& rSize,
92 double fTransparence,
93 sal_Int32 nBlur,
95 const basegfx::BColor& rColor)
96 : mpSdrShadowAttribute(ImpSdrShadowAttribute(
97 rOffset, rSize, fTransparence, nBlur, eAlignment, rColor))
98 {
99 }
100
102 : mpSdrShadowAttribute(theGlobalDefault())
103 {
104 }
105
107
109
111
113 {
114 return mpSdrShadowAttribute.same_object(theGlobalDefault());
115 }
116
118
120
122 {
123 // tdf#87509 default attr is always != non-default attr, even with same values
124 if(rCandidate.isDefault() != isDefault())
125 return false;
126
127 return mpSdrShadowAttribute == rCandidate.mpSdrShadowAttribute;
128 }
129
131 {
132 return mpSdrShadowAttribute->getOffset();
133 }
134
136 {
137 return mpSdrShadowAttribute->getSize();
138 }
139
141 {
142 return mpSdrShadowAttribute->getTransparence();
143 }
144
146 {
147 return mpSdrShadowAttribute->getBlur();
148 }
149
151 {
152 return mpSdrShadowAttribute->meAlignment;
153 }
154
156 {
157 return mpSdrShadowAttribute->getColor();
158 }
159
160} // end of namespace
161
162/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const basegfx::B2DVector & getSize() const
ImpSdrShadowAttribute(const basegfx::B2DVector &rOffset, const basegfx::B2DVector &rSize, double fTransparence, sal_Int32 nBlur, model::RectangleAlignment eAlignment, const basegfx::BColor &rColor)
const basegfx::B2DVector & getOffset() const
bool operator==(const ImpSdrShadowAttribute &rCandidate) const
o3tl::cow_wrapper< ImpSdrShadowAttribute > ImplType
model::RectangleAlignment getAlignment() const
SdrShadowAttribute & operator=(const SdrShadowAttribute &)
const basegfx::B2DVector & getSize() const
const basegfx::B2DVector & getOffset() const
bool operator==(const SdrShadowAttribute &rCandidate) const
bool same_object(const cow_wrapper &rOther) const
RectangleAlignment