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