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 : #ifndef _SV_GRADIENT_HXX
21 : #define _SV_GRADIENT_HXX
22 :
23 : #include <sal/types.h>
24 : #include <vcl/dllapi.h>
25 : #include <tools/color.hxx>
26 :
27 : #include <vcl/vclenum.hxx>
28 :
29 : // ----------------
30 : // - Impl_Gradient -
31 : // ----------------
32 :
33 : class Rectangle;
34 : class Point;
35 : class SvStream;
36 :
37 : class Impl_Gradient
38 : {
39 : public:
40 : sal_uLong mnRefCount;
41 : GradientStyle meStyle;
42 : Color maStartColor;
43 : Color maEndColor;
44 : sal_uInt16 mnAngle;
45 : sal_uInt16 mnBorder;
46 : sal_uInt16 mnOfsX;
47 : sal_uInt16 mnOfsY;
48 : sal_uInt16 mnIntensityStart;
49 : sal_uInt16 mnIntensityEnd;
50 : sal_uInt16 mnStepCount;
51 :
52 : friend SvStream& operator>>( SvStream& rIStm, Impl_Gradient& rImplGradient );
53 : friend SvStream& operator<<( SvStream& rOStm, const Impl_Gradient& rImplGradient );
54 :
55 : Impl_Gradient();
56 : Impl_Gradient( const Impl_Gradient& rImplGradient );
57 : };
58 :
59 : // ------------
60 : // - Gradient -
61 : // ------------
62 :
63 : class VCL_DLLPUBLIC Gradient
64 : {
65 : private:
66 : Impl_Gradient* mpImplGradient;
67 : void MakeUnique();
68 :
69 : public:
70 : Gradient();
71 : Gradient( const Gradient& rGradient );
72 : Gradient( GradientStyle eStyle,
73 : const Color& rStartColor,
74 : const Color& rEndColor );
75 : ~Gradient();
76 :
77 : void SetStyle( GradientStyle eStyle );
78 208641 : GradientStyle GetStyle() const { return mpImplGradient->meStyle; }
79 :
80 : void SetStartColor( const Color& rColor );
81 69547 : const Color& GetStartColor() const { return mpImplGradient->maStartColor; }
82 : void SetEndColor( const Color& rColor );
83 69547 : const Color& GetEndColor() const { return mpImplGradient->maEndColor; }
84 :
85 : void SetAngle( sal_uInt16 nAngle );
86 139094 : sal_uInt16 GetAngle() const { return mpImplGradient->mnAngle; }
87 :
88 : void SetBorder( sal_uInt16 nBorder );
89 69547 : sal_uInt16 GetBorder() const { return mpImplGradient->mnBorder; }
90 : void SetOfsX( sal_uInt16 nOfsX );
91 0 : sal_uInt16 GetOfsX() const { return mpImplGradient->mnOfsX; }
92 : void SetOfsY( sal_uInt16 nOfsY );
93 0 : sal_uInt16 GetOfsY() const { return mpImplGradient->mnOfsY; }
94 :
95 : void SetStartIntensity( sal_uInt16 nIntens );
96 69547 : sal_uInt16 GetStartIntensity() const { return mpImplGradient->mnIntensityStart; }
97 : void SetEndIntensity( sal_uInt16 nIntens );
98 69547 : sal_uInt16 GetEndIntensity() const { return mpImplGradient->mnIntensityEnd; }
99 :
100 : void SetSteps( sal_uInt16 nSteps );
101 139094 : sal_uInt16 GetSteps() const { return mpImplGradient->mnStepCount; }
102 :
103 : void GetBoundRect( const Rectangle& rRect, Rectangle &rBoundRect, Point& rCenter ) const;
104 :
105 : Gradient& operator=( const Gradient& rGradient );
106 : sal_Bool operator==( const Gradient& rGradient ) const;
107 0 : sal_Bool operator!=( const Gradient& rGradient ) const
108 0 : { return !(Gradient::operator==( rGradient )); }
109 : sal_Bool IsSameInstance( const Gradient& rGradient ) const
110 : { return (mpImplGradient == rGradient.mpImplGradient); }
111 :
112 : friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Gradient& rGradient );
113 : friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const Gradient& rGradient );
114 : };
115 :
116 : #endif // _SV_GRADIENT_HXX
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|