1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
35 #include <viewopt.hxx>
37 namespace vcl
{ class Window
; }
39 class SwFlyFrameAttrMgr
;
44 class SwInputFieldList
;
48 class SwFormatINetFormat
;
50 class NaviContentBookmark
;
51 struct SwCallMouseEvent
;
52 class SfxStringListItem
;
53 enum class SvMacroItemId
: sal_uInt16
;
56 enum class SwLineBreakClear
;
57 class SwContentControl
;
58 enum class SwContentControlType
;
61 struct SearchOptions2
;
64 enum class SelectionType
: sal_Int32
67 Text
= CNT_TXT
, // text, never frames too 0x0001
68 Graphic
= CNT_GRF
, // graphic 0x0002
69 Ole
= CNT_OLE
, // OLE 0x0010
70 Frame
= 0x000020, // frame, no content type
71 NumberList
= 0x000040, // NumList
72 Table
= 0x000080, // cursor is in table
73 TableCell
= 0x000100, // table cells are selected
74 DrawObject
= 0x000200, // drawing objects (rectangle, circle...)
75 DrawObjectEditMode
= 0x000400, // draw-textobjects in edit mode
76 Ornament
= 0x000800, // edit ornament objects
77 DbForm
= 0x001000, // drawing objects: DB-Forms
78 FormControl
= 0x002000, // a form control is focused. Neither set nor evaluated by the SwWrtShell itself, only by its clients.
79 Media
= 0x004000, // Media object
80 ExtrudedCustomShape
= 0x008000, // extruded custom shape
81 FontWork
= 0x010000, // fontwork
82 PostIt
= 0x020000, // annotation
83 TableRow
= 0x040000, // table rows are selected
84 TableCol
= 0x080000, // table columns are selected
88 template<> struct typed_flags
<SelectionType
> : is_typed_flags
<SelectionType
, 0x0ffff3> {};
91 /** Used by the UI to modify the document model.
93 Eg. the Insert() method will take the current cursor position, insert the
94 string, and take care of undo etc.
96 class SAL_DLLPUBLIC_RTTI SwWrtShell final
: public SwFEShell
99 using SwCursorShell::Left
;
100 using SwCursorShell::Right
;
101 using SwCursorShell::Up
;
102 using SwCursorShell::Down
;
103 using SwCursorShell::LeftMargin
;
104 using SwCursorShell::RightMargin
;
105 using SwCursorShell::SelectTextAttr
;
106 using SwCursorShell::GotoPage
;
107 using SwFEShell::InsertObject
;
108 using SwEditShell::AutoCorrect
;
109 using SwCursorShell::GotoMark
;
111 typedef tools::Long (SwWrtShell::*SELECTFUNC
)(const Point
*, bool bProp
);
112 typedef void (SwWrtShell::*SELECTFUNC2
)(const Point
*, bool bProp
);
114 SELECTFUNC2 m_fnDrag
= &SwWrtShell::BeginDrag
;
115 SELECTFUNC m_fnSetCursor
= &SwWrtShell::SetCursor
;
116 SELECTFUNC2 m_fnEndDrag
= &SwWrtShell::DefaultEndDrag
;
117 SELECTFUNC m_fnKillSel
= &SwWrtShell::Ignore
;
120 using SwCursorShell::GotoFootnoteAnchor
;
121 using SwEditShell::Insert
;
123 tools::Long
CallSetCursor(const Point
* pPt
, bool bProp
) { return (this->*m_fnSetCursor
)(pPt
, bProp
); }
124 void Drag (const Point
* pPt
, bool bProp
) { (this->*m_fnDrag
)(pPt
, bProp
); }
125 void EndDrag (const Point
* pPt
, bool bProp
) { (this->*m_fnEndDrag
)(pPt
, bProp
); }
126 tools::Long
KillSelection(const Point
* pPt
, bool bProp
) { return (this->*m_fnKillSel
)(pPt
, bProp
); }
128 bool IsSplitVerticalByDefault() const;
129 void SetSplitVerticalByDefault(bool value
);
131 // reset all selections
132 SW_DLLPUBLIC
tools::Long
ResetSelect( const Point
*, bool );
134 // resets the cursorstack after movement with PageUp/-Down if a stack is built up
135 inline void ResetCursorStack();
136 SW_DLLPUBLIC SelectionType
GetSelectionType() const;
138 bool IsModePushed() const { return nullptr != m_pModeStack
; }
143 SW_DLLPUBLIC
void EndSelect();
144 bool IsInSelect() const { return m_bInSelect
; }
145 void SetInSelect() { m_bInSelect
= true; }
146 // is there a text- or frameselection?
147 bool HasSelection() const { return SwCursorShell::HasSelection() ||
148 IsMultiSelection() || IsSelFrameMode() || IsObjSelected(); }
149 bool Pop(SwCursorShell::PopMode
, ::std::optional
<SwCallLink
>& roLink
);
150 SW_DLLPUBLIC
bool Pop(SwCursorShell::PopMode
= SwCursorShell::PopMode::DeleteStack
);
152 SW_DLLPUBLIC
void EnterStdMode();
153 bool IsStdMode() const { return !m_bExtMode
&& !m_bAddMode
&& !m_bBlockMode
; }
155 void AssureStdMode();
159 void ToggleExtMode();
160 bool IsExtMode() const { return m_bExtMode
; }
164 void ToggleAddMode();
165 bool IsAddMode() const { return m_bAddMode
; }
167 void EnterBlockMode();
168 void LeaveBlockMode();
169 void ToggleBlockMode();
170 bool IsBlockMode() const { return m_bBlockMode
; }
172 void SetInsMode( bool bOn
= true );
173 void ToggleInsMode() { SetInsMode( !m_bIns
); }
174 bool IsInsMode() const { return m_bIns
; }
175 SW_DLLPUBLIC
void SetRedlineFlagsAndCheckInsMode( RedlineFlags eMode
);
177 SW_DLLPUBLIC
void EnterSelFrameMode(const Point
*pStartDrag
= nullptr);
178 SW_DLLPUBLIC
void LeaveSelFrameMode();
179 bool IsSelFrameMode() const { return m_bLayoutMode
; }
180 // reset selection of frames
181 SW_DLLPUBLIC
void UnSelectFrame();
185 // select table cells for editing of formulas in the ribbonbar
186 inline void SelTableCells( const Link
<SwWrtShell
&,void> &rLink
);
187 inline void EndSelTableCells();
189 // leave per word or per line selection mode. Is usually called in MB-Up.
190 bool IsExtSel() const { return m_bSelWrd
|| m_bSelLn
; }
192 // query whether the active m_fnDrag pointer is set to BeginDrag
193 // is needed for MouseMove to work around bugs 55592/55931
194 inline bool Is_FnDragEQBeginDrag() const;
198 bool IsSttOfPara() const { return IsSttPara(); }
199 bool IsEndOfPara() const { return IsEndPara(); }
201 // select word / sentence
202 bool SelNearestWrd();
203 SW_DLLPUBLIC
bool SelWrd(const Point
* = nullptr, sal_Int16 nWordType
= i18n::WordType::ANYWORD_IGNOREWHITESPACES
);
204 // #i32329# Enhanced selection
205 void SelSentence (const Point
*);
206 SW_DLLPUBLIC
void SelPara (const Point
*);
207 SW_DLLPUBLIC
void SelAll();
209 // basecursortravelling
210 typedef bool (SwWrtShell::*FNSimpleMove
)();
211 SW_DLLPUBLIC
bool SimpleMove( FNSimpleMove
, bool bSelect
);
213 SW_DLLPUBLIC
bool Left( SwCursorSkipMode nMode
, bool bSelect
,
214 sal_uInt16 nCount
, bool bBasicCall
, bool bVisual
= false );
215 SW_DLLPUBLIC
bool Right( SwCursorSkipMode nMode
, bool bSelect
,
216 sal_uInt16 nCount
, bool bBasicCall
, bool bVisual
= false );
217 SW_DLLPUBLIC
bool Up ( bool bSelect
, sal_uInt16 nCount
= 1, bool bBasicCall
= false );
218 SW_DLLPUBLIC
bool Down( bool bSelect
, sal_uInt16 nCount
= 1, bool bBasicCall
= false );
219 void NxtWrd ( bool bSelect
= false ) { SimpleMove( &SwWrtShell::NxtWrd_
, bSelect
); }
220 bool PrvWrd ( bool bSelect
= false ) { return SimpleMove( &SwWrtShell::PrvWrd_
, bSelect
); }
222 bool LeftMargin ( bool bSelect
, bool bBasicCall
);
223 SW_DLLPUBLIC
bool RightMargin( bool bSelect
, bool bBasicCall
);
225 SW_DLLPUBLIC
bool StartOfSection( bool bSelect
= false );
226 SW_DLLPUBLIC
bool EndOfSection ( bool bSelect
= false );
228 SW_DLLPUBLIC
bool SttNxtPg ( bool bSelect
= false );
229 void SttPrvPg ( bool bSelect
= false );
230 void EndNxtPg ( bool bSelect
= false );
231 SW_DLLPUBLIC
bool EndPrvPg ( bool bSelect
= false );
232 SW_DLLPUBLIC
bool SttPg ( bool bSelect
= false );
233 SW_DLLPUBLIC
bool EndPg ( bool bSelect
= false );
234 SW_DLLPUBLIC
bool SttPara ( bool bSelect
= false );
235 SW_DLLPUBLIC
void EndPara ( bool bSelect
= false );
237 { return SimpleMove( &SwWrtShell::FwdPara_
, false/*bSelect*/ ); }
239 { SimpleMove( &SwWrtShell::BwdPara_
, false/*bSelect*/ ); }
240 void FwdSentence( bool bSelect
= false )
241 { SimpleMove( &SwWrtShell::FwdSentence_
, bSelect
); }
242 void BwdSentence( bool bSelect
= false )
243 { SimpleMove( &SwWrtShell::BwdSentence_
, bSelect
); }
245 // #i20126# Enhanced table selection
246 SW_DLLPUBLIC
bool SelectTableRowCol( const Point
& rPt
, const Point
* pEnd
= nullptr, bool bRowDrag
= false );
247 void SelectTableRow();
248 void SelectTableCol();
249 void SelectTableCell();
251 SW_DLLPUBLIC
bool SelectTextAttr( sal_uInt16 nWhich
, const SwTextAttr
* pAttr
= nullptr );
254 void StartOfColumn ();
256 void StartOfNextColumn ();
257 void EndOfNextColumn ();
258 void StartOfPrevColumn ();
259 void EndOfPrevColumn ();
261 // set the cursor to page "nPage" at the beginning
262 // additionally to an identically named implementation in crsrsh.hxx
263 // here all existing selections are being reset before setting the
265 SW_DLLPUBLIC
bool GotoPage( sal_uInt16 nPage
, bool bRecord
);
267 // setting the cursor; remember the old position for turning back
268 DECL_LINK( ExecFlyMac
, const SwFlyFrameFormat
*, void );
270 bool PageCursor(SwTwips lOffset
, bool bSelect
);
273 void UpdateInputFields( SwInputFieldList
* pLst
= nullptr );
275 void NoEdit(bool bHideCursor
= true);
278 bool IsRetainSelection() const { return m_bRetainSelection
; }
279 void SetRetainSelection( bool bRet
) { m_bRetainSelection
= bRet
; }
281 // change current data base and notify
282 SW_DLLPUBLIC
void ChgDBData(const SwDBData
& SwDBData
);
285 void DelToEndOfLine();
286 SW_DLLPUBLIC
void DelToStartOfLine();
287 SW_DLLPUBLIC
void DelLine();
288 SW_DLLPUBLIC
bool DelLeft();
290 // also deletes the frame or sets the cursor in the frame when bDelFrame == false
291 SW_DLLPUBLIC
bool DelRight(bool isReplaceHeuristic
= false);
292 SW_DLLPUBLIC
void DelToEndOfPara();
293 void DelToStartOfPara();
294 SW_DLLPUBLIC
bool DelToEndOfSentence();
295 void DelToStartOfSentence();
299 // checks whether a word selection exists.
300 // According to the rules for intelligent Cut / Paste
301 // surrounding spaces are cut out.
302 // returns type of word selection (see enum)
305 WORD_SPACE_BEFORE
= 1,
306 WORD_SPACE_AFTER
= 2,
309 int IntelligentCut(SelectionType nSelectionType
, bool bCut
= true);
312 SW_DLLPUBLIC
bool InsertField2(SwField
const &, SwPaM
* pAnnotationRange
= nullptr);
313 SW_DLLPUBLIC
void Insert(const OUString
&);
315 void InsertGraphic( const OUString
&rPath
, const OUString
&rFilter
,
316 const Graphic
&, SwFlyFrameAttrMgr
* = nullptr,
317 RndStdIds nAnchorType
= RndStdIds::FLY_AT_PARA
);
319 void InsertByWord( const OUString
& );
320 SW_DLLPUBLIC
void InsertPageBreak(const OUString
*pPageDesc
= nullptr, const ::std::optional
<sal_uInt16
>& rPgNum
= std::nullopt
);
321 void InsertEnclosingChars(std::u16string_view sStartStr
, std::u16string_view sEndStr
);
322 SW_DLLPUBLIC
void InsertLineBreak(std::optional
<SwLineBreakClear
> oClear
= std::nullopt
);
323 void InsertColumnBreak();
324 SW_DLLPUBLIC
void InsertContentControl(SwContentControlType eType
);
325 SW_DLLPUBLIC
void InsertFootnote(const OUString
&, bool bEndNote
= false, bool bEdit
= true );
326 SW_DLLPUBLIC
void SplitNode( bool bAutoFormat
= false );
330 void InsertTableOf(const SwTOXBase
& rTOX
, const SfxItemSet
* pSet
= nullptr);
331 SW_DLLPUBLIC
void UpdateTableOf(const SwTOXBase
& rTOX
, const SfxItemSet
* pSet
= nullptr);
333 // numbering and bullets
335 Turns on numbering or bullets.
337 @param bNum true: turn on numbering
338 false: turn on bullets
340 void NumOrBulletOn(bool bNum
); // #i29560#
341 void NumOrBulletOff(); // #i29560#
343 SW_DLLPUBLIC
void BulletOn();
346 SW_DLLPUBLIC
void InsertObject( /*SvInPlaceObjectRef *pObj, */ // != 0 for clipboard
347 const svt::EmbeddedObjectRef
&,
348 SvGlobalName
const *pName
, // != 0 create object accordingly
349 sal_uInt16 nSlotId
= 0); // SlotId for dialog
351 bool InsertOleObject( const svt::EmbeddedObjectRef
& xObj
, SwFlyFrameFormat
**pFlyFrameFormat
= nullptr );
352 SW_DLLPUBLIC
void LaunchOLEObj(sal_Int32 nVerb
= css::embed::EmbedVerbs::MS_OLEVERB_PRIMARY
); // start server
353 virtual void MoveObjectIfActive( svt::EmbeddedObjectRef
& xObj
, const Point
& rOffset
) override
;
354 virtual void CalcAndSetScale( svt::EmbeddedObjectRef
& xObj
,
355 const SwRect
*pFlyPrtRect
= nullptr,
356 const SwRect
*pFlyFrameRect
= nullptr,
357 const bool bNoTextFramePrtAreaChanged
= false ) override
;
358 virtual void ConnectObj( svt::EmbeddedObjectRef
& xIPObj
, const SwRect
&rPrt
,
359 const SwRect
&rFrame
) override
;
361 // styles and formats
363 // enum tells when should happen when the style was not found
364 enum GetStyle
{ GETSTYLE_NOCREATE
, // create none
365 GETSTYLE_CREATESOME
, // if on PoolId create mapt
366 GETSTYLE_CREATEANY
}; // return standard if applicable
368 SW_DLLPUBLIC SwTextFormatColl
* GetParaStyle(const OUString
&rCollName
,
369 GetStyle eCreate
= GETSTYLE_NOCREATE
);
370 SW_DLLPUBLIC SwCharFormat
* GetCharStyle(const OUString
&rFormatName
,
371 GetStyle eCreate
= GETSTYLE_NOCREATE
);
372 SW_DLLPUBLIC SwFrameFormat
* GetTableStyle(std::u16string_view rFormatName
);
374 void SetPageStyle(const OUString
&rCollName
);
376 SW_DLLPUBLIC OUString
const & GetCurPageStyle() const;
378 // change current style using the attributes in effect
379 void QuickUpdateStyle();
381 enum DoType
{ UNDO
, REDO
, REPEAT
};
383 enum class FieldDialogPressedButton
{ NONE
, Previous
, Next
};
385 void Do(DoType eDoType
, sal_uInt16 nCnt
= 1, sal_uInt16 nOffset
= 0);
386 OUString
GetDoString( DoType eDoType
) const;
387 OUString
GetRepeatString() const;
388 void GetDoStrings( DoType eDoType
, SfxStringListItem
& rStrLstItem
) const;
390 // search and replace
391 SW_DLLPUBLIC sal_Int32
SearchPattern(const i18nutil::SearchOptions2
& rSearchOpt
,
393 SwDocPositions eStart
, SwDocPositions eEnd
,
394 FindRanges eFlags
= FindRanges::InBody
,
395 bool bReplace
= false );
397 sal_Int32
SearchTempl (const OUString
&rTempl
,
398 SwDocPositions eStart
, SwDocPositions eEnd
,
399 FindRanges eFlags
= FindRanges::InBody
,
400 const OUString
* pReplTempl
= nullptr );
402 sal_Int32
SearchAttr (const SfxItemSet
& rFindSet
,
404 SwDocPositions eStart
, SwDocPositions eEnd
,
405 FindRanges eFlags
= FindRanges::InBody
,
406 const i18nutil::SearchOptions2
* pSearchOpt
= nullptr,
407 const SfxItemSet
* pReplaceSet
= nullptr);
409 SW_DLLPUBLIC
void AutoCorrect( SvxAutoCorrect
& rACorr
, sal_Unicode cChar
);
411 // action ahead of cursor movement
412 // resets selection if applicable, triggers timer and GCAttr()
413 void MoveCursor( bool bWithSelect
= false );
415 // update input fields
416 bool StartInputFieldDlg(SwField
*, bool bPrevButton
, bool bNextButton
, weld::Widget
* pParentWin
, FieldDialogPressedButton
* pPressedButton
= nullptr);
417 // update DropDown fields
418 bool StartDropDownFieldDlg(SwField
*, bool bPrevButton
, bool bNextButton
, weld::Widget
* pParentWin
, FieldDialogPressedButton
* pPressedButton
= nullptr);
420 //"Handler" for changes at DrawView - for controls.
421 virtual void DrawSelChanged( ) override
;
423 // jump to bookmark and set the "selections-flags" correctly again
424 SW_DLLPUBLIC
void GotoMark( const ::sw::mark::MarkBase
* const pMark
);
425 bool GotoMark( const ::sw::mark::MarkBase
* const pMark
, bool bSelect
);
426 SW_DLLPUBLIC
void GotoMark( const OUString
& rName
);
427 bool GoNextBookmark(); // true when there still was one
428 bool GoPrevBookmark();
430 bool GotoFieldmark(::sw::mark::Fieldmark
const * const pMark
);
432 SW_DLLPUBLIC
bool GotoField( const SwFormatField
& rField
);
434 /** @param bOnlyRefresh:
435 * false: run default actions (e.g. toggle checkbox, remove placeholder content)
436 * true: do not alter the content control, just refresh the doc model
438 SW_DLLPUBLIC
bool GotoContentControl(const SwFormatContentControl
& rContentControl
,
439 bool bOnlyRefresh
= false);
441 // jump to the next / previous hyperlink - inside text and also
443 void SelectNextPrevHyperlink( bool bNext
);
445 // determine corresponding SwView
446 const SwView
& GetView() const { return m_rView
; }
447 SwView
& GetView() { return m_rView
; }
449 // Because nobody else is doing it, here is an ExecMacro()
450 void ExecMacro( const SvxMacro
& rMacro
, OUString
* pRet
= nullptr, SbxArray
* pArgs
= nullptr );
451 // call into the dark Basic/JavaScript
452 sal_uInt16
CallEvent( SvMacroItemId nEvent
, const SwCallMouseEvent
& rCallEvent
,
453 bool bCheckPtr
= false );
455 // a click at the given field. the cursor is on it.
456 // execute the predefined actions.
457 void ClickToField( const SwField
& rField
, bool bExecHyperlinks
);
458 void ClickToINetAttr( const SwFormatINetFormat
& rItem
, LoadUrlFlags nFilter
= LoadUrlFlags::NONE
);
459 bool ClickToINetGrf( const Point
& rDocPt
, LoadUrlFlags nFilter
);
460 inline bool IsInClickToEdit() const ;
462 // if a URL-Button is selected, return its URL; otherwise an empty string
463 bool GetURLFromButton( OUString
& rURL
, OUString
& rDescr
) const;
465 void NavigatorPaste(const NaviContentBookmark
& rBkmk
);
467 SW_DLLPUBLIC
virtual void ApplyViewOptions( const SwViewOption
&rOpt
) override
;
468 SW_DLLPUBLIC
virtual void SetReadonlyOption( bool bSet
) override
;
470 // automatic update of styles
471 void AutoUpdateFrame(SwFrameFormat
* pFormat
, const SfxItemSet
& rStyleSet
);
472 void AutoUpdatePara(SwTextFormatColl
* pColl
, const SfxItemSet
& rStyleSet
, SwPaM
* pPaM
= nullptr );
474 // starts dialog for inserting ranges via Drag&Drop/Clipboard
475 void StartInsertRegionDialog(const SwSectionData
&);
477 // ctor, the first one is a kind of a controlled copy ctor for more views of a document
478 SwWrtShell( SwWrtShell
&, vcl::Window
*pWin
, SwView
&rShell
);
479 SwWrtShell( SwDoc
& rDoc
, vcl::Window
*pWin
, SwView
&rShell
,
480 const SwViewOption
*pViewOpt
);
481 virtual ~SwWrtShell() override
;
483 bool TryRemoveIndent(); // #i23725#
485 OUString
GetSelDescr() const;
487 SwNavigationMgr
& GetNavigationMgr() { return m_aNavigationMgr
; }
489 void addCurrentPosition();
490 SW_DLLPUBLIC
bool GotoFly( const OUString
& rName
, FlyCntType eType
= FLYCNTTYPE_ALL
,
491 bool bSelFrame
= true );
492 bool GotoINetAttr( const SwTextINetFormat
& rAttr
);
493 void GotoOutline( SwOutlineNodes::size_type nIdx
);
494 bool GotoOutline( const OUString
& rName
);
495 bool GotoRegion( std::u16string_view rName
);
496 bool GotoRefMark( const OUString
& rRefMark
, sal_uInt16 nSubType
= 0,
497 sal_uInt16 nSeqNo
= 0, sal_uInt16 nFlags
= 0 );
498 SW_DLLPUBLIC
bool GotoNextTOXBase( const OUString
* pName
= nullptr);
499 SW_DLLPUBLIC
bool GotoTable( const OUString
& rName
);
500 void GotoFormatField( const SwFormatField
& rField
);
501 const SwRangeRedline
* GotoRedline( SwRedlineTable::size_type nArrPos
, bool bSelect
);
502 SW_DLLPUBLIC
bool GotoDrawingObject(std::u16string_view rName
);
503 void GotoFootnoteAnchor(const SwTextFootnote
& rTextFootnote
);
504 SW_DLLPUBLIC
void ChangeHeaderOrFooter(std::u16string_view rStyleName
, bool bHeader
, bool bOn
, bool bShowWarning
);
505 virtual void SetShowHeaderFooterSeparator( FrameControlType eControl
, bool bShow
) override
;
507 /// Inserts a new annotation/comment at the current cursor position / selection.
508 void InsertPostIt(SwFieldMgr
& rFieldMgr
, const SfxRequest
& rReq
);
510 bool IsOutlineContentVisible(const size_t nPos
);
511 void MakeOutlineContentVisible(const size_t nPos
, bool bMakeVisible
= true, bool bSetAttrOutlineVisibility
= true);
512 void MakeAllFoldedOutlineContentVisible(bool bMakeVisible
= true);
513 void InvalidateOutlineContentVisibility();
514 bool GetAttrOutlineContentVisible(const size_t nPos
) const;
516 void MakeOutlineLevelsVisible(const int nLevel
);
518 bool HasFoldedOutlineContentSelected() const;
519 virtual void InfoReadOnlyDialog(bool bAsync
) const override
;
520 virtual bool WarnHiddenSectionDialog() const override
;
521 virtual bool WarnSwitchToDesignModeDialog() const override
;
523 std::optional
<OString
> getLOKPayload(int nType
, int nViewId
) const;
528 void CloseMark( bool bOkFlag
);
537 ModeStack(ModeStack
*pNextMode
, bool _bIns
, bool _bExt
, bool _bAdd
, bool _bBlock
):
544 } *m_pModeStack
= nullptr;
546 // carry cursor along when PageUp / -Down
552 } m_ePageMove
= MV_NO
;
557 std::unique_ptr
<CursorStack
> pNext
;
558 bool bValidCurPos
: 1;
559 bool bIsFrameSel
: 1;
562 CursorStack( bool bValid
, bool bFrameSel
, const Point
&rDocPos
,
563 SwTwips lOff
, std::unique_ptr
<CursorStack
> pN
)
565 pNext(std::move(pN
)),
566 bValidCurPos( bValid
),
567 bIsFrameSel( bFrameSel
),
573 std::unique_ptr
<CursorStack
> m_pCursorStack
;
576 SwNavigationMgr m_aNavigationMgr
;
579 bool m_bDestOnStack
= false;
580 bool HasCursorStack() const { return nullptr != m_pCursorStack
; }
581 bool PushCursor(SwTwips lOffset
, bool bSelect
);
582 bool PopCursor(bool bUpdate
, bool bSelect
= false);
584 // take END cursor along when PageUp / -Down
590 bool NxtWrdForDelete();
591 bool PrvWrdForDelete();
594 SW_DLLPUBLIC
bool FwdPara_();
602 bool m_bBlockMode
:1;
603 bool m_bLayoutMode
:1;
606 bool m_bIsInClickToEdit
:1;
607 bool m_bClearMark
:1; // don't delete selection for ChartAutoPilot
608 bool m_bRetainSelection
:1; // Do not remove selections
611 Link
<SwWrtShell
&,void> m_aSelTableLink
;
613 // resets the cursor stack after movement by PageUp/-Down
614 void ResetCursorStack_();
616 using SwCursorShell::SetCursor
;
617 tools::Long
SetCursor(const Point
*, bool bProp
=false );
619 tools::Long
SetCursorKillSel(const Point
*, bool bProp
);
621 void BeginDrag(const Point
*, bool bProp
);
622 void DefaultDrag(const Point
*, bool bProp
);
623 void DefaultEndDrag(const Point
*, bool bProp
);
625 void ExtSelWrd(const Point
*, bool bProp
);
626 void ExtSelLn(const Point
*, bool bProp
);
628 void BeginFrameDrag(const Point
*, bool bProp
);
630 // after SSize/Move of a frame update; Point is destination.
631 void UpdateLayoutFrame(const Point
*, bool bProp
);
633 void SttLeaveSelect();
634 void AddLeaveSelect();
635 tools::Long
Ignore(const Point
*, bool bProp
);
637 void LeaveExtSel() { m_bSelWrd
= m_bSelLn
= false;}
639 bool GoStart(bool KeepArea
, bool *,
640 bool bSelect
, bool bDontMoveRegion
= false);
641 bool GoEnd(bool KeepArea
= false, const bool * = nullptr);
643 SAL_DLLPRIVATE
void ImplSetInsMode(bool bOn
);
652 bool MoveBookMark(BookMarkMove eFuncId
, const ::sw::mark::MarkBase
* const pMark
=nullptr);
655 inline void SwWrtShell::ResetCursorStack()
657 if ( HasCursorStack() )
661 inline void SwWrtShell::SelTableCells(const Link
<SwWrtShell
&,void> &rLink
)
663 SetSelTableCells( true );
665 m_aSelTableLink
= rLink
;
667 inline void SwWrtShell::EndSelTableCells()
669 SetSelTableCells( false );
673 inline bool SwWrtShell::IsInClickToEdit() const { return m_bIsInClickToEdit
; }
675 inline bool SwWrtShell::Is_FnDragEQBeginDrag() const
678 SELECTFUNC2 fnTmp
= &SwWrtShell::BeginDrag
;
679 return m_fnDrag
== fnTmp
;
681 return m_fnDrag
== &SwWrtShell::BeginDrag
;
685 class MakeAllOutlineContentTemporarilyVisible
688 SwWrtShell
* m_pWrtSh
= nullptr;
689 bool m_bDone
= false;
690 bool m_bScrollToCursor
= false;
692 static sal_uInt32 nLock
;
693 MakeAllOutlineContentTemporarilyVisible(SwDoc
* pDoc
, bool bScrollToCursor
= false)
698 if (SwDocShell
* pDocSh
= pDoc
->GetDocShell())
699 if ((m_pWrtSh
= pDocSh
->GetWrtShell()) && m_pWrtSh
->GetViewOptions() &&
700 m_pWrtSh
->GetViewOptions()->IsShowOutlineContentVisibilityButton())
702 m_pWrtSh
->LockView(true);
703 m_pWrtSh
->LockPaint(LockPaintReason::OutlineFolding
);
704 m_pWrtSh
->MakeAllFoldedOutlineContentVisible();
705 m_bScrollToCursor
= bScrollToCursor
;
710 ~MakeAllOutlineContentTemporarilyVisible() COVERITY_NOEXCEPT_FALSE
715 if (m_bDone
&& m_pWrtSh
)
717 m_pWrtSh
->MakeAllFoldedOutlineContentVisible(false);
718 m_pWrtSh
->UnlockPaint();
719 m_pWrtSh
->LockView(false);
720 if (m_bScrollToCursor
)
721 m_pWrtSh
->UpdateCursor(SwCursorShell::SCROLLWIN
);
726 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */