Coverage Report

Created: 2025-07-07 10:01

/src/libreoffice/include/vcl/cursor.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_CURSOR_HXX
21
#define INCLUDED_VCL_CURSOR_HXX
22
23
#include <tools/gen.hxx>
24
#include <tools/link.hxx>
25
#include <vcl/dllapi.h>
26
#include <vcl/vclptr.hxx>
27
#include <rtl/ustring.hxx>
28
#include <memory>
29
30
class Timer;
31
struct ImplCursorData;
32
class OutputDevice;
33
namespace vcl { class Window; }
34
35
// Cursor styles
36
0
#define CURSOR_SHADOW                   (sal_uInt16(0x0001))
37
38
enum class CursorDirection
39
{
40
    NONE, LTR, RTL
41
};
42
43
namespace vcl
44
{
45
46
class VCL_DLLPUBLIC Cursor
47
{
48
private:
49
    std::unique_ptr<ImplCursorData> mpData;
50
    VclPtr<vcl::Window> mpWindow;           // only for shadow cursor
51
    Size            maSize;
52
    Point           maPos;
53
    Degree10        mnOrientation;
54
    sal_uInt16      mnStyle;
55
    bool            mbVisible;
56
    CursorDirection mnDirection;
57
58
public:
59
    SAL_DLLPRIVATE void         ImplDraw();
60
    DECL_DLLPRIVATE_LINK( ImplTimerHdl, Timer*, void );
61
    SAL_DLLPRIVATE void         ImplShow();
62
    SAL_DLLPRIVATE void         ImplHide();
63
    SAL_DLLPRIVATE void         ImplResume( bool bRestore = false );
64
    SAL_DLLPRIVATE bool         ImplSuspend();
65
    SAL_DLLPRIVATE void         ImplNew();
66
67
public:
68
                    Cursor();
69
    SAL_DLLPRIVATE  Cursor( const Cursor& rCursor );
70
                    ~Cursor();
71
72
    void            SetStyle( sal_uInt16 nStyle );
73
0
    sal_uInt16      GetStyle() const { return mnStyle; }
74
75
    void            Show();
76
    void            Hide();
77
88.1k
    bool            IsVisible() const { return mbVisible; }
78
79
    void            SetWindow( vcl::Window* pWindow );
80
81
    void            SetPos( const Point& rNewPos );
82
0
    const Point&    GetPos() const { return maPos; }
83
84
    void            SetSize( const Size& rNewSize );
85
0
    const Size&     GetSize() const { return maSize; }
86
    void            SetWidth( tools::Long nNewWidth );
87
0
    tools::Long            GetWidth() const { return maSize.Width(); }
88
0
    tools::Long            GetHeight() const { return maSize.Height(); }
89
90
    void            SetOrientation( Degree10 nOrientation = 0_deg10 );
91
92
    void            SetDirection( CursorDirection nDirection = CursorDirection::NONE );
93
94
    SAL_DLLPRIVATE Cursor& operator=( const Cursor& rCursor );
95
    SAL_DLLPRIVATE bool    operator==( const Cursor& rCursor ) const;
96
    bool            operator!=( const Cursor& rCursor ) const
97
0
                        { return !(Cursor::operator==( rCursor )); }
98
99
    void            DrawToDevice(OutputDevice& rRenderContext);
100
101
private:
102
    SAL_DLLPRIVATE void LOKNotify( vcl::Window* pWindow, const OUString& rAction );
103
    SAL_DLLPRIVATE bool ImplPrepForDraw(const OutputDevice* pDevice, ImplCursorData& rData);
104
    SAL_DLLPRIVATE void ImplRestore();
105
    SAL_DLLPRIVATE void ImplDoShow( bool bDrawDirect, bool bRestore );
106
    SAL_DLLPRIVATE bool ImplDoHide( bool bStop );
107
};
108
109
} // namespace vcl
110
111
#endif // INCLUDED_VCL_CURSOR_HXX
112
113
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */