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