1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
|
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: txtcrsr.cxx,v $
* $Revision: 1.19 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
#include <sfx2/request.hxx>
#include <svtools/eitem.hxx>
#ifndef __SBX_SBXVARIABLE_HXX //autogen
#include <basic/sbxvar.hxx>
#endif
#include <sfx2/viewfrm.hxx>
#include <sfx2/bindings.hxx>
#ifndef _VIEW_HXX
#include <view.hxx>
#endif
#include <wrtsh.hxx>
#ifndef _TEXTSH_HXX
#include <textsh.hxx>
#endif
#include <num.hxx>
#include <edtwin.hxx>
#include <crsskip.hxx>
#ifndef _CMDID_H
#include <cmdid.h>
#endif
#include <globals.h>
#ifndef _GLOBALS_HRC
#include <globals.hrc>
#endif
using namespace ::com::sun::star;
void SwTextShell::ExecBasicMove(SfxRequest &rReq)
{
SwWrtShell &rSh = GetShell();
GetView().GetEditWin().FlushInBuffer();
const SfxItemSet *pArgs = rReq.GetArgs();
BOOL bSelect = FALSE;
USHORT nCount = 1;
if(pArgs)
{
const SfxPoolItem *pItem;
if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_MOVE_COUNT, TRUE, &pItem))
nCount = ((const SfxInt16Item *)pItem)->GetValue();
if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_MOVE_SELECTION, TRUE, &pItem))
bSelect = ((const SfxBoolItem *)pItem)->GetValue();
}
switch(rReq.GetSlot())
{
case FN_CHAR_LEFT_SEL: rReq.SetSlot( FN_CHAR_LEFT ); bSelect = TRUE; break;
case FN_CHAR_RIGHT_SEL: rReq.SetSlot( FN_CHAR_RIGHT ); bSelect = TRUE; break;
case FN_LINE_UP_SEL: rReq.SetSlot( FN_LINE_UP ); bSelect = TRUE; break;
case FN_LINE_DOWN_SEL: rReq.SetSlot( FN_LINE_DOWN ); bSelect = TRUE; break;
}
uno::Reference< frame::XDispatchRecorder > xRecorder =
GetView().GetViewFrame()->GetBindings().GetRecorder();
if ( xRecorder.is() )
{
rReq.AppendItem( SfxInt16Item(FN_PARAM_MOVE_COUNT, nCount) );
rReq.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, bSelect) );
}
USHORT nSlot = rReq.GetSlot();
rReq.Done();
// Get EditWin before calling the move functions (shell change may occur!)
SwEditWin& rTmpEditWin = GetView().GetEditWin();
for( USHORT i = 0; i < nCount; i++ )
{
switch(nSlot)
{
case FN_CHAR_LEFT: rSh.Left( CRSR_SKIP_CELLS, bSelect, 1, FALSE, TRUE ); break;
case FN_CHAR_RIGHT: rSh.Right( CRSR_SKIP_CELLS, bSelect, 1, FALSE, TRUE ); break;
case FN_LINE_UP: rSh.Up ( bSelect, 1 ); break;
case FN_LINE_DOWN: rSh.Down ( bSelect, 1 ); break;
default: ASSERT(FALSE, falscher Dispatcher); return;
}
}
//#i42732# - notify the edit window that from now on we do not use the input language
rTmpEditWin.SetUseInputLanguage( sal_False );
}
void SwTextShell::ExecMove(SfxRequest &rReq)
{
SwWrtShell &rSh = GetShell();
SwEditWin& rTmpEditWin = GetView().GetEditWin();
rTmpEditWin.FlushInBuffer();
USHORT nSlot = rReq.GetSlot();
BOOL bRet = FALSE;
switch ( nSlot )
{
case FN_START_OF_LINE_SEL:
case FN_START_OF_LINE: bRet = rSh.LeftMargin ( FN_START_OF_LINE_SEL == nSlot, FALSE );
break;
case FN_END_OF_LINE_SEL:
case FN_END_OF_LINE: bRet = rSh.RightMargin( FN_END_OF_LINE_SEL == nSlot, FALSE );
break;
case FN_START_OF_DOCUMENT_SEL:
case FN_START_OF_DOCUMENT: bRet = rSh.SttDoc ( FN_START_OF_DOCUMENT_SEL == nSlot);
break;
case FN_END_OF_DOCUMENT_SEL:
case FN_END_OF_DOCUMENT: bRet = rSh.EndDoc( FN_END_OF_DOCUMENT_SEL == nSlot );
break;
case FN_SELECT_WORD: bRet = rSh.SelNearestWrd(); break;
case SID_SELECTALL: bRet = 0 != rSh.SelAll(); break;
default: ASSERT(FALSE, falscher Dispatcher); return;
}
if ( bRet )
rReq.Done();
else
rReq.Ignore();
//#i42732# - notify the edit window that from now on we do not use the input language
rTmpEditWin.SetUseInputLanguage( sal_False );
}
void SwTextShell::ExecMovePage(SfxRequest &rReq)
{
SwWrtShell &rSh = GetShell();
GetView().GetEditWin().FlushInBuffer();
USHORT nSlot = rReq.GetSlot();
switch( nSlot )
{
case FN_START_OF_NEXT_PAGE_SEL :
case FN_START_OF_NEXT_PAGE: rSh.SttNxtPg( FN_START_OF_NEXT_PAGE_SEL == nSlot ); break;
case FN_END_OF_NEXT_PAGE_SEL:
case FN_END_OF_NEXT_PAGE: rSh.EndNxtPg( FN_END_OF_NEXT_PAGE_SEL == nSlot ); break;
case FN_START_OF_PREV_PAGE_SEL:
case FN_START_OF_PREV_PAGE: rSh.SttPrvPg( FN_START_OF_PREV_PAGE_SEL == nSlot ); break;
case FN_END_OF_PREV_PAGE_SEL:
case FN_END_OF_PREV_PAGE: rSh.EndPrvPg( FN_END_OF_PREV_PAGE_SEL == nSlot ); break;
case FN_START_OF_PAGE_SEL:
case FN_START_OF_PAGE: rSh.SttPg ( FN_START_OF_PAGE_SEL == nSlot ); break;
case FN_END_OF_PAGE_SEL:
case FN_END_OF_PAGE: rSh.EndPg ( FN_END_OF_PAGE_SEL == nSlot ); break;
default: ASSERT(FALSE, falscher Dispatcher); return;
}
rReq.Done();
}
void SwTextShell::ExecMoveCol(SfxRequest &rReq)
{
SwWrtShell &rSh = GetShell();
switch ( rReq.GetSlot() )
{
case FN_START_OF_COLUMN: rSh.StartOfColumn ( FALSE ); break;
case FN_END_OF_COLUMN: rSh.EndOfColumn ( FALSE ); break;
case FN_START_OF_NEXT_COLUMN: rSh.StartOfNextColumn( FALSE ) ; break;
case FN_END_OF_NEXT_COLUMN: rSh.EndOfNextColumn ( FALSE ); break;
case FN_START_OF_PREV_COLUMN: rSh.StartOfPrevColumn( FALSE ); break;
case FN_END_OF_PREV_COLUMN: rSh.EndOfPrevColumn ( FALSE ); break;
default: ASSERT(FALSE, falscher Dispatcher); return;
}
rReq.Done();
}
void SwTextShell::ExecMoveLingu(SfxRequest &rReq)
{
SwWrtShell &rSh = GetShell();
GetView().GetEditWin().FlushInBuffer();
USHORT nSlot = rReq.GetSlot();
BOOL bRet = FALSE;
switch ( nSlot )
{
case FN_NEXT_WORD_SEL:
case FN_NEXT_WORD: bRet = rSh.NxtWrd( FN_NEXT_WORD_SEL == nSlot );
break;
case FN_START_OF_PARA_SEL:
case FN_START_OF_PARA: bRet = rSh.SttPara( FN_START_OF_PARA_SEL == nSlot );
break;
case FN_END_OF_PARA_SEL:
case FN_END_OF_PARA: bRet = rSh.EndPara( FN_END_OF_PARA_SEL == nSlot );
break;
case FN_PREV_WORD_SEL:
case FN_PREV_WORD: bRet = rSh.PrvWrd( FN_PREV_WORD_SEL == nSlot );
break;
case FN_NEXT_SENT_SEL:
case FN_NEXT_SENT: bRet = rSh.FwdSentence( FN_NEXT_SENT_SEL == nSlot );
break;
case FN_PREV_SENT_SEL:
case FN_PREV_SENT: bRet = rSh.BwdSentence( FN_PREV_SENT_SEL == nSlot );
break;
case FN_NEXT_PARA: bRet = rSh.FwdPara ( FALSE );
break;
case FN_PREV_PARA: bRet = rSh.BwdPara ( FALSE );
break;
default: ASSERT(FALSE, falscher Dispatcher); return;
}
rReq.Done();
}
void SwTextShell::ExecMoveMisc(SfxRequest &rReq)
{
SwWrtShell &rSh = GetShell();
USHORT nSlot = rReq.GetSlot();
BOOL bSetRetVal = TRUE, bRet = TRUE;
switch ( nSlot )
{
case FN_CNTNT_TO_NEXT_FRAME:
bRet = rSh.GotoObj(TRUE, GOTOOBJ_GOTO_ANY);
if(bRet)
{
rSh.HideCrsr();
rSh.EnterSelFrmMode();
}
break;
case FN_NEXT_FOOTNOTE:
rSh.MoveCrsr();
bRet = rSh.GotoNextFtnAnchor();
break;
case FN_PREV_FOOTNOTE:
rSh.MoveCrsr();
bRet = rSh.GotoPrevFtnAnchor();
break;
case FN_TO_HEADER:
rSh.MoveCrsr();
if ( FRMTYPE_HEADER & rSh.GetFrmType(0,FALSE) )
rSh.SttPg();
else
rSh.GotoHeaderTxt();
bSetRetVal = FALSE;
break;
case FN_TO_FOOTER:
rSh.MoveCrsr();
if ( FRMTYPE_FOOTER & rSh.GetFrmType(0,FALSE) )
rSh.EndPg();
else
rSh.GotoFooterTxt();
bSetRetVal = FALSE;
break;
case FN_FOOTNOTE_TO_ANCHOR:
rSh.MoveCrsr();
if ( FRMTYPE_FOOTNOTE & rSh.GetFrmType(0,FALSE) )
rSh.GotoFtnAnchor();
else
rSh.GotoFtnTxt();
bSetRetVal = FALSE;
break;
case FN_TO_FOOTNOTE_AREA :
rSh.GotoFtnTxt();
break;
case FN_PREV_TABLE:
bRet = rSh.MoveTable( fnTablePrev, fnTableStart);
break;
case FN_NEXT_TABLE:
bRet = rSh.MoveTable(fnTableNext, fnTableStart);
break;
case FN_GOTO_NEXT_REGION :
bRet = rSh.MoveRegion(fnRegionNext, fnRegionStart);
break;
case FN_GOTO_PREV_REGION :
bRet = rSh.MoveRegion(fnRegionPrev, fnRegionStart);
break;
case FN_NEXT_TOXMARK:
bRet = rSh.GotoNxtPrvTOXMark( TRUE );
break;
case FN_PREV_TOXMARK:
bRet = rSh.GotoNxtPrvTOXMark( FALSE );
break;
case FN_NEXT_TBLFML:
bRet = rSh.GotoNxtPrvTblFormula( TRUE, FALSE );
break;
case FN_PREV_TBLFML:
bRet = rSh.GotoNxtPrvTblFormula( FALSE, FALSE );
break;
case FN_NEXT_TBLFML_ERR:
bRet = rSh.GotoNxtPrvTblFormula( TRUE, TRUE );
break;
case FN_PREV_TBLFML_ERR:
bRet = rSh.GotoNxtPrvTblFormula( FALSE, TRUE );
break;
default:
ASSERT(FALSE, falscher Dispatcher);
return;
}
if( bSetRetVal )
rReq.SetReturnValue(SfxBoolItem( nSlot, bRet ));
rReq.Done();
}
|