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