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);
513
514 void MakeOutlineLevelsVisible(const int nLevel);
515
516 bool HasFoldedOutlineContentSelected();
517 void InfoReadOnlyDialog(bool bAsync = false);
518
519 std::optional<OString> getLOKPayload(int nType, int nViewId) const;
520
521private:
522
523 SAL_DLLPRIVATE void OpenMark();
524 SAL_DLLPRIVATE void CloseMark( bool bOkFlag );
525
527 {
529 bool bAdd,
533 ModeStack(ModeStack *pNextMode, bool _bIns, bool _bExt, bool _bAdd, bool _bBlock):
534 pNext(pNextMode),
535 bAdd(_bAdd),
536 bBlock(_bBlock),
537 bExt(_bExt),
538 bIns(_bIns)
539 {}
540 } *m_pModeStack = nullptr;
541
542 // carry cursor along when PageUp / -Down
544 {
547 MV_PAGE_DOWN
548 } m_ePageMove = MV_NO;
549
551 {
553 std::unique_ptr<CursorStack> pNext;
554 bool bValidCurPos : 1;
555 bool bIsFrameSel : 1;
557
558 CursorStack( bool bValid, bool bFrameSel, const Point &rDocPos,
559 SwTwips lOff, std::unique_ptr<CursorStack> pN )
560 : aDocPos(rDocPos),
561 pNext(std::move(pN)),
562 bValidCurPos( bValid ),
563 bIsFrameSel( bFrameSel ),
564 lOffset(lOff)
565 {
566 }
567
568 };
569 std::unique_ptr<CursorStack> m_pCursorStack;
570
573
575 bool m_bDestOnStack = false;
576 bool HasCursorStack() const { return nullptr != m_pCursorStack; }
577 SAL_DLLPRIVATE bool PushCursor(SwTwips lOffset, bool bSelect);
578 SAL_DLLPRIVATE bool PopCursor(bool bUpdate, bool bSelect = false);
579
580 // take END cursor along when PageUp / -Down
581 SAL_DLLPRIVATE void SttWrd();
582 SAL_DLLPRIVATE void EndWrd();
583 SAL_DLLPRIVATE bool NxtWrd_();
584 SAL_DLLPRIVATE bool PrvWrd_();
585 // #i92468#
586 SAL_DLLPRIVATE bool NxtWrdForDelete();
587 SAL_DLLPRIVATE bool PrvWrdForDelete();
588 SAL_DLLPRIVATE bool FwdSentence_();
589 SAL_DLLPRIVATE bool BwdSentence_();
590 bool FwdPara_();
591 SAL_DLLPRIVATE bool BwdPara_();
592
593 // selections
594 bool m_bIns :1;
595 bool m_bInSelect :1;
596 bool m_bExtMode :1;
597 bool m_bAddMode :1;
600 bool m_bSelWrd :1;
601 bool m_bSelLn :1;
603 bool m_bClearMark :1; // don't delete selection for ChartAutoPilot
604 bool m_bRetainSelection :1; // Do not remove selections
605
608
609 // resets the cursor stack after movement by PageUp/-Down
610 SAL_DLLPRIVATE void ResetCursorStack_();
611
613 SAL_DLLPRIVATE tools::Long SetCursor(const Point *, bool bProp=false );
614
615 SAL_DLLPRIVATE tools::Long SetCursorKillSel(const Point *, bool bProp );
616
617 SAL_DLLPRIVATE void BeginDrag(const Point *, bool bProp );
618 SAL_DLLPRIVATE void DefaultDrag(const Point *, bool bProp );
619 SAL_DLLPRIVATE void DefaultEndDrag(const Point *, bool bProp );
620
621 SAL_DLLPRIVATE void ExtSelWrd(const Point *, bool bProp );
622 SAL_DLLPRIVATE void ExtSelLn(const Point *, bool bProp );
623
624 SAL_DLLPRIVATE void BeginFrameDrag(const Point *, bool bProp );
625
626 // after SSize/Move of a frame update; Point is destination.
627 SAL_DLLPRIVATE void UpdateLayoutFrame(const Point *, bool bProp );
628
629 SAL_DLLPRIVATE void SttLeaveSelect();
630 SAL_DLLPRIVATE void AddLeaveSelect();
631 SAL_DLLPRIVATE tools::Long Ignore(const Point *, bool bProp );
632
633 SAL_DLLPRIVATE void LeaveExtSel() { m_bSelWrd = m_bSelLn = false;}
634
635 SAL_DLLPRIVATE bool GoStart(bool KeepArea, bool *,
636 bool bSelect, bool bDontMoveRegion = false);
637 SAL_DLLPRIVATE bool GoEnd(bool KeepArea = false, const bool * = nullptr);
638
640 {
643 BOOKMARK_PREV
644 };
645
646 SAL_DLLPRIVATE bool MoveBookMark(BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark=nullptr);
647};
648
650{
651 if ( HasCursorStack() )
653}
654
656{
657 SetSelTableCells( true );
658 m_bClearMark = true;
659 m_aSelTableLink = rLink;
660}
662{
663 SetSelTableCells( false );
664 m_bClearMark = true;
665}
666
667inline bool SwWrtShell::IsInClickToEdit() const { return m_bIsInClickToEdit; }
668
670{
671#ifdef __GNUC__
673 return m_fnDrag == fnTmp;
674#else
676#endif
677}
678
680{
681private:
683 bool m_bDone = false;
684 bool m_bScrollToCursor = false;
685public:
686 static sal_uInt32 nLock;
687 MakeAllOutlineContentTemporarilyVisible(SwDoc* pDoc, bool bScrollToCursor = false)
688 {
689 ++nLock;
690 if (nLock > 1)
691 return;
692 if (SwDocShell* pDocSh = pDoc->GetDocShell())
693 if ((m_pWrtSh = pDocSh->GetWrtShell()) && m_pWrtSh->GetViewOptions() &&
695 {
696 m_pWrtSh->LockView(true);
699 m_bScrollToCursor = bScrollToCursor;
700 m_bDone = true;
701 }
702 }
703
705 {
706 --nLock;
707 if (nLock > 0)
708 return;
709 if (m_bDone && m_pWrtSh)
710 {
713 m_pWrtSh->LockView(false);
716 }
717 }
718};
719
720/* 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:687
~MakeAllOutlineContentTemporarilyVisible() COVERITY_NOEXCEPT_FALSE
Definition: wrtsh.hxx:704
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:1576
bool GotoRefMark(const OUString &rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo)
jump to reference marker
Definition: crstrvl.cxx:1270
bool LeftMargin()
Definition: crsrsh.hxx:367
int SetCursor(const Point &rPt, bool bOnlyText=false, bool bBlock=true)
Definition: crsrsh.cxx:761
bool HasSelection() const
Does the current cursor create a selection?
Definition: crsrsh.cxx:2535
bool IsMultiSelection() const
Definition: crsrsh.hxx:904
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:1114
bool RightMargin(bool bAPI=false)
Definition: crsrsh.hxx:368
bool GotoPage(sal_uInt16 nPage)
Definition: crsrsh.cxx:1188
bool GoPrevBookmark()
Definition: crbm.cxx:236
void SetSelTableCells(bool bFlag)
Definition: crsrsh.hxx:822
bool IsSttPara() const
Definition: crsrsh.cxx:1095
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:2097
bool GotoNextTOXBase(const OUString *=nullptr)
jump to the next index
Definition: crstrvl.cxx:263
bool Right(sal_uInt16 nCnt, SwCursorSkipMode nMode, bool bAllowVisual=false)
Definition: crsrsh.hxx:363
const SwRangeRedline * GotoRedline(SwRedlineTable::size_type nArrPos, bool bSelect)
Definition: crstrvl.cxx:2440
bool Down(sal_uInt16 nCnt=1)
Definition: crsrsh.hxx:366
bool GotoOutline(const OUString &rName)
Definition: crstrvl.cxx:1039
@ SCROLLWIN
scroll window
Definition: crsrsh.hxx:162
bool Left(sal_uInt16 nCnt, SwCursorSkipMode nMode, bool bAllowVisual=false)
Definition: crsrsh.hxx:361
bool GotoRegion(std::u16string_view rName)
Definition: trvlreg.cxx:270
bool GoNextBookmark()
Definition: crbm.cxx:203
bool GotoFormatField(const SwFormatField &rField)
Definition: crstrvl.cxx:867
bool GotoINetAttr(const SwTextINetFormat &rAttr)
Definition: crstrvl.cxx:2124
bool Up(sal_uInt16 nCnt=1)
Definition: crsrsh.hxx:365
Definition: doc.hxx:195
SwDocShell * GetDocShell()
Definition: doc.hxx:1362
void SplitNode(bool bAutoFormat=false, bool bCheckTableStart=true)
Definition: editsh.cxx:182
void ChgDBData(const SwDBData &SwDBData)
Definition: edfld.cxx:296
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
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:2613
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:1245
void BeginDrag(const Point *pPt, bool bProp)
Definition: feshview.cxx:719
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:293
SfxPoolItem subclass that wraps an SwContentControl.
Style of a layout element.
Definition: frmfmt.hxx:62
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
vector_type::size_type size_type
Definition: docary.hxx:222
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Definition: txatbase.hxx:44
Represents the style of a paragraph.
Definition: fmtcol.hxx:61
bool IsShowOutlineContentVisibilityButton() const
Definition: viewopt.cxx:100
virtual void DrawSelChanged()
Definition: viewsh.cxx:2183
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:433
void UnlockPaint(bool bVirDev=false)
Definition: viewsh.hxx:619
void LockPaint()
Definition: viewsh.hxx:614
virtual void SetReadonlyOption(bool bSet)
Definition: viewsh.cxx:2466
void LockView(bool b)
Definition: viewsh.hxx:472
virtual void SetShowHeaderFooterSeparator(FrameControlType eControl, bool bShow)
Definition: viewsh.cxx:99
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:655
bool m_bBlockMode
Definition: wrtsh.hxx:598
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:808
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:600
void BwdPara()
Definition: wrtsh.hxx:236
@ BOOKMARK_INDEX
Definition: wrtsh.hxx:641
@ BOOKMARK_NEXT
Definition: wrtsh.hxx:642
void EndSelTableCells()
Definition: wrtsh.hxx:661
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:569
SELECTFUNC2 m_fnDrag
Definition: wrtsh.hxx:114
bool FwdPara_()
Definition: wrtsh4.cxx:210
Point m_aStart
Definition: wrtsh.hxx:606
void FwdSentence(bool bSelect=false)
Definition: wrtsh.hxx:238
SAL_DLLPRIVATE void LeaveExtSel()
Definition: wrtsh.hxx:633
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:304
SwView & GetView()
Definition: wrtsh.hxx:444
void(SwWrtShell::* SELECTFUNC2)(const Point *, bool bProp)
Definition: wrtsh.hxx:112
bool Is_FnDragEQBeginDrag() const
Definition: wrtsh.hxx:669
void ResetCursorStack()
Definition: wrtsh.hxx:649
tools::Long CallSetCursor(const Point *pPt, bool bProp)
Definition: wrtsh.hxx:123
SAL_DLLPRIVATE void BeginDrag(const Point *, bool bProp)
Definition: select.cxx:778
bool m_bIsInClickToEdit
Definition: wrtsh.hxx:602
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:596
@ GETSTYLE_CREATESOME
Definition: wrtsh.hxx:362
Link< SwWrtShell &, void > m_aSelTableLink
Definition: wrtsh.hxx:607
bool m_bAddMode
Definition: wrtsh.hxx:597
bool IsBlockMode() const
Definition: wrtsh.hxx:168
SAL_DLLPRIVATE tools::Long Ignore(const Point *, bool bProp)
Definition: select.cxx:379
void MakeAllFoldedOutlineContentVisible(bool bMakeVisible=true)
Definition: wrtsh1.cxx:2564
bool IsInSelect() const
Definition: wrtsh.hxx:144
bool HasCursorStack() const
Definition: wrtsh.hxx:576
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:601
SwView & m_rView
Definition: wrtsh.hxx:571
SwNavigationMgr m_aNavigationMgr
Definition: wrtsh.hxx:572
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:574
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:594
bool m_bClearMark
Definition: wrtsh.hxx:603
SAL_DLLPRIVATE void ResetCursorStack_()
Definition: move.cxx:533
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:599
bool IsInClickToEdit() const
Definition: wrtsh.hxx:667
bool m_bRetainSelection
Definition: wrtsh.hxx:604
@ MV_PAGE_UP
Definition: wrtsh.hxx:546
bool IsExtMode() const
Definition: wrtsh.hxx:158
bool m_bInSelect
Definition: wrtsh.hxx:595
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:132
#define CNT_TXT
Definition: editsh.hxx:130
#define CNT_GRF
Definition: editsh.hxx:131
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:553
CursorStack(bool bValid, bool bFrameSel, const Point &rDocPos, SwTwips lOff, std::unique_ptr< CursorStack > pN)
Definition: wrtsh.hxx:558
ModeStack(ModeStack *pNextMode, bool _bIns, bool _bExt, bool _bAdd, bool _bBlock)
Definition: wrtsh.hxx:533
ModeStack * pNext
Definition: wrtsh.hxx:528
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