Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _WRTSH_HXX
20 : #define _WRTSH_HXX
21 :
22 : #include <com/sun/star/embed/XEmbeddedObject.hpp>
23 : #include "swdllapi.h"
24 : #include <fesh.hxx>
25 : #include <sortopt.hxx>
26 : #include <swurl.hxx>
27 : #include <IMark.hxx>
28 : #include "navmgr.hxx"
29 :
30 : class Window;
31 : class SbxArray;
32 : class SwDoc;
33 : class SwViewOption;
34 : class SwFlyFrmAttrMgr;
35 : class SwField;
36 : class SwTOXBase;
37 : class SwView;
38 : class SvGlobalName;
39 : class SwInputFieldList;
40 : class SwSectionData;
41 : class Timer;
42 : class SvxMacro;
43 : class SwFmtINetFmt;
44 : class SvxAutoCorrect;
45 : class NaviContentBookmark;
46 : struct SwCallMouseEvent;
47 : class SfxStringListItem;
48 :
49 : namespace com { namespace sun { namespace star { namespace util {
50 : struct SearchOptions;
51 : } } } }
52 :
53 :
54 : typedef sal_Int32 SelectionType;
55 : namespace nsSelectionType
56 : {
57 : const SelectionType SEL_TXT = CNT_TXT; // text, never frames too 0x0001
58 : const SelectionType SEL_GRF = CNT_GRF; // graphic 0x0002
59 : const SelectionType SEL_OLE = CNT_OLE; // OLE 0x0010
60 : const SelectionType SEL_FRM = 0x000020; // frame, no content type
61 : const SelectionType SEL_NUM = 0x000040; // NumList
62 : const SelectionType SEL_TBL = 0x000080; // cursor is in table
63 : const SelectionType SEL_TBL_CELLS = 0x000100; // table cells are selected
64 : const SelectionType SEL_DRW = 0x000200; // drawing objects (rectangle, circle...)
65 : const SelectionType SEL_DRW_TXT = 0x000400; // draw-textobjects in edit mode
66 : const SelectionType SEL_BEZ = 0x000800; // edit ornament objects
67 : const SelectionType SEL_DRW_FORM = 0x001000; // drawing objects: DB-Forms
68 : const SelectionType SEL_FOC_FRM_CTRL = 0x002000; // a form control is focused. Neither set nor evaluated by the SwWrtShell itself, only by it's clients.
69 : const SelectionType SEL_MEDIA = 0x004000; // Media object
70 : const SelectionType SEL_EXTRUDED_CUSTOMSHAPE = 0x008000; // extruded custom shape
71 : const SelectionType SEL_FONTWORK = 0x010000; // fontwork
72 : const SelectionType SEL_POSTIT = 0x020000; //annotation
73 : }
74 :
75 :
76 : class SW_DLLPUBLIC SwWrtShell: public SwFEShell
77 : {
78 : private:
79 : using SwCrsrShell::Left;
80 : using SwCrsrShell::Right;
81 : using SwCrsrShell::Up;
82 : using SwCrsrShell::Down;
83 : using SwCrsrShell::LeftMargin;
84 : using SwCrsrShell::RightMargin;
85 : using SwCrsrShell::SelectTxtAttr;
86 : using SwCrsrShell::GotoPage;
87 : using SwFEShell::InsertObject;
88 : using SwEditShell::AutoCorrect;
89 : using SwCrsrShell::GotoMark;
90 :
91 : typedef long (SwWrtShell::*SELECTFUNC)(const Point *, sal_Bool bProp );
92 :
93 : SELECTFUNC fnDrag;
94 : SELECTFUNC fnSetCrsr;
95 : SELECTFUNC fnEndDrag;
96 : SELECTFUNC fnKillSel;
97 :
98 : public:
99 :
100 : using SwEditShell::Insert;
101 :
102 0 : long SetCursor (const Point* pPt, bool bProp) { return (this->*fnSetCrsr)(pPt, bProp); }
103 0 : long Drag (const Point* pPt, bool bProp) { return (this->*fnDrag)(pPt, bProp); }
104 0 : long EndDrag (const Point* pPt, bool bProp) { return (this->*fnEndDrag)(pPt, bProp); }
105 0 : long KillSelection(const Point* pPt, bool bProp) { return (this->*fnKillSel)(pPt, bProp); }
106 :
107 : // reset all selections
108 : long ResetSelect( const Point *, sal_Bool );
109 :
110 : // resets the cursorstack after movement with PageUp/-Down if a stack is built up
111 : inline void ResetCursorStack();
112 : SelectionType GetSelectionType() const;
113 :
114 792 : bool IsModePushed() const { return 0 != pModeStack; }
115 : void PushMode();
116 : void PopMode();
117 :
118 : void SttSelect();
119 : void EndSelect();
120 0 : sal_Bool IsInSelect() const { return bInSelect; }
121 0 : void SetInSelect(sal_Bool bSel = sal_True) { bInSelect = bSel; }
122 : // is there a text- or frameselection?
123 8832 : sal_Bool HasSelection() const { return SwCrsrShell::HasSelection() ||
124 8832 : IsMultiSelection() || IsSelFrmMode() || IsObjSelected(); }
125 : sal_Bool Pop( sal_Bool bOldCrsr = sal_True );
126 :
127 : void EnterStdMode();
128 643 : bool IsStdMode() const { return !bExtMode && !bAddMode && !bBlockMode; }
129 :
130 : void EnterExtMode();
131 : void LeaveExtMode();
132 : long ToggleExtMode();
133 0 : sal_Bool IsExtMode() const { return bExtMode; }
134 :
135 : void EnterAddMode();
136 : void LeaveAddMode();
137 : long ToggleAddMode();
138 0 : sal_Bool IsAddMode() const { return bAddMode; }
139 :
140 : void EnterBlockMode();
141 : void LeaveBlockMode();
142 : long ToggleBlockMode();
143 0 : sal_Bool IsBlockMode() const { return bBlockMode; }
144 :
145 : void SetInsMode( sal_Bool bOn = sal_True );
146 0 : void ToggleInsMode() { SetInsMode( !bIns ); }
147 639 : sal_Bool IsInsMode() const { return bIns; }
148 : void SetRedlineModeAndCheckInsMode( sal_uInt16 eMode );
149 :
150 : void EnterSelFrmMode(const Point *pStartDrag = 0);
151 : void LeaveSelFrmMode();
152 4497 : sal_Bool IsSelFrmMode() const { return bLayoutMode; }
153 : // reset selection of frames
154 : void UnSelectFrm();
155 :
156 : void Invalidate();
157 :
158 : // select table cells for editing of formulas in the ribbonbar
159 : inline void SelTblCells( const Link &rLink, sal_Bool bMark = sal_True );
160 : inline void EndSelTblCells();
161 :
162 : // leave per word or per line selection mode. Is usually called in MB-Up.
163 0 : bool IsExtSel() const { return bSelWrd || bSelLn; }
164 :
165 : // query whether the active fnDrag pointer is set to BeginDrag
166 : // is needed for MouseMove to work around bugs 55592/55931
167 : inline bool Is_FnDragEQBeginDrag() const;
168 :
169 : // base requests
170 0 : sal_Bool IsInWrd() { return IsInWord(); }
171 0 : sal_Bool IsSttWrd() { return IsStartWord(); }
172 : sal_Bool IsEndWrd();
173 0 : bool IsSttOfPara() const { return IsSttPara(); }
174 : bool IsEndOfPara() const { return IsEndPara(); }
175 :
176 : // select word / sentense
177 : sal_Bool SelNearestWrd();
178 : sal_Bool SelWrd (const Point * = 0, sal_Bool bProp=sal_False );
179 : // #i32329# Enhanced selection
180 : void SelSentence (const Point * = 0, sal_Bool bProp=sal_False );
181 : void SelPara (const Point * = 0, sal_Bool bProp=sal_False );
182 : long SelAll();
183 :
184 : // basecursortravelling
185 : typedef sal_Bool (SwWrtShell:: *FNSimpleMove)();
186 : sal_Bool SimpleMove( FNSimpleMove, sal_Bool bSelect );
187 :
188 : sal_Bool Left ( sal_uInt16 nMode, sal_Bool bSelect,
189 : sal_uInt16 nCount, sal_Bool bBasicCall, sal_Bool bVisual = sal_False );
190 : sal_Bool Right ( sal_uInt16 nMode, sal_Bool bSelect,
191 : sal_uInt16 nCount, sal_Bool bBasicCall, sal_Bool bVisual = sal_False );
192 : sal_Bool Up ( sal_Bool bSelect = sal_False, sal_uInt16 nCount = 1,
193 : sal_Bool bBasicCall = sal_False );
194 : sal_Bool Down ( sal_Bool bSelect = sal_False, sal_uInt16 nCount = 1,
195 : sal_Bool bBasicCall = sal_False );
196 0 : sal_Bool NxtWrd ( sal_Bool bSelect = sal_False ) { return SimpleMove( &SwWrtShell::_NxtWrd, bSelect ); }
197 0 : sal_Bool PrvWrd ( sal_Bool bSelect = sal_False ) { return SimpleMove( &SwWrtShell::_PrvWrd, bSelect ); }
198 :
199 : sal_Bool LeftMargin ( sal_Bool bSelect, sal_Bool bBasicCall );
200 : sal_Bool RightMargin( sal_Bool bSelect, sal_Bool bBasicCall );
201 :
202 : sal_Bool SttDoc ( sal_Bool bSelect = sal_False );
203 : sal_Bool EndDoc ( sal_Bool bSelect = sal_False );
204 :
205 : sal_Bool SttNxtPg ( sal_Bool bSelect = sal_False );
206 : sal_Bool SttPrvPg ( sal_Bool bSelect = sal_False );
207 : sal_Bool EndNxtPg ( sal_Bool bSelect = sal_False );
208 : sal_Bool EndPrvPg ( sal_Bool bSelect = sal_False );
209 : sal_Bool SttPg ( sal_Bool bSelect = sal_False );
210 : sal_Bool EndPg ( sal_Bool bSelect = sal_False );
211 : sal_Bool SttPara ( sal_Bool bSelect = sal_False );
212 : sal_Bool EndPara ( sal_Bool bSelect = sal_False );
213 0 : sal_Bool FwdPara ( sal_Bool bSelect = sal_False )
214 0 : { return SimpleMove( &SwWrtShell::_FwdPara, bSelect ); }
215 0 : sal_Bool BwdPara ( sal_Bool bSelect = sal_False )
216 0 : { return SimpleMove( &SwWrtShell::_BwdPara, bSelect ); }
217 0 : sal_Bool FwdSentence( sal_Bool bSelect = sal_False )
218 0 : { return SimpleMove( &SwWrtShell::_FwdSentence, bSelect ); }
219 0 : sal_Bool BwdSentence( sal_Bool bSelect = sal_False )
220 0 : { return SimpleMove( &SwWrtShell::_BwdSentence, bSelect ); }
221 :
222 : // #i20126# Enhanced table selection
223 : sal_Bool SelectTableRowCol( const Point& rPt, const Point* pEnd = 0, bool bRowDrag = false );
224 : sal_Bool SelectTableRow();
225 : sal_Bool SelectTableCol();
226 : sal_Bool SelectTableCell();
227 :
228 : sal_Bool SelectTxtAttr( sal_uInt16 nWhich, const SwTxtAttr* pAttr = 0 );
229 :
230 : // per column jumps
231 : sal_Bool StartOfColumn ( sal_Bool bSelect = sal_False );
232 : sal_Bool EndOfColumn ( sal_Bool bSelect = sal_False );
233 : sal_Bool StartOfNextColumn ( sal_Bool bSelect = sal_False );
234 : sal_Bool EndOfNextColumn ( sal_Bool bSelect = sal_False );
235 : sal_Bool StartOfPrevColumn ( sal_Bool bSelect = sal_False );
236 : sal_Bool EndOfPrevColumn ( sal_Bool bSelect = sal_False );
237 :
238 : // set the cursor to page "nPage" at the beginning
239 : // additionally to a identically named implementation in crsrsh.hxx
240 : // here all existing selections are being reset before setting the
241 : // cursor
242 : sal_Bool GotoPage( sal_uInt16 nPage, sal_Bool bRecord );
243 :
244 : // setting the cursor; remember the old position for turning back
245 : DECL_LINK( ExecFlyMac, void * );
246 :
247 : sal_Bool PageCrsr(SwTwips lOffset, sal_Bool bSelect);
248 :
249 : // update fields
250 : void UpdateInputFlds( SwInputFieldList* pLst = 0, sal_Bool bOnlyInSel = sal_False );
251 :
252 : void NoEdit(bool bHideCrsr = true);
253 : void Edit();
254 :
255 42 : sal_Bool IsRetainSelection() const { return mbRetainSelection; }
256 0 : void SetRetainSelection( sal_Bool bRet ) { mbRetainSelection = bRet; }
257 :
258 : // change current data base and notify
259 : void ChgDBData(const SwDBData& SwDBData);
260 :
261 : // delete
262 : long DelToEndOfLine();
263 : long DelToStartOfLine();
264 : long DelLine();
265 : long DelLeft();
266 :
267 : // also deletes the frame or sets the cursor in the frame when bDelFrm == sal_False
268 : long DelRight();
269 : long DelToEndOfPara();
270 : long DelToStartOfPara();
271 : long DelToEndOfSentence();
272 : long DelToStartOfSentence();
273 : long DelNxtWord();
274 : long DelPrvWord();
275 :
276 : // checks whether a word selection exists.
277 : // According to the rules for intelligent Cut / Paste
278 : // surrounding spaces are cut out.
279 : // returns type of word selection (see enum)
280 : enum word {
281 : NO_WORD = 0,
282 : WORD_SPACE_BEFORE = 1,
283 : WORD_SPACE_AFTER = 2,
284 : WORD_NO_SPACE = 3
285 : };
286 : int IntelligentCut(int nSelectionType, sal_Bool bCut = sal_True);
287 :
288 : // edit
289 : void Insert(SwField &, SwPaM *pCommentRange = NULL);
290 : void Insert(const String &);
291 : // graphic
292 : void Insert( const String &rPath, const String &rFilter,
293 : const Graphic &, SwFlyFrmAttrMgr * = 0,
294 : sal_Bool bRule = sal_False );
295 :
296 : void InsertByWord( const String & );
297 : void InsertPageBreak(const String *pPageDesc = 0, sal_uInt16 nPgNum = 0 );
298 : void InsertLineBreak();
299 : void InsertColumnBreak();
300 : void InsertFootnote(const String &, sal_Bool bEndNote = sal_False, sal_Bool bEdit = sal_True );
301 : void SplitNode( sal_Bool bAutoFormat = sal_False, sal_Bool bCheckTableStart = sal_True );
302 : bool CanInsert();
303 :
304 : // indexes
305 : void InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0);
306 : sal_Bool UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0);
307 :
308 : // numbering and bullets
309 : /**
310 : Turns on numbering or bullets.
311 :
312 : @param bNum sal_True: turn on numbering
313 : sal_False: turn on bullets
314 : */
315 : void NumOrBulletOn(sal_Bool bNum); // #i29560#
316 : void NumOrBulletOff(); // #i29560#
317 : void NumOn();
318 : void BulletOn();
319 :
320 : //OLE
321 : void InsertObject( /*SvInPlaceObjectRef *pObj, */ // != 0 for clipboard
322 : const svt::EmbeddedObjectRef&,
323 : SvGlobalName *pName = 0, // != 0 create object accordingly
324 : sal_Bool bActivate = sal_True,
325 : sal_uInt16 nSlotId = 0); // SlotId for dialog
326 :
327 : sal_Bool InsertOleObject( const svt::EmbeddedObjectRef& xObj, SwFlyFrmFmt **pFlyFrmFmt = 0 );
328 : void LaunchOLEObj( long nVerb = 0 ); // start server
329 : virtual void MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset );
330 : virtual void CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
331 : const SwRect *pFlyPrtRect = 0,
332 : const SwRect *pFlyFrmRect = 0,
333 : const bool bNoTxtFrmPrtAreaChanged = false );
334 : virtual void ConnectObj( svt::EmbeddedObjectRef& xIPObj, const SwRect &rPrt,
335 : const SwRect &rFrm );
336 :
337 : // styles and formats
338 :
339 : // enum tells when should happen when the style was not found
340 : enum GetStyle { GETSTYLE_NOCREATE, // create none
341 : GETSTYLE_CREATESOME, // if on PoolId create mapt
342 : GETSTYLE_CREATEANY }; // return standard if applicable
343 :
344 : SwTxtFmtColl* GetParaStyle(const String &rCollName,
345 : GetStyle eCreate = GETSTYLE_NOCREATE);
346 : SwCharFmt* GetCharStyle(const String &rFmtName,
347 : GetStyle eCreate = GETSTYLE_NOCREATE);
348 : SwFrmFmt* GetTblStyle(const String &rFmtName);
349 :
350 : void SetPageStyle(const String &rCollName);
351 :
352 : String GetCurPageStyle( const sal_Bool bCalcFrm = sal_True ) const;
353 :
354 : // change current style using the attributes in effect
355 : void QuickUpdateStyle();
356 :
357 : enum DoType { UNDO, REDO, REPEAT };
358 :
359 : void Do( DoType eDoType, sal_uInt16 nCnt = 1 );
360 : String GetDoString( DoType eDoType ) const;
361 : String GetRepeatString() const;
362 : sal_uInt16 GetDoStrings( DoType eDoType, SfxStringListItem& rStrLstItem ) const;
363 :
364 : // search and replace
365 : sal_uLong SearchPattern(const com::sun::star::util::SearchOptions& rSearchOpt,
366 : sal_Bool bSearchInNotes,
367 : SwDocPositions eStart, SwDocPositions eEnde,
368 : FindRanges eFlags = FND_IN_BODY,
369 : int bReplace = sal_False );
370 :
371 : sal_uLong SearchTempl (const String &rTempl,
372 : SwDocPositions eStart, SwDocPositions eEnde,
373 : FindRanges eFlags = FND_IN_BODY,
374 : const String* pReplTempl = 0 );
375 :
376 : sal_uLong SearchAttr (const SfxItemSet& rFindSet,
377 : sal_Bool bNoColls,
378 : SwDocPositions eStart,SwDocPositions eEnde,
379 : FindRanges eFlags = FND_IN_BODY,
380 : const com::sun::star::util::SearchOptions* pSearchOpt = 0,
381 : const SfxItemSet* pReplaceSet = 0);
382 :
383 : void AutoCorrect( SvxAutoCorrect& rACorr, sal_Unicode cChar = ' ' );
384 :
385 : // action ahead of cursor movement
386 : // resets selection if applicable, triggers timer and GCAttr()
387 : void MoveCrsr( sal_Bool bWithSelect = sal_False );
388 :
389 : // update input fields
390 : sal_Bool StartInputFldDlg(SwField*, sal_Bool bNextButton, Window* pParentWin = 0, OString* pWindowState = 0);
391 : // update DropDown fields
392 : sal_Bool StartDropDownFldDlg(SwField*, sal_Bool bNextButton, OString* pWindowState = 0);
393 :
394 : //"Handler" for changes at DrawView - for controls.
395 : virtual void DrawSelChanged( );
396 :
397 : // jump to bookmark and set the "selctions-flags" correctly again
398 : sal_Bool GotoMark( const ::sw::mark::IMark* const pMark );
399 : sal_Bool GotoMark( const ::sw::mark::IMark* const pMark, sal_Bool bSelect, sal_Bool bStart );
400 : sal_Bool GotoMark( const OUString& rName );
401 : sal_Bool GoNextBookmark(); // sal_True when there still was one
402 : sal_Bool GoPrevBookmark();
403 :
404 : bool GotoFieldmark(::sw::mark::IFieldmark const * const pMark);
405 :
406 : sal_Bool GotoField( const SwFmtFld& rFld );
407 :
408 : // jump to the next / previous hyperlink - inside text and also
409 : // on graphics
410 : bool SelectNextPrevHyperlink( bool bNext = true );
411 :
412 : // determine corresponding SwView
413 14788 : const SwView& GetView() const { return rView; }
414 26535 : SwView& GetView() { return rView; }
415 :
416 : // Because nobody else is doing it, here is a ExecMacro()
417 : void ExecMacro( const SvxMacro& rMacro, String* pRet = 0, SbxArray* pArgs = 0 );
418 : // call into the dark Basic/JavaScript
419 : sal_uInt16 CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent,
420 : bool bCheckPtr = false, SbxArray* pArgs = 0,
421 : const Link* pCallBack = 0 );
422 :
423 : // a click at the given field. the cursor is on it.
424 : // execute the predefined actions.
425 : void ClickToField( const SwField& rFld );
426 : void ClickToINetAttr( const SwFmtINetFmt& rItem, sal_uInt16 nFilter = URLLOAD_NOFILTER );
427 : bool ClickToINetGrf( const Point& rDocPt, sal_uInt16 nFilter = URLLOAD_NOFILTER );
428 : inline bool IsInClickToEdit() const ;
429 :
430 : // if a URL-Button is selected, return its URL; otherwise an empty string
431 : bool GetURLFromButton( String& rURL, String& rDescr ) const;
432 :
433 : void NavigatorPaste( const NaviContentBookmark& rBkmk,
434 : const sal_uInt16 nAction );
435 :
436 : virtual void ApplyViewOptions( const SwViewOption &rOpt );
437 : virtual void SetReadonlyOption( sal_Bool bSet );
438 :
439 : // automatic update of styles
440 : void AutoUpdateFrame(SwFrmFmt* pFmt, const SfxItemSet& rStyleSet);
441 : void AutoUpdatePara(SwTxtFmtColl* pColl, const SfxItemSet& rStyleSet, SwPaM* pPaM = NULL );
442 :
443 : // link for inserting ranges via Drag&Drop/Clipboard
444 : DECL_STATIC_LINK( SwWrtShell, InsertRegionDialog, SwSectionData* );
445 :
446 :
447 : // ctor, the first one is a kind of a controlled copy ctor for more views of a document
448 : SwWrtShell( SwWrtShell&, Window *pWin, SwView &rShell);
449 : SwWrtShell( SwDoc& rDoc, Window *pWin, SwView &rShell,
450 : const SwViewOption *pViewOpt = 0);
451 : virtual ~SwWrtShell();
452 :
453 : bool TryRemoveIndent(); // #i23725#
454 :
455 : String GetSelDescr() const;
456 :
457 : SwNavigationMgr& GetNavigationMgr();
458 : void addCurrentPosition();
459 : sal_Bool GotoFly( const String& rName, FlyCntType eType = FLYCNTTYPE_ALL,
460 : sal_Bool bSelFrame = sal_True );
461 : bool GotoINetAttr( const SwTxtINetFmt& rAttr );
462 : void GotoOutline( sal_uInt16 nIdx );
463 : bool GotoOutline( const String& rName );
464 : bool GotoRegion( const String& rName );
465 : sal_Bool GotoRefMark( const String& rRefMark, sal_uInt16 nSubType = 0,
466 : sal_uInt16 nSeqNo = 0 );
467 : sal_Bool GotoNextTOXBase( const String* pName = 0);
468 : bool GotoTable( const String& rName );
469 : sal_Bool GotoFld( const SwFmtFld& rFld );
470 : const SwRedline* GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect = sal_False);
471 :
472 : void ChangeHeaderOrFooter(const String& rStyleName, sal_Bool bHeader, sal_Bool bOn, sal_Bool bShowWarning);
473 : virtual void SetShowHeaderFooterSeparator( FrameControlType eControl, bool bShow );
474 :
475 : private:
476 :
477 : SW_DLLPRIVATE void OpenMark();
478 : SW_DLLPRIVATE void CloseMark( bool bOkFlag );
479 :
480 : SW_DLLPRIVATE String GetWrdDelim();
481 : SW_DLLPRIVATE String GetSDelim();
482 : SW_DLLPRIVATE String GetBothDelim();
483 :
484 : struct ModeStack
485 : {
486 : ModeStack *pNext;
487 : sal_Bool bAdd,
488 : bBlock,
489 : bExt,
490 : bIns;
491 0 : ModeStack(ModeStack *pNextMode, sal_Bool _bIns, sal_Bool _bExt, sal_Bool _bAdd, sal_Bool _bBlock):
492 : pNext(pNextMode),
493 : bAdd(_bAdd),
494 : bBlock(_bBlock),
495 : bExt(_bExt),
496 0 : bIns(_bIns)
497 0 : {}
498 : } *pModeStack;
499 :
500 : // carry cursor along when PageUp / -Down
501 : enum PageMove
502 : {
503 : MV_NO,
504 : MV_PAGE_UP,
505 : MV_PAGE_DOWN
506 : } ePageMove;
507 :
508 : struct CrsrStack
509 : {
510 : Point aDocPos;
511 : CrsrStack *pNext;
512 : sal_Bool bValidCurPos : 1;
513 : sal_Bool bIsFrmSel : 1;
514 : SwTwips lOffset;
515 :
516 0 : CrsrStack( sal_Bool bValid, sal_Bool bFrmSel, const Point &rDocPos,
517 : SwTwips lOff, CrsrStack *pN )
518 : : aDocPos(rDocPos),
519 : pNext(pN),
520 : bValidCurPos( bValid ),
521 : bIsFrmSel( bFrmSel ),
522 0 : lOffset(lOff)
523 : {
524 :
525 :
526 0 : }
527 :
528 : } *pCrsrStack;
529 :
530 : SwView &rView;
531 : SwNavigationMgr aNavigationMgr;
532 :
533 : Point aDest;
534 : bool bDestOnStack;
535 1820 : bool HasCrsrStack() const { return 0 != pCrsrStack; }
536 : SW_DLLPRIVATE sal_Bool PushCrsr(SwTwips lOffset, sal_Bool bSelect);
537 : SW_DLLPRIVATE sal_Bool PopCrsr(sal_Bool bUpdate, sal_Bool bSelect = sal_False);
538 :
539 : // take END cursor along when PageUp / -Down
540 : SW_DLLPRIVATE bool _SttWrd();
541 : SW_DLLPRIVATE bool _EndWrd();
542 : SW_DLLPRIVATE sal_Bool _NxtWrd();
543 : SW_DLLPRIVATE sal_Bool _PrvWrd();
544 : // #i92468#
545 : SW_DLLPRIVATE sal_Bool _NxtWrdForDelete();
546 : SW_DLLPRIVATE sal_Bool _PrvWrdForDelete();
547 : SW_DLLPRIVATE sal_Bool _FwdSentence();
548 : SW_DLLPRIVATE sal_Bool _BwdSentence();
549 : sal_Bool _FwdPara();
550 : SW_DLLPRIVATE sal_Bool _BwdPara();
551 :
552 : // selections
553 : sal_Bool bIns :1;
554 : sal_Bool bInSelect :1;
555 : sal_Bool bExtMode :1;
556 : sal_Bool bAddMode :1;
557 : sal_Bool bBlockMode :1;
558 : sal_Bool bLayoutMode :1;
559 : sal_Bool bCopy :1;
560 : sal_Bool bSelWrd :1;
561 : sal_Bool bSelLn :1;
562 : bool bIsInClickToEdit:1;
563 : sal_Bool bClearMark :1; // don't delete selection for ChartAutoPilot
564 : sal_Bool mbRetainSelection :1; // Do not remove selections
565 :
566 : Point aStart;
567 : Link aSelTblLink;
568 :
569 : // resets the cursor stack after movement by PageUp/-Down
570 : SW_DLLPRIVATE void _ResetCursorStack();
571 :
572 : SW_DLLPRIVATE void SttDragDrop(Timer *);
573 :
574 : using SwCrsrShell::SetCrsr;
575 : SW_DLLPRIVATE long SetCrsr(const Point *, sal_Bool bProp=sal_False );
576 :
577 : SW_DLLPRIVATE long SetCrsrKillSel(const Point *, sal_Bool bProp=sal_False );
578 :
579 : SW_DLLPRIVATE long StdSelect(const Point *, sal_Bool bProp=sal_False );
580 : SW_DLLPRIVATE long BeginDrag(const Point *, sal_Bool bProp=sal_False );
581 : SW_DLLPRIVATE long Drag(const Point *, sal_Bool bProp=sal_False );
582 : SW_DLLPRIVATE long EndDrag(const Point *, sal_Bool bProp=sal_False );
583 :
584 : SW_DLLPRIVATE long ExtSelWrd(const Point *, sal_Bool bProp=sal_False );
585 : SW_DLLPRIVATE long ExtSelLn(const Point *, sal_Bool bProp=sal_False );
586 :
587 : // move text from Drag and Drop; Point is destination for all selections.
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 : // after SSize/Move of a frame update; Point is 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 :
599 0 : SW_DLLPRIVATE void LeaveExtSel() { bSelWrd = bSelLn = sal_False;}
600 :
601 : SW_DLLPRIVATE sal_Bool GoStart(sal_Bool KeepArea = sal_False, sal_Bool * = 0,
602 : sal_Bool bSelect = sal_False, sal_Bool bDontMoveRegion = sal_False);
603 : SW_DLLPRIVATE sal_Bool GoEnd(sal_Bool KeepArea = sal_False, sal_Bool * = 0);
604 :
605 : enum BookMarkMove
606 : {
607 : BOOKMARK_INDEX,
608 : BOOKMARK_NEXT,
609 : BOOKMARK_PREV,
610 : BOOKMARK_LAST_LAST_ENTRY
611 : };
612 :
613 : SW_DLLPRIVATE sal_Bool MoveBookMark(BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark=NULL);
614 : };
615 :
616 1820 : inline void SwWrtShell::ResetCursorStack()
617 : {
618 1820 : if ( HasCrsrStack() )
619 0 : _ResetCursorStack();
620 1820 : }
621 :
622 0 : inline void SwWrtShell::SelTblCells(const Link &rLink, sal_Bool bMark )
623 : {
624 0 : SetSelTblCells( sal_True );
625 0 : bClearMark = bMark;
626 0 : aSelTblLink = rLink;
627 0 : }
628 0 : inline void SwWrtShell::EndSelTblCells()
629 : {
630 0 : SetSelTblCells( sal_False );
631 0 : bClearMark = sal_True;
632 0 : }
633 :
634 0 : inline bool SwWrtShell::IsInClickToEdit() const { return bIsInClickToEdit; }
635 :
636 0 : inline bool SwWrtShell::Is_FnDragEQBeginDrag() const
637 : {
638 : #ifdef __GNUC__
639 0 : SELECTFUNC fnTmp = &SwWrtShell::BeginDrag;
640 0 : return fnDrag == fnTmp;
641 : #else
642 : return fnDrag == &SwWrtShell::BeginDrag;
643 : #endif
644 : }
645 :
646 : #endif
647 :
648 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|