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