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/dllapi.h>
26 #include <o3tl/cow_wrapper.hxx>
27 
28 class Gradient;
29 class BitmapEx;
30 class ImplWallpaper;
31 
32 enum class WallpaperStyle
33 {
34  NONE,
35  Tile,
36  Center,
37  Scale,
38  TopLeft,
39  Top,
40  TopRight,
41  Left,
42  Right,
43  BottomLeft,
44  Bottom,
46  ApplicationGradient // defines a gradient that internally covers the whole application
47  // and uses a color derived from the face color
48 };
49 
51 {
52 public:
54 
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  ImplType mpImplWallpaper;
61 
62  SAL_DLLPRIVATE static Gradient ImplGetApplicationGradient();
63 
64 public:
65  Wallpaper();
66  Wallpaper( const Wallpaper& rWallpaper );
67  Wallpaper( Wallpaper&& rWallpaper );
68  Wallpaper( const Color& rColor );
69  explicit Wallpaper( const BitmapEx& rBmpEx );
70  Wallpaper( const Gradient& rGradient );
71  ~Wallpaper();
72 
73  void SetColor( const Color& rColor );
74  const Color& GetColor() const;
75 
76  void SetStyle( WallpaperStyle eStyle );
77  WallpaperStyle GetStyle() const;
78 
79  void SetBitmap( const BitmapEx& rBitmap );
80  BitmapEx GetBitmap() const;
81  bool IsBitmap() const;
82 
83  void SetGradient( const Gradient& rGradient );
84  Gradient GetGradient() const;
85  bool IsGradient() const;
86 
87  void SetRect( const tools::Rectangle& rRect );
88  tools::Rectangle GetRect() const;
89  bool IsRect() const;
90 
91  bool IsFixed() const;
92  bool IsScrollable() const;
93 
94  Wallpaper& operator=( const Wallpaper& rWallpaper );
95  Wallpaper& operator=( Wallpaper&& rWallpaper );
96 
97  bool operator==( const Wallpaper& rWallpaper ) const;
98  bool operator!=( const Wallpaper& rWallpaper ) const
99  { return !(Wallpaper::operator==( rWallpaper )); }
100 
101  bool IsEmpty() const
102  {
103  return GetStyle() == WallpaperStyle::NONE && GetColor() == COL_TRANSPARENT &&
104  !IsBitmap() && !IsGradient() && !IsRect();
105  }
106 
107  friend SvStream& ReadWallpaper( SvStream& rIStm, Wallpaper& rWallpaper );
108  friend SvStream& WriteWallpaper( SvStream& rOStm, const Wallpaper& rWallpaper );
109 };
110 
111 #endif // INCLUDED_VCL_WALL_HXX
112 
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
SvStream & WriteWallpaper(SvStream &rOStm, const Wallpaper &rWallpaper)
Definition: wall.cxx:361
bool operator==(const Wallpaper &rWallpaper) const
Definition: wall.cxx:351
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
SvStream & ReadWallpaper(SvStream &rIStm, Wallpaper &rWallpaper)
Definition: wall.cxx:356
bool operator!=(const Wallpaper &rWallpaper) const
Definition: wall.hxx:98
bool operator==(const ItalicMatrix &a, const ItalicMatrix &b)
Definition: vclenum.hxx:203
ImplType mpImplWallpaper
Definition: wall.hxx:60
WallpaperStyle
Definition: wall.hxx:32
o3tl::cow_wrapper< ImplWallpaper > ImplType
Definition: wall.hxx:53
bool IsEmpty() const
Definition: wall.hxx:101