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