Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/toolkit/inc/controls/table/mousefunction.hxx
Line
Count
Source
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
#pragma once
21
22
#include "tabletypes.hxx"
23
24
#include <salhelper/simplereferenceobject.hxx>
25
26
class MouseEvent;
27
28
namespace svt::table
29
{
30
class ITableControl;
31
32
//= FunctionResult
33
34
enum FunctionResult
35
{
36
    ActivateFunction,
37
    ContinueFunction,
38
    DeactivateFunction,
39
40
    SkipFunction
41
};
42
43
//= MouseFunction
44
45
class MouseFunction : public ::salhelper::SimpleReferenceObject
46
{
47
public:
48
0
    MouseFunction() {}
49
    MouseFunction(const MouseFunction&) = delete;
50
    MouseFunction& operator=(const MouseFunction&) = delete;
51
    virtual FunctionResult handleMouseMove(ITableControl& i_tableControl, MouseEvent const& i_event)
52
        = 0;
53
    virtual FunctionResult handleMouseDown(ITableControl& i_tableControl, MouseEvent const& i_event)
54
        = 0;
55
    virtual FunctionResult handleMouseUp(ITableControl& i_tableControl, MouseEvent const& i_event)
56
        = 0;
57
58
protected:
59
0
    virtual ~MouseFunction() override {}
60
};
61
62
//= ColumnResize
63
64
class ColumnResize final : public MouseFunction
65
{
66
public:
67
    ColumnResize()
68
0
        : m_nResizingColumn(COL_INVALID)
69
0
    {
70
0
    }
71
72
public:
73
    // MouseFunction
74
    virtual FunctionResult handleMouseMove(ITableControl& i_tableControl,
75
                                           MouseEvent const& i_event) override;
76
    virtual FunctionResult handleMouseDown(ITableControl& i_tableControl,
77
                                           MouseEvent const& i_event) override;
78
    virtual FunctionResult handleMouseUp(ITableControl& i_tableControl,
79
                                         MouseEvent const& i_event) override;
80
81
private:
82
    ColPos m_nResizingColumn;
83
};
84
85
//= RowSelection
86
87
class RowSelection final : public MouseFunction
88
{
89
public:
90
    RowSelection()
91
0
        : m_bActive(false)
92
0
    {
93
0
    }
94
95
public:
96
    // MouseFunction
97
    virtual FunctionResult handleMouseMove(ITableControl& i_tableControl,
98
                                           MouseEvent const& i_event) override;
99
    virtual FunctionResult handleMouseDown(ITableControl& i_tableControl,
100
                                           MouseEvent const& i_event) override;
101
    virtual FunctionResult handleMouseUp(ITableControl& i_tableControl,
102
                                         MouseEvent const& i_event) override;
103
104
private:
105
    bool m_bActive;
106
};
107
108
//= ColumnSortHandler
109
110
class ColumnSortHandler final : public MouseFunction
111
{
112
public:
113
    ColumnSortHandler()
114
0
        : m_nActiveColumn(COL_INVALID)
115
0
    {
116
0
    }
117
118
public:
119
    // MouseFunction
120
    virtual FunctionResult handleMouseMove(ITableControl& i_tableControl,
121
                                           MouseEvent const& i_event) override;
122
    virtual FunctionResult handleMouseDown(ITableControl& i_tableControl,
123
                                           MouseEvent const& i_event) override;
124
    virtual FunctionResult handleMouseUp(ITableControl& i_tableControl,
125
                                         MouseEvent const& i_event) override;
126
127
private:
128
    ColPos m_nActiveColumn;
129
};
130
131
} // namespace svt::table
132
133
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */