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_UI_INC_WRTSH_HXX
20 : #define INCLUDED_SW_SOURCE_UI_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 : 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 *, sal_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 *, sal_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 0 : bool IsModePushed() const { return 0 != pModeStack; }
119 : void PushMode();
120 : void PopMode();
121 :
122 : void SttSelect();
123 : void EndSelect();
124 0 : sal_Bool IsInSelect() const { return bInSelect; }
125 0 : void SetInSelect(sal_Bool bSel = sal_True) { bInSelect = bSel; }
126 : // is there a text- or frameselection?
127 0 : sal_Bool HasSelection() const { return SwCrsrShell::HasSelection() ||
128 0 : IsMultiSelection() || IsSelFrmMode() || IsObjSelected(); }
129 : sal_Bool Pop( sal_Bool bOldCrsr = sal_True );
130 :
131 : void EnterStdMode();
132 0 : bool IsStdMode() const { return !bExtMode && !bAddMode && !bBlockMode; }
133 :
134 : void EnterExtMode();
135 : void LeaveExtMode();
136 : bool ToggleExtMode();
137 0 : sal_Bool IsExtMode() const { return bExtMode; }
138 :
139 : void EnterAddMode();
140 : void LeaveAddMode();
141 : bool ToggleAddMode();
142 0 : sal_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( sal_Bool bOn = sal_True );
150 0 : void ToggleInsMode() { SetInsMode( !bIns ); }
151 0 : sal_Bool IsInsMode() const { return bIns; }
152 : void SetRedlineModeAndCheckInsMode( sal_uInt16 eMode );
153 :
154 : void EnterSelFrmMode(const Point *pStartDrag = 0);
155 : void LeaveSelFrmMode();
156 0 : sal_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, sal_Bool bMark = sal_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 : sal_Bool IsInWrd() { return IsInWord(); }
175 0 : sal_Bool IsSttWrd() { return IsStartWord(); }
176 : sal_Bool IsEndWrd();
177 0 : bool IsSttOfPara() const { return IsSttPara(); }
178 : bool IsEndOfPara() const { return IsEndPara(); }
179 :
180 : // select word / sentense
181 : sal_Bool SelNearestWrd();
182 : sal_Bool SelWrd (const Point * = 0, sal_Bool bProp=sal_False );
183 : // #i32329# Enhanced selection
184 : void SelSentence (const Point * = 0, sal_Bool bProp=sal_False );
185 : void SelPara (const Point * = 0, sal_Bool bProp=sal_False );
186 : long SelAll();
187 :
188 : // basecursortravelling
189 : typedef sal_Bool (SwWrtShell:: *FNSimpleMove)();
190 : sal_Bool SimpleMove( FNSimpleMove, sal_Bool bSelect );
191 :
192 : sal_Bool Left ( sal_uInt16 nMode, sal_Bool bSelect,
193 : sal_uInt16 nCount, sal_Bool bBasicCall, sal_Bool bVisual = sal_False );
194 : sal_Bool Right ( sal_uInt16 nMode, sal_Bool bSelect,
195 : sal_uInt16 nCount, sal_Bool bBasicCall, sal_Bool bVisual = sal_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 : sal_Bool NxtWrd ( sal_Bool bSelect = sal_False ) { return SimpleMove( &SwWrtShell::_NxtWrd, bSelect ); }
199 0 : sal_Bool PrvWrd ( sal_Bool bSelect = sal_False ) { return SimpleMove( &SwWrtShell::_PrvWrd, bSelect ); }
200 :
201 : sal_Bool LeftMargin ( sal_Bool bSelect, sal_Bool bBasicCall );
202 : sal_Bool RightMargin( sal_Bool bSelect, sal_Bool bBasicCall );
203 :
204 : sal_Bool SttDoc ( sal_Bool bSelect = sal_False );
205 : sal_Bool EndDoc ( sal_Bool bSelect = sal_False );
206 :
207 : sal_Bool SttNxtPg ( sal_Bool bSelect = sal_False );
208 : sal_Bool SttPrvPg ( sal_Bool bSelect = sal_False );
209 : sal_Bool EndNxtPg ( sal_Bool bSelect = sal_False );
210 : sal_Bool EndPrvPg ( sal_Bool bSelect = sal_False );
211 : sal_Bool SttPg ( sal_Bool bSelect = sal_False );
212 : sal_Bool EndPg ( sal_Bool bSelect = sal_False );
213 : sal_Bool SttPara ( sal_Bool bSelect = sal_False );
214 : sal_Bool EndPara ( sal_Bool bSelect = sal_False );
215 0 : sal_Bool FwdPara ( sal_Bool bSelect = sal_False )
216 0 : { return SimpleMove( &SwWrtShell::_FwdPara, bSelect ); }
217 0 : sal_Bool BwdPara ( sal_Bool bSelect = sal_False )
218 0 : { return SimpleMove( &SwWrtShell::_BwdPara, bSelect ); }
219 0 : sal_Bool FwdSentence( sal_Bool bSelect = sal_False )
220 0 : { return SimpleMove( &SwWrtShell::_FwdSentence, bSelect ); }
221 0 : sal_Bool BwdSentence( sal_Bool bSelect = sal_False )
222 0 : { return SimpleMove( &SwWrtShell::_BwdSentence, bSelect ); }
223 :
224 : // #i20126# Enhanced table selection
225 : sal_Bool SelectTableRowCol( const Point& rPt, const Point* pEnd = 0, bool bRowDrag = false );
226 : sal_Bool SelectTableRow();
227 : sal_Bool SelectTableCol();
228 : sal_Bool SelectTableCell();
229 :
230 : sal_Bool SelectTxtAttr( sal_uInt16 nWhich, const SwTxtAttr* pAttr = 0 );
231 :
232 : // per column jumps
233 : sal_Bool StartOfColumn ( sal_Bool bSelect = sal_False );
234 : sal_Bool EndOfColumn ( sal_Bool bSelect = sal_False );
235 : sal_Bool StartOfNextColumn ( sal_Bool bSelect = sal_False );
236 : sal_Bool EndOfNextColumn ( sal_Bool bSelect = sal_False );
237 : sal_Bool StartOfPrevColumn ( sal_Bool bSelect = sal_False );
238 : sal_Bool EndOfPrevColumn ( sal_Bool bSelect = sal_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 : sal_Bool GotoPage( sal_uInt16 nPage, sal_Bool bRecord );
245 :
246 : // setting the cursor; remember the old position for turning back
247 : DECL_LINK( ExecFlyMac, void * );
248 :
249 : sal_Bool PageCrsr(SwTwips lOffset, sal_Bool bSelect);
250 :
251 : // update fields
252 : void UpdateInputFlds( SwInputFieldList* pLst = 0 );
253 :
254 : void NoEdit(bool bHideCrsr = true);
255 : void Edit();
256 :
257 0 : sal_Bool IsRetainSelection() const { return mbRetainSelection; }
258 0 : void SetRetainSelection( sal_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, sal_Bool bCut = sal_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 : sal_Bool bRule = sal_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 &, sal_Bool bEndNote = sal_False, sal_Bool bEdit = sal_True );
303 : void SplitNode( sal_Bool bAutoFormat = sal_False, sal_Bool bCheckTableStart = sal_True );
304 : bool CanInsert();
305 :
306 : // indexes
307 : void InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0);
308 : sal_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(sal_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 : sal_Bool bActivate = sal_True,
327 : sal_uInt16 nSlotId = 0); // SlotId for dialog
328 :
329 : sal_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 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 : OUString GetDoString( DoType eDoType ) const;
363 : OUString 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 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 : 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, OString* pWindowState = 0);
393 : // update DropDown fields
394 : sal_Bool StartDropDownFldDlg(SwField*, sal_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 : 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 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 : bool SelectNextPrevHyperlink( bool bNext = true );
413 :
414 : // determine corresponding SwView
415 0 : const SwView& GetView() const { return rView; }
416 0 : 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( sal_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&, Window *pWin, SwView &rShell);
450 : SwWrtShell( SwDoc& rDoc, Window *pWin, SwView &rShell,
451 : const SwViewOption *pViewOpt = 0);
452 : virtual ~SwWrtShell();
453 :
454 : bool TryRemoveIndent(); // #i23725#
455 :
456 : OUString GetSelDescr() const;
457 :
458 : SwNavigationMgr& GetNavigationMgr();
459 : void addCurrentPosition();
460 : sal_Bool GotoFly( const OUString& rName, FlyCntType eType = FLYCNTTYPE_ALL,
461 : sal_Bool bSelFrame = sal_True );
462 : bool GotoINetAttr( const SwTxtINetFmt& rAttr );
463 : void GotoOutline( sal_uInt16 nIdx );
464 : bool GotoOutline( const OUString& rName );
465 : bool GotoRegion( const OUString& rName );
466 : sal_Bool GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType = 0,
467 : sal_uInt16 nSeqNo = 0 );
468 : sal_Bool GotoNextTOXBase( const OUString* pName = 0);
469 : bool GotoTable( const OUString& rName );
470 : sal_Bool GotoFld( const SwFmtFld& rFld );
471 : const SwRangeRedline* GotoRedline( sal_uInt16 nArrPos, sal_Bool bSelect = sal_False);
472 :
473 : void ChangeHeaderOrFooter(const OUString& rStyleName, sal_Bool bHeader, sal_Bool bOn, sal_Bool bShowWarning);
474 : virtual void SetShowHeaderFooterSeparator( FrameControlType eControl, bool bShow ) SAL_OVERRIDE;
475 :
476 : private:
477 :
478 : SAL_DLLPRIVATE void OpenMark();
479 : SAL_DLLPRIVATE void CloseMark( bool bOkFlag );
480 :
481 : struct ModeStack
482 : {
483 : ModeStack *pNext;
484 : sal_Bool bAdd,
485 : bBlock,
486 : bExt,
487 : bIns;
488 0 : ModeStack(ModeStack *pNextMode, sal_Bool _bIns, sal_Bool _bExt, sal_Bool _bAdd, sal_Bool _bBlock):
489 : pNext(pNextMode),
490 : bAdd(_bAdd),
491 : bBlock(_bBlock),
492 : bExt(_bExt),
493 0 : bIns(_bIns)
494 0 : {}
495 : } *pModeStack;
496 :
497 : // carry cursor along when PageUp / -Down
498 : enum PageMove
499 : {
500 : MV_NO,
501 : MV_PAGE_UP,
502 : MV_PAGE_DOWN
503 : } ePageMove;
504 :
505 : struct CrsrStack
506 : {
507 : Point aDocPos;
508 : CrsrStack *pNext;
509 : sal_Bool bValidCurPos : 1;
510 : sal_Bool bIsFrmSel : 1;
511 : SwTwips lOffset;
512 :
513 0 : CrsrStack( sal_Bool bValid, sal_Bool bFrmSel, const Point &rDocPos,
514 : SwTwips lOff, CrsrStack *pN )
515 : : aDocPos(rDocPos),
516 : pNext(pN),
517 : bValidCurPos( bValid ),
518 : bIsFrmSel( bFrmSel ),
519 0 : lOffset(lOff)
520 : {
521 :
522 0 : }
523 :
524 : } *pCrsrStack;
525 :
526 : SwView &rView;
527 : SwNavigationMgr aNavigationMgr;
528 :
529 : Point aDest;
530 : bool bDestOnStack;
531 0 : bool HasCrsrStack() const { return 0 != pCrsrStack; }
532 : SAL_DLLPRIVATE sal_Bool PushCrsr(SwTwips lOffset, sal_Bool bSelect);
533 : SAL_DLLPRIVATE sal_Bool PopCrsr(sal_Bool bUpdate, sal_Bool bSelect = sal_False);
534 :
535 : // take END cursor along when PageUp / -Down
536 : SAL_DLLPRIVATE bool _SttWrd();
537 : SAL_DLLPRIVATE bool _EndWrd();
538 : SAL_DLLPRIVATE sal_Bool _NxtWrd();
539 : SAL_DLLPRIVATE sal_Bool _PrvWrd();
540 : // #i92468#
541 : SAL_DLLPRIVATE sal_Bool _NxtWrdForDelete();
542 : SAL_DLLPRIVATE sal_Bool _PrvWrdForDelete();
543 : SAL_DLLPRIVATE sal_Bool _FwdSentence();
544 : SAL_DLLPRIVATE sal_Bool _BwdSentence();
545 : sal_Bool _FwdPara();
546 : SAL_DLLPRIVATE sal_Bool _BwdPara();
547 :
548 : // selections
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 bCopy :1;
556 : sal_Bool bSelWrd :1;
557 : sal_Bool bSelLn :1;
558 : bool bIsInClickToEdit:1;
559 : sal_Bool bClearMark :1; // don't delete selection for ChartAutoPilot
560 : sal_Bool mbRetainSelection :1; // Do not remove selections
561 :
562 : Point aStart;
563 : Link aSelTblLink;
564 :
565 : // resets the cursor stack after movement by PageUp/-Down
566 : SAL_DLLPRIVATE void _ResetCursorStack();
567 :
568 : SAL_DLLPRIVATE void SttDragDrop(Timer *);
569 :
570 : using SwCrsrShell::SetCrsr;
571 : SAL_DLLPRIVATE long SetCrsr(const Point *, sal_Bool bProp=sal_False );
572 :
573 : SAL_DLLPRIVATE long SetCrsrKillSel(const Point *, sal_Bool bProp=sal_False );
574 :
575 : SAL_DLLPRIVATE long StdSelect(const Point *, sal_Bool bProp=sal_False );
576 : SAL_DLLPRIVATE long BeginDrag(const Point *, sal_Bool bProp=sal_False );
577 : SAL_DLLPRIVATE long Drag(const Point *, sal_Bool bProp=sal_False );
578 : SAL_DLLPRIVATE long EndDrag(const Point *, sal_Bool bProp=sal_False );
579 :
580 : SAL_DLLPRIVATE long ExtSelWrd(const Point *, sal_Bool bProp=sal_False );
581 : SAL_DLLPRIVATE long ExtSelLn(const Point *, sal_Bool bProp=sal_False );
582 :
583 : // move text from Drag and Drop; Point is destination for all selections.
584 : SAL_DLLPRIVATE long MoveText(const Point *, sal_Bool bProp=sal_False );
585 :
586 : SAL_DLLPRIVATE long BeginFrmDrag(const Point *, sal_Bool bProp=sal_False );
587 :
588 : // after SSize/Move of a frame update; Point is destination.
589 : SAL_DLLPRIVATE long UpdateLayoutFrm(const Point *, sal_Bool bProp=sal_False );
590 :
591 : SAL_DLLPRIVATE long SttLeaveSelect(const Point *, sal_Bool bProp=sal_False );
592 : SAL_DLLPRIVATE long AddLeaveSelect(const Point *, sal_Bool bProp=sal_False );
593 : SAL_DLLPRIVATE long Ignore(const Point *, sal_Bool bProp=sal_False );
594 :
595 0 : SAL_DLLPRIVATE void LeaveExtSel() { bSelWrd = bSelLn = sal_False;}
596 :
597 : SAL_DLLPRIVATE sal_Bool GoStart(sal_Bool KeepArea = sal_False, sal_Bool * = 0,
598 : sal_Bool bSelect = sal_False, sal_Bool bDontMoveRegion = sal_False);
599 : SAL_DLLPRIVATE sal_Bool GoEnd(sal_Bool KeepArea = sal_False, sal_Bool * = 0);
600 :
601 : enum BookMarkMove
602 : {
603 : BOOKMARK_INDEX,
604 : BOOKMARK_NEXT,
605 : BOOKMARK_PREV,
606 : BOOKMARK_LAST_LAST_ENTRY
607 : };
608 :
609 : SAL_DLLPRIVATE sal_Bool MoveBookMark(BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark=NULL);
610 : };
611 :
612 0 : inline void SwWrtShell::ResetCursorStack()
613 : {
614 0 : if ( HasCrsrStack() )
615 0 : _ResetCursorStack();
616 0 : }
617 :
618 0 : inline void SwWrtShell::SelTblCells(const Link &rLink, sal_Bool bMark )
619 : {
620 0 : SetSelTblCells( sal_True );
621 0 : bClearMark = bMark;
622 0 : aSelTblLink = rLink;
623 0 : }
624 0 : inline void SwWrtShell::EndSelTblCells()
625 : {
626 0 : SetSelTblCells( sal_False );
627 0 : bClearMark = sal_True;
628 0 : }
629 :
630 0 : inline bool SwWrtShell::IsInClickToEdit() const { return bIsInClickToEdit; }
631 :
632 0 : inline bool SwWrtShell::Is_FnDragEQBeginDrag() const
633 : {
634 : #ifdef __GNUC__
635 0 : SELECTFUNC fnTmp = &SwWrtShell::BeginDrag;
636 0 : return fnDrag == fnTmp;
637 : #else
638 : return fnDrag == &SwWrtShell::BeginDrag;
639 : #endif
640 : }
641 :
642 : #endif
643 :
644 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|