Coverage Report

Created: 2025-07-07 10:01

/src/libreoffice/include/vcl/wall.hxx
Line
Count
Source (jump to first uncovered line)
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
enum class WallpaperStyle
31
{
32
    NONE,
33
    Tile,
34
    Center,
35
    Scale,
36
    TopLeft,
37
    Top,
38
    TopRight,
39
    Left,
40
    Right,
41
    BottomLeft,
42
    Bottom,
43
    BottomRight,
44
    ApplicationGradient          // defines a gradient that internally covers the whole application
45
                                 // and uses a color derived from the face color
46
};
47
48
class VCL_DLLPUBLIC Wallpaper
49
{
50
public:
51
    SAL_DLLPRIVATE void             ImplSetCachedBitmap( const BitmapEx& rBmp ) const;
52
    SAL_DLLPRIVATE const BitmapEx*  ImplGetCachedBitmap() const;
53
    SAL_DLLPRIVATE void             ImplReleaseCachedBitmap() const;
54
55
private:
56
    SAL_DLLPRIVATE static Gradient  ImplGetApplicationGradient();
57
58
public:
59
                    Wallpaper();
60
                    Wallpaper( const Wallpaper& rWallpaper );
61
                    Wallpaper( Wallpaper&& rWallpaper );
62
                    Wallpaper( const Color& rColor );
63
                    explicit Wallpaper( const BitmapEx& rBmpEx );
64
                    ~Wallpaper();
65
66
    void            SetColor( const Color& rColor );
67
15.8k
    const Color&    GetColor() const { return maColor; }
68
69
    void            SetStyle( WallpaperStyle eStyle );
70
1.92M
    WallpaperStyle  GetStyle() const { return meStyle; }
71
72
    void            SetBitmap( const BitmapEx& rBitmap );
73
    const BitmapEx & GetBitmap() const;
74
    bool            IsBitmap() const;
75
76
    void            SetGradient( const Gradient& rGradient );
77
    Gradient        GetGradient() const;
78
    bool            IsGradient() const;
79
80
0
    void            SetRect( const tools::Rectangle& rRect ) { maRect = rRect; }
81
0
    const tools::Rectangle & GetRect() const { return maRect; }
82
    bool            IsRect() const;
83
84
    bool            IsFixed() const;
85
    bool            IsScrollable() const;
86
87
    Wallpaper&      operator=( const Wallpaper& rWallpaper );
88
    Wallpaper&      operator=( Wallpaper&& rWallpaper );
89
90
    bool            operator==( const Wallpaper& rWallpaper ) const;
91
92
    bool            IsEmpty() const
93
0
    {
94
0
        return GetStyle() == WallpaperStyle::NONE && GetColor() == COL_TRANSPARENT &&
95
0
               !IsBitmap() && !IsGradient() && !IsRect();
96
0
    }
97
98
    friend SvStream& ReadWallpaper( SvStream& rIStm, Wallpaper& rWallpaper );
99
    friend SvStream& WriteWallpaper( SvStream& rOStm, const Wallpaper& rWallpaper );
100
private:
101
    tools::Rectangle            maRect;
102
    BitmapEx                    maBitmap;
103
    mutable BitmapEx            maCache;
104
    std::optional<Gradient>     mpGradient;
105
    Color                       maColor;
106
    WallpaperStyle              meStyle;
107
};
108
109
#endif // INCLUDED_VCL_WALL_HXX
110
111
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */