LibreOffice Module sw (master)  1
wrtsh.hxx
Go to the documentation of this file.
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 
20 #pragma once
21 
22 #include <swdllapi.h>
23 #include <fesh.hxx>
24 #include <swurl.hxx>
25 #include <IMark.hxx>
26 #include "navmgr.hxx"
27 #include <optional>
28 #include <com/sun/star/embed/EmbedVerbs.hpp>
29 #include <o3tl/typed_flags_set.hxx>
30 #include <svx/swframetypes.hxx>
31 #include <vcl/weld.hxx>
32 
33 #include <doc.hxx>
34 #include <docsh.hxx>
35 #include <viewopt.hxx>
36 
37 namespace vcl { class Window; }
38 class SbxArray;
39 class SwFlyFrameAttrMgr;
40 class SwField;
41 class SwTOXBase;
42 class SwView;
43 class SvGlobalName;
44 class SwInputFieldList;
45 class SwSectionData;
46 class Timer;
47 class SvxMacro;
48 class SwFormatINetFormat;
49 class SvxAutoCorrect;
51 struct SwCallMouseEvent;
52 class SfxStringListItem;
53 enum class SvMacroItemId : sal_uInt16;
54 class SwFieldMgr;
55 class SfxRequest;
56 
57 namespace i18nutil {
58  struct SearchOptions2;
59 }
60 
61 enum class SelectionType : sal_Int32
62 {
63  NONE = 0x000000,
64  Text = CNT_TXT, // text, never frames too 0x0001
65  Graphic = CNT_GRF, // graphic 0x0002
66  Ole = CNT_OLE, // OLE 0x0010
67  Frame = 0x000020, // frame, no content type
68  NumberList = 0x000040, // NumList
69  Table = 0x000080, // cursor is in table
70  TableCell = 0x000100, // table cells are selected
71  DrawObject = 0x000200, // drawing objects (rectangle, circle...)
72  DrawObjectEditMode = 0x000400, // draw-textobjects in edit mode
73  Ornament = 0x000800, // edit ornament objects
74  DbForm = 0x001000, // drawing objects: DB-Forms
75  FormControl = 0x002000, // a form control is focused. Neither set nor evaluated by the SwWrtShell itself, only by its clients.
76  Media = 0x004000, // Media object
77  ExtrudedCustomShape = 0x008000, // extruded custom shape
78  FontWork = 0x010000, // fontwork
79  PostIt = 0x020000, // annotation
80  TableRow = 0x040000, // table rows are selected
81  TableCol = 0x080000, // table columns are selected
82  All = 0x0ffff3,
83 };
84 namespace o3tl {
85  template<> struct typed_flags<SelectionType> : is_typed_flags<SelectionType, 0x0ffff3> {};
86 }
87 
93 class SW_DLLPUBLIC SwWrtShell final : public SwFEShell
94 {
95 private:
96  using SwCursorShell::Left;
98  using SwCursorShell::Up;
99  using SwCursorShell::Down;
107 
108  typedef tools::Long (SwWrtShell::*SELECTFUNC)(const Point *, bool bProp );
109  typedef void (SwWrtShell::*SELECTFUNC2)(const Point *, bool bProp );
110 
111  SELECTFUNC2 m_fnDrag = &SwWrtShell::BeginDrag;
112  SELECTFUNC m_fnSetCursor = &SwWrtShell::SetCursor;
113  SELECTFUNC2 m_fnEndDrag = &SwWrtShell::DefaultEndDrag;
114  SELECTFUNC m_fnKillSel = &SwWrtShell::Ignore;
115 
116 public:
117 
118  using SwEditShell::Insert;
119 
120  tools::Long CallSetCursor(const Point* pPt, bool bProp) { return (this->*m_fnSetCursor)(pPt, bProp); }
121  void Drag (const Point* pPt, bool bProp) { (this->*m_fnDrag)(pPt, bProp); }
122  void EndDrag (const Point* pPt, bool bProp) { (this->*m_fnEndDrag)(pPt, bProp); }
123  tools::Long KillSelection(const Point* pPt, bool bProp) { return (this->*m_fnKillSel)(pPt, bProp); }
124 
125  bool IsSplitVerticalByDefault() const;
126  void SetSplitVerticalByDefault(bool value);
127 
128  // reset all selections
129  tools::Long ResetSelect( const Point *, bool );
130 
131  // resets the cursorstack after movement with PageUp/-Down if a stack is built up
132  inline void ResetCursorStack();
133  SelectionType GetSelectionType() const;
134 
135  bool IsModePushed() const { return nullptr != m_pModeStack; }
136  void PushMode();
137  void PopMode();
138 
139  void SttSelect();
140  void EndSelect();
141  bool IsInSelect() const { return m_bInSelect; }
142  void SetInSelect() { m_bInSelect = true; }
143  // is there a text- or frameselection?
144  bool HasSelection() const { return SwCursorShell::HasSelection() ||
145  IsMultiSelection() || IsSelFrameMode() || IsObjSelected(); }
147 
148  void EnterStdMode();
149  bool IsStdMode() const { return !m_bExtMode && !m_bAddMode && !m_bBlockMode; }
150 
151  void EnterExtMode();
152  void LeaveExtMode();
153  void ToggleExtMode();
154  bool IsExtMode() const { return m_bExtMode; }
155 
156  void EnterAddMode();
157  void LeaveAddMode();
158  void ToggleAddMode();
159  bool IsAddMode() const { return m_bAddMode; }
160 
161  void EnterBlockMode();
162  void LeaveBlockMode();
163  void ToggleBlockMode();
164  bool IsBlockMode() const { return m_bBlockMode; }
165 
166  void SetInsMode( bool bOn = true );
167  void ToggleInsMode() { SetInsMode( !m_bIns ); }
168  bool IsInsMode() const { return m_bIns; }
169  void SetRedlineFlagsAndCheckInsMode( RedlineFlags eMode );
170 
171  void EnterSelFrameMode(const Point *pStartDrag = nullptr);
172  void LeaveSelFrameMode();
173  bool IsSelFrameMode() const { return m_bLayoutMode; }
174  // reset selection of frames
175  void UnSelectFrame();
176 
177  void Invalidate();
178 
179  // select table cells for editing of formulas in the ribbonbar
180  inline void SelTableCells( const Link<SwWrtShell&,void> &rLink );
181  inline void EndSelTableCells();
182 
183  // leave per word or per line selection mode. Is usually called in MB-Up.
184  bool IsExtSel() const { return m_bSelWrd || m_bSelLn; }
185 
186  // query whether the active m_fnDrag pointer is set to BeginDrag
187  // is needed for MouseMove to work around bugs 55592/55931
188  inline bool Is_FnDragEQBeginDrag() const;
189 
190  // base requests
191  bool IsEndWrd();
192  bool IsSttOfPara() const { return IsSttPara(); }
193  bool IsEndOfPara() const { return IsEndPara(); }
194 
195  // select word / sentence
196  bool SelNearestWrd();
197  bool SelWrd (const Point * = nullptr );
198  // #i32329# Enhanced selection
199  void SelSentence (const Point *);
200  void SelPara (const Point *);
201  void SelAll();
202 
203  // basecursortravelling
204 typedef bool (SwWrtShell::*FNSimpleMove)();
205  bool SimpleMove( FNSimpleMove, bool bSelect );
206 
207  bool Left ( sal_uInt16 nMode, bool bSelect,
208  sal_uInt16 nCount, bool bBasicCall, bool bVisual = false );
209  bool Right ( sal_uInt16 nMode, bool bSelect,
210  sal_uInt16 nCount, bool bBasicCall, bool bVisual = false );
211  bool Up ( bool bSelect, sal_uInt16 nCount = 1, bool bBasicCall = false );
212  bool Down ( bool bSelect, sal_uInt16 nCount = 1, bool bBasicCall = false );
213  void NxtWrd ( bool bSelect = false ) { SimpleMove( &SwWrtShell::NxtWrd_, bSelect ); }
214  bool PrvWrd ( bool bSelect = false ) { return SimpleMove( &SwWrtShell::PrvWrd_, bSelect ); }
215 
216  bool LeftMargin ( bool bSelect, bool bBasicCall );
217  bool RightMargin( bool bSelect, bool bBasicCall );
218 
219  bool StartOfSection( bool bSelect = false );
220  bool EndOfSection ( bool bSelect = false );
221 
222  bool SttNxtPg ( bool bSelect = false );
223  void SttPrvPg ( bool bSelect = false );
224  void EndNxtPg ( bool bSelect = false );
225  bool EndPrvPg ( bool bSelect = false );
226  bool SttPg ( bool bSelect = false );
227  bool EndPg ( bool bSelect = false );
228  bool SttPara ( bool bSelect = false );
229  void EndPara ( bool bSelect = false );
230  bool FwdPara ()
231  { return SimpleMove( &SwWrtShell::FwdPara_, false/*bSelect*/ ); }
232  void BwdPara ()
233  { SimpleMove( &SwWrtShell::BwdPara_, false/*bSelect*/ ); }
234  void FwdSentence( bool bSelect = false )
235  { SimpleMove( &SwWrtShell::FwdSentence_, bSelect ); }
236  void BwdSentence( bool bSelect = false )
237  { SimpleMove( &SwWrtShell::BwdSentence_, bSelect ); }
238 
239  // #i20126# Enhanced table selection
240  bool SelectTableRowCol( const Point& rPt, const Point* pEnd = nullptr, bool bRowDrag = false );
241  void SelectTableRow();
242  void SelectTableCol();
243  void SelectTableCell();
244 
245  bool SelectTextAttr( sal_uInt16 nWhich, const SwTextAttr* pAttr = nullptr );
246 
247  // per column jumps
248  void StartOfColumn ();
249  void EndOfColumn ();
250  void StartOfNextColumn ();
251  void EndOfNextColumn ();
252  void StartOfPrevColumn ();
253  void EndOfPrevColumn ();
254 
255  // set the cursor to page "nPage" at the beginning
256  // additionally to an identically named implementation in crsrsh.hxx
257  // here all existing selections are being reset before setting the
258  // cursor
259  bool GotoPage( sal_uInt16 nPage, bool bRecord );
260 
261  // setting the cursor; remember the old position for turning back
262  DECL_LINK( ExecFlyMac, const SwFlyFrameFormat*, void );
263 
264  bool PageCursor(SwTwips lOffset, bool bSelect);
265 
266  // update fields
267  void UpdateInputFields( SwInputFieldList* pLst = nullptr );
268 
269  void NoEdit(bool bHideCursor = true);
270  void Edit();
271 
272  bool IsRetainSelection() const { return m_bRetainSelection; }
273  void SetRetainSelection( bool bRet ) { m_bRetainSelection = bRet; }
274 
275  // change current data base and notify
276  void ChgDBData(const SwDBData& SwDBData);
277 
278  // delete
279  void DelToEndOfLine();
280  void DelToStartOfLine();
281  void DelLine();
282  bool DelLeft();
283 
284  // also deletes the frame or sets the cursor in the frame when bDelFrame == false
285  bool DelRight();
286  void DelToEndOfPara();
287  void DelToStartOfPara();
288  bool DelToEndOfSentence();
289  void DelToStartOfSentence();
290  void DelNxtWord();
291  void DelPrvWord();
292 
293  // checks whether a word selection exists.
294  // According to the rules for intelligent Cut / Paste
295  // surrounding spaces are cut out.
296  // returns type of word selection (see enum)
297  enum word {
298  NO_WORD = 0,
299  WORD_SPACE_BEFORE = 1,
300  WORD_SPACE_AFTER = 2,
301  WORD_NO_SPACE = 3
302  };
303  int IntelligentCut(SelectionType nSelectionType, bool bCut = true);
304 
305  // edit
306  void Insert(SwField const &, SwPaM* pAnnotationRange = nullptr);
307  void Insert(const OUString &);
308  // graphic
309  void Insert( const OUString &rPath, const OUString &rFilter,
310  const Graphic &, SwFlyFrameAttrMgr * = nullptr,
311  RndStdIds nAnchorType = RndStdIds::FLY_AT_PARA);
312 
313  void InsertByWord( const OUString & );
314  void InsertPageBreak(const OUString *pPageDesc = nullptr, const ::std::optional<sal_uInt16>& rPgNum = std::nullopt);
315  void InsertLineBreak();
316  void InsertColumnBreak();
317  void InsertFootnote(const OUString &, bool bEndNote = false, bool bEdit = true );
318  void SplitNode( bool bAutoFormat = false );
319  bool CanInsert();
320 
321  // indexes
322  void InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = nullptr);
323  void UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = nullptr);
324 
325  // numbering and bullets
332  void NumOrBulletOn(bool bNum); // #i29560#
333  void NumOrBulletOff(); // #i29560#
334  void NumOn();
335  void BulletOn();
336 
337  //OLE
338  void InsertObject( /*SvInPlaceObjectRef *pObj, */ // != 0 for clipboard
339  const svt::EmbeddedObjectRef&,
340  SvGlobalName const *pName, // != 0 create object accordingly
341  sal_uInt16 nSlotId = 0); // SlotId for dialog
342 
343  bool InsertOleObject( const svt::EmbeddedObjectRef& xObj, SwFlyFrameFormat **pFlyFrameFormat = nullptr );
344  void LaunchOLEObj(sal_Int32 nVerb = css::embed::EmbedVerbs::MS_OLEVERB_PRIMARY); // start server
345  virtual void MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset ) override;
346  virtual void CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
347  const SwRect *pFlyPrtRect = nullptr,
348  const SwRect *pFlyFrameRect = nullptr,
349  const bool bNoTextFramePrtAreaChanged = false ) override;
350  virtual void ConnectObj( svt::EmbeddedObjectRef& xIPObj, const SwRect &rPrt,
351  const SwRect &rFrame ) override;
352 
353  // styles and formats
354 
355  // enum tells when should happen when the style was not found
356  enum GetStyle { GETSTYLE_NOCREATE, // create none
357  GETSTYLE_CREATESOME, // if on PoolId create mapt
358  GETSTYLE_CREATEANY }; // return standard if applicable
359 
360  SwTextFormatColl* GetParaStyle(const OUString &rCollName,
361  GetStyle eCreate = GETSTYLE_NOCREATE);
362  SwCharFormat* GetCharStyle(const OUString &rFormatName,
363  GetStyle eCreate = GETSTYLE_NOCREATE);
364  SwFrameFormat* GetTableStyle(std::u16string_view rFormatName);
365 
366  void SetPageStyle(const OUString &rCollName);
367 
368  OUString const & GetCurPageStyle() const;
369 
370  // change current style using the attributes in effect
371  void QuickUpdateStyle();
372 
373  enum DoType { UNDO, REDO, REPEAT };
374 
376 
377  void Do( DoType eDoType, sal_uInt16 nCnt = 1 );
378  OUString GetDoString( DoType eDoType ) const;
379  OUString GetRepeatString() const;
380  void GetDoStrings( DoType eDoType, SfxStringListItem& rStrLstItem ) const;
381 
382  // search and replace
383  sal_uLong SearchPattern(const i18nutil::SearchOptions2& rSearchOpt,
384  bool bSearchInNotes,
385  SwDocPositions eStart, SwDocPositions eEnd,
387  bool bReplace = false );
388 
389  sal_uLong SearchTempl (const OUString &rTempl,
390  SwDocPositions eStart, SwDocPositions eEnd,
392  const OUString* pReplTempl = nullptr );
393 
394  sal_uLong SearchAttr (const SfxItemSet& rFindSet,
395  bool bNoColls,
396  SwDocPositions eStart, SwDocPositions eEnd,
398  const i18nutil::SearchOptions2* pSearchOpt = nullptr,
399  const SfxItemSet* pReplaceSet = nullptr);
400 
401  void AutoCorrect( SvxAutoCorrect& rACorr, sal_Unicode cChar );
402 
403  // action ahead of cursor movement
404  // resets selection if applicable, triggers timer and GCAttr()
405  void MoveCursor( bool bWithSelect = false );
406 
407  // update input fields
408  bool StartInputFieldDlg(SwField*, bool bPrevButton, bool bNextButton, weld::Widget* pParentWin, FieldDialogPressedButton* pPressedButton = nullptr);
409  // update DropDown fields
410  bool StartDropDownFieldDlg(SwField*, bool bPrevButton, bool bNextButton, weld::Widget* pParentWin, FieldDialogPressedButton* pPressedButton = nullptr);
411 
412  //"Handler" for changes at DrawView - for controls.
413  virtual void DrawSelChanged( ) override;
414 
415  // jump to bookmark and set the "selections-flags" correctly again
416  void GotoMark( const ::sw::mark::IMark* const pMark );
417  bool GotoMark( const ::sw::mark::IMark* const pMark, bool bSelect );
418  void GotoMark( const OUString& rName );
419  bool GoNextBookmark(); // true when there still was one
420  bool GoPrevBookmark();
421 
422  bool GotoFieldmark(::sw::mark::IFieldmark const * const pMark);
423 
424  bool GotoField( const SwFormatField& rField );
425 
426  // jump to the next / previous hyperlink - inside text and also
427  // on graphics
428  void SelectNextPrevHyperlink( bool bNext );
429 
430  // determine corresponding SwView
431  const SwView& GetView() const { return m_rView; }
432  SwView& GetView() { return m_rView; }
433 
434  // Because nobody else is doing it, here is an ExecMacro()
435  void ExecMacro( const SvxMacro& rMacro, OUString* pRet = nullptr, SbxArray* pArgs = nullptr );
436  // call into the dark Basic/JavaScript
437  sal_uInt16 CallEvent( SvMacroItemId nEvent, const SwCallMouseEvent& rCallEvent,
438  bool bCheckPtr = false );
439 
440  // a click at the given field. the cursor is on it.
441  // execute the predefined actions.
442  void ClickToField( const SwField& rField, bool bExecHyperlinks );
443  void ClickToINetAttr( const SwFormatINetFormat& rItem, LoadUrlFlags nFilter = LoadUrlFlags::NONE );
444  bool ClickToINetGrf( const Point& rDocPt, LoadUrlFlags nFilter );
445  inline bool IsInClickToEdit() const ;
446 
447  // if a URL-Button is selected, return its URL; otherwise an empty string
448  bool GetURLFromButton( OUString& rURL, OUString& rDescr ) const;
449 
450  void NavigatorPaste( const NaviContentBookmark& rBkmk,
451  const sal_uInt16 nAction );
452 
453  virtual void ApplyViewOptions( const SwViewOption &rOpt ) override;
454  virtual void SetReadonlyOption( bool bSet ) override;
455 
456  // automatic update of styles
457  void AutoUpdateFrame(SwFrameFormat* pFormat, const SfxItemSet& rStyleSet);
458  void AutoUpdatePara(SwTextFormatColl* pColl, const SfxItemSet& rStyleSet, SwPaM* pPaM = nullptr );
459 
460  // starts dialog for inserting ranges via Drag&Drop/Clipboard
461  void StartInsertRegionDialog(const SwSectionData&);
462 
463  // ctor, the first one is a kind of a controlled copy ctor for more views of a document
464  SwWrtShell( SwWrtShell&, vcl::Window *pWin, SwView &rShell);
465  SwWrtShell( SwDoc& rDoc, vcl::Window *pWin, SwView &rShell,
466  const SwViewOption *pViewOpt);
467  virtual ~SwWrtShell() override;
468 
469  bool TryRemoveIndent(); // #i23725#
470 
471  OUString GetSelDescr() const;
472 
473  SwNavigationMgr& GetNavigationMgr() { return m_aNavigationMgr; }
474 
475  void addCurrentPosition();
476  bool GotoFly( const OUString& rName, FlyCntType eType = FLYCNTTYPE_ALL,
477  bool bSelFrame = true );
478  bool GotoINetAttr( const SwTextINetFormat& rAttr );
480  bool GotoOutline( const OUString& rName );
481  bool GotoRegion( std::u16string_view rName );
482  bool GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType = 0,
483  sal_uInt16 nSeqNo = 0 );
484  bool GotoNextTOXBase( const OUString* pName = nullptr);
485  bool GotoTable( const OUString& rName );
486  void GotoFormatField( const SwFormatField& rField );
487  const SwRangeRedline* GotoRedline( SwRedlineTable::size_type nArrPos, bool bSelect);
488  bool GotoDrawingObject(std::u16string_view rName);
489 
490  void ChangeHeaderOrFooter(std::u16string_view rStyleName, bool bHeader, bool bOn, bool bShowWarning);
491  virtual void SetShowHeaderFooterSeparator( FrameControlType eControl, bool bShow ) override;
492 
494  void InsertPostIt(SwFieldMgr& rFieldMgr, const SfxRequest& rReq);
495 
496  bool IsOutlineContentVisible(const size_t nPos);
497  void MakeOutlineContentVisible(const size_t nPos, bool bMakeVisible = true);
498  void MakeAllFoldedOutlineContentVisible(bool bMakeVisible = true);
499  void InvalidateOutlineContentVisibility();
500  bool GetAttrOutlineContentVisible(const size_t nPos);
501 
502 private:
503 
504  SAL_DLLPRIVATE void OpenMark();
505  SAL_DLLPRIVATE void CloseMark( bool bOkFlag );
506 
507  struct ModeStack
508  {
510  bool bAdd,
511  bBlock,
512  bExt,
513  bIns;
514  ModeStack(ModeStack *pNextMode, bool _bIns, bool _bExt, bool _bAdd, bool _bBlock):
515  pNext(pNextMode),
516  bAdd(_bAdd),
517  bBlock(_bBlock),
518  bExt(_bExt),
519  bIns(_bIns)
520  {}
521  } *m_pModeStack = nullptr;
522 
523  // carry cursor along when PageUp / -Down
524  enum PageMove
525  {
528  MV_PAGE_DOWN
529  } m_ePageMove = MV_NO;
530 
531  struct CursorStack
532  {
533  Point aDocPos;
534  std::unique_ptr<CursorStack> pNext;
535  bool bValidCurPos : 1;
536  bool bIsFrameSel : 1;
538 
539  CursorStack( bool bValid, bool bFrameSel, const Point &rDocPos,
540  SwTwips lOff, std::unique_ptr<CursorStack> pN )
541  : aDocPos(rDocPos),
542  pNext(std::move(pN)),
543  bValidCurPos( bValid ),
544  bIsFrameSel( bFrameSel ),
545  lOffset(lOff)
546  {
547  }
548 
549  };
550  std::unique_ptr<CursorStack> m_pCursorStack;
551 
554 
555  Point m_aDest;
556  bool m_bDestOnStack = false;
557  bool HasCursorStack() const { return nullptr != m_pCursorStack; }
558  SAL_DLLPRIVATE bool PushCursor(SwTwips lOffset, bool bSelect);
559  SAL_DLLPRIVATE bool PopCursor(bool bUpdate, bool bSelect = false);
560 
561  // take END cursor along when PageUp / -Down
562  SAL_DLLPRIVATE void SttWrd();
563  SAL_DLLPRIVATE void EndWrd();
564  SAL_DLLPRIVATE bool NxtWrd_();
565  SAL_DLLPRIVATE bool PrvWrd_();
566  // #i92468#
567  SAL_DLLPRIVATE bool NxtWrdForDelete();
568  SAL_DLLPRIVATE bool PrvWrdForDelete();
569  SAL_DLLPRIVATE bool FwdSentence_();
570  SAL_DLLPRIVATE bool BwdSentence_();
571  bool FwdPara_();
572  SAL_DLLPRIVATE bool BwdPara_();
573 
574  // selections
575  bool m_bIns :1;
576  bool m_bInSelect :1;
577  bool m_bExtMode :1;
578  bool m_bAddMode :1;
579  bool m_bBlockMode :1;
580  bool m_bLayoutMode :1;
581  bool m_bSelWrd :1;
582  bool m_bSelLn :1;
583  bool m_bIsInClickToEdit:1;
584  bool m_bClearMark :1; // don't delete selection for ChartAutoPilot
585  bool m_bRetainSelection :1; // Do not remove selections
586 
587  Point m_aStart;
589 
590  // resets the cursor stack after movement by PageUp/-Down
591  SAL_DLLPRIVATE void ResetCursorStack_();
592 
594  SAL_DLLPRIVATE tools::Long SetCursor(const Point *, bool bProp=false );
595 
596  SAL_DLLPRIVATE tools::Long SetCursorKillSel(const Point *, bool bProp );
597 
598  SAL_DLLPRIVATE void BeginDrag(const Point *, bool bProp );
599  SAL_DLLPRIVATE void DefaultDrag(const Point *, bool bProp );
600  SAL_DLLPRIVATE void DefaultEndDrag(const Point *, bool bProp );
601 
602  SAL_DLLPRIVATE void ExtSelWrd(const Point *, bool bProp );
603  SAL_DLLPRIVATE void ExtSelLn(const Point *, bool bProp );
604 
605  SAL_DLLPRIVATE void BeginFrameDrag(const Point *, bool bProp );
606 
607  // after SSize/Move of a frame update; Point is destination.
608  SAL_DLLPRIVATE void UpdateLayoutFrame(const Point *, bool bProp );
609 
610  SAL_DLLPRIVATE void SttLeaveSelect();
611  SAL_DLLPRIVATE void AddLeaveSelect();
612  SAL_DLLPRIVATE tools::Long Ignore(const Point *, bool bProp );
613 
614  SAL_DLLPRIVATE void LeaveExtSel() { m_bSelWrd = m_bSelLn = false;}
615 
616  SAL_DLLPRIVATE bool GoStart(bool KeepArea, bool *,
617  bool bSelect, bool bDontMoveRegion = false);
618  SAL_DLLPRIVATE bool GoEnd(bool KeepArea = false, const bool * = nullptr);
619 
621  {
624  BOOKMARK_PREV
625  };
626 
627  SAL_DLLPRIVATE bool MoveBookMark(BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark=nullptr);
628 };
629 
631 {
632  if ( HasCursorStack() )
634 }
635 
637 {
638  SetSelTableCells( true );
639  m_bClearMark = true;
640  m_aSelTableLink = rLink;
641 }
643 {
644  SetSelTableCells( false );
645  m_bClearMark = true;
646 }
647 
648 inline bool SwWrtShell::IsInClickToEdit() const { return m_bIsInClickToEdit; }
649 
651 {
652 #ifdef __GNUC__
654  return m_fnDrag == fnTmp;
655 #else
656  return m_fnDrag == &SwWrtShell::BeginDrag;
657 #endif
658 }
659 
661 {
662 private:
663  SwWrtShell* m_pWrtSh = nullptr;
664  bool m_bDone = false;
665 public:
666  static sal_uInt32 nLock;
668  {
669  ++nLock;
670  if (nLock > 1)
671  return;
672  if (SwDocShell* pDocSh = pDoc->GetDocShell())
673  if ((m_pWrtSh = pDocSh->GetWrtShell()) && m_pWrtSh->GetViewOptions() &&
675  {
676  m_pWrtSh->StartAllAction();
678  m_bDone = true;
679  }
680  }
681 
683  {
684  --nLock;
685  if (nLock > 0)
686  return;
687  if (m_bDone && m_pWrtSh)
688  {
689  m_pWrtSh->MakeAllFoldedOutlineContentVisible(false);
690  m_pWrtSh->EndAllAction();
691  }
692  }
693 };
694 
695 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwView & GetView()
Definition: wrtsh.hxx:432
bool GotoPage(sal_uInt16 nPage)
Definition: crsrsh.cxx:1188
SAL_DLLPRIVATE tools::Long Ignore(const Point *, bool bProp)
Definition: select.cxx:379
bool IsInClickToEdit() const
Definition: wrtsh.hxx:648
void NxtWrd(bool bSelect=false)
Definition: wrtsh.hxx:213
bool GotoTable(const OUString &rName)
Definition: trvltbl.cxx:794
void ChgDBData(const SwDBData &SwDBData)
Definition: edfld.cxx:294
Represents the style of a paragraph.
Definition: fmtcol.hxx:56
void EndSelTableCells()
Definition: wrtsh.hxx:642
void ResetCursorStack()
Definition: wrtsh.hxx:630
bool IsInsMode() const
Definition: wrtsh.hxx:168
bool Right(sal_uInt16 nCnt, sal_uInt16 nMode, bool bAllowVisual=false)
Definition: crsrsh.hxx:351
void ToggleInsMode()
Definition: wrtsh.hxx:167
FieldDialogPressedButton
Definition: wrtsh.hxx:375
LoadUrlFlags
Definition: swurl.hxx:27
SwDocShell * GetDocShell()
Definition: doc.hxx:1352
SELECTFUNC2 m_fnDrag
Definition: wrtsh.hxx:111
void InsertTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
Insert content table. Renew if required.
Definition: edtox.cxx:122
virtual void MoveObjectIfActive(svt::EmbeddedObjectRef &xObj, const Point &rOffset)
The layout has been changed, so the active object has to be moved after that.
Definition: fews.cxx:1315
bool IsSttPara() const
Definition: crsrsh.cxx:1095
void UpdateTableOf(const SwTOXBase &rTOX, const SfxItemSet *pSet=nullptr)
update tables of content
Definition: edtox.cxx:150
bool IsRetainSelection() const
Definition: wrtsh.hxx:272
sal_uIntPtr sal_uLong
long Long
#define CNT_GRF
Definition: editsh.hxx:130
Base class of all fields.
Definition: fldbas.hxx:289
const SwRangeRedline * GotoRedline(SwRedlineTable::size_type nArrPos, bool bSelect)
Definition: crstrvl.cxx:2331
Definition: doc.hxx:188
virtual void CalcAndSetScale(svt::EmbeddedObjectRef &xObj, const SwRect *pFlyPrtRect=nullptr, const SwRect *pFlyFrameRect=nullptr, const bool bNoTextFramePrtAreaChanged=false)=0
Client for OleObject has to be up-to-date regarding scaling.
void AutoCorrect(SvxAutoCorrect &rACorr, bool bInsertMode, sal_Unicode cChar)
Call AutoCorrect.
Definition: edws.cxx:255
Link< SwWrtShell &, void > m_aSelTableLink
Definition: wrtsh.hxx:588
SvMacroItemId
SAL_DLLPRIVATE bool BwdPara_()
Definition: wrtsh4.cxx:219
bool Left(sal_uInt16 nCnt, sal_uInt16 nMode, bool bAllowVisual=false)
Definition: crsrsh.hxx:349
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
SAL_DLLPRIVATE bool FwdSentence_()
Definition: wrtsh4.cxx:174
bool GotoMark(const ::sw::mark::IMark *const pMark)
Definition: crbm.cxx:184
void EndAllAction()
Definition: edws.cxx:97
bool IsStdMode() const
Definition: wrtsh.hxx:149
virtual void SetReadonlyOption(bool bSet)
Definition: viewsh.cxx:2362
bool HasSelection() const
Does the current cursor create a selection?
Definition: crsrsh.cxx:2521
SwDocPositions
Definition: cshtyp.hxx:103
SwNavigationMgr & GetNavigationMgr()
Definition: wrtsh.hxx:473
Used by the UI to modify the document model.
Definition: wrtsh.hxx:93
void BeginDrag(const Point *pPt, bool bProp)
Definition: feshview.cxx:713
sal_uInt16 sal_Unicode
virtual void ApplyViewOptions(const SwViewOption &rOpt) override
Apply ViewOptions with Start-/EndAction.
Definition: editsh.cxx:1081
const SwView & GetView() const
Definition: wrtsh.hxx:431
NONE
bool m_bIsInClickToEdit
Definition: wrtsh.hxx:583
bool Down(sal_uInt16 nCnt=1)
Definition: crsrsh.hxx:354
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
Definition: txatbase.hxx:41
void BwdPara()
Definition: wrtsh.hxx:232
FindRanges
Definition: cshtyp.hxx:90
bool PrvWrd(bool bSelect=false)
Definition: wrtsh.hxx:214
int SetCursor(const Point &rPt, bool bOnlyText=false, bool bBlock=true)
Definition: crsrsh.cxx:761
bool IsBlockMode() const
Definition: wrtsh.hxx:164
bool GotoRegion(std::u16string_view rName)
Definition: trvlreg.cxx:270
bool GotoFly(const OUString &rName, FlyCntType eType, bool bSelFrame)
Jump to named Fly (graphic/OLE).
Definition: feshview.cxx:2593
bool IsShowOutlineContentVisibilityButton() const
Definition: viewopt.cxx:99
SwNavigationMgr m_aNavigationMgr
Definition: wrtsh.hxx:553
virtual void ConnectObj(svt::EmbeddedObjectRef &, const SwRect &rPrt, const SwRect &rFrame)=0
Connect objects with ActivateWhenVisible at Paint.
void SetInSelect()
Definition: wrtsh.hxx:142
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
bool LeftMargin()
Definition: crsrsh.hxx:355
sal_uInt16 char * pName
Style of a layout element.
Definition: frmfmt.hxx:58
bool HasSelection() const
Definition: wrtsh.hxx:144
std::unique_ptr< CursorStack > m_pCursorStack
Definition: wrtsh.hxx:550
bool Up(sal_uInt16 nCnt=1)
Definition: crsrsh.hxx:353
virtual void DrawSelChanged()
Definition: viewsh.cxx:2090
void SetRetainSelection(bool bRet)
Definition: wrtsh.hxx:273
FlyCntType
Definition: flyenum.hxx:23
SelectionType
virtual void SetShowHeaderFooterSeparator(FrameControlType eControl, bool bShow)
Definition: viewsh.cxx:95
void BwdSentence(bool bSelect=false)
Definition: wrtsh.hxx:236
SAL_DLLPRIVATE bool BwdSentence_()
Definition: wrtsh4.cxx:191
vector_type::size_type size_type
Definition: docary.hxx:223
bool GotoFieldmark(const ::sw::mark::IFieldmark *const pMark)
Definition: crbm.cxx:302
bool GotoINetAttr(const SwTextINetFormat &rAttr)
Definition: crstrvl.cxx:2005
bool RightMargin(bool bAPI=false)
Definition: crsrsh.hxx:356
bool GotoNextTOXBase(const OUString *=nullptr)
jump to the next index
Definition: crstrvl.cxx:267
bool GoNextBookmark()
Definition: crbm.cxx:200
void MakeAllFoldedOutlineContentVisible(bool bMakeVisible=true)
Definition: wrtsh1.cxx:2199
#define CNT_OLE
Definition: editsh.hxx:131
bool IsSttOfPara() const
Definition: wrtsh.hxx:192
bool SelectTextAttr(sal_uInt16 nWhich, bool bExpand, const SwTextAttr *pAttr=nullptr)
Definition: crstrvl.cxx:1976
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
void Insert(const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic, const SfxItemSet *pFlyAttrSet)
Definition: fefly1.cxx:824
bool IsInSelect() const
Definition: wrtsh.hxx:141
#define CNT_TXT
Definition: editsh.hxx:129
Point m_aStart
Definition: wrtsh.hxx:587
void FwdSentence(bool bSelect=false)
Definition: wrtsh.hxx:234
tools::Long SwTwips
Definition: swtypes.hxx:49
bool HasCursorStack() const
Definition: wrtsh.hxx:557
SAL_DLLPRIVATE void DefaultEndDrag(const Point *, bool bProp)
Definition: select.cxx:808
void Drag(const Point *pPt, bool bProp)
Definition: wrtsh.hxx:121
tools::Long CallSetCursor(const Point *pPt, bool bProp)
Definition: wrtsh.hxx:120
SwTextFormatColl * GetParaStyle(SwDoc &rDoc, const OUString &rName)
Get a Paragraph Style which fits a given name.
void EndDrag(const Point *pPt, bool bProp)
Definition: wrtsh.hxx:122
SwFlyFrameFormat * InsertObject(const svt::EmbeddedObjectRef &, SfxItemSet *pFlyAttrSet)
Definition: fefly1.cxx:917
CursorStack(bool bValid, bool bFrameSel, const Point &rDocPos, SwTwips lOff, std::unique_ptr< CursorStack > pN)
Definition: wrtsh.hxx:539
FrameControlType
Definition: swtypes.hxx:234
bool Is_FnDragEQBeginDrag() const
Definition: wrtsh.hxx:650
bool IsMultiSelection() const
Definition: crsrsh.hxx:884
SwView & m_rView
Definition: wrtsh.hxx:552
const short REDO
bool IsEndOfPara() const
Definition: wrtsh.hxx:193
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:423
bool IsModePushed() const
Definition: wrtsh.hxx:135
Point m_aDest
Definition: wrtsh.hxx:555
size_t IsObjSelected() const
Definition: feshview.cxx:1240
tools::Long KillSelection(const Point *pPt, bool bProp)
Definition: wrtsh.hxx:123
SAL_DLLPRIVATE void BeginDrag(const Point *, bool bProp)
Definition: select.cxx:778
~MakeAllOutlineContentTemporarilyVisible() COVERITY_NOEXCEPT_FALSE
Definition: wrtsh.hxx:682
bool IsExtMode() const
Definition: wrtsh.hxx:154
bool GoPrevBookmark()
Definition: crbm.cxx:233
Find "one" only in body text.
void GetCurPageStyle(SwPaM const &rPaM, OUString &rString)
MakeAllOutlineContentTemporarilyVisible(SwDoc *pDoc)
Definition: wrtsh.hxx:667
void SetSelTableCells(bool bFlag)
Definition: crsrsh.hxx:799
void Insert(sal_Unicode, bool bOnlyCurrCursor=false)
Edit (all selected ranges).
Definition: editsh.cxx:63
SAL_DLLPRIVATE bool NxtWrd_()
Definition: wrtsh4.cxx:65
RndStdIds
bool IsExtSel() const
Definition: wrtsh.hxx:184
bool IsAddMode() const
Definition: wrtsh.hxx:159
bool FwdPara_()
Definition: wrtsh4.cxx:208
SAL_DLLPRIVATE bool PrvWrd_()
Definition: wrtsh4.cxx:96
bool IsEndPara() const
Definition: crsrsh.cxx:1114
void SplitNode(bool bAutoFormat=false, bool bCheckTableStart=true)
Definition: editsh.cxx:183
bool Pop(PopMode)
delete cursor
Definition: crsrsh.cxx:2265
std::vector< SwNode * >::size_type size_type
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
SwCharFormat * GetCharStyle(SwDoc &rDoc, const OUString &rName)
Get a Character Style which fits a given name.
bool GotoOutline(const OUString &rName)
Definition: crstrvl.cxx:988
bool FwdPara()
Definition: wrtsh.hxx:230
void(SwWrtShell::* SELECTFUNC2)(const Point *, bool bProp)
Definition: wrtsh.hxx:109
bool GotoFormatField(const SwFormatField &rField)
Definition: crstrvl.cxx:834
ModeStack(ModeStack *pNextMode, bool _bIns, bool _bExt, bool _bAdd, bool _bBlock)
Definition: wrtsh.hxx:514
std::unique_ptr< CursorStack > pNext
Definition: wrtsh.hxx:534
bool m_bClearMark
Definition: wrtsh.hxx:584
Definition: view.hxx:144
bool GotoRefMark(const OUString &rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo)
jump to reference marker
Definition: crstrvl.cxx:1224
bool IsSelFrameMode() const
Definition: wrtsh.hxx:173
const short REPEAT
SAL_DLLPRIVATE void LeaveExtSel()
Definition: wrtsh.hxx:614
SAL_DLLPRIVATE tools::Long SetCursor(const Point *, bool bProp=false)
Definition: select.cxx:304
void SelTableCells(const Link< SwWrtShell &, void > &rLink)
Definition: wrtsh.hxx:636
ModeStack * pNext
Definition: wrtsh.hxx:509
SAL_DLLPRIVATE void ResetCursorStack_()
Definition: move.cxx:533
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo