LibreOffice Module vcl (master)  1
wall.hxx
Go to the documentation of this file.
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 INCLUDED_VCL_WALL_HXX
21 #define INCLUDED_VCL_WALL_HXX
22 
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>
29 
30 class Gradient;
31 class BitmapEx;
32 class ImplWallpaper;
33 
34 enum class WallpaperStyle
35 {
36  NONE,
37  Tile,
38  Center,
39  Scale,
40  TopLeft,
41  Top,
42  TopRight,
43  Left,
44  Right,
45  BottomLeft,
46  Bottom,
48  ApplicationGradient // defines a gradient that internally covers the whole application
49  // and uses a color derived from the face color
50 };
51 
53 {
54 public:
55  SAL_DLLPRIVATE void ImplSetCachedBitmap( BitmapEx& rBmp ) const;
56  SAL_DLLPRIVATE const BitmapEx* ImplGetCachedBitmap() const;
57  SAL_DLLPRIVATE void ImplReleaseCachedBitmap() const;
58 
59 private:
60  SAL_DLLPRIVATE static Gradient ImplGetApplicationGradient();
61 
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();
69 
70  void SetColor( const Color& rColor );
71  const Color& GetColor() const { return maColor; }
72 
73  void SetStyle( WallpaperStyle eStyle );
74  WallpaperStyle GetStyle() const { return meStyle; }
75 
76  void SetBitmap( const BitmapEx& rBitmap );
77  const BitmapEx & GetBitmap() const;
78  bool IsBitmap() const;
79 
80  void SetGradient( const Gradient& rGradient );
81  Gradient GetGradient() const;
82  bool IsGradient() const;
83 
84  void SetRect( const tools::Rectangle& rRect ) { maRect = rRect; }
85  const tools::Rectangle & GetRect() const { return maRect; }
86  bool IsRect() const;
87 
88  bool IsFixed() const;
89  bool IsScrollable() const;
90 
91  Wallpaper& operator=( const Wallpaper& rWallpaper );
92  Wallpaper& operator=( Wallpaper&& rWallpaper );
93 
94  bool operator==( const Wallpaper& rWallpaper ) const;
95  bool operator!=( const Wallpaper& rWallpaper ) const
96  { return !(Wallpaper::operator==( rWallpaper )); }
97 
98  bool IsEmpty() const
99  {
100  return GetStyle() == WallpaperStyle::NONE && GetColor() == COL_TRANSPARENT &&
101  !IsBitmap() && !IsGradient() && !IsRect();
102  }
103 
104  friend SvStream& ReadWallpaper( SvStream& rIStm, Wallpaper& rWallpaper );
105  friend SvStream& WriteWallpaper( SvStream& rOStm, const Wallpaper& rWallpaper );
106 private:
109  mutable BitmapEx maCache;
110  std::optional<Gradient> mpGradient;
113 };
114 
115 #endif // INCLUDED_VCL_WALL_HXX
116 
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
WallpaperStyle GetStyle() const
Definition: wall.hxx:74
basegfx::BColor maColor
SvStream & ReadWallpaper(SvStream &rIStm, Wallpaper &rImplWallpaper)
Definition: wall.cxx:30
SvStream & WriteWallpaper(SvStream &rOStm, const Wallpaper &rImplWallpaper)
Definition: wall.cxx:82
bool operator==(const Wallpaper &rWallpaper) const
Definition: wall.cxx:261
WallpaperStyle meStyle
Definition: wall.hxx:112
tools::Rectangle maRect
Definition: wall.hxx:107
bool operator!=(const Wallpaper &rWallpaper) const
Definition: wall.hxx:95
Color maColor
Definition: wall.hxx:111
bool operator==(const ItalicMatrix &a, const ItalicMatrix &b)
Definition: vclenum.hxx:204
void SetRect(const tools::Rectangle &rRect)
Definition: wall.hxx:84
const Color & GetColor() const
Definition: wall.hxx:71
WallpaperStyle
Definition: wall.hxx:34
BitmapEx maBitmap
Definition: wall.hxx:108
const tools::Rectangle & GetRect() const
Definition: wall.hxx:85
std::optional< Gradient > mpGradient
Definition: wall.hxx:110
bool IsEmpty() const
Definition: wall.hxx:98
BitmapEx maCache
Definition: wall.hxx:109