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