1*01aa44aaSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*01aa44aaSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*01aa44aaSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*01aa44aaSAndrew Rist * distributed with this work for additional information 6*01aa44aaSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*01aa44aaSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*01aa44aaSAndrew Rist * "License"); you may not use this file except in compliance 9*01aa44aaSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*01aa44aaSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*01aa44aaSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*01aa44aaSAndrew Rist * software distributed under the License is distributed on an 15*01aa44aaSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*01aa44aaSAndrew Rist * KIND, either express or implied. See the License for the 17*01aa44aaSAndrew Rist * specific language governing permissions and limitations 18*01aa44aaSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*01aa44aaSAndrew Rist *************************************************************/ 21*01aa44aaSAndrew Rist 22*01aa44aaSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SVTOOLS_MOUSEFUNCTION_HXX 25cdf0e10cSrcweir #define SVTOOLS_MOUSEFUNCTION_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "svtools/table/tabletypes.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <rtl/ref.hxx> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <boost/noncopyable.hpp> 32cdf0e10cSrcweir 33cdf0e10cSrcweir class MouseEvent; 34cdf0e10cSrcweir 35cdf0e10cSrcweir //...................................................................................................................... 36cdf0e10cSrcweir namespace svt { namespace table 37cdf0e10cSrcweir { 38cdf0e10cSrcweir //...................................................................................................................... 39cdf0e10cSrcweir 40cdf0e10cSrcweir class ITableControl; 41cdf0e10cSrcweir 42cdf0e10cSrcweir //================================================================================================================== 43cdf0e10cSrcweir //= FunctionResult 44cdf0e10cSrcweir //================================================================================================================== 45cdf0e10cSrcweir enum FunctionResult 46cdf0e10cSrcweir { 47cdf0e10cSrcweir ActivateFunction, 48cdf0e10cSrcweir ContinueFunction, 49cdf0e10cSrcweir DeactivateFunction, 50cdf0e10cSrcweir 51cdf0e10cSrcweir SkipFunction 52cdf0e10cSrcweir }; 53cdf0e10cSrcweir 54cdf0e10cSrcweir //================================================================================================================== 55cdf0e10cSrcweir //= IMouseFunction 56cdf0e10cSrcweir //================================================================================================================== 57cdf0e10cSrcweir class IMouseFunction : public ::rtl::IReference, public ::boost::noncopyable 58cdf0e10cSrcweir { 59cdf0e10cSrcweir public: 60cdf0e10cSrcweir virtual FunctionResult handleMouseMove( ITableControl& i_tableControl, MouseEvent const & i_event ) = 0; 61cdf0e10cSrcweir virtual FunctionResult handleMouseDown( ITableControl& i_tableControl, MouseEvent const & i_event ) = 0; 62cdf0e10cSrcweir virtual FunctionResult handleMouseUp( ITableControl& i_tableControl, MouseEvent const & i_event ) = 0; 63cdf0e10cSrcweir 64cdf0e10cSrcweir protected: ~IMouseFunction()65cdf0e10cSrcweir virtual ~IMouseFunction() { } 66cdf0e10cSrcweir }; 67cdf0e10cSrcweir 68cdf0e10cSrcweir //================================================================================================================== 69cdf0e10cSrcweir //= MouseFunction 70cdf0e10cSrcweir //================================================================================================================== 71cdf0e10cSrcweir class MouseFunction : public IMouseFunction 72cdf0e10cSrcweir { 73cdf0e10cSrcweir public: MouseFunction()74cdf0e10cSrcweir MouseFunction() 75cdf0e10cSrcweir :m_refCount( 0 ) 76cdf0e10cSrcweir { 77cdf0e10cSrcweir } 78cdf0e10cSrcweir protected: ~MouseFunction()79cdf0e10cSrcweir ~MouseFunction() 80cdf0e10cSrcweir { 81cdf0e10cSrcweir } 82cdf0e10cSrcweir 83cdf0e10cSrcweir public: 84cdf0e10cSrcweir virtual oslInterlockedCount SAL_CALL acquire(); 85cdf0e10cSrcweir virtual oslInterlockedCount SAL_CALL release(); 86cdf0e10cSrcweir 87cdf0e10cSrcweir private: 88cdf0e10cSrcweir oslInterlockedCount m_refCount; 89cdf0e10cSrcweir }; 90cdf0e10cSrcweir 91cdf0e10cSrcweir //================================================================================================================== 92cdf0e10cSrcweir //= ColumnResize 93cdf0e10cSrcweir //================================================================================================================== 94cdf0e10cSrcweir class ColumnResize : public MouseFunction 95cdf0e10cSrcweir { 96cdf0e10cSrcweir public: ColumnResize()97cdf0e10cSrcweir ColumnResize() 98cdf0e10cSrcweir :m_nResizingColumn( COL_INVALID ) 99cdf0e10cSrcweir { 100cdf0e10cSrcweir } 101cdf0e10cSrcweir 102cdf0e10cSrcweir public: 103cdf0e10cSrcweir // IMouseFunction 104cdf0e10cSrcweir virtual FunctionResult handleMouseMove( ITableControl& i_tableControl, MouseEvent const & i_event ); 105cdf0e10cSrcweir virtual FunctionResult handleMouseDown( ITableControl& i_tableControl, MouseEvent const & i_event ); 106cdf0e10cSrcweir virtual FunctionResult handleMouseUp( ITableControl& i_tableControl, MouseEvent const & i_event ); 107cdf0e10cSrcweir 108cdf0e10cSrcweir private: 109cdf0e10cSrcweir ColPos m_nResizingColumn; 110cdf0e10cSrcweir }; 111cdf0e10cSrcweir 112cdf0e10cSrcweir //================================================================================================================== 113cdf0e10cSrcweir //= RowSelection 114cdf0e10cSrcweir //================================================================================================================== 115cdf0e10cSrcweir class RowSelection : public MouseFunction 116cdf0e10cSrcweir { 117cdf0e10cSrcweir public: RowSelection()118cdf0e10cSrcweir RowSelection() 119cdf0e10cSrcweir :m_bActive( false ) 120cdf0e10cSrcweir { 121cdf0e10cSrcweir } 122cdf0e10cSrcweir 123cdf0e10cSrcweir public: 124cdf0e10cSrcweir // IMouseFunction 125cdf0e10cSrcweir virtual FunctionResult handleMouseMove( ITableControl& i_tableControl, MouseEvent const & i_event ); 126cdf0e10cSrcweir virtual FunctionResult handleMouseDown( ITableControl& i_tableControl, MouseEvent const & i_event ); 127cdf0e10cSrcweir virtual FunctionResult handleMouseUp( ITableControl& i_tableControl, MouseEvent const & i_event ); 128cdf0e10cSrcweir 129cdf0e10cSrcweir private: 130cdf0e10cSrcweir bool m_bActive; 131cdf0e10cSrcweir }; 132cdf0e10cSrcweir 133cdf0e10cSrcweir //================================================================================================================== 134cdf0e10cSrcweir //= ColumnSortHandler 135cdf0e10cSrcweir //================================================================================================================== 136cdf0e10cSrcweir class ColumnSortHandler : public MouseFunction 137cdf0e10cSrcweir { 138cdf0e10cSrcweir public: ColumnSortHandler()139cdf0e10cSrcweir ColumnSortHandler() 140cdf0e10cSrcweir :m_nActiveColumn( COL_INVALID ) 141cdf0e10cSrcweir { 142cdf0e10cSrcweir } 143cdf0e10cSrcweir 144cdf0e10cSrcweir public: 145cdf0e10cSrcweir // IMouseFunction 146cdf0e10cSrcweir virtual FunctionResult handleMouseMove( ITableControl& i_tableControl, MouseEvent const & i_event ); 147cdf0e10cSrcweir virtual FunctionResult handleMouseDown( ITableControl& i_tableControl, MouseEvent const & i_event ); 148cdf0e10cSrcweir virtual FunctionResult handleMouseUp( ITableControl& i_tableControl, MouseEvent const & i_event ); 149cdf0e10cSrcweir 150cdf0e10cSrcweir private: 151cdf0e10cSrcweir ColPos m_nActiveColumn; 152cdf0e10cSrcweir }; 153cdf0e10cSrcweir 154cdf0e10cSrcweir //...................................................................................................................... 155cdf0e10cSrcweir } } // namespace svt::table 156cdf0e10cSrcweir //...................................................................................................................... 157cdf0e10cSrcweir 158cdf0e10cSrcweir #endif // SVTOOLS_MOUSEFUNCTION_HXX 159