xref: /trunk/main/sc/source/ui/inc/select.hxx (revision 38d50f7b)
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 #ifndef SC_SELECT_HXX
25 #define SC_SELECT_HXX
26 
27 #ifndef _SELENG_HXX //autogen
28 #include <vcl/seleng.hxx>
29 #endif
30 
31 #include "viewdata.hxx"		// ScSplitPos
32 
33 // ---------------------------------------------------------------------------
34 
35 class ScTabView;
36 class ScViewData;
37 
38 
39 class ScViewSelectionEngine : public SelectionEngine
40 {
41 private:
42 	ScSplitPos		eWhich;
43 public:
44 					ScViewSelectionEngine( Window* pWindow, ScTabView* pView,
45 													ScSplitPos eSplitPos );
46 
GetWhich() const47 	ScSplitPos		GetWhich() const			{ return eWhich; }
SetWhich(ScSplitPos eNew)48 	void			SetWhich(ScSplitPos eNew)	{ eWhich = eNew; }
49 };
50 
51 
52 class ScViewFunctionSet : public FunctionSet			// View (Gridwin / Tastatur)
53 {
54 private:
55 	ScViewData*				pViewData;
56 	ScViewSelectionEngine*	pEngine;
57 
58 	sal_Bool			bAnchor;
59 	sal_Bool			bStarted;
60 	ScAddress		aAnchorPos;
61 
62 	ScSplitPos		GetWhich();
63 
64 public:
65 					ScViewFunctionSet( ScViewData* pNewViewData );
66 
67 	void			SetSelectionEngine( ScViewSelectionEngine* pSelEngine );
68 
69 	void			SetAnchor( SCCOL nPosX, SCROW nPosY );
70 	void			SetAnchorFlag( sal_Bool bSet );
71 
72 	virtual void	BeginDrag();
73 	virtual void	CreateAnchor();
74 	virtual void	DestroyAnchor();
75 	virtual sal_Bool	SetCursorAtPoint( const Point& rPointPixel, sal_Bool bDontSelectAtCursor = sal_False );
76 	virtual sal_Bool	IsSelectionAtPoint( const Point& rPointPixel );
77 	virtual void	DeselectAtPoint( const Point& rPointPixel );
78 	virtual void	DeselectAll();
79 
80 	sal_Bool			SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, sal_Bool bScroll );
81 };
82 
83 
84 // ---------------------------------------------------------------------------
85 
86 
87 class ScHeaderFunctionSet : public FunctionSet			// Spalten- / Zeilenkoepfe
88 {
89 private:
90 	ScViewData*		pViewData;
91 	sal_Bool			bColumn;				// Col- / Rowbar
92 	ScSplitPos		eWhich;
93 
94 	sal_Bool			bAnchor;
95 	SCCOLROW		nCursorPos;
96 
97 public:
98 					ScHeaderFunctionSet( ScViewData* pNewViewData );
99 
100 	void			SetColumn( sal_Bool bSet );
101 	void			SetWhich( ScSplitPos eNew );
102 
103 	virtual void	BeginDrag();
104 	virtual void	CreateAnchor();
105 	virtual void	DestroyAnchor();
106 	virtual sal_Bool	SetCursorAtPoint( const Point& rPointPixel, sal_Bool bDontSelectAtCursor = sal_False );
107 	virtual sal_Bool	IsSelectionAtPoint( const Point& rPointPixel );
108 	virtual void	DeselectAtPoint( const Point& rPointPixel );
109 	virtual void	DeselectAll();
110 
SetAnchorFlag(sal_Bool bSet)111 	void			SetAnchorFlag(sal_Bool bSet)	{ bAnchor = bSet; }
112 };
113 
114 
115 class ScHeaderSelectionEngine : public SelectionEngine
116 {
117 public:
118 					ScHeaderSelectionEngine( Window* pWindow, ScHeaderFunctionSet* pFuncSet );
119 };
120 
121 
122 
123 #endif
124