xref: /aoo42x/main/sc/source/ui/view/cellsh4.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sc.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir //------------------------------------------------------------------
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #ifdef _MSC_VER
36*cdf0e10cSrcweir #pragma optimize ("", off)
37*cdf0e10cSrcweir #endif
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir // INCLUDE ---------------------------------------------------------------
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir #include <sfx2/request.hxx>
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir #include "cellsh.hxx"
44*cdf0e10cSrcweir #include "tabvwsh.hxx"
45*cdf0e10cSrcweir #include "global.hxx"
46*cdf0e10cSrcweir #include "scmod.hxx"
47*cdf0e10cSrcweir #include "inputhdl.hxx"
48*cdf0e10cSrcweir #include "inputwin.hxx"
49*cdf0e10cSrcweir #include "document.hxx"
50*cdf0e10cSrcweir #include "sc.hrc"
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir //------------------------------------------------------------------
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir #define IS_AVAILABLE(WhichId,ppItem) \
56*cdf0e10cSrcweir     (pReqArgs->GetItemState((WhichId), sal_True, ppItem ) == SFX_ITEM_SET)
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir void ScCellShell::ExecuteCursor( SfxRequest& rReq )
60*cdf0e10cSrcweir {
61*cdf0e10cSrcweir 	ScViewData* pData = GetViewData();
62*cdf0e10cSrcweir 	ScTabViewShell*	pTabViewShell  	= pData->GetViewShell();
63*cdf0e10cSrcweir 	const SfxItemSet*	pReqArgs = rReq.GetArgs();
64*cdf0e10cSrcweir 	sal_uInt16				nSlotId  = rReq.GetSlot();
65*cdf0e10cSrcweir 	SCsCOLROW	        nRepeat = 1;
66*cdf0e10cSrcweir 	sal_Bool				bSel = sal_False;
67*cdf0e10cSrcweir 	sal_Bool				bKeep = sal_False;
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir 	if ( pReqArgs != NULL )
70*cdf0e10cSrcweir 	{
71*cdf0e10cSrcweir 		const	SfxPoolItem* pItem;
72*cdf0e10cSrcweir 		if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
73*cdf0e10cSrcweir 			nRepeat = static_cast<SCsCOLROW>(((const SfxInt16Item*)pItem)->GetValue());
74*cdf0e10cSrcweir 		if( IS_AVAILABLE( FN_PARAM_2, &pItem ) )
75*cdf0e10cSrcweir 			bSel = ((const SfxBoolItem*)pItem)->GetValue();
76*cdf0e10cSrcweir 	}
77*cdf0e10cSrcweir 	else
78*cdf0e10cSrcweir 	{
79*cdf0e10cSrcweir 		//	evaluate locked selection mode
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir 		sal_uInt16 nLocked = pTabViewShell->GetLockedModifiers();
82*cdf0e10cSrcweir 		if ( nLocked & KEY_SHIFT )
83*cdf0e10cSrcweir 			bSel = sal_True;				// EXT
84*cdf0e10cSrcweir 		else if ( nLocked & KEY_MOD1 )
85*cdf0e10cSrcweir 		{
86*cdf0e10cSrcweir 			// ADD mode: keep the selection, start a new block when marking with shift again
87*cdf0e10cSrcweir 			bKeep = sal_True;
88*cdf0e10cSrcweir 			pTabViewShell->SetNewStartIfMarking();
89*cdf0e10cSrcweir 		}
90*cdf0e10cSrcweir 	}
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir 	SCsCOLROW nRTLSign = 1;
93*cdf0e10cSrcweir 	if ( pData->GetDocument()->IsLayoutRTL( pData->GetTabNo() ) )
94*cdf0e10cSrcweir 	{
95*cdf0e10cSrcweir 		//!	evaluate cursor movement option?
96*cdf0e10cSrcweir 		nRTLSign = -1;
97*cdf0e10cSrcweir 	}
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir 	// einmal extra, damit der Cursor bei ExecuteInputDirect nicht zuoft gemalt wird:
100*cdf0e10cSrcweir 	pTabViewShell->HideAllCursors();
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 	//OS: einmal fuer alle wird doch reichen!
103*cdf0e10cSrcweir 	pTabViewShell->ExecuteInputDirect();
104*cdf0e10cSrcweir 	switch ( nSlotId )
105*cdf0e10cSrcweir 	{
106*cdf0e10cSrcweir 		case SID_CURSORDOWN:
107*cdf0e10cSrcweir 			pTabViewShell->MoveCursorRel(	0,	nRepeat, SC_FOLLOW_LINE, bSel, bKeep );
108*cdf0e10cSrcweir 			break;
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir 		case SID_CURSORBLKDOWN:
111*cdf0e10cSrcweir 			pTabViewShell->MoveCursorArea( 0, nRepeat, SC_FOLLOW_JUMP, bSel, bKeep );
112*cdf0e10cSrcweir 			break;
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir 		case SID_CURSORUP:
115*cdf0e10cSrcweir 			pTabViewShell->MoveCursorRel(	0,	-nRepeat, SC_FOLLOW_LINE, bSel, bKeep );
116*cdf0e10cSrcweir 			break;
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir 		case SID_CURSORBLKUP:
119*cdf0e10cSrcweir 			pTabViewShell->MoveCursorArea( 0, -nRepeat, SC_FOLLOW_JUMP, bSel, bKeep );
120*cdf0e10cSrcweir 			break;
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir 		case SID_CURSORLEFT:
123*cdf0e10cSrcweir 			pTabViewShell->MoveCursorRel( static_cast<SCsCOL>(-nRepeat * nRTLSign), 0, SC_FOLLOW_LINE, bSel, bKeep );
124*cdf0e10cSrcweir 			break;
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir 		case SID_CURSORBLKLEFT:
127*cdf0e10cSrcweir 			pTabViewShell->MoveCursorArea( static_cast<SCsCOL>(-nRepeat * nRTLSign), 0, SC_FOLLOW_JUMP, bSel, bKeep );
128*cdf0e10cSrcweir 			break;
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 		case SID_CURSORRIGHT:
131*cdf0e10cSrcweir 			pTabViewShell->MoveCursorRel(	static_cast<SCsCOL>(nRepeat * nRTLSign), 0, SC_FOLLOW_LINE, bSel, bKeep );
132*cdf0e10cSrcweir 			break;
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir 		case SID_CURSORBLKRIGHT:
135*cdf0e10cSrcweir 			pTabViewShell->MoveCursorArea( static_cast<SCsCOL>(nRepeat * nRTLSign), 0, SC_FOLLOW_JUMP, bSel, bKeep );
136*cdf0e10cSrcweir 			break;
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 		case SID_CURSORPAGEDOWN:
139*cdf0e10cSrcweir 			pTabViewShell->MoveCursorPage(	0, nRepeat, SC_FOLLOW_FIX, bSel, bKeep );
140*cdf0e10cSrcweir 			break;
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir 		case SID_CURSORPAGEUP:
143*cdf0e10cSrcweir 			pTabViewShell->MoveCursorPage(	0, -nRepeat, SC_FOLLOW_FIX, bSel, bKeep );
144*cdf0e10cSrcweir 			break;
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir 		case SID_CURSORPAGERIGHT_: //XXX !!!
147*cdf0e10cSrcweir 			pTabViewShell->MoveCursorPage( static_cast<SCsCOL>(nRepeat), 0, SC_FOLLOW_FIX, bSel, bKeep );
148*cdf0e10cSrcweir 			break;
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 		case SID_CURSORPAGELEFT_: //XXX !!!
151*cdf0e10cSrcweir 			pTabViewShell->MoveCursorPage( static_cast<SCsCOL>(-nRepeat), 0, SC_FOLLOW_FIX, bSel, bKeep );
152*cdf0e10cSrcweir 			break;
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir 		default:
155*cdf0e10cSrcweir 			DBG_ERROR("Unbekannte Message bei ViewShell (Cursor)");
156*cdf0e10cSrcweir 			return;
157*cdf0e10cSrcweir 	}
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir 	pTabViewShell->ShowAllCursors();
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 	rReq.AppendItem( SfxInt16Item(FN_PARAM_1, static_cast<sal_Int16>(nRepeat)) );
162*cdf0e10cSrcweir 	rReq.AppendItem( SfxBoolItem(FN_PARAM_2, bSel) );
163*cdf0e10cSrcweir 	rReq.Done();
164*cdf0e10cSrcweir }
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir void ScCellShell::GetStateCursor( SfxItemSet& /* rSet */ )
167*cdf0e10cSrcweir {
168*cdf0e10cSrcweir }
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir void ScCellShell::ExecuteCursorSel( SfxRequest& rReq )
171*cdf0e10cSrcweir {
172*cdf0e10cSrcweir 	const SfxItemSet*	pReqArgs = rReq.GetArgs();
173*cdf0e10cSrcweir 	sal_uInt16				nSlotId  = rReq.GetSlot();
174*cdf0e10cSrcweir 	short				nRepeat = 1;
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir 	if ( pReqArgs != NULL )
177*cdf0e10cSrcweir 	{
178*cdf0e10cSrcweir 		const	SfxPoolItem* pItem;
179*cdf0e10cSrcweir 		if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
180*cdf0e10cSrcweir 			nRepeat = ((const SfxInt16Item*)pItem)->GetValue();
181*cdf0e10cSrcweir 	}
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir 	switch ( nSlotId )
184*cdf0e10cSrcweir 	{
185*cdf0e10cSrcweir 		case SID_CURSORDOWN_SEL:		rReq.SetSlot( SID_CURSORDOWN );  break;
186*cdf0e10cSrcweir 		case SID_CURSORBLKDOWN_SEL:		rReq.SetSlot( SID_CURSORBLKDOWN );  break;
187*cdf0e10cSrcweir 		case SID_CURSORUP_SEL:			rReq.SetSlot( SID_CURSORUP );  break;
188*cdf0e10cSrcweir 		case SID_CURSORBLKUP_SEL:		rReq.SetSlot( SID_CURSORBLKUP );  break;
189*cdf0e10cSrcweir 		case SID_CURSORLEFT_SEL:		rReq.SetSlot( SID_CURSORLEFT );  break;
190*cdf0e10cSrcweir 		case SID_CURSORBLKLEFT_SEL:		rReq.SetSlot( SID_CURSORBLKLEFT );  break;
191*cdf0e10cSrcweir 		case SID_CURSORRIGHT_SEL:		rReq.SetSlot( SID_CURSORRIGHT );  break;
192*cdf0e10cSrcweir 		case SID_CURSORBLKRIGHT_SEL:	rReq.SetSlot( SID_CURSORBLKRIGHT );  break;
193*cdf0e10cSrcweir 		case SID_CURSORPAGEDOWN_SEL:	rReq.SetSlot( SID_CURSORPAGEDOWN );  break;
194*cdf0e10cSrcweir 		case SID_CURSORPAGEUP_SEL:		rReq.SetSlot( SID_CURSORPAGEUP );  break;
195*cdf0e10cSrcweir 		case SID_CURSORPAGERIGHT_SEL:	rReq.SetSlot( SID_CURSORPAGERIGHT_ );  break;
196*cdf0e10cSrcweir 		case SID_CURSORPAGELEFT_SEL:	rReq.SetSlot( SID_CURSORPAGELEFT_ );  break;
197*cdf0e10cSrcweir 		default:
198*cdf0e10cSrcweir 			DBG_ERROR("Unbekannte Message bei ViewShell (CursorSel)");
199*cdf0e10cSrcweir 			return;
200*cdf0e10cSrcweir 	}
201*cdf0e10cSrcweir 	rReq.AppendItem( SfxInt16Item(FN_PARAM_1, nRepeat ) );
202*cdf0e10cSrcweir 	rReq.AppendItem( SfxBoolItem(FN_PARAM_2, sal_True) );
203*cdf0e10cSrcweir 	ExecuteSlot( rReq, GetInterface() );
204*cdf0e10cSrcweir }
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir void ScCellShell::ExecuteMove( SfxRequest& rReq )
207*cdf0e10cSrcweir {
208*cdf0e10cSrcweir 	ScTabViewShell*	pTabViewShell  	= GetViewData()->GetViewShell();
209*cdf0e10cSrcweir 	sal_uInt16 nSlotId  = rReq.GetSlot();
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 	if(nSlotId != SID_CURSORTOPOFSCREEN && nSlotId != SID_CURSORENDOFSCREEN)
212*cdf0e10cSrcweir 		pTabViewShell->ExecuteInputDirect();
213*cdf0e10cSrcweir 	switch ( nSlotId )
214*cdf0e10cSrcweir 	{
215*cdf0e10cSrcweir 		case SID_NEXT_TABLE:
216*cdf0e10cSrcweir         case SID_NEXT_TABLE_SEL:
217*cdf0e10cSrcweir             pTabViewShell->SelectNextTab( 1, (nSlotId == SID_NEXT_TABLE_SEL) );
218*cdf0e10cSrcweir 			break;
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir 		case SID_PREV_TABLE:
221*cdf0e10cSrcweir         case SID_PREV_TABLE_SEL:
222*cdf0e10cSrcweir             pTabViewShell->SelectNextTab( -1, (nSlotId == SID_PREV_TABLE_SEL) );
223*cdf0e10cSrcweir 			break;
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir 		//	Cursorbewegungen in Bloecken gehen nicht von Basic aus,
226*cdf0e10cSrcweir 		//	weil das ScSbxRange-Objekt bei Eingaben die Markierung veraendert
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir 		case SID_NEXT_UNPROTECT:
229*cdf0e10cSrcweir 			pTabViewShell->FindNextUnprot( sal_False, !rReq.IsAPI() );
230*cdf0e10cSrcweir 			break;
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir 		case SID_PREV_UNPROTECT:
233*cdf0e10cSrcweir 			pTabViewShell->FindNextUnprot( sal_True, !rReq.IsAPI() );
234*cdf0e10cSrcweir 			break;
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir 		case SID_CURSORENTERUP:
237*cdf0e10cSrcweir 			if (rReq.IsAPI())
238*cdf0e10cSrcweir 				pTabViewShell->MoveCursorRel( 0, -1, SC_FOLLOW_LINE, sal_False );
239*cdf0e10cSrcweir 			else
240*cdf0e10cSrcweir 				pTabViewShell->MoveCursorEnter( sal_True );
241*cdf0e10cSrcweir 			break;
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir 		case SID_CURSORENTERDOWN:
244*cdf0e10cSrcweir 			if (rReq.IsAPI())
245*cdf0e10cSrcweir 				pTabViewShell->MoveCursorRel( 0, 1, SC_FOLLOW_LINE, sal_False );
246*cdf0e10cSrcweir 			else
247*cdf0e10cSrcweir 				pTabViewShell->MoveCursorEnter( sal_False );
248*cdf0e10cSrcweir 			break;
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir 		case SID_SELECT_COL:
251*cdf0e10cSrcweir 			pTabViewShell->MarkColumns();
252*cdf0e10cSrcweir 			break;
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir 		case SID_SELECT_ROW:
255*cdf0e10cSrcweir 			pTabViewShell->MarkRows();
256*cdf0e10cSrcweir 			break;
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir 		case SID_SELECT_NONE:
259*cdf0e10cSrcweir 			pTabViewShell->Unmark();
260*cdf0e10cSrcweir 			break;
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir 		case SID_ALIGNCURSOR:
263*cdf0e10cSrcweir 			pTabViewShell->AlignToCursor( GetViewData()->GetCurX(), GetViewData()->GetCurY(), SC_FOLLOW_JUMP );
264*cdf0e10cSrcweir 			break;
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir 		case SID_MARKDATAAREA:
267*cdf0e10cSrcweir 			pTabViewShell->MarkDataArea();
268*cdf0e10cSrcweir 			break;
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir 		case SID_MARKARRAYFORMULA:
271*cdf0e10cSrcweir 			pTabViewShell->MarkMatrixFormula();
272*cdf0e10cSrcweir 			break;
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir 		case SID_SETINPUTMODE:
275*cdf0e10cSrcweir 			SC_MOD()->SetInputMode( SC_INPUT_TABLE );
276*cdf0e10cSrcweir 			break;
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir 		case SID_FOCUS_INPUTLINE:
279*cdf0e10cSrcweir 			{
280*cdf0e10cSrcweir 				ScInputHandler* pHdl = SC_MOD()->GetInputHdl( pTabViewShell );
281*cdf0e10cSrcweir 				if (pHdl)
282*cdf0e10cSrcweir 				{
283*cdf0e10cSrcweir 					ScInputWindow* pWin = pHdl->GetInputWindow();
284*cdf0e10cSrcweir 					if (pWin)
285*cdf0e10cSrcweir 						pWin->SwitchToTextWin();
286*cdf0e10cSrcweir 				}
287*cdf0e10cSrcweir 			}
288*cdf0e10cSrcweir 			break;
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir 		case SID_CURSORTOPOFSCREEN:
291*cdf0e10cSrcweir 			pTabViewShell->MoveCursorScreen( 0, -1, SC_FOLLOW_LINE, sal_False );
292*cdf0e10cSrcweir 			break;
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir 		case SID_CURSORENDOFSCREEN:
295*cdf0e10cSrcweir 			pTabViewShell->MoveCursorScreen( 0, 1, SC_FOLLOW_LINE, sal_False );
296*cdf0e10cSrcweir 			break;
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir 		default:
299*cdf0e10cSrcweir 			DBG_ERROR("Unbekannte Message bei ViewShell (Cursor)");
300*cdf0e10cSrcweir 			return;
301*cdf0e10cSrcweir 	}
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir 	rReq.Done();
304*cdf0e10cSrcweir }
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir void ScCellShell::ExecutePageSel( SfxRequest& rReq )
307*cdf0e10cSrcweir {
308*cdf0e10cSrcweir 	sal_uInt16				nSlotId  = rReq.GetSlot();
309*cdf0e10cSrcweir 	switch ( nSlotId )
310*cdf0e10cSrcweir 	{
311*cdf0e10cSrcweir 		case SID_CURSORHOME_SEL:		rReq.SetSlot( SID_CURSORHOME );  break;
312*cdf0e10cSrcweir 		case SID_CURSOREND_SEL:			rReq.SetSlot( SID_CURSOREND );  break;
313*cdf0e10cSrcweir 		case SID_CURSORTOPOFFILE_SEL:	rReq.SetSlot( SID_CURSORTOPOFFILE );  break;
314*cdf0e10cSrcweir 		case SID_CURSORENDOFFILE_SEL:	rReq.SetSlot( SID_CURSORENDOFFILE );  break;
315*cdf0e10cSrcweir 		default:
316*cdf0e10cSrcweir 			DBG_ERROR("Unbekannte Message bei ViewShell (ExecutePageSel)");
317*cdf0e10cSrcweir 			return;
318*cdf0e10cSrcweir 	}
319*cdf0e10cSrcweir 	rReq.AppendItem( SfxBoolItem(FN_PARAM_2, sal_True) );
320*cdf0e10cSrcweir 	ExecuteSlot( rReq, GetInterface() );
321*cdf0e10cSrcweir }
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir void ScCellShell::ExecutePage( SfxRequest& rReq )
324*cdf0e10cSrcweir {
325*cdf0e10cSrcweir 	ScTabViewShell*	pTabViewShell  	= GetViewData()->GetViewShell();
326*cdf0e10cSrcweir 	const SfxItemSet*	pReqArgs = rReq.GetArgs();
327*cdf0e10cSrcweir 	sal_uInt16				nSlotId  = rReq.GetSlot();
328*cdf0e10cSrcweir 	sal_Bool				bSel = sal_False;
329*cdf0e10cSrcweir 	sal_Bool				bKeep = sal_False;
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir 	if ( pReqArgs != NULL )
332*cdf0e10cSrcweir 	{
333*cdf0e10cSrcweir 		const	SfxPoolItem* pItem;
334*cdf0e10cSrcweir 		if( IS_AVAILABLE( FN_PARAM_2, &pItem ) )
335*cdf0e10cSrcweir 			bSel = ((const SfxBoolItem*)pItem)->GetValue();
336*cdf0e10cSrcweir 	}
337*cdf0e10cSrcweir 	else
338*cdf0e10cSrcweir 	{
339*cdf0e10cSrcweir 		//	evaluate locked selection mode
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir 		sal_uInt16 nLocked = pTabViewShell->GetLockedModifiers();
342*cdf0e10cSrcweir 		if ( nLocked & KEY_SHIFT )
343*cdf0e10cSrcweir 			bSel = sal_True;				// EXT
344*cdf0e10cSrcweir 		else if ( nLocked & KEY_MOD1 )
345*cdf0e10cSrcweir 		{
346*cdf0e10cSrcweir 			// ADD mode: keep the selection, start a new block when marking with shift again
347*cdf0e10cSrcweir 			bKeep = sal_True;
348*cdf0e10cSrcweir 			pTabViewShell->SetNewStartIfMarking();
349*cdf0e10cSrcweir 		}
350*cdf0e10cSrcweir 	}
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir 	pTabViewShell->ExecuteInputDirect();
353*cdf0e10cSrcweir 	switch ( nSlotId )
354*cdf0e10cSrcweir 	{
355*cdf0e10cSrcweir 		case SID_CURSORHOME:
356*cdf0e10cSrcweir 			pTabViewShell->MoveCursorEnd( -1, 0, SC_FOLLOW_LINE, bSel, bKeep );
357*cdf0e10cSrcweir 			break;
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir 		case SID_CURSOREND:
360*cdf0e10cSrcweir 			pTabViewShell->MoveCursorEnd( 1, 0, SC_FOLLOW_JUMP, bSel, bKeep );
361*cdf0e10cSrcweir 			break;
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir 		case SID_CURSORTOPOFFILE:
364*cdf0e10cSrcweir 			pTabViewShell->MoveCursorEnd( -1, -1, SC_FOLLOW_LINE, bSel, bKeep );
365*cdf0e10cSrcweir 			break;
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir 		case SID_CURSORENDOFFILE:
368*cdf0e10cSrcweir 			pTabViewShell->MoveCursorEnd( 1, 1, SC_FOLLOW_JUMP, bSel, bKeep );
369*cdf0e10cSrcweir 			break;
370*cdf0e10cSrcweir 
371*cdf0e10cSrcweir 		default:
372*cdf0e10cSrcweir 			DBG_ERROR("Unbekannte Message bei ViewShell (ExecutePage)");
373*cdf0e10cSrcweir 			return;
374*cdf0e10cSrcweir 	}
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir 	rReq.AppendItem( SfxBoolItem(FN_PARAM_2, bSel) );
377*cdf0e10cSrcweir 	rReq.Done();
378*cdf0e10cSrcweir }
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir 
383