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 63 : sal_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 0 : sal_Bool HasSelection() const { return SwCrsrShell::HasSelection() ||
124 0 : IsMultiSelection() || IsSelFrmMode() || IsObjSelected(); }
125 : sal_Bool Pop( sal_Bool bOldCrsr = sal_True );
126 :
127 : void EnterStdMode();
128 0 : sal_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 0 : sal_Bool IsInsMode() const { return bIns; }
148 : void SetRedlineModeAndCheckInsMode( sal_uInt16 eMode );
149 :
150 : void EnterSelFrmMode(const Point *pStartDrag = 0);
151 : void LeaveSelFrmMode();
152 29 : 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 : sal_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 sal_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(sal_Bool bHideCrsr = sal_True);
253 : void Edit();
254 : sal_Bool IsNoEdit() const { return bNoEdit; }
255 :
256 15 : sal_Bool IsRetainSelection() const { return mbRetainSelection; }
257 0 : void SetRetainSelection( sal_Bool bRet ) { mbRetainSelection = bRet; }
258 :
259 : // change current data base and notify
260 : void ChgDBData(const SwDBData& SwDBData);
261 :
262 : // delete
263 : long DelToEndOfLine();
264 : long DelToStartOfLine();
265 : long DelLine();
266 : long DelLeft();
267 :
268 : // also deletes the frame or sets the cursor in the frame when bDelFrm == sal_False
269 : long DelRight();
270 : long DelToEndOfPara();
271 : long DelToStartOfPara();
272 : long DelToEndOfSentence();
273 : long DelToStartOfSentence();
274 : long DelNxtWord();
275 : long DelPrvWord();
276 :
277 : // checks whether a word selection exists.
278 : // According to the rules for intelligent Cut / Paste
279 : // surrounding spaces are cut out.
280 : // returns type of word selection (see enum)
281 : enum word {
282 : NO_WORD = 0,
283 : WORD_SPACE_BEFORE = 1,
284 : WORD_SPACE_AFTER = 2,
285 : WORD_NO_SPACE = 3
286 : };
287 : int IntelligentCut(int nSelectionType, sal_Bool bCut = sal_True);
288 :
289 : // edit
290 : void Insert(SwField &, SwPaM *pCommentRange = NULL);
291 : void Insert(const String &);
292 : // graphic
293 : void Insert( const String &rPath, const String &rFilter,
294 : const Graphic &, SwFlyFrmAttrMgr * = 0,
295 : sal_Bool bRule = sal_False );
296 :
297 : void InsertByWord( const String & );
298 : void InsertPageBreak(const String *pPageDesc = 0, sal_uInt16 nPgNum = 0 );
299 : void InsertLineBreak();
300 : void InsertColumnBreak();
301 : void InsertFootnote(const String &, sal_Bool bEndNote = sal_False, sal_Bool bEdit = sal_True );
302 : void SplitNode( sal_Bool bAutoFormat = sal_False, sal_Bool bCheckTableStart = sal_True );
303 : sal_Bool CanInsert();
304 :
305 : // indexes
306 : void InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0);
307 : sal_Bool UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0);
308 :
309 : // numbering and bullets
310 : /**
311 : Turns on numbering or bullets.
312 :
313 : @param bNum sal_True: turn on numbering
314 : sal_False: turn on bullets
315 : */
316 : void NumOrBulletOn(sal_Bool bNum); // #i29560#
317 : void NumOrBulletOff(); // #i29560#
318 : void NumOn();
319 : void BulletOn();
320 :
321 : //OLE
322 : void InsertObject( /*SvInPlaceObjectRef *pObj, */ // != 0 for clipboard
323 : const svt::EmbeddedObjectRef&,
324 : SvGlobalName *pName = 0, // != 0 create object accordingly
325 : sal_Bool bActivate = sal_True,
326 : sal_uInt16 nSlotId = 0); // SlotId for dialog
327 :
328 : sal_Bool InsertOleObject( const svt::EmbeddedObjectRef& xObj, SwFlyFrmFmt **pFlyFrmFmt = 0 );
329 : void LaunchOLEObj( long nVerb = 0 ); // start server
330 : sal_Bool IsOLEObj() const { return GetCntType() == CNT_OLE;}
331 : virtual void MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset );
332 : virtual void CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
333 : const SwRect *pFlyPrtRect = 0,
334 : const SwRect *pFlyFrmRect = 0,
335 : const bool bNoTxtFrmPrtAreaChanged = false );
336 : virtual void ConnectObj( svt::EmbeddedObjectRef& xIPObj, const SwRect &rPrt,
337 : const SwRect &rFrm );
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 String &rCollName,
347 : GetStyle eCreate = GETSTYLE_NOCREATE);
348 : SwCharFmt* GetCharStyle(const String &rFmtName,
349 : GetStyle eCreate = GETSTYLE_NOCREATE);
350 : SwFrmFmt* GetTblStyle(const String &rFmtName);
351 :
352 : void SetPageStyle(const String &rCollName);
353 :
354 : String GetCurPageStyle( const sal_Bool bCalcFrm = sal_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 : String GetDoString( DoType eDoType ) const;
363 : String GetRepeatString() const;
364 : sal_uInt16 GetDoStrings( DoType eDoType, SfxStringListItem& rStrLstItem ) const;
365 :
366 : // search and replace
367 : sal_uLong SearchPattern(const com::sun::star::util::SearchOptions& rSearchOpt,
368 : sal_Bool bSearchInNotes,
369 : SwDocPositions eStart, SwDocPositions eEnde,
370 : FindRanges eFlags = FND_IN_BODY,
371 : int bReplace = sal_False );
372 :
373 : sal_uLong SearchTempl (const String &rTempl,
374 : SwDocPositions eStart, SwDocPositions eEnde,
375 : FindRanges eFlags = FND_IN_BODY,
376 : const String* pReplTempl = 0 );
377 :
378 : sal_uLong SearchAttr (const SfxItemSet& rFindSet,
379 : sal_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( sal_Bool bWithSelect = sal_False );
390 :
391 : // update input fields
392 : sal_Bool StartInputFldDlg(SwField*, sal_Bool bNextButton, Window* pParentWin = 0, rtl::OString* pWindowState = 0);
393 : // update DropDown fields
394 : sal_Bool StartDropDownFldDlg(SwField*, sal_Bool bNextButton, rtl::OString* pWindowState = 0);
395 :
396 : //"Handler" for changes at DrawView - for controls.
397 : virtual void DrawSelChanged( );
398 :
399 : // jump to bookmark and set the "selctions-flags" correctly again
400 : sal_Bool GotoMark( const ::sw::mark::IMark* const pMark );
401 : sal_Bool GotoMark( const ::sw::mark::IMark* const pMark, sal_Bool bSelect, sal_Bool bStart );
402 : sal_Bool GotoMark( const ::rtl::OUString& rName );
403 : sal_Bool GoNextBookmark(); // sal_True when there still was one
404 : sal_Bool GoPrevBookmark();
405 :
406 : bool GotoFieldmark(::sw::mark::IFieldmark const * const pMark);
407 :
408 : sal_Bool GotoField( const SwFmtFld& rFld );
409 :
410 : // jump to the next / previous hyperlink - inside text and also
411 : // on graphics
412 : sal_Bool SelectNextPrevHyperlink( sal_Bool bNext = sal_True );
413 :
414 : // determine corresponding SwView
415 662 : const SwView& GetView() const { return rView; }
416 1513 : SwView& GetView() { return rView; }
417 :
418 : // Because nobody else is doing it, here is a ExecMacro()
419 : void ExecMacro( const SvxMacro& rMacro, String* 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 : sal_Bool ClickToINetGrf( const Point& rDocPt, sal_uInt16 nFilter = URLLOAD_NOFILTER );
430 : inline sal_Bool IsInClickToEdit() const ;
431 :
432 : // if a URL-Button is selected, return its URL; otherwise an empty string
433 : sal_Bool GetURLFromButton( String& rURL, String& rDescr ) const;
434 :
435 : void NavigatorPaste( const NaviContentBookmark& rBkmk,
436 : const sal_uInt16 nAction );
437 :
438 : virtual void ApplyViewOptions( const SwViewOption &rOpt );
439 : virtual void SetReadonlyOption( sal_Bool bSet );
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 :
449 : // ctor, the first one is a kind of a controlled copy ctor for more views of a document
450 : SwWrtShell( SwWrtShell&, Window *pWin, SwView &rShell);
451 : SwWrtShell( SwDoc& rDoc, Window *pWin, SwView &rShell,
452 : const SwViewOption *pViewOpt = 0);
453 : virtual ~SwWrtShell();
454 :
455 : sal_Bool TryRemoveIndent(); // #i23725#
456 :
457 : String GetSelDescr() const;
458 :
459 : SwNavigationMgr& GetNavigationMgr();
460 : void addCurrentPosition();
461 : sal_Bool GotoFly( const String& rName, FlyCntType eType = FLYCNTTYPE_ALL,
462 : sal_Bool bSelFrame = sal_True );
463 : bool GotoINetAttr( const SwTxtINetFmt& rAttr );
464 : void GotoOutline( sal_uInt16 nIdx );
465 : bool GotoOutline( const String& rName );
466 : bool GotoRegion( const String& rName );
467 : sal_Bool GotoRefMark( const String& rRefMark, sal_uInt16 nSubType = 0,
468 : sal_uInt16 nSeqNo = 0 );
469 : sal_Bool GotoNextTOXBase( const String* pName = 0);
470 : bool GotoTable( const String& rName );
471 : sal_Bool GotoFld( const SwFmtFld& rFld );
472 : const SwRedline* GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect = sal_False);
473 :
474 : void ChangeHeaderOrFooter(const String& rStyleName, sal_Bool bHeader, sal_Bool bOn, sal_Bool bShowWarning);
475 : virtual void SetShowHeaderFooterSeparator( FrameControlType eControl, bool bShow );
476 :
477 : private:
478 :
479 : SW_DLLPRIVATE void OpenMark();
480 : SW_DLLPRIVATE void CloseMark( sal_Bool bOkFlag );
481 :
482 : SW_DLLPRIVATE String GetWrdDelim();
483 : SW_DLLPRIVATE String GetSDelim();
484 : SW_DLLPRIVATE String GetBothDelim();
485 :
486 : struct ModeStack
487 : {
488 : ModeStack *pNext;
489 : sal_Bool bAdd,
490 : bBlock,
491 : bExt,
492 : bIns;
493 0 : ModeStack(ModeStack *pNextMode, sal_Bool _bIns, sal_Bool _bExt, sal_Bool _bAdd, sal_Bool _bBlock):
494 : pNext(pNextMode),
495 : bAdd(_bAdd),
496 : bBlock(_bBlock),
497 : bExt(_bExt),
498 0 : bIns(_bIns)
499 0 : {}
500 : } *pModeStack;
501 :
502 : // carry cursor along when PageUp / -Down
503 : enum PageMove
504 : {
505 : MV_NO,
506 : MV_PAGE_UP,
507 : MV_PAGE_DOWN
508 : } ePageMove;
509 :
510 : struct CrsrStack
511 : {
512 : Point aDocPos;
513 : CrsrStack *pNext;
514 : sal_Bool bValidCurPos : 1;
515 : sal_Bool bIsFrmSel : 1;
516 : SwTwips lOffset;
517 :
518 0 : CrsrStack( sal_Bool bValid, sal_Bool bFrmSel, const Point &rDocPos,
519 : SwTwips lOff, CrsrStack *pN )
520 : : aDocPos(rDocPos),
521 : pNext(pN),
522 : bValidCurPos( bValid ),
523 : bIsFrmSel( bFrmSel ),
524 0 : lOffset(lOff)
525 : {
526 :
527 :
528 0 : }
529 :
530 : } *pCrsrStack;
531 :
532 : SwView &rView;
533 : SwNavigationMgr aNavigationMgr;
534 :
535 : Point aDest;
536 : sal_Bool bDestOnStack;
537 626 : sal_Bool HasCrsrStack() const { return 0 != pCrsrStack; }
538 : SW_DLLPRIVATE sal_Bool PushCrsr(SwTwips lOffset, sal_Bool bSelect);
539 : SW_DLLPRIVATE sal_Bool PopCrsr(sal_Bool bUpdate, sal_Bool bSelect = sal_False);
540 :
541 : // take END cursor along when PageUp / -Down
542 : SW_DLLPRIVATE sal_Bool _SttWrd();
543 : SW_DLLPRIVATE sal_Bool _EndWrd();
544 : SW_DLLPRIVATE sal_Bool _NxtWrd();
545 : SW_DLLPRIVATE sal_Bool _PrvWrd();
546 : // #i92468#
547 : SW_DLLPRIVATE sal_Bool _NxtWrdForDelete();
548 : SW_DLLPRIVATE sal_Bool _PrvWrdForDelete();
549 : SW_DLLPRIVATE sal_Bool _FwdSentence();
550 : SW_DLLPRIVATE sal_Bool _BwdSentence();
551 : sal_Bool _FwdPara();
552 : SW_DLLPRIVATE sal_Bool _BwdPara();
553 :
554 : // selections
555 : sal_Bool bIns :1;
556 : sal_Bool bInSelect :1;
557 : sal_Bool bExtMode :1;
558 : sal_Bool bAddMode :1;
559 : sal_Bool bBlockMode :1;
560 : sal_Bool bLayoutMode :1;
561 : sal_Bool bNoEdit :1;
562 : sal_Bool bCopy :1;
563 : sal_Bool bSelWrd :1;
564 : sal_Bool bSelLn :1;
565 : sal_Bool bIsInClickToEdit:1;
566 : sal_Bool bClearMark :1; // don't delete selection for ChartAutoPilot
567 : sal_Bool mbRetainSelection :1; // Do not remove selections
568 :
569 : Point aStart;
570 : Link aSelTblLink;
571 :
572 : // resets the cursor stack after movement by PageUp/-Down
573 : SW_DLLPRIVATE void _ResetCursorStack();
574 :
575 : SW_DLLPRIVATE void SttDragDrop(Timer *);
576 :
577 : using SwCrsrShell::SetCrsr;
578 : SW_DLLPRIVATE long SetCrsr(const Point *, sal_Bool bProp=sal_False );
579 :
580 : SW_DLLPRIVATE long SetCrsrKillSel(const Point *, sal_Bool bProp=sal_False );
581 :
582 : SW_DLLPRIVATE long StdSelect(const Point *, sal_Bool bProp=sal_False );
583 : SW_DLLPRIVATE long BeginDrag(const Point *, sal_Bool bProp=sal_False );
584 : SW_DLLPRIVATE long Drag(const Point *, sal_Bool bProp=sal_False );
585 : SW_DLLPRIVATE long EndDrag(const Point *, sal_Bool bProp=sal_False );
586 :
587 : SW_DLLPRIVATE long ExtSelWrd(const Point *, sal_Bool bProp=sal_False );
588 : SW_DLLPRIVATE long ExtSelLn(const Point *, sal_Bool bProp=sal_False );
589 :
590 : // move text from Drag and Drop; Point is destination for all selections.
591 : SW_DLLPRIVATE long MoveText(const Point *, sal_Bool bProp=sal_False );
592 :
593 : SW_DLLPRIVATE long BeginFrmDrag(const Point *, sal_Bool bProp=sal_False );
594 :
595 : // after SSize/Move of a frame update; Point is destination.
596 : SW_DLLPRIVATE long UpdateLayoutFrm(const Point *, sal_Bool bProp=sal_False );
597 :
598 : SW_DLLPRIVATE long SttLeaveSelect(const Point *, sal_Bool bProp=sal_False );
599 : SW_DLLPRIVATE long AddLeaveSelect(const Point *, sal_Bool bProp=sal_False );
600 : SW_DLLPRIVATE long Ignore(const Point *, sal_Bool bProp=sal_False );
601 :
602 0 : SW_DLLPRIVATE void LeaveExtSel() { bSelWrd = bSelLn = sal_False;}
603 :
604 : SW_DLLPRIVATE sal_Bool GoStart(sal_Bool KeepArea = sal_False, sal_Bool * = 0,
605 : sal_Bool bSelect = sal_False, sal_Bool bDontMoveRegion = sal_False);
606 : SW_DLLPRIVATE sal_Bool GoEnd(sal_Bool KeepArea = sal_False, sal_Bool * = 0);
607 :
608 : enum BookMarkMove
609 : {
610 : BOOKMARK_INDEX,
611 : BOOKMARK_NEXT,
612 : BOOKMARK_PREV,
613 : BOOKMARK_LAST_LAST_ENTRY
614 : };
615 :
616 : SW_DLLPRIVATE sal_Bool MoveBookMark(BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark=NULL);
617 : };
618 :
619 626 : inline void SwWrtShell::ResetCursorStack()
620 : {
621 626 : if ( HasCrsrStack() )
622 0 : _ResetCursorStack();
623 626 : }
624 :
625 0 : inline void SwWrtShell::SelTblCells(const Link &rLink, sal_Bool bMark )
626 : {
627 0 : SetSelTblCells( sal_True );
628 0 : bClearMark = bMark;
629 0 : aSelTblLink = rLink;
630 0 : }
631 0 : inline void SwWrtShell::EndSelTblCells()
632 : {
633 0 : SetSelTblCells( sal_False );
634 0 : bClearMark = sal_True;
635 0 : }
636 :
637 0 : inline sal_Bool SwWrtShell::IsInClickToEdit() const { return bIsInClickToEdit; }
638 :
639 0 : inline sal_Bool SwWrtShell::Is_FnDragEQBeginDrag() const
640 : {
641 : #ifdef GCC
642 0 : SELECTFUNC fnTmp = &SwWrtShell::BeginDrag;
643 0 : return fnDrag == fnTmp;
644 : #else
645 : return sal::static_int_cast< sal_Bool >(fnDrag == &SwWrtShell::BeginDrag);
646 : #endif
647 : }
648 :
649 : #endif
650 :
651 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|