xref: /aoo42x/main/sc/source/ui/view/tabsplit.cxx (revision b3f79822)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26 
27 // System - Includes -----------------------------------------------------
28 
29 
30 
31 // INCLUDE ---------------------------------------------------------------
32 
33 #include "tabsplit.hxx"
34 #include "viewdata.hxx"
35 #include "dbfunc.hxx"
36 
37 //==================================================================
38 
ScTabSplitter(Window * pParent,WinBits nWinStyle,ScViewData * pData)39 ScTabSplitter::ScTabSplitter( Window* pParent, WinBits nWinStyle, ScViewData* pData ) :
40 	Splitter( pParent, nWinStyle ),
41 	pViewData(pData)
42 {
43 	SetFixed(sal_False);
44 	EnableRTL( sal_False );
45 }
46 
47 
~ScTabSplitter()48 ScTabSplitter::~ScTabSplitter()
49 {
50 }
51 
MouseMove(const MouseEvent & rMEvt)52 void __EXPORT ScTabSplitter::MouseMove( const MouseEvent& rMEvt )
53 {
54 	if (bFixed)
55 		Window::MouseMove( rMEvt );
56 	else
57 		Splitter::MouseMove( rMEvt );
58 }
59 
MouseButtonUp(const MouseEvent & rMEvt)60 void __EXPORT ScTabSplitter::MouseButtonUp( const MouseEvent& rMEvt )
61 {
62 	if (bFixed)
63 		Window::MouseButtonUp( rMEvt );
64 	else
65 		Splitter::MouseButtonUp( rMEvt );
66 }
67 
MouseButtonDown(const MouseEvent & rMEvt)68 void __EXPORT ScTabSplitter::MouseButtonDown( const MouseEvent& rMEvt )
69 {
70 	if (bFixed)
71 		Window::MouseButtonDown( rMEvt );
72 	else
73 		Splitter::MouseButtonDown( rMEvt );
74 }
75 
Splitting(Point & rSplitPos)76 void __EXPORT ScTabSplitter::Splitting( Point& rSplitPos )
77 {
78 	Window* pParent = GetParent();
79 	Point aScreenPos = pParent->OutputToNormalizedScreenPixel( rSplitPos );
80 	pViewData->GetView()->SnapSplitPos( aScreenPos );
81 	Point aNew = pParent->NormalizedScreenToOutputPixel( aScreenPos );
82 	if ( IsHorizontal() )
83 		rSplitPos.X() = aNew.X();
84 	else
85 		rSplitPos.Y() = aNew.Y();
86 }
87 
88 
SetFixed(sal_Bool bSet)89 void ScTabSplitter::SetFixed(sal_Bool bSet)
90 {
91 	bFixed = bSet;
92 	if (bSet)
93 		SetPointer(POINTER_ARROW);
94 	else if (IsHorizontal())
95 		SetPointer(POINTER_HSPLIT);
96 	else
97 		SetPointer(POINTER_VSPLIT);
98 }
99 
100 
101 
102