xref: /aoo41x/main/sc/source/ui/view/tabsplit.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sc.hxx"
30 
31 // System - Includes -----------------------------------------------------
32 
33 
34 
35 // INCLUDE ---------------------------------------------------------------
36 
37 #include "tabsplit.hxx"
38 #include "viewdata.hxx"
39 #include "dbfunc.hxx"
40 
41 //==================================================================
42 
43 ScTabSplitter::ScTabSplitter( Window* pParent, WinBits nWinStyle, ScViewData* pData ) :
44 	Splitter( pParent, nWinStyle ),
45 	pViewData(pData)
46 {
47 	SetFixed(sal_False);
48 	EnableRTL( sal_False );
49 }
50 
51 
52 ScTabSplitter::~ScTabSplitter()
53 {
54 }
55 
56 void __EXPORT ScTabSplitter::MouseMove( const MouseEvent& rMEvt )
57 {
58 	if (bFixed)
59 		Window::MouseMove( rMEvt );
60 	else
61 		Splitter::MouseMove( rMEvt );
62 }
63 
64 void __EXPORT ScTabSplitter::MouseButtonUp( const MouseEvent& rMEvt )
65 {
66 	if (bFixed)
67 		Window::MouseButtonUp( rMEvt );
68 	else
69 		Splitter::MouseButtonUp( rMEvt );
70 }
71 
72 void __EXPORT ScTabSplitter::MouseButtonDown( const MouseEvent& rMEvt )
73 {
74 	if (bFixed)
75 		Window::MouseButtonDown( rMEvt );
76 	else
77 		Splitter::MouseButtonDown( rMEvt );
78 }
79 
80 void __EXPORT ScTabSplitter::Splitting( Point& rSplitPos )
81 {
82 	Window* pParent = GetParent();
83 	Point aScreenPos = pParent->OutputToNormalizedScreenPixel( rSplitPos );
84 	pViewData->GetView()->SnapSplitPos( aScreenPos );
85 	Point aNew = pParent->NormalizedScreenToOutputPixel( aScreenPos );
86 	if ( IsHorizontal() )
87 		rSplitPos.X() = aNew.X();
88 	else
89 		rSplitPos.Y() = aNew.Y();
90 }
91 
92 
93 void ScTabSplitter::SetFixed(sal_Bool bSet)
94 {
95 	bFixed = bSet;
96 	if (bSet)
97 		SetPointer(POINTER_ARROW);
98 	else if (IsHorizontal())
99 		SetPointer(POINTER_HSPLIT);
100 	else
101 		SetPointer(POINTER_VSPLIT);
102 }
103 
104 
105 
106