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