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 SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(GetView().GetViewFrame()->GetChildWindow(SwWordCountWrapper::GetChildWindowId()));
59 if (pWrdCnt)
60 pWrdCnt->UpdateCounts();
61}
62
64{
65 SwMvContext aMvContext(this);
66 if( !IsInWord() && !IsEndWrd() && !IsStartWord() )
67 PrvWrd();
68 if( IsEndWrd() )
69 Left(SwCursorSkipMode::Cells, false, 1, false );
70 return SelWrd();
71}
72
73bool SwWrtShell::SelWrd(const Point *pPt )
74{
75 bool bRet;
76 {
77 SwMvContext aMvContext(this);
78 SttSelect();
79 bRet = SwCursorShell::SelectWord( pPt );
80 }
81 EndSelect();
82 if( bRet )
83 {
84 m_bSelWrd = true;
85 if(pPt)
86 m_aStart = *pPt;
87 }
88 return bRet;
89}
90
91void SwWrtShell::SelSentence(const Point *pPt )
92{
93 {
94 SwMvContext aMvContext(this);
95 ClearMark();
97 SttSelect();
99 }
100 EndSelect();
101 if(pPt)
102 m_aStart = *pPt;
103 m_bSelLn = true;
104 m_bSelWrd = false; // disable SelWord, otherwise no SelLine goes on
105}
106
107void SwWrtShell::SelPara(const Point *pPt )
108{
109 {
110 SwMvContext aMvContext(this);
111 ClearMark();
113 SttSelect();
115 }
116 EndSelect();
117 if(pPt)
118 m_aStart = *pPt;
119 m_bSelLn = false;
120 m_bSelWrd = false; // disable SelWord, otherwise no SelLine goes on
121}
122
124{
125 const bool bLockedView = IsViewLocked();
126 LockView( true );
127 {
128 if(m_bBlockMode)
130 SwMvContext aMvContext(this);
131 bool bMoveTable = false;
132 std::optional<SwPosition> oStartPos;
133 std::optional<SwPosition> oEndPos;
134 SwShellCursor* pTmpCursor = nullptr;
135
136 // Query these early, before we move the cursor.
137 bool bHasWholeTabSelection = HasWholeTabSelection();
138 bool bIsCursorInTable = IsCursorInTable();
139
140 if (!bHasWholeTabSelection)
141 {
142 if ( IsSelection() && IsCursorPtAtEnd() )
143 SwapPam();
144 pTmpCursor = getShellCursor( false );
145 if( pTmpCursor )
146 {
147 oStartPos.emplace( *pTmpCursor->GetPoint() );
148 oEndPos.emplace( *pTmpCursor->GetMark() );
149 }
150 Push();
151 bool bIsFullSel = !MoveSection( GoCurrSection, fnSectionStart);
152 SwapPam();
153 bIsFullSel &= !MoveSection( GoCurrSection, fnSectionEnd);
155 GoStart(true, &bMoveTable, false, !bIsFullSel);
156 }
157 else
158 {
159 EnterStdMode();
160 SttEndDoc(true);
161 }
162 SttSelect();
163 GoEnd(true, &bMoveTable);
164
165 bool bNeedsExtendedSelectAll = StartsWithTable();
166
167 // If the cursor was in a table, then we only need the extended select
168 // all if the whole table is already selected, to still allow selecting
169 // only a single cell or a single table before selecting the whole
170 // document.
171 if (bNeedsExtendedSelectAll && bIsCursorInTable)
172 bNeedsExtendedSelectAll = bHasWholeTabSelection;
173
174 if (bNeedsExtendedSelectAll)
175 {
176 // Disable table cursor to make sure getShellCursor() returns m_pCurrentCursor, not m_pTableCursor.
177 if (IsTableMode())
179 // Do the extended select all on m_pCurrentCursor.
180 ExtendedSelectAll(/*bFootnotes =*/ false);
181 }
182
183 SwDoc *pDoc = GetDoc();
184 if ( pDoc )
185 {
186 pDoc->SetPrepareSelAll();
187 }
188
189 if( oStartPos )
190 {
191 pTmpCursor = getShellCursor( false );
192 if( pTmpCursor )
193 {
194 // Some special handling for sections (e.g. TOC) at the beginning of the document body
195 // to avoid the selection of the first section
196 // if the last selection was behind the first section or
197 // if the last selection was already the first section
198 // In this both cases we select to the end of document
199 if( ( *pTmpCursor->GetPoint() < *oEndPos ||
200 ( *oStartPos == *pTmpCursor->GetMark() &&
201 *oEndPos == *pTmpCursor->GetPoint() ) ) && !bNeedsExtendedSelectAll)
203 }
204 }
205 }
206 EndSelect();
207 LockView( bLockedView );
208}
209
210// Description: Text search
211
212sal_Int32 SwWrtShell::SearchPattern( const i18nutil::SearchOptions2& rSearchOpt, bool bSearchInNotes,
214 FindRanges eFlags, bool bReplace )
215{
216 // no enhancement of existing selections
217 if(!(eFlags & FindRanges::InSel))
218 ClearMark();
219 bool bCancel = false;
220 sal_Int32 nRet = Find_Text(rSearchOpt, bSearchInNotes, eStt, eEnd, bCancel, eFlags, bReplace);
221 if(bCancel)
222 {
223 Undo();
224 nRet = SAL_MAX_INT32;
225 }
226 return nRet;
227}
228
229// Description: search for templates
230
231sal_Int32 SwWrtShell::SearchTempl( const OUString &rTempl,
233 FindRanges eFlags, const OUString* pReplTempl )
234{
235 // no enhancement of existing selections
236 if(!(eFlags & FindRanges::InSel))
237 ClearMark();
239 SwTextFormatColl *pReplaceColl = nullptr;
240 if( pReplTempl )
241 pReplaceColl = GetParaStyle(*pReplTempl, SwWrtShell::GETSTYLE_CREATESOME );
242
243 bool bCancel = false;
244 sal_Int32 nRet = FindFormat(pColl ? *pColl : GetDfltTextFormatColl(),
245 eStt,eEnd, bCancel, eFlags, pReplaceColl);
246 if(bCancel)
247 {
248 Undo();
249 nRet = SAL_MAX_INT32;
250 }
251 return nRet;
252}
253
254// search for attributes
255
256sal_Int32 SwWrtShell::SearchAttr( const SfxItemSet& rFindSet, bool bNoColls,
257 SwDocPositions eStart, SwDocPositions eEnd,
258 FindRanges eFlags, const i18nutil::SearchOptions2* pSearchOpt,
259 const SfxItemSet* pReplaceSet )
260{
261 // no enhancement of existing selections
262 if (!(eFlags & FindRanges::InSel))
263 ClearMark();
264
265 // Searching
266 bool bCancel = false;
267 sal_Int32 nRet = FindAttrs(rFindSet, bNoColls, eStart, eEnd, bCancel, eFlags, pSearchOpt, pReplaceSet);
268
269 if(bCancel)
270 {
271 Undo();
272 nRet = SAL_MAX_INT32;
273 }
274 return nRet;
275}
276
277// Selection modes
278
280{
282}
283
285{
286 if ( nullptr == m_pModeStack )
287 return;
288
289 if ( m_bExtMode && !m_pModeStack->bExt )
290 LeaveExtMode();
291 if ( m_bAddMode && !m_pModeStack->bAdd )
292 LeaveAddMode();
296
297 m_pModeStack = std::move(m_pModeStack->pNext);
298}
299
300// Two methods for setting cursors: the first maps at the
301// eponymous methods in the CursorShell, the second removes
302// all selections at first.
303
304tools::Long SwWrtShell::SetCursor(const Point *pPt, bool bTextOnly)
305{
306 // Remove a possibly present selection at the position
307 // of the mouseclick
308
309 if(!IsInSelect() && TestCurrPam(*pPt)) {
310 ClearMark();
311 }
312
313 return SwCursorShell::SetCursor(*pPt, bTextOnly);
314}
315
316tools::Long SwWrtShell::SetCursorKillSel(const Point *pPt, bool bTextOnly )
317{
318 SwActContext aActContext(this);
319 ResetSelect(pPt,false);
320 return SwCursorShell::SetCursor(*pPt, bTextOnly);
321}
322
324{
325 // Remove Frame selection with guaranteed invalid position
326 Point aPt(LONG_MIN, LONG_MIN);
327 SelectObj(aPt);
329}
330
331// Remove of all selections
332
334{
335 if(IsSelFrameMode())
336 {
339 }
340 else
341 {
342 // SwActContext opens an Action -
343 // to avoid problems in the basic process with the
344 // shell switching, GetChgLnk().Call() may be called
345 // after EndAction().
346 {
347 SwActContext aActContext(this);
348 m_bSelWrd = m_bSelLn = false;
349 KillPams();
350 ClearMark();
353 }
354
355 // After canceling of all selections an update of Attr-Controls
356 // could be necessary.
357 GetChgLnk().Call(nullptr);
358
361 }
362 Invalidate();
364 return 1;
365}
366
368{
370}
371
373{
375}
376
377// Do nothing
378
379tools::Long SwWrtShell::Ignore(const Point *, bool ) {
380 return 1;
381}
382
383// Begin of a selection process.
384
386{
387 if(m_bInSelect)
388 return;
389 if(!HasMark())
390 SetMark();
391 if( m_bBlockMode )
392 {
393 SwShellCursor* pTmp = getShellCursor( true );
394 if( !pTmp->HasMark() )
395 pTmp->SetMark();
396 }
399 m_bInSelect = true;
400 Invalidate();
402}
403
404namespace {
405
406void collectUIInformation(SwShellCursor* pCursor)
407{
408 EventDescription aDescription;
409 OUString aSelStart = OUString::number(pCursor->Start()->GetContentIndex());
410 OUString aSelEnd = OUString::number(pCursor->End()->GetContentIndex());
411
412 aDescription.aParameters = {{"START_POS", aSelStart}, {"END_POS", aSelEnd}};
413 aDescription.aAction = "SELECT";
414 aDescription.aID = "writer_edit";
415 aDescription.aKeyWord = "SwEditWinUIObject";
416 aDescription.aParent = "MainWindow";
417
418 UITestLogger::getInstance().logEvent(aDescription);
419}
420
421}
422
423// End of a selection process.
424
426{
427 if(m_bInSelect && !m_bExtMode)
428 {
429 m_bInSelect = false;
430 if (m_bAddMode)
431 {
433 }
434 else
435 {
439 }
440 }
441 SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(GetView().GetViewFrame()->GetChildWindow(SwWordCountWrapper::GetChildWindowId()));
442 if (pWrdCnt)
443 pWrdCnt->UpdateCounts();
444
445 collectUIInformation(GetCursor_());
446}
447
448void SwWrtShell::ExtSelWrd(const Point *pPt, bool )
449{
450 SwMvContext aMvContext(this);
451 if( IsTableMode() )
452 return;
453
454 // Bug 66823: actual crsr has in additional mode no selection?
455 // Then destroy the actual and go to prev, this will be expand
456 if( !HasMark() && GoPrevCursor() )
457 {
458 bool bHasMark = HasMark(); // that's wrong!
459 GoNextCursor();
460 if( bHasMark )
461 {
463 GoPrevCursor();
464 }
465 }
466
467 // check the direction of the selection with the new point
468 bool bMoveCursor = true, bToTop = false;
469 SwCursorShell::SelectWord( &m_aStart ); // select the startword
470 SwCursorShell::Push(); // save the cursor
471 SwCursorShell::SetCursor( *pPt ); // and check the direction
472
474 {
475 case -1: bToTop = false; break;
476 case 1: bToTop = true; break;
477 default: bMoveCursor = false; break;
478 }
479
481
482 if( !bMoveCursor )
483 return;
484
485 // select to Top but cursor select to Bottom? or
486 // select to Bottom but cursor select to Top? --> swap the cursor
487 if( bToTop )
488 SwapPam();
489
490 SwCursorShell::Push(); // save cur cursor
491 if( SwCursorShell::SelectWord( pPt )) // select the current word
492 {
493 if( bToTop )
494 SwapPam();
495 Combine();
496 }
497 else
498 {
500 if( bToTop )
501 SwapPam();
502 }
503}
504
505void SwWrtShell::ExtSelLn(const Point *pPt, bool )
506{
507 SwMvContext aMvContext(this);
509 if( IsTableMode() )
510 return;
511
512 // Bug 66823: actual crsr has in additional mode no selection?
513 // Then destroy the actual and go to prev, this will be expand
514 if( !HasMark() && GoPrevCursor() )
515 {
516 bool bHasMark = HasMark(); // that's wrong!
517 GoNextCursor();
518 if( bHasMark )
519 {
521 GoPrevCursor();
522 }
523 }
524
525 // if applicable fit the selection to the "Mark"
526 bool bToTop = !IsCursorPtAtEnd();
527 SwapPam();
528
529 // The "Mark" has to be at the end or the beginning of the line.
530 if( bToTop ? !IsEndSentence() : !IsStartSentence() )
531 {
532 if( bToTop )
533 {
534 if( !IsEndPara() )
537 }
538 else
540 }
541 SwapPam();
542
543 if (bToTop)
545 else
547}
548
549// Back into the standard mode: no mode, no selections.
550
552{
553 if(m_bAddMode)
554 LeaveAddMode();
555 if(m_bBlockMode)
557 m_bBlockMode = false;
558 m_bExtMode = false;
559 m_bInSelect = false;
560 if(IsSelFrameMode())
561 {
564 }
565 else
566 {
567 // SwActContext opens and action which has to be
568 // closed prior to the call of
569 // GetChgLnk().Call()
570 SwActContext aActContext(this);
571 m_bSelWrd = m_bSelLn = false;
572 if( !IsRetainSelection() )
573 KillPams();
574 ClearMark();
577 }
578 Invalidate();
580}
581
582// Extended Mode
583
585{
586 if(m_bBlockMode)
587 {
589 KillPams();
590 ClearMark();
591 }
592 m_bExtMode = true;
593 m_bAddMode = false;
594 m_bBlockMode = false;
595 SttSelect();
596}
597
599{
600 m_bExtMode = false;
601 EndSelect();
602}
603
604// End of a selection; if the selection is empty,
605// ClearMark().
606
608{
610 return;
611 }
612 ClearMark();
613}
614
615// Leaving of the selection mode in additional mode
616
618{
621 CreateCursor();
622}
623
624// Additional Mode
625
627{
628 if(IsTableMode()) return;
629 if(m_bBlockMode)
633 m_bAddMode = true;
634 m_bBlockMode = false;
635 m_bExtMode = false;
637 CreateCursor();
638 Invalidate();
639}
640
642{
645 m_bAddMode = false;
646 Invalidate();
647}
648
649// Block Mode
650
652{
653 m_bBlockMode = false;
654 EnterStdMode();
655 m_bBlockMode = true;
657 Invalidate();
658}
659
661{
662 m_bBlockMode = false;
664 EndSelect();
665 Invalidate();
666}
667
668// Insert mode
669
671{
672 m_bIns = bOn;
674 const SfxBoolItem aTmp( SID_ATTR_INSERT, m_bIns );
676 StartAction();
677 EndAction();
678 Invalidate();
679}
680//Overwrite mode is incompatible with red-lining
682{
684 if (IsRedlineOn())
685 SetInsMode();
686}
687
688// Edit frame
689
690void SwWrtShell::BeginFrameDrag(const Point *pPt, bool bIsShift)
691{
693 if(bStartDrag)
694 {
696 SwFEShell::BeginDrag( &aTmp, bIsShift );
697 }
698 else
699 SwFEShell::BeginDrag( pPt, bIsShift );
700}
701
702void SwWrtShell::EnterSelFrameMode(const Point *pPos)
703{
704 if(pPos)
705 {
706 nStartDragX = pPos->X();
707 nStartDragY = pPos->Y();
708 bStartDrag = true;
709 }
710 m_bLayoutMode = true;
711 HideCursor();
712
713 // equal call of BeginDrag in the SwFEShell
717 Invalidate();
718}
719
721{
724 m_bLayoutMode = false;
725 bStartDrag = false;
726 Edit();
728 Invalidate();
729}
730
731// Description: execute framebound macro
732
733IMPL_LINK( SwWrtShell, ExecFlyMac, const SwFlyFrameFormat*, pFlyFormat, void )
734{
735 const SwFrameFormat *pFormat = pFlyFormat ? static_cast<const SwFrameFormat*>(pFlyFormat) : GetFlyFrameFormat();
736 OSL_ENSURE(pFormat, "no frame format");
737 const SvxMacroItem &rFormatMac = pFormat->GetMacro();
738
739 if(rFormatMac.HasMacro(SvMacroItemId::SwObjectSelect))
740 {
741 const SvxMacro &rMac = rFormatMac.GetMacro(SvMacroItemId::SwObjectSelect);
742 if( IsFrameSelected() )
743 m_bLayoutMode = true;
744 CallChgLnk();
745 ExecMacro( rMac );
746 }
747}
748
749void SwWrtShell::UpdateLayoutFrame(const Point *, bool )
750{
751 // still a dummy
754}
755
756// Handler for toggling the modes. Returns back the old mode.
757
759{
761 Invalidate();
762}
763
765{
767 Invalidate();
768}
769
771{
773 Invalidate();
774}
775
776// Dragging in standard mode (Selecting of content)
777
778void SwWrtShell::BeginDrag(const Point * /*pPt*/, bool )
779{
780 if(m_bSelWrd)
781 {
782 m_bInSelect = true;
783 if( !IsCursorPtAtEnd() )
784 SwapPam();
785
788 }
789 else if(m_bSelLn)
790 {
791 m_bInSelect = true;
794 }
795 else
796 {
798 SttSelect();
799 }
800}
801
802void SwWrtShell::DefaultDrag(const Point *, bool )
803{
804 if( IsSelTableCells() )
805 m_aSelTableLink.Call(*this);
806}
807
808void SwWrtShell::DefaultEndDrag(const Point * /*pPt*/, bool )
809{
811 if( IsExtSel() )
812 LeaveExtSel();
813
814 if( IsSelTableCells() )
815 m_aSelTableLink.Call(*this);
816 EndSelect();
817}
818
819// #i32329# Enhanced table selection
820bool SwWrtShell::SelectTableRowCol( const Point& rPt, const Point* pEnd, bool bRowDrag )
821{
822 SwMvContext aMvContext(this);
823 SttSelect();
824 if(SelTableRowCol( rPt, pEnd, bRowDrag ))
825 {
828 return true;
829 }
830 return false;
831}
832
833// Description: Selection of a table line or column
834
836{
837 if ( SelTableRow() )
838 {
841 }
842}
843
845{
846 if ( SelTableCol() )
847 {
850 }
851}
852
854{
855 if ( SelTableBox() )
856 {
859 }
860}
861
862// Description: Check if a word selection is present.
863// According to the rules for intelligent cut / paste
864// surrounding spaces are cut out.
865// Return: Delivers the type of the word selection.
866
868{
869 // On multiple selection no intelligent drag and drop
870 // there are multiple cursors, since a second was placed
871 // already at the target position.
872 if( IsAddMode() || !(nSelection & SelectionType::Text) )
873 return NO_WORD;
874
875 OUString sText;
876 CharClass& rCC = GetAppCharClass();
877
878 // If the first character is no word character,
879 // no word selected.
880 sal_Unicode cPrev = GetChar(false);
881 sal_Unicode cNext = GetChar(true, -1);
882 if( !cPrev || !cNext ||
883 !rCC.isLetterNumeric( ( sText = OUString(cPrev) ), 0 ) ||
884 !rCC.isLetterNumeric( ( sText = OUString(cNext) ), 0 ) )
885 return NO_WORD;
886
887 cPrev = GetChar(false, -1);
888 cNext = GetChar();
889
890 int cWord = NO_WORD;
891 // is a word selected?
892 if (cPrev && cNext &&
893 CH_TXTATR_BREAKWORD != cPrev && CH_TXTATR_INWORD != cPrev &&
894 CH_TXTATR_BREAKWORD != cNext && CH_TXTATR_INWORD != cNext &&
895 !rCC.isLetterNumeric( ( sText = OUString(cPrev) ), 0 ) &&
896 !rCC.isLetterNumeric( ( sText = OUString(cNext) ), 0 ) )
897 cWord = WORD_NO_SPACE;
898
899 if(cWord == WORD_NO_SPACE && ' ' == cPrev )
900 {
901 cWord = WORD_SPACE_BEFORE;
902 // delete the space before
903 if(bCut)
904 {
905 Push();
906 if(IsCursorPtAtEnd())
907 SwapPam();
908 ClearMark();
909 SetMark();
911 SwFEShell::Delete(true);
913 }
914 }
915 else if(cWord == WORD_NO_SPACE && cNext == ' ')
916 {
917 cWord = WORD_SPACE_AFTER;
918 // delete the space behind
919 if(bCut) {
920 Push();
921 if(!IsCursorPtAtEnd()) SwapPam();
922 ClearMark();
923 SetMark();
925 SwFEShell::Delete(true);
927 }
928 }
929 return cWord;
930}
931
932 // jump to the next / previous hyperlink - inside text and also
933 // on graphics
935{
936 StartAction();
937 bool bRet = SwCursorShell::SelectNxtPrvHyperlink( bNext );
938 if( !bRet ) // didn't find? wrap and check again
939 {
940 SwShellCursor* pCursor = GetCursor_();
941 SwCursorSaveState aSaveState(*pCursor);
942 EnterStdMode();
943 if( bNext )
944 SttEndDoc(true);
945 else
946 SttEndDoc(false);
948 if (!bRet) // didn't find again? restore cursor position and bail
949 {
950 pCursor->RestoreSavePos();
951 EndAction(true); // don't scroll to restored cursor position
952 return;
953 }
954 }
955 EndAction();
956
957 bool bCreateXSelection = false;
958 const bool bFrameSelected = IsFrameSelected() || IsObjSelected();
959 if( IsSelection() )
960 {
961 if ( bFrameSelected )
963
964 // Set the function pointer for the canceling of the selection
965 // set at cursor
968 bCreateXSelection = true;
969 }
970 else if( bFrameSelected )
971 {
973 bCreateXSelection = true;
974 }
975 else if( (CNT_GRF | CNT_OLE ) & GetCntType() )
976 {
979 bCreateXSelection = true;
980 }
981
982 if( bCreateXSelection )
984}
985
986// For the preservation of the selection the cursor will be moved left
987// after SetMark(), so that the cursor is not moved by inserting text.
988// Because a present selection at the CORE page is cleared at the
989// current cursor position, the cursor will be pushed on the stack.
990// After moving, they will again resummarized.
991
992/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
void SetState(const SfxItemSet &rSet)
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:1019
static void SetFrameMode(FlyMode eMode, SwWrtShell *pShell)
Definition: basesh.cxx:2130
A helper class to save cursor state (position).
Definition: swcrsr.hxx:233
void ExtendedSelectAll(bool bFootnotes=true)
Definition: crsrsh.cxx:593
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:2246
void SetOverwriteCursor(bool bFlag)
Definition: crsrsh.hxx:469
void StartAction()
Definition: crsrsh.cxx:225
const SwTableNode * IsCursorInTable() const
Definition: crsrsh.hxx:902
bool GoPrevCursor()
go to the previous SSelection
Definition: crsrsh.cxx:1375
bool IsStartSentence() const
Definition: crstrvl1.cxx:41
void BlockCursorToCursor()
Definition: crsrsh.cxx:902
bool SelectNxtPrvHyperlink(bool bNext)
Definition: crstrvl.cxx:2551
SwShellCursor * GetCursor_()
Definition: crsrsh.hxx:336
void SwapPam()
Definition: crsrsh.cxx:975
const SwRect & GetCharRect() const
Definition: crsrsh.hxx:525
const Link< LinkParamNone *, void > & GetChgLnk() const
Definition: crsrsh.hxx:493
bool SelTableBox()
Definition: trvltbl.cxx:286
bool IsInWord(sal_Int16 nWordType=css::i18n::WordType::ANYWORD_IGNOREWHITESPACES) const
Definition: crstrvl1.cxx:36
void HideCursor()
Definition: crsrsh.cxx:2424
int SetCursor(const Point &rPt, bool bOnlyText=false, bool bBlock=true)
Definition: crsrsh.cxx:760
bool HasSelection() const
Does the current cursor create a selection?
Definition: crsrsh.cxx:2535
bool SttEndDoc(bool bStt)
Definition: crsrsh.cxx:572
bool MovePara(SwWhichPara, SwMoveFnCollection const &)
Definition: crsrsh.cxx:695
bool IsEndPara() const
Definition: crsrsh.cxx:1113
int CompareCursorStackMkCurrPt() const
Definition: crsrsh.cxx:1053
bool IsSelTableCells() const
Definition: crsrsh.hxx:816
void TableCursorToCursor()
enter block mode, change normal cursor into block cursor
Definition: crsrsh.cxx:895
bool GoNextCursor()
go to the next SSelection
Definition: crsrsh.cxx:1356
bool IsSelection() const
Definition: crsrsh.hxx:892
void CursorToBlockCursor()
leave block mode, change block cursor into normal cursor
Definition: crsrsh.cxx:919
void Combine()
Combine two cursors.
Definition: crsrsh.cxx:2342
SwPaM * CreateCursor()
delete the current cursor and make the following into the current
Definition: crsrsh.cxx:122
bool HasMark() const
Definition: crsrsh.hxx:890
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:242
sal_Int32 FindFormat(const SwTextFormatColl &rFormatColl, SwDocPositions eStart, SwDocPositions eEnd, bool &bCancel, FindRanges eRng, const SwTextFormatColl *pReplFormat)
Definition: crsrsh.cxx:3507
bool TestCurrPam(const Point &rPt, bool bTstHit=false)
Search in the selected area for a Selection that covers the given point.
Definition: crsrsh.cxx:990
bool GoStartSentence()
Definition: crstrvl1.cxx:78
void UnsetEnhancedTableSelection()
Definition: crsrsh.hxx:818
bool SelectWord(const Point *pPt)
Definition: crstrvl1.cxx:83
bool Right(sal_uInt16 nCnt, SwCursorSkipMode nMode, bool bAllowVisual=false)
Definition: crsrsh.hxx:359
sal_Int32 Find_Text(const i18nutil::SearchOptions2 &rSearchOpt, bool bSearchInNotes, SwDocPositions eStart, SwDocPositions eEnd, bool &bCancel, FindRanges eRng, bool bReplace=false)
Definition: crsrsh.cxx:3488
void ClearMark()
Definition: crsrsh.cxx:938
void SetMark()
Definition: crsrsh.hxx:888
bool StartsWithTable()
If document body starts with a table.
Definition: crsrsh.cxx:625
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:3525
bool SelTableCol()
Definition: crsrsh.hxx:610
SwShellCursor * getShellCursor(bool bBlock)
Delivers the current shell cursor.
Definition: crsrsh.cxx:3051
void DestroyCursor()
transform TableCursor to normal cursor, nullify Tablemode
Definition: crsrsh.cxx:150
bool MoveSection(SwWhichSection, SwMoveFnCollection const &)
Definition: crsrsh.cxx:719
SwTable::SearchType GetEnhancedTableSelection() const
Definition: crsrsh.hxx:819
bool Left(sal_uInt16 nCnt, SwCursorSkipMode nMode, bool bAllowVisual=false)
Definition: crsrsh.hxx:357
bool SelTableRow()
Definition: crsrsh.hxx:609
void KillPams()
Definition: crsrsh.cxx:1021
bool IsCursorPtAtEnd() const
Definition: crsrsh.hxx:907
bool IsTableMode() const
Definition: crsrsh.hxx:652
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:2615
void RestoreSavePos()
Restore cursor state to the one saved by SwCursorSaveState.
Definition: swcrsr.cxx:2333
Definition: doc.hxx:192
void SetSplitVerticalByDefault(bool value)
Definition: doc.cxx:1694
void SetPrepareSelAll()
Definition: doc.hxx:571
bool IsSplitVerticalByDefault() const
Definition: doc.cxx:1689
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:126
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:733
bool IsFrameSelected() const
Definition: feshview.cxx:1253
void EndDrag()
Definition: feshview.cxx:745
bool HasWholeTabSelection() const
Definition: fetab.cxx:950
bool SelTableRowCol(const Point &rPt, const Point *pEnd, bool bRowDrag)
pEnd will be used during MouseMove
Definition: fetab.cxx:1884
size_t IsObjSelected() const
Definition: feshview.cxx:1245
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:177
void BeginDrag(const Point *pPt, bool bProp)
Definition: feshview.cxx:719
const SvxMacroItem & GetMacro(bool=true) const
Definition: frmatr.hxx:92
Style of a layout element.
Definition: frmfmt.hxx:62
Class for automated call of Start- and EndCursorMove().
Definition: editsh.hxx:1027
const SwPosition * GetMark() const
Definition: pam.hxx:263
const SwPosition * End() const
Definition: pam.hxx:271
const SwPosition * GetPoint() const
Definition: pam.hxx:261
const SwPosition * Start() const
Definition: pam.hxx:266
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:259
virtual void SetMark() override
Unless this is called, the getter method of Mark will return Point.
Definition: viscrs.cxx:892
@ SEARCH_NONE
Definition: swtable.hxx:146
Represents the style of a paragraph.
Definition: fmtcol.hxx:59
static void ClearSelection(const SwWrtShell &rSh, const SwFrameShell *pCreator=nullptr)
Definition: swdtflvr.cxx:4324
static void CreateSelection(SwWrtShell &rSh, const SwFrameShell *pCreator=nullptr)
Definition: swdtflvr.cxx:4312
bool IsViewLocked() const
Definition: viewsh.hxx:474
SwDoc * GetDoc() const
Definition: viewsh.hxx:290
void LockView(bool b)
Definition: viewsh.hxx:475
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void EnterBlockMode()
Definition: select.cxx:651
bool m_bBlockMode
Definition: wrtsh.hxx:588
bool IsSelFrameMode() const
Definition: wrtsh.hxx:177
void SelectTableRow()
Definition: select.cxx:835
SAL_DLLPRIVATE tools::Long SetCursorKillSel(const Point *, bool bProp)
Definition: select.cxx:316
void EnterSelFrameMode(const Point *pStartDrag=nullptr)
Definition: select.cxx:702
bool IsRetainSelection() const
Definition: wrtsh.hxx:276
SAL_DLLPRIVATE void DefaultEndDrag(const Point *, bool bProp)
Definition: select.cxx:808
SAL_DLLPRIVATE void SttLeaveSelect()
Definition: select.cxx:607
void SetSplitVerticalByDefault(bool value)
Definition: select.cxx:372
void ToggleBlockMode()
Definition: select.cxx:764
void EnterExtMode()
Definition: select.cxx:584
bool m_bSelWrd
Definition: wrtsh.hxx:590
@ 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:425
void LeaveSelFrameMode()
Definition: select.cxx:720
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:256
SELECTFUNC2 m_fnEndDrag
Definition: wrtsh.hxx:116
SELECTFUNC2 m_fnDrag
Definition: wrtsh.hxx:114
void PopMode()
Definition: select.cxx:284
Point m_aStart
Definition: wrtsh.hxx:596
SAL_DLLPRIVATE bool GoStart(bool KeepArea, bool *, bool bSelect, bool bDontMoveRegion=false)
Definition: move.cxx:208
void PushMode()
Definition: select.cxx:279
SAL_DLLPRIVATE void LeaveExtSel()
Definition: wrtsh.hxx:623
SAL_DLLPRIVATE void BeginFrameDrag(const Point *, bool bProp)
Definition: select.cxx:690
void LeaveAddMode()
Definition: select.cxx:641
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:304
void SelectNextPrevHyperlink(bool bNext)
Definition: select.cxx:934
sal_Int32 SearchTempl(const OUString &rTempl, SwDocPositions eStart, SwDocPositions eEnd, FindRanges eFlags=FindRanges::InBody, const OUString *pReplTempl=nullptr)
Definition: select.cxx:231
bool IsSplitVerticalByDefault() const
Definition: select.cxx:367
void SetInsMode(bool bOn=true)
Definition: select.cxx:670
struct SwWrtShell::ModeStack * m_pModeStack
SAL_DLLPRIVATE void ExtSelWrd(const Point *, bool bProp)
Definition: select.cxx:448
void EnterStdMode()
Definition: select.cxx:551
SAL_DLLPRIVATE void AddLeaveSelect()
Definition: select.cxx:617
void SelectTableCol()
Definition: select.cxx:844
void SelPara(const Point *)
Definition: select.cxx:107
void SelectTableCell()
Definition: select.cxx:853
void SelSentence(const Point *)
Definition: select.cxx:91
SELECTFUNC m_fnKillSel
Definition: wrtsh.hxx:117
SAL_DLLPRIVATE void BeginDrag(const Point *, bool bProp)
Definition: select.cxx:778
SAL_DLLPRIVATE bool GoEnd(bool KeepArea=false, const bool *=nullptr)
Definition: move.cxx:274
int IntelligentCut(SelectionType nSelectionType, bool bCut=true)
Definition: select.cxx:867
void LeaveBlockMode()
Definition: select.cxx:660
bool m_bExtMode
Definition: wrtsh.hxx:586
@ 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:212
Link< SwWrtShell &, void > m_aSelTableLink
Definition: wrtsh.hxx:597
bool m_bAddMode
Definition: wrtsh.hxx:587
SAL_DLLPRIVATE tools::Long Ignore(const Point *, bool bProp)
Definition: select.cxx:379
bool IsInSelect() const
Definition: wrtsh.hxx:144
bool m_bSelLn
Definition: wrtsh.hxx:591
void SetRedlineFlagsAndCheckInsMode(RedlineFlags eMode)
Definition: select.cxx:681
void SelAll()
Definition: select.cxx:123
void LeaveExtMode()
Definition: select.cxx:598
SELECTFUNC m_fnSetCursor
Definition: wrtsh.hxx:115
void ToggleAddMode()
Definition: select.cxx:758
bool m_bIns
Definition: wrtsh.hxx:584
void Edit()
Definition: wrtsh1.cxx:186
bool m_bClearMark
Definition: wrtsh.hxx:593
bool IsAddMode() const
Definition: wrtsh.hxx:163
void SttSelect()
Definition: select.cxx:385
void UnSelectFrame()
Definition: select.cxx:323
bool IsEndWrd()
Definition: wrtsh1.cxx:194
bool SelNearestWrd()
Definition: select.cxx:63
bool IsExtSel() const
Definition: wrtsh.hxx:188
SwTextFormatColl * GetParaStyle(const OUString &rCollName, GetStyle eCreate=GETSTYLE_NOCREATE)
Definition: wrtsh1.cxx:1801
tools::Long ResetSelect(const Point *, bool)
Definition: select.cxx:333
void ToggleExtMode()
Definition: select.cxx:770
bool SelWrd(const Point *=nullptr)
Definition: select.cxx:73
void Invalidate()
Definition: select.cxx:53
bool m_bLayoutMode
Definition: wrtsh.hxx:589
SAL_DLLPRIVATE void DefaultDrag(const Point *, bool bProp)
Definition: select.cxx:802
SAL_DLLPRIVATE void UpdateLayoutFrame(const Point *, bool bProp)
Definition: select.cxx:749
bool SelectTableRowCol(const Point &rPt, const Point *pEnd=nullptr, bool bRowDrag=false)
Definition: select.cxx:820
bool m_bInSelect
Definition: wrtsh.hxx:585
void EnterAddMode()
Definition: select.cxx:626
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2025
const SwView & GetView() const
Definition: wrtsh.hxx:438
SAL_DLLPRIVATE void ExtSelLn(const Point *, bool bProp)
Definition: select.cxx:505
static UITestLogger & getInstance()
void logEvent(const EventDescription &rDescription)
#define FN_STAT_SELMODE
Definition: cmdid.h:846
Any value
SwDocPositions
Definition: cshtyp.hxx:104
FindRanges
Definition: cshtyp.hxx:91
@ InSel
Find in selections.
#define CNT_OLE
Definition: editsh.hxx:132
#define CNT_GRF
Definition: editsh.hxx:131
SelectionType
#define CH_TXTATR_INWORD
Definition: hintids.hxx:174
#define CH_TXTATR_BREAKWORD
Definition: hintids.hxx:173
CharClass & GetAppCharClass()
Definition: init.cxx:705
Mode eMode
@ FLY_DRAG_START
Definition: mdiexp.hxx:41
@ FLY_DRAG_END
Definition: mdiexp.hxx:41
long Long
bool GoCurrPara(SwPaM &rPam, SwMoveFnCollection const &aPosPara)
Definition: pam.cxx:1188
bool GoCurrSection(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:1230
SwMoveFnCollection const & fnParaStart
Definition: paminit.cxx:46
SwMoveFnCollection const & fnSectionEnd
Definition: paminit.cxx:50
SwMoveFnCollection const & fnParaEnd
Definition: paminit.cxx:47
SwMoveFnCollection const & fnSectionStart
Definition: paminit.cxx:49
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:733
std::map< OUString, OUString > aParameters
sal_Int32 GetContentIndex() const
Definition: pam.hxx:84
ModeStack * pNext
Definition: wrtsh.hxx:518
#define SAL_MAX_INT32
sal_uInt16 sal_Unicode