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 #ifndef _WRTSH_HXX
23 #define _WRTSH_HXX
24
25 #include <com/sun/star/embed/XEmbeddedObject.hpp>
26 #include "swdllapi.h"
27 #include <fesh.hxx>
28 #include <sortopt.hxx>
29 #include <swurl.hxx>
30 #include <IMark.hxx>
31
32 class Window;
33 class OutputDevice;
34 class SbxArray;
35 class SwDoc;
36 class SpellCheck;
37 class SwViewOption;
38 class SwFlyFrmAttrMgr;
39 class SwField;
40 class SwTOXBase;
41 class SdrView;
42 class SwView;
43 class SvGlobalName;
44 class SwInputFieldList;
45 class SwSectionData;
46 class Timer;
47 class SvxMacro;
48 class SwFmtINetFmt;
49 class SvxINetBookmark;
50 class SvxAutoCorrect;
51 class NaviContentBookmark;
52 struct SwCallMouseEvent;
53 class DropEvent;
54 struct ChartSelectionInfo;
55 class SfxStringListItem;
56 class SfxRequest;
57
58 namespace com { namespace sun { namespace star { namespace util {
59 struct SearchOptions;
60 } } } }
61
62
63 typedef sal_Int32 SelectionType;
64 namespace nsSelectionType
65 {
66 const SelectionType SEL_TXT = CNT_TXT; // Text, niemals auch Rahmen 0x0001
67 const SelectionType SEL_GRF = CNT_GRF; // Grafik 0x0002
68 const SelectionType SEL_OLE = CNT_OLE; // OLE 0x0010
69 const SelectionType SEL_FRM = 0x000020; // Rahmen, keine Inhaltsform
70 const SelectionType SEL_NUM = 0x000040; // NumListe
71 const SelectionType SEL_TBL = 0x000080; // Cursor steht in Tabelle
72 const SelectionType SEL_TBL_CELLS = 0x000100; // Tabellenzellen sind selektiert
73 const SelectionType SEL_DRW = 0x000200; // Zeichenobjekte (Rechteck, Kreis...)
74 const SelectionType SEL_DRW_TXT = 0x000400; // Draw-Textobjekte im Editmode
75 const SelectionType SEL_BEZ = 0x000800; // Bezierobjekte editieren
76 const SelectionType SEL_DRW_FORM = 0x001000; // Zeichenobjekte: DB-Forms
77 const SelectionType SEL_FOC_FRM_CTRL = 0x002000; // a form control is focused. Neither set nor evaluated by the SwWrtShell itself, only by its clients.
78 const SelectionType SEL_MEDIA = 0x004000; // Media object
79 const SelectionType SEL_EXTRUDED_CUSTOMSHAPE = 0x008000; // extruded custom shape
80 const SelectionType SEL_FONTWORK = 0x010000; // Fontwork
81 const SelectionType SEL_POSTIT = 0x020000; // Annotation
82 }
83
84
85 class SW_DLLPUBLIC SwWrtShell: public SwFEShell
86 {
87 private:
88 using SwCrsrShell::Left;
89 using SwCrsrShell::Right;
90 using SwCrsrShell::Up;
91 using SwCrsrShell::Down;
92 using SwCrsrShell::LeftMargin;
93 using SwCrsrShell::RightMargin;
94 using SwCrsrShell::SelectTxtAttr;
95 using SwCrsrShell::GotoPage;
96 using SwFEShell::InsertObject;
97 using SwEditShell::AutoCorrect;
98 using SwCrsrShell::GotoMark;
99
100 public:
101
102 using SwEditShell::Insert;
103
104 typedef long (SwWrtShell::*SELECTFUNC)(const Point *, sal_Bool bProp );
105
106 SELECTFUNC fnDrag;
107 SELECTFUNC fnSetCrsr;
108 SELECTFUNC fnEndDrag;
109 SELECTFUNC fnKillSel;
110
111 // Alle Selektionen aufheben
112 long ResetSelect( const Point *, sal_Bool );
113
114 // setzt den Cursorstack nach dem Bewegen mit PageUp/-Down
115 // zurück, falls ein Stack aufgebaut ist
116 inline void ResetCursorStack();
117 SelectionType GetSelectionType() const;
118
IsModePushed() const119 sal_Bool IsModePushed() const { return 0 != pModeStack; }
120 void PushMode();
121 void PopMode();
122
123 void SttSelect();
124 void EndSelect();
IsInSelect() const125 sal_Bool IsInSelect() const { return bInSelect; }
SetInSelect(sal_Bool bSel=sal_True)126 void SetInSelect(sal_Bool bSel = sal_True) { bInSelect = bSel; }
127 // Liegt eine Text- oder Rahmenselektion vor?
HasSelection() const128 sal_Bool HasSelection() const { return SwCrsrShell::HasSelection() ||
129 IsMultiSelection() || IsSelFrmMode() || IsObjSelected(); }
130 sal_Bool Pop( sal_Bool bOldCrsr = sal_True );
131
132 void EnterStdMode();
IsStdMode() const133 sal_Bool IsStdMode() const { return !bExtMode && !bAddMode && !bBlockMode; }
134
135 void EnterExtMode();
136 void LeaveExtMode();
137 long ToggleExtMode();
IsExtMode() const138 sal_Bool IsExtMode() const { return bExtMode; }
139
140 void EnterAddMode();
141 void LeaveAddMode();
142 long ToggleAddMode();
IsAddMode() const143 sal_Bool IsAddMode() const { return bAddMode; }
144
145 void EnterBlockMode();
146 void LeaveBlockMode();
147 long ToggleBlockMode();
IsBlockMode() const148 sal_Bool IsBlockMode() const { return bBlockMode; }
149
150 void SetInsMode( sal_Bool bOn = sal_True );
ToggleInsMode()151 void ToggleInsMode() { SetInsMode( !bIns ); }
IsInsMode() const152 sal_Bool IsInsMode() const { return bIns; }
153 void SetRedlineModeAndCheckInsMode( sal_uInt16 eMode );
154
155 void EnterSelFrmMode(const Point *pStartDrag = 0);
156 void LeaveSelFrmMode();
IsSelFrmMode() const157 sal_Bool IsSelFrmMode() const { return bLayoutMode; }
158 // Selektion von Rahmen aufheben
159 void UnSelectFrm();
160
161 void Invalidate();
162
163 // Tabellenzellen selektieren für Bearbeiten von Formeln in der Ribbonbar
164 inline void SelTblCells( const Link &rLink, sal_Bool bMark = sal_True );
165 inline void EndSelTblCells();
166
167 // Wortweisen oder zeilenweisen Selektionsmodus verlassen. Wird
168 // in der Regel in MB-Up gerufen.
IsExtSel() const169 sal_Bool IsExtSel() const { return bSelWrd || bSelLn; }
170
171 // erfrage, ob der akt. fnDrag - Pointer auf BeginDrag gesetzt ist
172 // Wird für MouseMove gebraucht, um die Bugs 55592/55931 zu umgehen.
173 inline sal_Bool Is_FnDragEQBeginDrag() const;
174
175 // Basisabfragen
IsInWrd()176 sal_Bool IsInWrd() { return IsInWord(); }
IsSttWrd()177 sal_Bool IsSttWrd() { return IsStartWord(); }
178 sal_Bool IsEndWrd();
IsSttOfPara() const179 sal_Bool IsSttOfPara() const { return IsSttPara(); }
IsEndOfPara() const180 sal_Bool IsEndOfPara() const { return IsEndPara(); }
181
182 // Wort bzw. Satz selektieren.
183 sal_Bool SelNearestWrd();
184 sal_Bool SelWrd (const Point * = 0, sal_Bool bProp=sal_False );
185 // --> FME 2004-07-30 #i32329# Enhanced selection
186 void SelSentence (const Point * = 0, sal_Bool bProp=sal_False );
187 void SelPara (const Point * = 0, sal_Bool bProp=sal_False );
188 // <--
189 long SelAll();
190
191 // Basiscursortravelling
192 typedef sal_Bool (SwWrtShell:: *FNSimpleMove)();
193 sal_Bool SimpleMove( FNSimpleMove, sal_Bool bSelect );
194
195 sal_Bool Left ( sal_uInt16 nMode, sal_Bool bSelect,
196 sal_uInt16 nCount, sal_Bool bBasicCall, sal_Bool bVisual = sal_False );
197 sal_Bool Right ( sal_uInt16 nMode, sal_Bool bSelect,
198 sal_uInt16 nCount, sal_Bool bBasicCall, sal_Bool bVisual = sal_False );
199 sal_Bool Up ( sal_Bool bSelect = sal_False, sal_uInt16 nCount = 1,
200 sal_Bool bBasicCall = sal_False );
201 sal_Bool Down ( sal_Bool bSelect = sal_False, sal_uInt16 nCount = 1,
202 sal_Bool bBasicCall = sal_False );
NxtWrd(sal_Bool bSelect=sal_False)203 sal_Bool NxtWrd ( sal_Bool bSelect = sal_False ) { return SimpleMove( &SwWrtShell::_NxtWrd, bSelect ); }
PrvWrd(sal_Bool bSelect=sal_False)204 sal_Bool PrvWrd ( sal_Bool bSelect = sal_False ) { return SimpleMove( &SwWrtShell::_PrvWrd, bSelect ); }
205
206 sal_Bool LeftMargin ( sal_Bool bSelect, sal_Bool bBasicCall );
207 sal_Bool RightMargin( sal_Bool bSelect, sal_Bool bBasicCall );
208
209 sal_Bool SttDoc ( sal_Bool bSelect = sal_False );
210 sal_Bool EndDoc ( sal_Bool bSelect = sal_False );
211
212 sal_Bool SttNxtPg ( sal_Bool bSelect = sal_False );
213 sal_Bool SttPrvPg ( sal_Bool bSelect = sal_False );
214 sal_Bool EndNxtPg ( sal_Bool bSelect = sal_False );
215 sal_Bool EndPrvPg ( sal_Bool bSelect = sal_False );
216 sal_Bool SttPg ( sal_Bool bSelect = sal_False );
217 sal_Bool EndPg ( sal_Bool bSelect = sal_False );
218 sal_Bool SttPara ( sal_Bool bSelect = sal_False );
219 sal_Bool EndPara ( sal_Bool bSelect = sal_False );
FwdPara(sal_Bool bSelect=sal_False)220 sal_Bool FwdPara ( sal_Bool bSelect = sal_False )
221 { return SimpleMove( &SwWrtShell::_FwdPara, bSelect ); }
BwdPara(sal_Bool bSelect=sal_False)222 sal_Bool BwdPara ( sal_Bool bSelect = sal_False )
223 { return SimpleMove( &SwWrtShell::_BwdPara, bSelect ); }
FwdSentence(sal_Bool bSelect=sal_False)224 sal_Bool FwdSentence( sal_Bool bSelect = sal_False )
225 { return SimpleMove( &SwWrtShell::_FwdSentence, bSelect ); }
BwdSentence(sal_Bool bSelect=sal_False)226 sal_Bool BwdSentence( sal_Bool bSelect = sal_False )
227 { return SimpleMove( &SwWrtShell::_BwdSentence, bSelect ); }
228
229 // --> FME 2004-07-30 #i20126# Enhanced table selection
230 sal_Bool SelectTableRowCol( const Point& rPt, const Point* pEnd = 0, bool bRowDrag = false );
231 // <--
232 sal_Bool SelectTableRow();
233 sal_Bool SelectTableCol();
234 sal_Bool SelectTableCell();
235
236 sal_Bool SelectTxtAttr( sal_uInt16 nWhich, const SwTxtAttr* pAttr = 0 );
237
238 // Spaltenweise Spruenge
239 sal_Bool StartOfColumn ( sal_Bool bSelect = sal_False );
240 sal_Bool EndOfColumn ( sal_Bool bSelect = sal_False );
241 sal_Bool StartOfNextColumn ( sal_Bool bSelect = sal_False );
242 sal_Bool EndOfNextColumn ( sal_Bool bSelect = sal_False );
243 sal_Bool StartOfPrevColumn ( sal_Bool bSelect = sal_False );
244 sal_Bool EndOfPrevColumn ( sal_Bool bSelect = sal_False );
245
246 // Setze den Cursor auf die Seite "nPage" an den Anfang
247 // zusätzlich zu der gleichnamigen Implementierung in crsrsh.hxx
248 // werden hier alle bestehenden Selektionen vor dem Setzen des
249 // Cursors aufgehoben
250 sal_Bool GotoPage( sal_uInt16 nPage, sal_Bool bRecord );
251
252 // Setzen des Cursors; merken der alten Position für Zurückblättern.
253 DECL_LINK( ExecFlyMac, void * );
254
255 sal_Bool PageCrsr(SwTwips lOffset, sal_Bool bSelect);
256
257 // Felder Update
258 void UpdateInputFlds( SwInputFieldList* pLst = 0 );
259
260 void NoEdit(sal_Bool bHideCrsr = sal_True);
261 void Edit();
IsNoEdit() const262 sal_Bool IsNoEdit() const { return bNoEdit; }
263
IsRetainSelection() const264 sal_Bool IsRetainSelection() const { return mbRetainSelection; }
SetRetainSelection(sal_Bool bRet)265 void SetRetainSelection( sal_Bool bRet ) { mbRetainSelection = bRet; }
266
267 // change current data base and notify
268 void ChgDBData(const SwDBData& SwDBData);
269
270 // Löschen
271 long DelToEndOfLine();
272 long DelToStartOfLine();
273 long DelLine();
274 long DelLeft();
275
276 // löscht auch Rahmen bzw. setzt den Cursor in den Rahmen,
277 // wenn bDelFrm == sal_False ist
278 long DelRight();
279 long DelToEndOfPara();
280 long DelToStartOfPara();
281 long DelToEndOfSentence();
282 long DelToStartOfSentence();
283 long DelNxtWord();
284 long DelPrvWord();
285
286 // Prüft, ob eine Wortselektion vorliegt.
287 // Gemäss den Regeln für intelligentes Cut / Paste
288 // werden umgebende Spaces rausgeschnitten.
289 // Liefert Art der Wortselektion zurück (siehe enum)
290 enum word {
291 NO_WORD = 0,
292 WORD_SPACE_BEFORE = 1,
293 WORD_SPACE_AFTER = 2,
294 WORD_NO_SPACE = 3
295 };
296 int IntelligentCut(int nSelectionType, sal_Bool bCut = sal_True);
297
298 // Editieren
299 void Insert( SwField& rFld );
300
301 void Insert(const String &);
302
303 // Graphic
304 void Insert( const String &rPath, const String &rFilter,
305 const Graphic &, SwFlyFrmAttrMgr * = 0,
306 sal_Bool bRule = sal_False );
307
308 void InsertByWord( const String & );
309 void InsertPageBreak(const String *pPageDesc = 0, sal_uInt16 nPgNum = 0 );
310 void InsertLineBreak();
311 void InsertColumnBreak();
312 void InsertFootnote(const String &, sal_Bool bEndNote = sal_False, sal_Bool bEdit = sal_True );
313 void SplitNode( sal_Bool bAutoFormat = sal_False, sal_Bool bCheckTableStart = sal_True );
314 bool CanInsert();
315
316 // Verzeichnisse
317 void InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0);
318 sal_Bool UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0);
319
320 // Numerierung und Bullets
321 /**
322 Turns on numbering or bullets.
323
324 @param bNum sal_True: turn on numbering
325 sal_False: turn on bullets
326 */
327 void NumOrBulletOn(sal_Bool bNum); // #i29560#
328 void NumOrBulletOff(); // #i29560#
329 void NumOn();
330 void BulletOn();
331
332 //OLE
333 void InsertObject( /*SvInPlaceObjectRef *pObj, */ // != 0 for Clipboard
334 const svt::EmbeddedObjectRef&,
335 SvGlobalName *pName = 0, // != 0 entspr. Object erzeugen.
336 sal_Bool bActivate = sal_True,
337 sal_uInt16 nSlotId = 0); // SlotId für Dialog
338
339 sal_Bool InsertOleObject( const svt::EmbeddedObjectRef& xObj, SwFlyFrmFmt **pFlyFrmFmt = 0 );
340 void LaunchOLEObj( long nVerb = 0 ); // Server starten
IsOLEObj() const341 sal_Bool IsOLEObj() const { return GetCntType() == CNT_OLE;}
342 virtual void MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset );
343 virtual void CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
344 const SwRect *pFlyPrtRect = 0,
345 const SwRect *pFlyFrmRect = 0,
346 const bool bNoTxtFrmPrtAreaChanged = false );
347 virtual void ConnectObj( svt::EmbeddedObjectRef& xIPObj, const SwRect &rPrt,
348 const SwRect &rFrm );
349
350 // Vorlagen und Formate
351
352 // enum gibt an, was geschehen soll, wenn das Style nicht gefunden wurde
353 enum GetStyle { GETSTYLE_NOCREATE, // keins anlegen
354 GETSTYLE_CREATESOME, // falls auf PoolId mapt anlegen
355 GETSTYLE_CREATEANY }; // ggfs. Standard returnen
356
357 SwTxtFmtColl* GetParaStyle(const String &rCollName,
358 GetStyle eCreate = GETSTYLE_NOCREATE);
359 SwCharFmt* GetCharStyle(const String &rFmtName,
360 GetStyle eCreate = GETSTYLE_NOCREATE);
361 SwFrmFmt* GetTblStyle(const String &rFmtName);
362
363 void SetPageStyle(const String &rCollName);
364
365 String GetCurPageStyle( const sal_Bool bCalcFrm = sal_True ) const;
366
367 // Aktuelle Vorlage anhand der geltenden Attribute ändern
368 void QuickUpdateStyle();
369
370 enum DoType { UNDO, REDO, REPEAT };
371
372 void Do( DoType eDoType, sal_uInt16 nCnt = 1 );
373 String GetDoString( DoType eDoType ) const;
374 String GetRepeatString() const;
375 sal_uInt16 GetDoStrings( DoType eDoType, SfxStringListItem& rStrLstItem ) const;
376
377 // Suchen oder Ersetzen
378 sal_uLong SearchPattern(const com::sun::star::util::SearchOptions& rSearchOpt,
379 sal_Bool bSearchInNotes,
380 SwDocPositions eStart, SwDocPositions eEnde,
381 FindRanges eFlags = FND_IN_BODY,
382 int bReplace = sal_False );
383
384 sal_uLong SearchTempl (const String &rTempl,
385 SwDocPositions eStart, SwDocPositions eEnde,
386 FindRanges eFlags = FND_IN_BODY,
387 const String* pReplTempl = 0 );
388
389 sal_uLong SearchAttr (const SfxItemSet& rFindSet,
390 sal_Bool bNoColls,
391 SwDocPositions eStart,SwDocPositions eEnde,
392 FindRanges eFlags = FND_IN_BODY,
393 const com::sun::star::util::SearchOptions* pSearchOpt = 0,
394 const SfxItemSet* pReplaceSet = 0);
395
396 void AutoCorrect( SvxAutoCorrect& rACorr, sal_Unicode cChar = ' ' );
397
398 // Aktion vor Cursorbewegung
399 // Hebt ggfs. Selektionen auf, triggert Timer und GCAttr()
400 void MoveCrsr( sal_Bool bWithSelect = sal_False );
401
402 // Eingabefelder updaten
403 sal_Bool StartInputFldDlg(SwField*, sal_Bool bNextButton, Window* pParentWin = 0, ByteString* pWindowState = 0);
404 // update DropDown fields
405 sal_Bool StartDropDownFldDlg(SwField*, sal_Bool bNextButton, ByteString* pWindowState = 0);
406
407 // "Handler" für Änderungen an der DrawView - für Controls.
408 virtual void DrawSelChanged( );
409
410 // springe zum Bookmark und setze die "Selections-Flags" wieder richtig
411 sal_Bool GotoMark( const ::sw::mark::IMark* const pMark );
412 sal_Bool GotoMark( const ::sw::mark::IMark* const pMark, sal_Bool bSelect, sal_Bool bStart );
413 sal_Bool GotoMark( const ::rtl::OUString& rName );
414 sal_Bool GoNextBookmark(); // sal_True, wenn's noch eine gab
415 sal_Bool GoPrevBookmark();
416
417 bool GotoFieldmark(::sw::mark::IFieldmark const * const pMark);
418
419 sal_Bool GotoField( const SwFmtFld& rFld );
420
421 // jump to the next / previous hyperlink - inside text and also
422 // on graphics
423 sal_Bool SelectNextPrevHyperlink( sal_Bool bNext = sal_True );
424
425 // Zugehörige SwView ermitteln
GetView() const426 const SwView& GetView() const { return rView; }
GetView()427 SwView& GetView() { return rView; }
428
429 // Weil es sonst keiner macht, gibt es hier eine ExecMacro()
430 void ExecMacro( const SvxMacro& rMacro, String* pRet = 0, SbxArray* pArgs = 0 );
431 // rufe ins dunkle Basic/JavaScript
432 sal_uInt16 CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent,
433 sal_Bool bCheckPtr = sal_False, SbxArray* pArgs = 0,
434 const Link* pCallBack = 0 );
435
436 // ein Klick aus das angegebene Feld. Der Cursor steht auf diesem.
437 // Führe die vor definierten Aktionen aus.
438 void ClickToField( const SwField& rFld );
439 void ClickToINetAttr( const SwFmtINetFmt& rItem, sal_uInt16 nFilter = URLLOAD_NOFILTER );
440 sal_Bool ClickToINetGrf( const Point& rDocPt, sal_uInt16 nFilter = URLLOAD_NOFILTER );
441 inline sal_Bool IsInClickToEdit() const ;
442
443 // falls ein URL-Button selektiert ist, dessen URL returnen, ansonsten
444 // einen LeerString
445 sal_Bool GetURLFromButton( String& rURL, String& rDescr ) const;
446
447 void NavigatorPaste( const NaviContentBookmark& rBkmk,
448 const sal_uInt16 nAction );
449
450 virtual void ApplyViewOptions( const SwViewOption &rOpt );
451
452 // autom. Update von Vorlagen
453 void AutoUpdateFrame(SwFrmFmt* pFmt, const SfxItemSet& rStyleSet);
454 void AutoUpdatePara(SwTxtFmtColl* pColl, const SfxItemSet& rStyleSet);
455
456 // Link fürs einfügen von Bereichen über Drag&Drop/Clipboard
457 DECL_STATIC_LINK( SwWrtShell, InsertRegionDialog, SwSectionData* );
458
459
460 // ctoren, der erstere ist eine Art kontrollierter copy ctor für weitere
461 // Sichten auf ein Dokument
462 SwWrtShell( SwWrtShell&, Window *pWin, SwView &rShell);
463 SwWrtShell( SwDoc& rDoc, Window *pWin, SwView &rShell,
464 const SwViewOption *pViewOpt = 0);
465 virtual ~SwWrtShell();
466
467 sal_Bool TryRemoveIndent(); // #i23725#
468
469 String GetSelDescr() const;
470
471 private:
472
473 SW_DLLPRIVATE void OpenMark();
474 SW_DLLPRIVATE void CloseMark( sal_Bool bOkFlag );
475
476 SW_DLLPRIVATE String GetWrdDelim();
477 SW_DLLPRIVATE String GetSDelim();
478 SW_DLLPRIVATE String GetBothDelim();
479
480 struct ModeStack
481 {
482 ModeStack *pNext;
483 sal_Bool bAdd,
484 bBlock,
485 bExt,
486 bIns;
ModeStackSwWrtShell::ModeStack487 ModeStack(ModeStack *pNextMode, sal_Bool _bIns, sal_Bool _bExt, sal_Bool _bAdd, sal_Bool _bBlock):
488 pNext(pNextMode),
489 bAdd(_bAdd),
490 bBlock(_bBlock),
491 bExt(_bExt),
492 bIns(_bIns)
493 {}
494 } *pModeStack;
495
496 // Cursor bei PageUp/-Down mitnehmen
497 enum PageMove
498 {
499 MV_NO,
500 MV_PAGE_UP,
501 MV_PAGE_DOWN
502 } ePageMove;
503
504 struct CrsrStack
505 {
506 Point aDocPos;
507 CrsrStack *pNext;
508 sal_Bool bValidCurPos : 1;
509 sal_Bool bIsFrmSel : 1;
510 SwTwips lOffset;
511
CrsrStackSwWrtShell::CrsrStack512 CrsrStack( sal_Bool bValid, sal_Bool bFrmSel, const Point &rDocPos,
513 SwTwips lOff, CrsrStack *pN )
514 : aDocPos(rDocPos),
515 pNext(pN),
516 bValidCurPos( bValid ),
517 bIsFrmSel( bFrmSel ),
518 lOffset(lOff)
519 {
520
521
522 }
523
524 } *pCrsrStack;
525
526 SwView &rView;
527
528 Point aDest;
529 sal_Bool bDestOnStack;
HasCrsrStack() const530 sal_Bool HasCrsrStack() const { return 0 != pCrsrStack; }
531 SW_DLLPRIVATE sal_Bool PushCrsr(SwTwips lOffset, sal_Bool bSelect);
532 SW_DLLPRIVATE sal_Bool PopCrsr(sal_Bool bUpdate, sal_Bool bSelect = sal_False);
533
534 // ENDE Cursor bei PageUp/-Down mitnehmen
535 SW_DLLPRIVATE sal_Bool _SttWrd();
536 SW_DLLPRIVATE sal_Bool _EndWrd();
537 SW_DLLPRIVATE sal_Bool _NxtWrd();
538 SW_DLLPRIVATE sal_Bool _PrvWrd();
539 // --> OD 2008-08-06 #i92468#
540 SW_DLLPRIVATE sal_Bool _NxtWrdForDelete();
541 SW_DLLPRIVATE sal_Bool _PrvWrdForDelete();
542 // <--
543 SW_DLLPRIVATE sal_Bool _FwdSentence();
544 SW_DLLPRIVATE sal_Bool _BwdSentence();
545 sal_Bool _FwdPara();
546 SW_DLLPRIVATE sal_Bool _BwdPara();
547
548 // Selektionen
549 sal_Bool bIns :1;
550 sal_Bool bInSelect :1;
551 sal_Bool bExtMode :1;
552 sal_Bool bAddMode :1;
553 sal_Bool bBlockMode :1;
554 sal_Bool bLayoutMode :1;
555 sal_Bool bNoEdit :1;
556 sal_Bool bCopy :1;
557 sal_Bool bSelWrd :1;
558 sal_Bool bSelLn :1;
559 sal_Bool bIsInClickToEdit:1;
560 sal_Bool bClearMark :1; // Selektion für ChartAutoPilot nicht löschen
561 sal_Bool mbRetainSelection :1; // Do not remove selections
562
563 Point aStart;
564 Link aSelTblLink;
565
566 SELECTFUNC fnLeaveSelect;
567
568 // setzt den Cursorstack nach dem Bewegen mit PageUp/-Down zurück.
569 SW_DLLPRIVATE void _ResetCursorStack();
570
571 SW_DLLPRIVATE void SttDragDrop(Timer *);
572
573 using SwCrsrShell::SetCrsr;
574 SW_DLLPRIVATE long SetCrsr(const Point *, sal_Bool bProp=sal_False );
575
576 SW_DLLPRIVATE long SetCrsrKillSel(const Point *, sal_Bool bProp=sal_False );
577
578 SW_DLLPRIVATE long StdSelect(const Point *, sal_Bool bProp=sal_False );
579 SW_DLLPRIVATE long BeginDrag(const Point *, sal_Bool bProp=sal_False );
580 SW_DLLPRIVATE long Drag(const Point *, sal_Bool bProp=sal_False );
581 SW_DLLPRIVATE long EndDrag(const Point *, sal_Bool bProp=sal_False );
582
583 SW_DLLPRIVATE long ExtSelWrd(const Point *, sal_Bool bProp=sal_False );
584 SW_DLLPRIVATE long ExtSelLn(const Point *, sal_Bool bProp=sal_False );
585
586 // Verschieben von Text aus Drag and Drop; Point ist
587 // Destination für alle Selektionen.
588 SW_DLLPRIVATE long MoveText(const Point *, sal_Bool bProp=sal_False );
589
590 SW_DLLPRIVATE long BeginFrmDrag(const Point *, sal_Bool bProp=sal_False );
591
592 // nach SSize/Move eines Frames Update; Point ist Destination.
593 SW_DLLPRIVATE long UpdateLayoutFrm(const Point *, sal_Bool bProp=sal_False );
594
595 SW_DLLPRIVATE long SttLeaveSelect(const Point *, sal_Bool bProp=sal_False );
596 SW_DLLPRIVATE long AddLeaveSelect(const Point *, sal_Bool bProp=sal_False );
597 SW_DLLPRIVATE long Ignore(const Point *, sal_Bool bProp=sal_False );
598
LeaveExtSel()599 SW_DLLPRIVATE void LeaveExtSel() { bSelWrd = bSelLn = sal_False;}
600 SW_DLLPRIVATE bool _CanInsert();
601
602 SW_DLLPRIVATE sal_Bool GoStart(sal_Bool KeepArea = sal_False, sal_Bool * = 0,
603 sal_Bool bSelect = sal_False, sal_Bool bDontMoveRegion = sal_False);
604 SW_DLLPRIVATE sal_Bool GoEnd(sal_Bool KeepArea = sal_False, sal_Bool * = 0);
605
606 enum BookMarkMove
607 {
608 BOOKMARK_INDEX,
609 BOOKMARK_NEXT,
610 BOOKMARK_PREV,
611 BOOKMARK_LAST_LAST_ENTRY
612 };
613
614 SW_DLLPRIVATE sal_Bool MoveBookMark(BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark=NULL);
615 };
616
ResetCursorStack()617 inline void SwWrtShell::ResetCursorStack()
618 {
619 if ( HasCrsrStack() )
620 _ResetCursorStack();
621 }
622
SelTblCells(const Link & rLink,sal_Bool bMark)623 inline void SwWrtShell::SelTblCells(const Link &rLink, sal_Bool bMark )
624 {
625 SetSelTblCells( sal_True );
626 bClearMark = bMark;
627 aSelTblLink = rLink;
628 }
EndSelTblCells()629 inline void SwWrtShell::EndSelTblCells()
630 {
631 SetSelTblCells( sal_False );
632 bClearMark = sal_True;
633 }
634
IsInClickToEdit() const635 inline sal_Bool SwWrtShell::IsInClickToEdit() const { return bIsInClickToEdit; }
636
Is_FnDragEQBeginDrag() const637 inline sal_Bool SwWrtShell::Is_FnDragEQBeginDrag() const
638 {
639 #ifdef GCC
640 SELECTFUNC fnTmp = &SwWrtShell::BeginDrag;
641 return fnDrag == fnTmp;
642 #else
643 return sal::static_int_cast< sal_Bool >(fnDrag == &SwWrtShell::BeginDrag);
644 #endif
645 }
646
647 #endif
648
649 /* vim: set noet sw=4 ts=4: */
650