Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / toolkit / inc / controls / table / mousefunction.hxx
blobef68dc89cea4951bb1d6b4543a324a98487273f4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include "tabletypes.hxx"
24 #include <salhelper/simplereferenceobject.hxx>
26 class MouseEvent;
28 namespace svt::table
30 class ITableControl;
32 //= FunctionResult
34 enum FunctionResult
36 ActivateFunction,
37 ContinueFunction,
38 DeactivateFunction,
40 SkipFunction
43 //= MouseFunction
45 class MouseFunction : public ::salhelper::SimpleReferenceObject
47 public:
48 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;
58 protected:
59 virtual ~MouseFunction() override {}
62 //= ColumnResize
64 class ColumnResize final : public MouseFunction
66 public:
67 ColumnResize()
68 : m_nResizingColumn(COL_INVALID)
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;
81 private:
82 ColPos m_nResizingColumn;
85 //= RowSelection
87 class RowSelection final : public MouseFunction
89 public:
90 RowSelection()
91 : m_bActive(false)
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;
104 private:
105 bool m_bActive;
108 //= ColumnSortHandler
110 class ColumnSortHandler final : public MouseFunction
112 public:
113 ColumnSortHandler()
114 : m_nActiveColumn(COL_INVALID)
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;
127 private:
128 ColPos m_nActiveColumn;
131 } // namespace svt::table
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */