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 namespace drawinglayer 27 { 28 namespace attribute 29 { 30 class ImpSdr3DLightAttribute 31 { 32 public: 33 // 3D light attribute definitions 34 basegfx::BColor maColor; 35 basegfx::B3DVector maDirection; 36 37 bool mbSpecular : 1; 38 ImpSdr3DLightAttribute(const basegfx::BColor & rColor,const basegfx::B3DVector & rDirection,bool bSpecular)39 ImpSdr3DLightAttribute( 40 const basegfx::BColor& rColor, 41 const basegfx::B3DVector& rDirection, 42 bool bSpecular) 43 : maColor(rColor), 44 maDirection(rDirection), 45 mbSpecular(bSpecular) 46 { 47 } 48 49 // data read access getColor() const50 const basegfx::BColor& getColor() const { return maColor; } getDirection() const51 const basegfx::B3DVector& getDirection() const { return maDirection; } getSpecular() const52 bool getSpecular() const { return mbSpecular; } 53 operator ==(const ImpSdr3DLightAttribute & rCandidate) const54 bool operator==(const ImpSdr3DLightAttribute& rCandidate) const 55 { 56 return (getColor() == rCandidate.getColor() 57 && getDirection() == rCandidate.getDirection() 58 && getSpecular() == rCandidate.getSpecular()); 59 } 60 }; 61 62 namespace 63 { 64 struct theGlobalDefault : 65 public rtl::Static< Sdr3DLightAttribute::ImplType, theGlobalDefault > {}; 66 } 67 Sdr3DLightAttribute(const basegfx::BColor & rColor,const basegfx::B3DVector & rDirection,bool bSpecular)68 Sdr3DLightAttribute::Sdr3DLightAttribute( 69 const basegfx::BColor& rColor, 70 const basegfx::B3DVector& rDirection, 71 bool bSpecular) 72 : mpSdr3DLightAttribute(ImpSdr3DLightAttribute( 73 rColor, rDirection, bSpecular)) 74 { 75 } 76 77 Sdr3DLightAttribute::Sdr3DLightAttribute(const Sdr3DLightAttribute&) = default; 78 79 Sdr3DLightAttribute::~Sdr3DLightAttribute() = default; 80 81 Sdr3DLightAttribute& Sdr3DLightAttribute::operator=(const Sdr3DLightAttribute&) = default; 82 operator ==(const Sdr3DLightAttribute & rCandidate) const83 bool Sdr3DLightAttribute::operator==(const Sdr3DLightAttribute& rCandidate) const 84 { 85 return rCandidate.mpSdr3DLightAttribute == mpSdr3DLightAttribute; 86 } 87 getColor() const88 const basegfx::BColor& Sdr3DLightAttribute::getColor() const 89 { 90 return mpSdr3DLightAttribute->getColor(); 91 } 92 getDirection() const93 const basegfx::B3DVector& Sdr3DLightAttribute::getDirection() const 94 { 95 return mpSdr3DLightAttribute->getDirection(); 96 } 97 getSpecular() const98 bool Sdr3DLightAttribute::getSpecular() const 99 { 100 return mpSdr3DLightAttribute->getSpecular(); 101 } 102 103 } // end of namespace attribute 104 } // end of namespace drawinglayer 105 106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 107