bump product version to 7.6.3.2-android
[LibreOffice.git] / include / vcl / wall.hxx
blob474d2afe500cc321d855d5bdba443c68a03be468
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_WALL_HXX
21 #define INCLUDED_VCL_WALL_HXX
23 #include <tools/color.hxx>
24 #include <tools/gen.hxx>
25 #include <vcl/bitmapex.hxx>
26 #include <vcl/gradient.hxx>
27 #include <vcl/dllapi.h>
28 #include <optional>
30 class Gradient;
31 class BitmapEx;
32 class ImplWallpaper;
34 enum class WallpaperStyle
36 NONE,
37 Tile,
38 Center,
39 Scale,
40 TopLeft,
41 Top,
42 TopRight,
43 Left,
44 Right,
45 BottomLeft,
46 Bottom,
47 BottomRight,
48 ApplicationGradient // defines a gradient that internally covers the whole application
49 // and uses a color derived from the face color
52 class VCL_DLLPUBLIC Wallpaper
54 public:
55 SAL_DLLPRIVATE void ImplSetCachedBitmap( const BitmapEx& rBmp ) const;
56 SAL_DLLPRIVATE const BitmapEx* ImplGetCachedBitmap() const;
57 SAL_DLLPRIVATE void ImplReleaseCachedBitmap() const;
59 private:
60 SAL_DLLPRIVATE static Gradient ImplGetApplicationGradient();
62 public:
63 Wallpaper();
64 Wallpaper( const Wallpaper& rWallpaper );
65 Wallpaper( Wallpaper&& rWallpaper );
66 Wallpaper( const Color& rColor );
67 explicit Wallpaper( const BitmapEx& rBmpEx );
68 ~Wallpaper();
70 void SetColor( const Color& rColor );
71 const Color& GetColor() const { return maColor; }
73 void SetStyle( WallpaperStyle eStyle );
74 WallpaperStyle GetStyle() const { return meStyle; }
76 void SetBitmap( const BitmapEx& rBitmap );
77 const BitmapEx & GetBitmap() const;
78 bool IsBitmap() const;
80 void SetGradient( const Gradient& rGradient );
81 Gradient GetGradient() const;
82 bool IsGradient() const;
84 void SetRect( const tools::Rectangle& rRect ) { maRect = rRect; }
85 const tools::Rectangle & GetRect() const { return maRect; }
86 bool IsRect() const;
88 bool IsFixed() const;
89 bool IsScrollable() const;
91 Wallpaper& operator=( const Wallpaper& rWallpaper );
92 Wallpaper& operator=( Wallpaper&& rWallpaper );
94 bool operator==( const Wallpaper& rWallpaper ) const;
95 bool operator!=( const Wallpaper& rWallpaper ) const
96 { return !(Wallpaper::operator==( rWallpaper )); }
98 bool IsEmpty() const
100 return GetStyle() == WallpaperStyle::NONE && GetColor() == COL_TRANSPARENT &&
101 !IsBitmap() && !IsGradient() && !IsRect();
104 friend SvStream& ReadWallpaper( SvStream& rIStm, Wallpaper& rWallpaper );
105 friend SvStream& WriteWallpaper( SvStream& rOStm, const Wallpaper& rWallpaper );
106 private:
107 tools::Rectangle maRect;
108 BitmapEx maBitmap;
109 mutable BitmapEx maCache;
110 std::optional<Gradient> mpGradient;
111 Color maColor;
112 WallpaperStyle meStyle;
115 #endif // INCLUDED_VCL_WALL_HXX
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */