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>
30 enum class WallpaperStyle
44 ApplicationGradient
// defines a gradient that internally covers the whole application
45 // and uses a color derived from the face color
48 class VCL_DLLPUBLIC Wallpaper
51 SAL_DLLPRIVATE
void ImplSetCachedBitmap( const BitmapEx
& rBmp
) const;
52 SAL_DLLPRIVATE
const BitmapEx
* ImplGetCachedBitmap() const;
53 SAL_DLLPRIVATE
void ImplReleaseCachedBitmap() const;
56 SAL_DLLPRIVATE
static Gradient
ImplGetApplicationGradient();
60 Wallpaper( const Wallpaper
& rWallpaper
);
61 Wallpaper( Wallpaper
&& rWallpaper
);
62 Wallpaper( const Color
& rColor
);
63 explicit Wallpaper( const BitmapEx
& rBmpEx
);
66 void SetColor( const Color
& rColor
);
67 const Color
& GetColor() const { return maColor
; }
69 void SetStyle( WallpaperStyle eStyle
);
70 WallpaperStyle
GetStyle() const { return meStyle
; }
72 void SetBitmap( const BitmapEx
& rBitmap
);
73 const BitmapEx
& GetBitmap() const;
74 bool IsBitmap() const;
76 void SetGradient( const Gradient
& rGradient
);
77 Gradient
GetGradient() const;
78 bool IsGradient() const;
80 void SetRect( const tools::Rectangle
& rRect
) { maRect
= rRect
; }
81 const tools::Rectangle
& GetRect() const { return maRect
; }
85 bool IsScrollable() const;
87 Wallpaper
& operator=( const Wallpaper
& rWallpaper
);
88 Wallpaper
& operator=( Wallpaper
&& rWallpaper
);
90 bool operator==( const Wallpaper
& rWallpaper
) const;
94 return GetStyle() == WallpaperStyle::NONE
&& GetColor() == COL_TRANSPARENT
&&
95 !IsBitmap() && !IsGradient() && !IsRect();
98 friend SvStream
& ReadWallpaper( SvStream
& rIStm
, Wallpaper
& rWallpaper
);
99 friend SvStream
& WriteWallpaper( SvStream
& rOStm
, const Wallpaper
& rWallpaper
);
101 tools::Rectangle maRect
;
103 mutable BitmapEx maCache
;
104 std::optional
<Gradient
> mpGradient
;
106 WallpaperStyle meStyle
;
109 #endif // INCLUDED_VCL_WALL_HXX
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */