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