1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
34 enum class WallpaperStyle
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
55 SAL_DLLPRIVATE
void ImplSetCachedBitmap( const BitmapEx
& rBmp
) const;
56 SAL_DLLPRIVATE
const BitmapEx
* ImplGetCachedBitmap() const;
57 SAL_DLLPRIVATE
void ImplReleaseCachedBitmap() const;
60 SAL_DLLPRIVATE
static Gradient
ImplGetApplicationGradient();
64 Wallpaper( const Wallpaper
& rWallpaper
);
65 Wallpaper( Wallpaper
&& rWallpaper
);
66 Wallpaper( const Color
& rColor
);
67 explicit Wallpaper( const BitmapEx
& rBmpEx
);
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
; }
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
)); }
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
);
107 tools::Rectangle maRect
;
109 mutable BitmapEx maCache
;
110 std::optional
<Gradient
> mpGradient
;
112 WallpaperStyle meStyle
;
115 #endif // INCLUDED_VCL_WALL_HXX
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */