LibreOffice Module sw (master) 1
select.cxx
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#include <limits.h>
21#include <hintids.hxx>
22#include <sfx2/bindings.hxx>
23#include <sfx2/viewfrm.hxx>
24#include <svl/eitem.hxx>
25#include <svl/macitem.hxx>
27#include <sfx2/event.hxx>
28#include <osl/diagnose.h>
29#include <cmdid.h>
30#include <view.hxx>
31#include <basesh.hxx>
32#include <wrtsh.hxx>
33#include <frmatr.hxx>
34#include <mdiexp.hxx>
35#include <fmtcol.hxx>
36#include <frmfmt.hxx>
37#include <swdtflvr.hxx>
38#include <doc.hxx>
39#include <wordcountdialog.hxx>
40#include <memory>
41#include <vcl/uitest/logger.hxx>
43
44namespace com::sun::star::util {
45 struct SearchOptions2;
46}
47
48using namespace ::com::sun::star::util;
49
51static bool bStartDrag = false;
52
54{
55 // to avoid making the slot volatile, invalidate it every time if something could have been changed
56 // this is still much cheaper than asking for the state every 200 ms (and avoid background processing)
58 GetView().GetViewFrame().GetBindings().Update(FN_STAT_SELMODE); // make selection mode control icon update immediately
59 SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(GetView().GetViewFrame().GetChildWindow(SwWordCountWrapper::GetChildWindowId()));
60 if (pWrdCnt)
61 pWrdCnt->UpdateCounts();
62}
63
65{
66 SwMvContext aMvContext(this);
67 if( !IsInWord() && !IsEndWrd() && !IsStartWord() )
68 PrvWrd();
69 if( IsEndWrd() )
70 Left(SwCursorSkipMode::Cells, false, 1, false );
71 return SelWrd();
72}
73
74bool SwWrtShell::SelWrd(const Point *pPt )
75{
76 bool bRet;
77 {
78 SwMvContext aMvContext(this);
79 SttSelect();
80 bRet = SwCursorShell::SelectWord( pPt );
81 }
82 EndSelect();
83 if( bRet )
84 {
85 m_bSelWrd = true;
86 if(pPt)
87 m_aStart = *pPt;
88 }
89 return bRet;
90}
91
93{
94 {
95 SwMvContext aMvContext(this);
96 ClearMark();
98 SttSelect();
100 }
101 EndSelect();
102 if(pPt)
103 m_aStart = *pPt;
104 m_bSelLn = true;
105 m_bSelWrd = false; // disable SelWord, otherwise no SelLine goes on
106}
107
108void SwWrtShell::SelPara(const Point *pPt )
109{
110 {
111 SwMvContext aMvContext(this);
112 ClearMark();
114 SttSelect();
116 }
117 EndSelect();
118 if(pPt)
119 m_aStart = *pPt;
120 m_bSelLn = false;
121 m_bSelWrd = false; // disable SelWord, otherwise no SelLine goes on
122}
123
125{
126 const bool bLockedView = IsViewLocked();
127 LockView( true );
128 {
129 if(m_bBlockMode)
131 SwMvContext aMvContext(this);
132 bool bMoveTable = false;
133 std::optional<SwPosition> oStartPos;
134 std::optional<SwPosition> oEndPos;
135 SwShellCursor* pTmpCursor = nullptr;
136
137 // Query these early, before we move the cursor.
138 bool bHasWholeTabSelection = HasWholeTabSelection();
139 bool bIsCursorInTable = IsCursorInTable();
140
141 if (!bHasWholeTabSelection
142 && ( !bIsCursorInTable
143 || getShellCursor(false)->GetMarkNode().FindTableNode() == nullptr
144 || !ExtendedSelectedAll())) // ESA inside table -> else branch
145 {
146 if ( IsSelection() && IsCursorPtAtEnd() )
147 SwapPam();
148 pTmpCursor = getShellCursor( false );
149 if( pTmpCursor )
150 {
151 oStartPos.emplace( *pTmpCursor->GetPoint() );
152 oEndPos.emplace( *pTmpCursor->GetMark() );
153 }
154 Push();
155 bool bIsFullSel = !MoveSection( GoCurrSection, fnSectionStart);
156 SwapPam();
157 bIsFullSel &= !MoveSection( GoCurrSection, fnSectionEnd);
159 GoStart(true, &bMoveTable, false, !bIsFullSel);
160 SttSelect();
161 GoEnd(true, &bMoveTable);
162 }
163 else
164 {
165 if (MoveOutOfTable())
166 { // select outer text
167 EnterStdMode(); // delete m_pTableCursor
168// GoStart(true, &bMoveTable, false, true);
169 MoveSection(GoCurrSection, fnSectionStart); // don't move into prev table
170 SttSelect();
171 MoveSection(GoCurrSection, fnSectionEnd); // don't move to different cell
172 }
173 else
174 {
176 }
177 }
178
179 bool bNeedsExtendedSelectAll = StartsWith_() != StartsWith::None;
180
181 // the GoEnd() could have created a table selection, if so avoid ESA.
182 if (bNeedsExtendedSelectAll && bIsCursorInTable)
183 {
184 bNeedsExtendedSelectAll = !HasWholeTabSelection();
185 }
186
187 if (bNeedsExtendedSelectAll)
188 {
189 ExtendedSelectAll(/*bFootnotes =*/ false);
190 }
191
192 SwDoc *pDoc = GetDoc();
193 if ( pDoc )
194 {
195 pDoc->SetPrepareSelAll();
196 }
197
198 if( oStartPos )
199 {
200 pTmpCursor = getShellCursor( false );
201 if( pTmpCursor )
202 {
203 // Some special handling for sections (e.g. TOC) at the beginning of the document body
204 // to avoid the selection of the first section
205 // if the last selection was behind the first section or
206 // if the last selection was already the first section
207 // In this both cases we select to the end of document
208 if( ( *pTmpCursor->GetPoint() < *oEndPos ||
209 ( *oStartPos == *pTmpCursor->GetMark() &&
210 *oEndPos == *pTmpCursor->GetPoint() ) ) && !bNeedsExtendedSelectAll)
212 }
213 }
214 }
215 EndSelect();
216 LockView( bLockedView );
217}
218
219// Description: Text search
220
221sal_Int32 SwWrtShell::SearchPattern( const i18nutil::SearchOptions2& rSearchOpt, bool bSearchInNotes,
223 FindRanges eFlags, bool bReplace )
224{
225 // no enhancement of existing selections
226 if(!(eFlags & FindRanges::InSel))
227 ClearMark();
228 bool bCancel = false;
229 sal_Int32 nRet = Find_Text(rSearchOpt, bSearchInNotes, eStt, eEnd, bCancel, eFlags, bReplace);
230 if(bCancel)
231 {
232 Undo();
233 nRet = SAL_MAX_INT32;
234 }
235 return nRet;
236}
237
238// Description: search for templates
239
240sal_Int32 SwWrtShell::SearchTempl( const OUString &rTempl,
242 FindRanges eFlags, const OUString* pReplTempl )
243{
244 // no enhancement of existing selections
245 if(!(eFlags & FindRanges::InSel))
246 ClearMark();
248 SwTextFormatColl *pReplaceColl = nullptr;
249 if( pReplTempl )
250 pReplaceColl = GetParaStyle(*pReplTempl, SwWrtShell::GETSTYLE_CREATESOME );
251
252 bool bCancel = false;
253 sal_Int32 nRet = FindFormat(pColl ? *pColl : GetDfltTextFormatColl(),
254 eStt,eEnd, bCancel, eFlags, pReplaceColl);
255 if(bCancel)
256 {
257 Undo();
258 nRet = SAL_MAX_INT32;
259 }
260 return nRet;
261}
262
263// search for attributes
264
265sal_Int32 SwWrtShell::SearchAttr( const SfxItemSet& rFindSet, bool bNoColls,
266 SwDocPositions eStart, SwDocPositions eEnd,
267 FindRanges eFlags, const i18nutil::SearchOptions2* pSearchOpt,
268 const SfxItemSet* pReplaceSet )
269{
270 // no enhancement of existing selections
271 if (!(eFlags & FindRanges::InSel))
272 ClearMark();
273
274 // Searching
275 bool bCancel = false;
276 sal_Int32 nRet = FindAttrs(rFindSet, bNoColls, eStart, eEnd, bCancel, eFlags, pSearchOpt, pReplaceSet);
277
278 if(bCancel)
279 {
280 Undo();
281 nRet = SAL_MAX_INT32;
282 }
283 return nRet;
284}
285
286// Selection modes
287
289{
291}
292
294{
295 if ( nullptr == m_pModeStack )
296 return;
297
298 if ( m_bExtMode && !m_pModeStack->bExt )
299 LeaveExtMode();
300 if ( m_bAddMode && !m_pModeStack->bAdd )
301 LeaveAddMode();
305
306 m_pModeStack = std::move(m_pModeStack->pNext);
307}
308
309// Two methods for setting cursors: the first maps at the
310// eponymous methods in the CursorShell, the second removes
311// all selections at first.
312
313tools::Long SwWrtShell::SetCursor(const Point *pPt, bool bTextOnly)
314{
315 // Remove a possibly present selection at the position
316 // of the mouseclick
317
318 if(!IsInSelect() && TestCurrPam(*pPt)) {
319 ClearMark();
320 }
321
322 return SwCursorShell::SetCursor(*pPt, bTextOnly);
323}
324
326{
327 SwActContext aActContext(this);
328 ResetSelect(pPt,false);
329 return SwCursorShell::SetCursor(*pPt, bTextOnly);
330}
331
333{
334 // Remove Frame selection with guaranteed invalid position
335 Point aPt(LONG_MIN, LONG_MIN);
336 SelectObj(aPt);
338}
339
340// Remove of all selections
341
343{
344 if(IsSelFrameMode())
345 {
348 }
349 else
350 {
351 // SwActContext opens an Action -
352 // to avoid problems in the basic process with the
353 // shell switching, GetChgLnk().Call() may be called
354 // after EndAction().
355 {
356 SwActContext aActContext(this);
357 m_bSelWrd = m_bSelLn = false;
358 KillPams();
359 ClearMark();
362 }
363
364 // After canceling of all selections an update of Attr-Controls
365 // could be necessary.
366 GetChgLnk().Call(nullptr);
367
370 }
371 Invalidate();
373 return 1;
374}
375
377{
379}
380
382{
384}
385
386// Do nothing
387
389 return 1;
390}
391
392// Begin of a selection process.
393
395{
396 if(m_bInSelect)
397 return;
398 if(!HasMark())
399 SetMark();
400 if( m_bBlockMode )
401 {
402 SwShellCursor* pTmp = getShellCursor( true );
403 if( !pTmp->HasMark() )
404 pTmp->SetMark();
405 }
408 m_bInSelect = true;
409 Invalidate();
411}
412
413namespace {
414
415void collectUIInformation(SwShellCursor* pCursor)
416{
417 EventDescription aDescription;
418 OUString aSelStart = OUString::number(pCursor->Start()->GetContentIndex());
419 OUString aSelEnd = OUString::number(pCursor->End()->GetContentIndex());
420
421 aDescription.aParameters = {{"START_POS", aSelStart}, {"END_POS", aSelEnd}};
422 aDescription.aAction = "SELECT";
423 aDescription.aID = "writer_edit";
424 aDescription.aKeyWord = "SwEditWinUIObject";
425 aDescription.aParent = "MainWindow";
426
427 UITestLogger::getInstance().logEvent(aDescription);
428}
429
430}
431
432// End of a selection process.
433
435{
436 if(m_bInSelect && !m_bExtMode)
437 {
438 m_bInSelect = false;
439 if (m_bAddMode)
440 {
442 }
443 else
444 {
448 }
449 }
450 SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(GetView().GetViewFrame().GetChildWindow(SwWordCountWrapper::GetChildWindowId()));
451 if (pWrdCnt)
452 pWrdCnt->UpdateCounts();
453
454 collectUIInformation(GetCursor_());
455}
456
457void SwWrtShell::ExtSelWrd(const Point *pPt, bool )
458{
459 SwMvContext aMvContext(this);
460 if( IsTableMode() )
461 return;
462
463 // Bug 66823: actual crsr has in additional mode no selection?
464 // Then destroy the actual and go to prev, this will be expand
465 if( !HasMark() && GoPrevCursor() )
466 {
467 bool bHasMark = HasMark(); // that's wrong!
468 GoNextCursor();
469 if( bHasMark )
470 {
472 GoPrevCursor();
473 }
474 }
475
476 // check the direction of the selection with the new point
477 bool bMoveCursor = true, bToTop = false;
478 SwCursorShell::SelectWord( &m_aStart ); // select the startword
479 SwCursorShell::Push(); // save the cursor
480 SwCursorShell::SetCursor( *pPt ); // and check the direction
481
483 {
484 case -1: bToTop = false; break;
485 case 1: bToTop = true; break;
486 default: bMoveCursor = false; break;
487 }
488
490
491 if( !bMoveCursor )
492 return;
493
494 // select to Top but cursor select to Bottom? or
495 // select to Bottom but cursor select to Top? --> swap the cursor
496 if( bToTop )
497 SwapPam();
498
499 SwCursorShell::Push(); // save cur cursor
500 if( SwCursorShell::SelectWord( pPt )) // select the current word
501 {
502 if( bToTop )
503 SwapPam();
504 Combine();
505 }
506 else
507 {
509 if( bToTop )
510 SwapPam();
511 }
512}
513
514void SwWrtShell::ExtSelLn(const Point *pPt, bool )
515{
516 SwMvContext aMvContext(this);
518 if( IsTableMode() )
519 return;
520
521 // Bug 66823: actual crsr has in additional mode no selection?
522 // Then destroy the actual and go to prev, this will be expand
523 if( !HasMark() && GoPrevCursor() )
524 {
525 bool bHasMark = HasMark(); // that's wrong!
526 GoNextCursor();
527 if( bHasMark )
528 {
530 GoPrevCursor();
531 }
532 }
533
534 // if applicable fit the selection to the "Mark"
535 bool bToTop = !IsCursorPtAtEnd();
536 SwapPam();
537
538 // The "Mark" has to be at the end or the beginning of the line.
539 if( bToTop ? !IsEndSentence() : !IsStartSentence() )
540 {
541 if( bToTop )
542 {
543 if( !IsEndPara() )
546 }
547 else
549 }
550 SwapPam();
551
552 if (bToTop)
554 else
556}
557
558// Back into the standard mode: no mode, no selections.
559
561{
562 if(m_bAddMode)
563 LeaveAddMode();
564 if(m_bBlockMode)
566 m_bBlockMode = false;
567 m_bExtMode = false;
568 m_bInSelect = false;
569 if(IsSelFrameMode())
570 {
573 }
574 else
575 {
576 // SwActContext opens and action which has to be
577 // closed prior to the call of
578 // GetChgLnk().Call()
579 SwActContext aActContext(this);
580 m_bSelWrd = m_bSelLn = false;
581 if( !IsRetainSelection() )
582 KillPams();
583 ClearMark();
586 }
587 Invalidate();
589}
590
591// Extended Mode
592
594{
595 if(m_bBlockMode)
596 {
598 KillPams();
599 ClearMark();
600 }
601 m_bExtMode = true;
602 m_bAddMode = false;
603 m_bBlockMode = false;
604 SttSelect();
605}
606
608{
609 m_bExtMode = false;
610 EndSelect();
611}
612
613// End of a selection; if the selection is empty,
614// ClearMark().
615
617{
619 return;
620 }
621 ClearMark();
622}
623
624// Leaving of the selection mode in additional mode
625
627{
630 CreateCursor();
631}
632
633// Additional Mode
634
636{
637 if(IsTableMode()) return;
638 if(m_bBlockMode)
642 m_bAddMode = true;
643 m_bBlockMode = false;
644 m_bExtMode = false;
646 CreateCursor();
647 Invalidate();
648}
649
651{
654 m_bAddMode = false;
655 Invalidate();
656}
657
658// Block Mode
659
661{
662 m_bBlockMode = false;
663 EnterStdMode();
664 m_bBlockMode = true;
666 Invalidate();
667}
668
670{
671 m_bBlockMode = false;
673 EndSelect();
674 Invalidate();
675}
676
677// Insert mode
678
680{
681 m_bIns = bOn;
683 const SfxBoolItem aTmp( SID_ATTR_INSERT, m_bIns );
685 StartAction();
686 EndAction();
687 Invalidate();
688}
689//Overwrite mode is incompatible with red-lining
691{
693 if (IsRedlineOn())
694 SetInsMode();
695}
696
697// Edit frame
698
699void SwWrtShell::BeginFrameDrag(const Point *pPt, bool bIsShift)
700{
702 if(bStartDrag)
703 {
705 SwFEShell::BeginDrag( &aTmp, bIsShift );
706 }
707 else
708 SwFEShell::BeginDrag( pPt, bIsShift );
709}
710
712{
713 if(pPos)
714 {
715 nStartDragX = pPos->X();
716 nStartDragY = pPos->Y();
717 bStartDrag = true;
718 }
719 m_bLayoutMode = true;
720 HideCursor();
721
722 // equal call of BeginDrag in the SwFEShell
726 Invalidate();
727}
728
730{
733 m_bLayoutMode = false;
734 bStartDrag = false;
735 Edit();
737 Invalidate();
738}
739
740// Description: execute framebound macro
741
742IMPL_LINK( SwWrtShell, ExecFlyMac, const SwFlyFrameFormat*, pFlyFormat, void )
743{
744 const SwFrameFormat *pFormat = pFlyFormat ? static_cast<const SwFrameFormat*>(pFlyFormat) : GetFlyFrameFormat();
745 OSL_ENSURE(pFormat, "no frame format");
746 const SvxMacroItem &rFormatMac = pFormat->GetMacro();
747
748 if(rFormatMac.HasMacro(SvMacroItemId::SwObjectSelect))
749 {
750 const SvxMacro &rMac = rFormatMac.GetMacro(SvMacroItemId::SwObjectSelect);
751 if( IsFrameSelected() )
752 m_bLayoutMode = true;
753 CallChgLnk();
754 ExecMacro( rMac );
755 }
756}
757
759{
760 // still a dummy
763}
764
765// Handler for toggling the modes. Returns back the old mode.
766
768{
770 Invalidate();
771}
772
774{
776 Invalidate();
777}
778
780{
782 Invalidate();
783}
784
785// Dragging in standard mode (Selecting of content)
786
787void SwWrtShell::BeginDrag(const Point * /*pPt*/, bool )
788{
789 if(m_bSelWrd)
790 {
791 m_bInSelect = true;
792 if( !IsCursorPtAtEnd() )
793 SwapPam();
794
797 }
798 else if(m_bSelLn)
799 {
800 m_bInSelect = true;
803 }
804 else
805 {
807 SttSelect();
808 }
809}
810
811void SwWrtShell::DefaultDrag(const Point *, bool )
812{
813 if( IsSelTableCells() )
814 m_aSelTableLink.Call(*this);
815}
816
817void SwWrtShell::DefaultEndDrag(const Point * /*pPt*/, bool )
818{
820 if( IsExtSel() )
821 LeaveExtSel();
822
823 if( IsSelTableCells() )
824 m_aSelTableLink.Call(*this);
825 EndSelect();
826}
827
828// #i32329# Enhanced table selection
829bool SwWrtShell::SelectTableRowCol( const Point& rPt, const Point* pEnd, bool bRowDrag )
830{
831 SwMvContext aMvContext(this);
832 SttSelect();
833 if(SelTableRowCol( rPt, pEnd, bRowDrag ))
834 {
837 return true;
838 }
839 return false;
840}
841
842// Description: Selection of a table line or column
843
845{
846 if ( SelTableRow() )
847 {
850 }
851}
852
854{
855 if ( SelTableCol() )
856 {
859 }
860}
861
863{
864 if ( SelTableBox() )
865 {
868 }
869}
870
871// Description: Check if a word selection is present.
872// According to the rules for intelligent cut / paste
873// surrounding spaces are cut out.
874// Return: Delivers the type of the word selection.
875
877{
878 // On multiple selection no intelligent drag and drop
879 // there are multiple cursors, since a second was placed
880 // already at the target position.
881 if( IsAddMode() || !(nSelection & SelectionType::Text) )
882 return NO_WORD;
883
884 OUString sText;
885 CharClass& rCC = GetAppCharClass();
886
887 // If the first character is no word character,
888 // no word selected.
889 sal_Unicode cPrev = GetChar(false);
890 sal_Unicode cNext = GetChar(true, -1);
891 if( !cPrev || !cNext ||
892 !rCC.isLetterNumeric( ( sText = OUString(cPrev) ), 0 ) ||
893 !rCC.isLetterNumeric( ( sText = OUString(cNext) ), 0 ) )
894 return NO_WORD;
895
896 cPrev = GetChar(false, -1);
897 cNext = GetChar();
898
899 int cWord = NO_WORD;
900 // is a word selected?
901 if (cPrev && cNext &&
902 CH_TXTATR_BREAKWORD != cPrev && CH_TXTATR_INWORD != cPrev &&
903 CH_TXTATR_BREAKWORD != cNext && CH_TXTATR_INWORD != cNext &&
904 !rCC.isLetterNumeric( ( sText = OUString(cPrev) ), 0 ) &&
905 !rCC.isLetterNumeric( ( sText = OUString(cNext) ), 0 ) )
906 cWord = WORD_NO_SPACE;
907
908 if(cWord == WORD_NO_SPACE && ' ' == cPrev )
909 {
910 cWord = WORD_SPACE_BEFORE;
911 // delete the space before
912 if(bCut)
913 {
914 Push();
915 if(IsCursorPtAtEnd())
916 SwapPam();
917 ClearMark();
918 SetMark();
920 SwFEShell::Delete(true);
922 }
923 }
924 else if(cWord == WORD_NO_SPACE && cNext == ' ')
925 {
926 cWord = WORD_SPACE_AFTER;
927 // delete the space behind
928 if(bCut) {
929 Push();
930 if(!IsCursorPtAtEnd()) SwapPam();
931 ClearMark();
932 SetMark();
934 SwFEShell::Delete(true);
936 }
937 }
938 return cWord;
939}
940
941 // jump to the next / previous hyperlink - inside text and also
942 // on graphics
944{
945 StartAction();
946 bool bRet = SwCursorShell::SelectNxtPrvHyperlink( bNext );
947 if( !bRet ) // didn't find? wrap and check again
948 {
949 SwShellCursor* pCursor = GetCursor_();
950 SwCursorSaveState aSaveState(*pCursor);
951 EnterStdMode();
952 if( bNext )
953 SttEndDoc(true);
954 else
955 SttEndDoc(false);
957 if (!bRet) // didn't find again? restore cursor position and bail
958 {
959 pCursor->RestoreSavePos();
960 EndAction(true); // don't scroll to restored cursor position
961 return;
962 }
963 }
964 EndAction();
965
966 bool bCreateXSelection = false;
967 const bool bFrameSelected = IsFrameSelected() || IsObjSelected();
968 if( IsSelection() )
969 {
970 if ( bFrameSelected )
972
973 // Set the function pointer for the canceling of the selection
974 // set at cursor
977 bCreateXSelection = true;
978 }
979 else if( bFrameSelected )
980 {
982 bCreateXSelection = true;
983 }
984 else if( (CNT_GRF | CNT_OLE ) & GetCntType() )
985 {
988 bCreateXSelection = true;
989 }
990
991 if( bCreateXSelection )
993}
994
995// For the preservation of the selection the cursor will be moved left
996// after SetMark(), so that the cursor is not moved by inserting text.
997// Because a present selection at the CORE page is cleared at the
998// current cursor position, the cursor will be pushed on the stack.
999// After moving, they will again resummarized.
1000
1001/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
constexpr tools::Long Y() const
constexpr tools::Long X() const
void SetState(const SfxItemSet &rSet)
void Update(sal_uInt16 nId)
void Invalidate(sal_uInt16 nId)
SfxBindings & GetBindings()
SfxChildWindow * GetChildWindow(sal_uInt16)
SfxViewFrame & GetViewFrame() const
const SvxMacro & GetMacro(SvMacroItemId nEvent) const
bool HasMacro(SvMacroItemId nEvent) const
Class for automated call of Start- and EndAction().
Definition: editsh.hxx:1040
static void SetFrameMode(FlyMode eMode, SwWrtShell *pShell)
Definition: basesh.cxx:2307
A helper class to save cursor state (position).
Definition: swcrsr.hxx:233
void ExtendedSelectAll(bool bFootnotes=true)
Definition: crsrsh.cxx:748
bool Pop(PopMode, ::std::optional< SwCallLink > &roLink)
bool GoEndSentence()
Definition: crstrvl1.cxx:73
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2550
void SetOverwriteCursor(bool bFlag)
Definition: crsrsh.hxx:476
void StartAction()
Definition: crsrsh.cxx:226
const SwTableNode * IsCursorInTable() const
Check if Point of current cursor is placed within a table.
Definition: crsrsh.cxx:600
bool TrySelectOuterTable()
Definition: crsrsh.cxx:666
bool GoPrevCursor()
go to the previous SSelection
Definition: crsrsh.cxx:1676
bool IsStartSentence() const
Definition: crstrvl1.cxx:41
void BlockCursorToCursor()
Definition: crsrsh.cxx:1189
bool SelectNxtPrvHyperlink(bool bNext)
Definition: crstrvl.cxx:2713
SwShellCursor * GetCursor_()
Definition: crsrsh.hxx:343
void SwapPam()
Definition: crsrsh.cxx:1262
const SwRect & GetCharRect() const
Definition: crsrsh.hxx:536
const Link< LinkParamNone *, void > & GetChgLnk() const
Definition: crsrsh.hxx:504
bool SelTableBox()
Definition: trvltbl.cxx:286
StartsWith StartsWith_()
If document body starts with a table or starts/ends with hidden paragraph.
Definition: crsrsh.cxx:895
bool IsInWord(sal_Int16 nWordType=css::i18n::WordType::ANYWORD_IGNOREWHITESPACES) const
Definition: crstrvl1.cxx:36
void HideCursor()
Definition: crsrsh.cxx:2731
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 SttEndDoc(bool bStt)
Definition: crsrsh.cxx:579
bool MovePara(SwWhichPara, SwMoveFnCollection const &)
Definition: crsrsh.cxx:982
bool IsEndPara() const
Definition: crsrsh.cxx:1400
int CompareCursorStackMkCurrPt() const
Definition: crsrsh.cxx:1340
bool IsSelTableCells() const
Definition: crsrsh.hxx:834
bool MoveOutOfTable()
Definition: crsrsh.cxx:627
bool GoNextCursor()
go to the next SSelection
Definition: crsrsh.cxx:1657
bool IsSelection() const
Definition: crsrsh.hxx:910
void CursorToBlockCursor()
leave block mode, change block cursor into normal cursor
Definition: crsrsh.cxx:1206
void Combine()
Combine two cursors.
Definition: crsrsh.cxx:2647
SwPaM * CreateCursor()
delete the current cursor and make the following into the current
Definition: crsrsh.cxx:123
bool HasMark() const
Definition: crsrsh.hxx:908
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
sal_Int32 FindFormat(const SwTextFormatColl &rFormatColl, SwDocPositions eStart, SwDocPositions eEnd, bool &bCancel, FindRanges eRng, const SwTextFormatColl *pReplFormat)
Definition: crsrsh.cxx:3830
bool TestCurrPam(const Point &rPt, bool bTstHit=false)
Search in the selected area for a Selection that covers the given point.
Definition: crsrsh.cxx:1277
bool GoStartSentence()
Definition: crstrvl1.cxx:78
void UnsetEnhancedTableSelection()
Definition: crsrsh.hxx:836
bool SelectWord(const Point *pPt)
Definition: crstrvl1.cxx:83
bool Right(sal_uInt16 nCnt, SwCursorSkipMode nMode, bool bAllowVisual=false)
Definition: crsrsh.hxx:366
sal_Int32 Find_Text(const i18nutil::SearchOptions2 &rSearchOpt, bool bSearchInNotes, SwDocPositions eStart, SwDocPositions eEnd, bool &bCancel, FindRanges eRng, bool bReplace=false)
Definition: crsrsh.cxx:3811
void ClearMark()
Definition: crsrsh.cxx:1225
void SetMark()
Definition: crsrsh.hxx:906
sal_Int32 FindAttrs(const SfxItemSet &rSet, bool bNoCollections, SwDocPositions eStart, SwDocPositions eEnd, bool &bCancel, FindRanges eRng, const i18nutil::SearchOptions2 *pSearchOpt, const SfxItemSet *rReplSet)
Definition: crsrsh.cxx:3848
bool SelTableCol()
Definition: crsrsh.hxx:626
SwShellCursor * getShellCursor(bool bBlock)
Delivers the current shell cursor.
Definition: crsrsh.cxx:3356
void DestroyCursor()
transform TableCursor to normal cursor, nullify Tablemode
Definition: crsrsh.cxx:151
bool MoveSection(SwWhichSection, SwMoveFnCollection const &)
Definition: crsrsh.cxx:1006
SwTable::SearchType GetEnhancedTableSelection() const
Definition: crsrsh.hxx:837
bool Left(sal_uInt16 nCnt, SwCursorSkipMode nMode, bool bAllowVisual=false)
Definition: crsrsh.hxx:364
bool SelTableRow()
Definition: crsrsh.hxx:625
void KillPams()
Definition: crsrsh.cxx:1308
bool IsCursorPtAtEnd() const
Definition: crsrsh.hxx:920
bool IsTableMode() const
Definition: crsrsh.hxx:668
bool IsStartWord(sal_Int16 nWordType=css::i18n::WordType::ANYWORD_IGNOREWHITESPACES) const
Definition: crstrvl1.cxx:27
bool IsEndSentence() const
Definition: crstrvl1.cxx:45
sal_Unicode GetChar(bool bEnd=true, tools::Long nOffset=0)
get the nth character of the current SSelection
Definition: crsrsh.cxx:2918
::std::optional<::std::pair< SwNode const *, ::std::vector< SwTableNode * > > > ExtendedSelectedAll() const
If ExtendedSelectAll() was called and selection didn't change since then.
Definition: crsrsh.cxx:823
void RestoreSavePos()
Restore cursor state to the one saved by SwCursorSaveState.
Definition: swcrsr.cxx:2339
Definition: doc.hxx:197
void SetSplitVerticalByDefault(bool value)
Definition: doc.cxx:1730
void SetPrepareSelAll()
Definition: doc.hxx:580
bool IsSplitVerticalByDefault() const
Definition: doc.cxx:1725
sal_uInt16 GetCntType() const
Determine form of content. Return Type at CurrentCursor->SPoint.
Definition: edws.cxx:126
bool IsRedlineOn() const
Definition: edredln.cxx:43
bool Delete(bool isArtificialSelection=false)
Delete content of all ranges.
Definition: eddel.cxx:134
void SetRedlineFlags(RedlineFlags eMode)
Definition: edredln.cxx:32
SwTextFormatColl & GetDfltTextFormatColl() const
Definition: edfcol.cxx:689
void Undo(sal_uInt16 const nCount=1, sal_uInt16 nOffset=0)
Definition: edundo.cxx:105
void Drag(const Point *pPt, bool bProp)
Definition: feshview.cxx:741
bool IsFrameSelected() const
Definition: feshview.cxx:1133
void EndDrag()
Definition: feshview.cxx:753
bool HasWholeTabSelection() const
Definition: fetab.cxx:1023
bool SelTableRowCol(const Point &rPt, const Point *pEnd, bool bRowDrag)
pEnd will be used during MouseMove
Definition: fetab.cxx:1957
size_t IsObjSelected() const
Definition: feshview.cxx:1125
bool SelectObj(const Point &rSelPt, sal_uInt8 nFlag=0, SdrObject *pObj=nullptr)
If an object has been given, exactly this object is selected (instead of searching over position).
Definition: feshview.cxx:161
void BeginDrag(const Point *pPt, bool bProp)
Definition: feshview.cxx:727
const SvxMacroItem & GetMacro(bool=true) const
Definition: frmatr.hxx:116
Style of a layout element.
Definition: frmfmt.hxx:72
Class for automated call of Start- and EndCursorMove().
Definition: editsh.hxx:1048
const SwPosition * GetMark() const
Definition: pam.hxx:255
const SwPosition * End() const
Definition: pam.hxx:263
const SwPosition * GetPoint() const
Definition: pam.hxx:253
const SwPosition * Start() const
Definition: pam.hxx:258
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:251
Represents the current text cursor of one opened edit window.
Definition: viscrs.hxx:140
virtual void SetMark() override
Unless this is called, the getter method of Mark will return Point.
Definition: viscrs.cxx:939
@ SEARCH_NONE
Definition: swtable.hxx:146
Represents the style of a paragraph.
Definition: fmtcol.hxx:61
static void ClearSelection(const SwWrtShell &rSh, const SwFrameShell *pCreator=nullptr)
Definition: swdtflvr.cxx:4382
static void CreateSelection(SwWrtShell &rSh, const SwFrameShell *pCreator=nullptr)
Definition: swdtflvr.cxx:4370
bool IsViewLocked() const
Definition: viewsh.hxx:490
SwDoc * GetDoc() const
Definition: viewsh.hxx:308
void LockView(bool b)
Definition: viewsh.hxx:491
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void EnterBlockMode()
Definition: select.cxx:660
bool m_bBlockMode
Definition: wrtsh.hxx:600
bool IsSelFrameMode() const
Definition: wrtsh.hxx:177
void SelectTableRow()
Definition: select.cxx:844
SAL_DLLPRIVATE tools::Long SetCursorKillSel(const Point *, bool bProp)
Definition: select.cxx:325
void EnterSelFrameMode(const Point *pStartDrag=nullptr)
Definition: select.cxx:711
bool IsRetainSelection() const
Definition: wrtsh.hxx:276
SAL_DLLPRIVATE void DefaultEndDrag(const Point *, bool bProp)
Definition: select.cxx:817
SAL_DLLPRIVATE void SttLeaveSelect()
Definition: select.cxx:616
void SetSplitVerticalByDefault(bool value)
Definition: select.cxx:381
void ToggleBlockMode()
Definition: select.cxx:773
void EnterExtMode()
Definition: select.cxx:593
bool m_bSelWrd
Definition: wrtsh.hxx:602
@ WORD_NO_SPACE
Definition: wrtsh.hxx:305
@ WORD_SPACE_AFTER
Definition: wrtsh.hxx:304
@ WORD_SPACE_BEFORE
Definition: wrtsh.hxx:303
void EndSelect()
Definition: select.cxx:434
void LeaveSelFrameMode()
Definition: select.cxx:729
sal_Int32 SearchAttr(const SfxItemSet &rFindSet, bool bNoColls, SwDocPositions eStart, SwDocPositions eEnd, FindRanges eFlags=FindRanges::InBody, const i18nutil::SearchOptions2 *pSearchOpt=nullptr, const SfxItemSet *pReplaceSet=nullptr)
Definition: select.cxx:265
SELECTFUNC2 m_fnEndDrag
Definition: wrtsh.hxx:116
SELECTFUNC2 m_fnDrag
Definition: wrtsh.hxx:114
void PopMode()
Definition: select.cxx:293
Point m_aStart
Definition: wrtsh.hxx:608
SAL_DLLPRIVATE bool GoStart(bool KeepArea, bool *, bool bSelect, bool bDontMoveRegion=false)
Definition: move.cxx:208
void PushMode()
Definition: select.cxx:288
SAL_DLLPRIVATE void LeaveExtSel()
Definition: wrtsh.hxx:635
SAL_DLLPRIVATE void BeginFrameDrag(const Point *, bool bProp)
Definition: select.cxx:699
void LeaveAddMode()
Definition: select.cxx:650
bool PrvWrd(bool bSelect=false)
Definition: wrtsh.hxx:218
bool Left(SwCursorSkipMode nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:110
SAL_DLLPRIVATE tools::Long SetCursor(const Point *, bool bProp=false)
Definition: select.cxx:313
void SelectNextPrevHyperlink(bool bNext)
Definition: select.cxx:943
sal_Int32 SearchTempl(const OUString &rTempl, SwDocPositions eStart, SwDocPositions eEnd, FindRanges eFlags=FindRanges::InBody, const OUString *pReplTempl=nullptr)
Definition: select.cxx:240
bool IsSplitVerticalByDefault() const
Definition: select.cxx:376
void SetInsMode(bool bOn=true)
Definition: select.cxx:679
struct SwWrtShell::ModeStack * m_pModeStack
SAL_DLLPRIVATE void ExtSelWrd(const Point *, bool bProp)
Definition: select.cxx:457
void EnterStdMode()
Definition: select.cxx:560
SAL_DLLPRIVATE void AddLeaveSelect()
Definition: select.cxx:626
void SelectTableCol()
Definition: select.cxx:853
void SelPara(const Point *)
Definition: select.cxx:108
void SelectTableCell()
Definition: select.cxx:862
void SelSentence(const Point *)
Definition: select.cxx:92
SELECTFUNC m_fnKillSel
Definition: wrtsh.hxx:117
SAL_DLLPRIVATE void BeginDrag(const Point *, bool bProp)
Definition: select.cxx:787
SAL_DLLPRIVATE bool GoEnd(bool KeepArea=false, const bool *=nullptr)
Definition: move.cxx:292
int IntelligentCut(SelectionType nSelectionType, bool bCut=true)
Definition: select.cxx:876
void LeaveBlockMode()
Definition: select.cxx:669
bool m_bExtMode
Definition: wrtsh.hxx:598
@ GETSTYLE_CREATESOME
Definition: wrtsh.hxx:362
sal_Int32 SearchPattern(const i18nutil::SearchOptions2 &rSearchOpt, bool bSearchInNotes, SwDocPositions eStart, SwDocPositions eEnd, FindRanges eFlags=FindRanges::InBody, bool bReplace=false)
Definition: select.cxx:221
Link< SwWrtShell &, void > m_aSelTableLink
Definition: wrtsh.hxx:609
bool m_bAddMode
Definition: wrtsh.hxx:599
SAL_DLLPRIVATE tools::Long Ignore(const Point *, bool bProp)
Definition: select.cxx:388
bool IsInSelect() const
Definition: wrtsh.hxx:144
bool m_bSelLn
Definition: wrtsh.hxx:603
void SetRedlineFlagsAndCheckInsMode(RedlineFlags eMode)
Definition: select.cxx:690
void SelAll()
Definition: select.cxx:124
void LeaveExtMode()
Definition: select.cxx:607
SELECTFUNC m_fnSetCursor
Definition: wrtsh.hxx:115
void ToggleAddMode()
Definition: select.cxx:767
bool m_bIns
Definition: wrtsh.hxx:596
void Edit()
Definition: wrtsh1.cxx:188
bool m_bClearMark
Definition: wrtsh.hxx:605
bool IsAddMode() const
Definition: wrtsh.hxx:163
void SttSelect()
Definition: select.cxx:394
void UnSelectFrame()
Definition: select.cxx:332
bool IsEndWrd()
Definition: wrtsh1.cxx:196
bool SelNearestWrd()
Definition: select.cxx:64
bool IsExtSel() const
Definition: wrtsh.hxx:188
SwTextFormatColl * GetParaStyle(const OUString &rCollName, GetStyle eCreate=GETSTYLE_NOCREATE)
Definition: wrtsh1.cxx:1823
tools::Long ResetSelect(const Point *, bool)
Definition: select.cxx:342
void ToggleExtMode()
Definition: select.cxx:779
bool SelWrd(const Point *=nullptr)
Definition: select.cxx:74
void Invalidate()
Definition: select.cxx:53
bool m_bLayoutMode
Definition: wrtsh.hxx:601
SAL_DLLPRIVATE void DefaultDrag(const Point *, bool bProp)
Definition: select.cxx:811
SAL_DLLPRIVATE void UpdateLayoutFrame(const Point *, bool bProp)
Definition: select.cxx:758
bool SelectTableRowCol(const Point &rPt, const Point *pEnd=nullptr, bool bRowDrag=false)
Definition: select.cxx:829
bool m_bInSelect
Definition: wrtsh.hxx:597
void EnterAddMode()
Definition: select.cxx:635
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2047
const SwView & GetView() const
Definition: wrtsh.hxx:443
SAL_DLLPRIVATE void ExtSelLn(const Point *, bool bProp)
Definition: select.cxx:514
static UITestLogger & getInstance()
void logEvent(const EventDescription &rDescription)
#define FN_STAT_SELMODE
Definition: cmdid.h:867
Any value
SwDocPositions
Definition: cshtyp.hxx:104
FindRanges
Definition: cshtyp.hxx:91
@ InSel
Find in selections.
#define CNT_OLE
Definition: editsh.hxx:133
#define CNT_GRF
Definition: editsh.hxx:132
SelectionType
#define CH_TXTATR_INWORD
Definition: hintids.hxx:175
#define CH_TXTATR_BREAKWORD
Definition: hintids.hxx:174
CharClass & GetAppCharClass()
Definition: init.cxx:721
Mode eMode
@ FLY_DRAG_START
Definition: mdiexp.hxx:40
@ FLY_DRAG_END
Definition: mdiexp.hxx:40
long Long
bool GoCurrPara(SwPaM &rPam, SwMoveFnCollection const &aPosPara)
Definition: pam.cxx:1248
bool GoCurrSection(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:1288
SwMoveFnCollection const & fnParaStart
Definition: paminit.cxx:48
SwMoveFnCollection const & fnSectionEnd
Definition: paminit.cxx:52
SwMoveFnCollection const & fnParaEnd
Definition: paminit.cxx:49
SwMoveFnCollection const & fnSectionStart
Definition: paminit.cxx:51
static bool bStartDrag
Definition: select.cxx:51
static tools::Long nStartDragX
Definition: select.cxx:50
static tools::Long nStartDragY
Definition: select.cxx:50
IMPL_LINK(SwWrtShell, ExecFlyMac, const SwFlyFrameFormat *, pFlyFormat, void)
Definition: select.cxx:742
std::map< OUString, OUString > aParameters
sal_Int32 GetContentIndex() const
Definition: pam.hxx:85
ModeStack * pNext
Definition: wrtsh.hxx:530
#define SAL_MAX_INT32
sal_uInt16 sal_Unicode