Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SV_GRADIENT_HXX
30 : : #define _SV_GRADIENT_HXX
31 : :
32 : : #include <vcl/dllapi.h>
33 : : #include <tools/color.hxx>
34 : : #include <tools/gen.hxx>
35 : :
36 : : #include <vcl/vclenum.hxx>
37 : :
38 : : // ----------------
39 : : // - Impl_Gradient -
40 : : // ----------------
41 : :
42 : : class SvStream;
43 : :
44 : : class Impl_Gradient
45 : : {
46 : : public:
47 : : sal_uLong mnRefCount;
48 : : GradientStyle meStyle;
49 : : Color maStartColor;
50 : : Color maEndColor;
51 : : sal_uInt16 mnAngle;
52 : : sal_uInt16 mnBorder;
53 : : sal_uInt16 mnOfsX;
54 : : sal_uInt16 mnOfsY;
55 : : sal_uInt16 mnIntensityStart;
56 : : sal_uInt16 mnIntensityEnd;
57 : : sal_uInt16 mnStepCount;
58 : :
59 : : friend SvStream& operator>>( SvStream& rIStm, Impl_Gradient& rImplGradient );
60 : : friend SvStream& operator<<( SvStream& rOStm, const Impl_Gradient& rImplGradient );
61 : :
62 : : Impl_Gradient();
63 : : Impl_Gradient( const Impl_Gradient& rImplGradient );
64 : : };
65 : :
66 : : // ------------
67 : : // - Gradient -
68 : : // ------------
69 : :
70 : : class VCL_DLLPUBLIC Gradient
71 : : {
72 : : private:
73 : : Impl_Gradient* mpImplGradient;
74 : : void MakeUnique();
75 : :
76 : : public:
77 : : Gradient();
78 : : Gradient( const Gradient& rGradient );
79 : : Gradient( GradientStyle eStyle,
80 : : const Color& rStartColor,
81 : : const Color& rEndColor );
82 : : ~Gradient();
83 : :
84 : : void SetStyle( GradientStyle eStyle );
85 : 337002 : GradientStyle GetStyle() const { return mpImplGradient->meStyle; }
86 : :
87 : : void SetStartColor( const Color& rColor );
88 : 112334 : const Color& GetStartColor() const { return mpImplGradient->maStartColor; }
89 : : void SetEndColor( const Color& rColor );
90 : 112334 : const Color& GetEndColor() const { return mpImplGradient->maEndColor; }
91 : :
92 : : void SetAngle( sal_uInt16 nAngle );
93 : 224668 : sal_uInt16 GetAngle() const { return mpImplGradient->mnAngle; }
94 : :
95 : : void SetBorder( sal_uInt16 nBorder );
96 : 112334 : sal_uInt16 GetBorder() const { return mpImplGradient->mnBorder; }
97 : : void SetOfsX( sal_uInt16 nOfsX );
98 : 0 : sal_uInt16 GetOfsX() const { return mpImplGradient->mnOfsX; }
99 : : void SetOfsY( sal_uInt16 nOfsY );
100 : 0 : sal_uInt16 GetOfsY() const { return mpImplGradient->mnOfsY; }
101 : :
102 : : void SetStartIntensity( sal_uInt16 nIntens );
103 : 112334 : sal_uInt16 GetStartIntensity() const { return mpImplGradient->mnIntensityStart; }
104 : : void SetEndIntensity( sal_uInt16 nIntens );
105 : 112334 : sal_uInt16 GetEndIntensity() const { return mpImplGradient->mnIntensityEnd; }
106 : :
107 : : void SetSteps( sal_uInt16 nSteps );
108 : 224668 : sal_uInt16 GetSteps() const { return mpImplGradient->mnStepCount; }
109 : :
110 : : void GetBoundRect( const Rectangle& rRect, Rectangle &rBoundRect, Point& rCenter ) const;
111 : :
112 : : Gradient& operator=( const Gradient& rGradient );
113 : : sal_Bool operator==( const Gradient& rGradient ) const;
114 : 0 : sal_Bool operator!=( const Gradient& rGradient ) const
115 : 0 : { return !(Gradient::operator==( rGradient )); }
116 : : sal_Bool IsSameInstance( const Gradient& rGradient ) const
117 : : { return (mpImplGradient == rGradient.mpImplGradient); }
118 : :
119 : : friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Gradient& rGradient );
120 : : friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const Gradient& rGradient );
121 : : };
122 : :
123 : : #endif // _SV_GRADIENT_HXX
124 : :
125 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|