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 : #include <drawinglayer/attribute/sdrshadowattribute.hxx>
21 : #include <basegfx/vector/b2dvector.hxx>
22 : #include <basegfx/color/bcolor.hxx>
23 : #include <rtl/instance.hxx>
24 :
25 :
26 :
27 : namespace drawinglayer
28 : {
29 : namespace attribute
30 : {
31 0 : class ImpSdrShadowAttribute
32 : {
33 : public:
34 : // shadow definitions
35 : basegfx::B2DVector maOffset; // shadow offset 1/100th mm
36 : double mfTransparence; // [0.0 .. 1.0], 0.0==no transp.
37 : basegfx::BColor maColor; // color of shadow
38 :
39 0 : ImpSdrShadowAttribute(
40 : const basegfx::B2DVector& rOffset,
41 : double fTransparence,
42 : const basegfx::BColor& rColor)
43 : : maOffset(rOffset),
44 : mfTransparence(fTransparence),
45 0 : maColor(rColor)
46 : {
47 0 : }
48 :
49 0 : ImpSdrShadowAttribute()
50 : : maOffset(basegfx::B2DVector()),
51 : mfTransparence(0.0),
52 0 : maColor(basegfx::BColor())
53 : {
54 0 : }
55 :
56 : // data read access
57 0 : const basegfx::B2DVector& getOffset() const { return maOffset; }
58 0 : double getTransparence() const { return mfTransparence; }
59 0 : const basegfx::BColor& getColor() const { return maColor; }
60 :
61 0 : bool operator==(const ImpSdrShadowAttribute& rCandidate) const
62 : {
63 0 : return (getOffset() == rCandidate.getOffset()
64 0 : && getTransparence() == rCandidate.getTransparence()
65 0 : && getColor() == rCandidate.getColor());
66 : }
67 : };
68 :
69 : namespace
70 : {
71 : struct theGlobalDefault :
72 : public rtl::Static< SdrShadowAttribute::ImplType, theGlobalDefault > {};
73 : }
74 :
75 :
76 0 : SdrShadowAttribute::SdrShadowAttribute(
77 : const basegfx::B2DVector& rOffset,
78 : double fTransparence,
79 : const basegfx::BColor& rColor)
80 : : mpSdrShadowAttribute(ImpSdrShadowAttribute(
81 0 : rOffset, fTransparence, rColor))
82 : {
83 0 : }
84 :
85 0 : SdrShadowAttribute::SdrShadowAttribute()
86 0 : : mpSdrShadowAttribute(theGlobalDefault::get())
87 : {
88 0 : }
89 :
90 0 : SdrShadowAttribute::SdrShadowAttribute(const SdrShadowAttribute& rCandidate)
91 0 : : mpSdrShadowAttribute(rCandidate.mpSdrShadowAttribute)
92 : {
93 0 : }
94 :
95 0 : SdrShadowAttribute::~SdrShadowAttribute()
96 : {
97 0 : }
98 :
99 0 : bool SdrShadowAttribute::isDefault() const
100 : {
101 0 : return mpSdrShadowAttribute.same_object(theGlobalDefault::get());
102 : }
103 :
104 0 : SdrShadowAttribute& SdrShadowAttribute::operator=(const SdrShadowAttribute& rCandidate)
105 : {
106 0 : mpSdrShadowAttribute = rCandidate.mpSdrShadowAttribute;
107 0 : return *this;
108 : }
109 :
110 0 : bool SdrShadowAttribute::operator==(const SdrShadowAttribute& rCandidate) const
111 : {
112 0 : return mpSdrShadowAttribute == rCandidate.mpSdrShadowAttribute;
113 : }
114 :
115 0 : const basegfx::B2DVector& SdrShadowAttribute::getOffset() const
116 : {
117 0 : return mpSdrShadowAttribute->getOffset();
118 : }
119 :
120 0 : double SdrShadowAttribute::getTransparence() const
121 : {
122 0 : return mpSdrShadowAttribute->getTransparence();
123 : }
124 :
125 0 : const basegfx::BColor& SdrShadowAttribute::getColor() const
126 : {
127 0 : return mpSdrShadowAttribute->getColor();
128 : }
129 : } // end of namespace attribute
130 : } // end of namespace drawinglayer
131 :
132 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|