xref: /AOO41X/main/vcl/inc/vcl/wall.hxx (revision 47148b3bc50811ceb41802e4cc50a5db21535900)
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_WALL_HXX
25 #define _SV_WALL_HXX
26 
27 #include <vcl/sv.h>
28 #include <vcl/dllapi.h>
29 #include <tools/color.hxx>
30 
31 class Rectangle;
32 class Gradient;
33 class BitmapEx;
34 class ImplWallpaper;
35 
36 // -------------------
37 // - Wallpaper-Types -
38 // -------------------
39 
40 #define WALLPAPER_NULL                  WallpaperStyle_NULL
41 #define WALLPAPER_TILE                  WallpaperStyle_TILE
42 #define WALLPAPER_CENTER                WallpaperStyle_CENTER
43 #define WALLPAPER_SCALE                 WallpaperStyle_SCALE
44 #define WALLPAPER_TOPLEFT               WallpaperStyle_TOPLEFT
45 #define WALLPAPER_TOP                   WallpaperStyle_TOP
46 #define WALLPAPER_TOPRIGHT              WallpaperStyle_TOPRIGHT
47 #define WALLPAPER_LEFT                  WallpaperStyle_LEFT
48 #define WALLPAPER_RIGHT                 WallpaperStyle_RIGHT
49 #define WALLPAPER_BOTTOMLEFT            WallpaperStyle_BOTTOMLEFT
50 #define WALLPAPER_BOTTOM                WallpaperStyle_BOTTOM
51 #define WALLPAPER_BOTTOMRIGHT           WallpaperStyle_BOTTOMRIGHT
52 #define WALLPAPER_APPLICATIONGRADIENT   WallpaperStyle_APPLICATIONGRADIENT
53 #define WALLPAPER_FORCE_EQUAL_SIZE      WallpaperStyle_FORCE_EQUAL_SIZE
54 
55 #ifndef ENUM_WALLPAPERSTYLE_DECLARED
56 #define ENUM_WALLPAPERSTYLE_DECLARED
57 
58 enum WallpaperStyle
59 {
60     WALLPAPER_NULL,
61     WALLPAPER_TILE,
62     WALLPAPER_CENTER,
63     WALLPAPER_SCALE,
64     WALLPAPER_TOPLEFT,
65     WALLPAPER_TOP,
66     WALLPAPER_TOPRIGHT,
67     WALLPAPER_LEFT,
68     WALLPAPER_RIGHT,
69     WALLPAPER_BOTTOMLEFT,
70     WALLPAPER_BOTTOM,
71     WALLPAPER_BOTTOMRIGHT,
72     WALLPAPER_APPLICATIONGRADIENT,          // defines a gradient that internally covers the whole application
73                                             // and uses a color derived from the face color
74     WALLPAPER_FORCE_EQUAL_SIZE = 0x7fffffff
75 };
76 
77 #endif
78 
79 // -------------
80 // - Wallpaper -
81 // -------------
82 
83 class VCL_DLLPUBLIC Wallpaper
84 {
85 private:
86     ImplWallpaper*  mpImplWallpaper;
87 
88     SAL_DLLPRIVATE void           ImplMakeUnique( sal_Bool bReleaseCache = sal_True );
89     SAL_DLLPRIVATE Gradient       ImplGetApplicationGradient() const;
90 
91 //#if 0 // _SOLAR__PRIVATE
92 public:
ImplGetImpWallpaper() const93     SAL_DLLPRIVATE ImplWallpaper* ImplGetImpWallpaper() const { return mpImplWallpaper; }
94 //#endif
95 
96 public:
97                     Wallpaper();
98                     Wallpaper( const Wallpaper& rWallpaper );
99                     Wallpaper( const Color& rColor );
100                     explicit Wallpaper( const BitmapEx& rBmpEx );
101                     Wallpaper( const Gradient& rGradient );
102                     ~Wallpaper();
103 
104     void            SetColor( const Color& rColor );
105     const Color&    GetColor() const;
106 
107     void            SetStyle( WallpaperStyle eStyle );
108     WallpaperStyle  GetStyle() const;
109 
110     void            SetBitmap( const BitmapEx& rBitmap );
111     void            SetBitmap();
112     BitmapEx        GetBitmap() const;
113     sal_Bool            IsBitmap() const;
114 
115     void            SetGradient( const Gradient& rGradient );
116     void            SetGradient();
117     Gradient        GetGradient() const;
118     sal_Bool            IsGradient() const;
119 
120     void            SetRect( const Rectangle& rRect );
121     void            SetRect();
122     Rectangle       GetRect() const;
123     sal_Bool            IsRect() const;
124 
125     sal_Bool            IsFixed() const;
126     sal_Bool            IsScrollable() const;
127 
128     Wallpaper&      operator=( const Wallpaper& rWallpaper );
129     sal_Bool            operator==( const Wallpaper& rWallpaper ) const;
operator !=(const Wallpaper & rWallpaper) const130     sal_Bool            operator!=( const Wallpaper& rWallpaper ) const
131                         { return !(Wallpaper::operator==( rWallpaper )); }
IsSameInstance(const Wallpaper & rWallpaper) const132     sal_Bool            IsSameInstance( const Wallpaper& rWallpaper ) const
133                         { return (mpImplWallpaper == rWallpaper.mpImplWallpaper); }
134 
135     friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Wallpaper& rWallpaper );
136     friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const Wallpaper& rWallpaper );
137 };
138 
139 #endif  // _SV_WALL_HXX
140