1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SV_GRADIENT_HXX 25 #define _SV_GRADIENT_HXX 26 27 #include <vcl/dllapi.h> 28 #include <tools/color.hxx> 29 30 #include <vcl/vclenum.hxx> 31 32 // ------------------ 33 // - Gradient-Types - 34 // ------------------ 35 36 /* 37 #ifndef ENUM_GRADIENTSTYLE_DECLARED 38 #define ENUM_GRADIENTSTYLE_DECLARED 39 enum GradientStyle { GRADIENT_LINEAR, GRADIENT_AXIAL, GRADIENT_RADIAL, 40 GRADIENT_ELLIPTICAL, GRADIENT_SQUARE, GRADIENT_RECT }; 41 #endif 42 */ 43 44 // ---------------- 45 // - Impl_Gradient - 46 // ---------------- 47 48 class SvStream; 49 50 class Impl_Gradient 51 { 52 public: 53 sal_uLong mnRefCount; 54 GradientStyle meStyle; 55 Color maStartColor; 56 Color maEndColor; 57 sal_uInt16 mnAngle; 58 sal_uInt16 mnBorder; 59 sal_uInt16 mnOfsX; 60 sal_uInt16 mnOfsY; 61 sal_uInt16 mnIntensityStart; 62 sal_uInt16 mnIntensityEnd; 63 sal_uInt16 mnStepCount; 64 65 friend SvStream& operator>>( SvStream& rIStm, Impl_Gradient& rImplGradient ); 66 friend SvStream& operator<<( SvStream& rOStm, const Impl_Gradient& rImplGradient ); 67 68 Impl_Gradient(); 69 Impl_Gradient( const Impl_Gradient& rImplGradient ); 70 }; 71 72 // ------------ 73 // - Gradient - 74 // ------------ 75 76 class VCL_DLLPUBLIC Gradient 77 { 78 private: 79 Impl_Gradient* mpImplGradient; 80 void MakeUnique(); 81 82 public: 83 Gradient(); 84 Gradient( const Gradient& rGradient ); 85 Gradient( GradientStyle eStyle ); 86 Gradient( GradientStyle eStyle, 87 const Color& rStartColor, 88 const Color& rEndColor ); 89 ~Gradient(); 90 91 void SetStyle( GradientStyle eStyle ); GetStyle() const92 GradientStyle GetStyle() const { return mpImplGradient->meStyle; } 93 94 void SetStartColor( const Color& rColor ); GetStartColor() const95 const Color& GetStartColor() const { return mpImplGradient->maStartColor; } 96 void SetEndColor( const Color& rColor ); GetEndColor() const97 const Color& GetEndColor() const { return mpImplGradient->maEndColor; } 98 99 void SetAngle( sal_uInt16 nAngle ); GetAngle() const100 sal_uInt16 GetAngle() const { return mpImplGradient->mnAngle; } 101 102 void SetBorder( sal_uInt16 nBorder ); GetBorder() const103 sal_uInt16 GetBorder() const { return mpImplGradient->mnBorder; } 104 void SetOfsX( sal_uInt16 nOfsX ); GetOfsX() const105 sal_uInt16 GetOfsX() const { return mpImplGradient->mnOfsX; } 106 void SetOfsY( sal_uInt16 nOfsY ); GetOfsY() const107 sal_uInt16 GetOfsY() const { return mpImplGradient->mnOfsY; } 108 109 void SetStartIntensity( sal_uInt16 nIntens ); GetStartIntensity() const110 sal_uInt16 GetStartIntensity() const { return mpImplGradient->mnIntensityStart; } 111 void SetEndIntensity( sal_uInt16 nIntens ); GetEndIntensity() const112 sal_uInt16 GetEndIntensity() const { return mpImplGradient->mnIntensityEnd; } 113 114 void SetSteps( sal_uInt16 nSteps ); GetSteps() const115 sal_uInt16 GetSteps() const { return mpImplGradient->mnStepCount; } 116 117 Gradient& operator=( const Gradient& rGradient ); 118 sal_Bool operator==( const Gradient& rGradient ) const; operator !=(const Gradient & rGradient) const119 sal_Bool operator!=( const Gradient& rGradient ) const 120 { return !(Gradient::operator==( rGradient )); } IsSameInstance(const Gradient & rGradient) const121 sal_Bool IsSameInstance( const Gradient& rGradient ) const 122 { return (mpImplGradient == rGradient.mpImplGradient); } 123 124 friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Gradient& rGradient ); 125 friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const Gradient& rGradient ); 126 }; 127 128 #endif // _SV_GRADIENT_HXX 129