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/sdrlightattribute3d.hxx>
21 : #include <basegfx/color/bcolor.hxx>
22 : #include <basegfx/vector/b3dvector.hxx>
23 : #include <rtl/instance.hxx>
24 :
25 :
26 :
27 : namespace drawinglayer
28 : {
29 : namespace attribute
30 : {
31 81 : class ImpSdr3DLightAttribute
32 : {
33 : public:
34 : // 3D light attribute definitions
35 : basegfx::BColor maColor;
36 : basegfx::B3DVector maDirection;
37 :
38 : // bitfield
39 : bool mbSpecular : 1;
40 :
41 27 : ImpSdr3DLightAttribute(
42 : const basegfx::BColor& rColor,
43 : const basegfx::B3DVector& rDirection,
44 : bool bSpecular)
45 : : maColor(rColor),
46 : maDirection(rDirection),
47 27 : mbSpecular(bSpecular)
48 : {
49 27 : }
50 :
51 : // data read access
52 31036 : const basegfx::BColor& getColor() const { return maColor; }
53 37347 : const basegfx::B3DVector& getDirection() const { return maDirection; }
54 31036 : bool getSpecular() const { return mbSpecular; }
55 :
56 8 : bool operator==(const ImpSdr3DLightAttribute& rCandidate) const
57 : {
58 8 : return (getColor() == rCandidate.getColor()
59 8 : && getDirection() == rCandidate.getDirection()
60 16 : && getSpecular() == rCandidate.getSpecular());
61 : }
62 : };
63 :
64 : namespace
65 : {
66 : struct theGlobalDefault :
67 : public rtl::Static< Sdr3DLightAttribute::ImplType, theGlobalDefault > {};
68 : }
69 :
70 27 : Sdr3DLightAttribute::Sdr3DLightAttribute(
71 : const basegfx::BColor& rColor,
72 : const basegfx::B3DVector& rDirection,
73 : bool bSpecular)
74 : : mpSdr3DLightAttribute(ImpSdr3DLightAttribute(
75 27 : rColor, rDirection, bSpecular))
76 : {
77 27 : }
78 :
79 81 : Sdr3DLightAttribute::Sdr3DLightAttribute(const Sdr3DLightAttribute& rCandidate)
80 81 : : mpSdr3DLightAttribute(rCandidate.mpSdr3DLightAttribute)
81 : {
82 81 : }
83 :
84 108 : Sdr3DLightAttribute::~Sdr3DLightAttribute()
85 : {
86 108 : }
87 :
88 0 : Sdr3DLightAttribute& Sdr3DLightAttribute::operator=(const Sdr3DLightAttribute& rCandidate)
89 : {
90 0 : mpSdr3DLightAttribute = rCandidate.mpSdr3DLightAttribute;
91 0 : return *this;
92 : }
93 :
94 8 : bool Sdr3DLightAttribute::operator==(const Sdr3DLightAttribute& rCandidate) const
95 : {
96 8 : return rCandidate.mpSdr3DLightAttribute == mpSdr3DLightAttribute;
97 : }
98 :
99 31020 : const basegfx::BColor& Sdr3DLightAttribute::getColor() const
100 : {
101 31020 : return mpSdr3DLightAttribute->getColor();
102 : }
103 :
104 37331 : const basegfx::B3DVector& Sdr3DLightAttribute::getDirection() const
105 : {
106 37331 : return mpSdr3DLightAttribute->getDirection();
107 : }
108 :
109 31020 : bool Sdr3DLightAttribute::getSpecular() const
110 : {
111 31020 : return mpSdr3DLightAttribute->getSpecular();
112 : }
113 :
114 : } // end of namespace attribute
115 : } // end of namespace drawinglayer
116 :
117 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|