19#ifndef INCLUDED_SW_INC_CRSRSH_HXX
20#define INCLUDED_SW_INC_CRSRSH_HXX
22#include <com/sun/star/i18n/WordType.hpp>
24#include <rtl/ustring.hxx>
29#ifdef SW_DLLIMPLEMENTATION
67 struct SearchOptions2;
120 aFnd.pField =
nullptr;
142bool GetRanges(std::vector<std::shared_ptr<SwUnoCursor>> & rRanges,
149 ,
public sw::BroadcastingModify
164 SCROLLWIN = (1 << 1),
169 SAL_DLLPRIVATE
void UpdateCursor(
171 bool bIdleEnd =
false );
248 SAL_DLLPRIVATE
void MoveCursorToNum();
261 SAL_DLLPRIVATE
void MarkListLevel(
const OUString& sListId,
266 SAL_DLLPRIVATE
bool UpDown(
bool, sal_uInt16 );
267 SAL_DLLPRIVATE
bool LRMargin(
bool,
bool bAPI =
false );
268 SAL_DLLPRIVATE
bool IsAtLRMargin(
bool,
bool bAPI =
false )
const;
270 SAL_DLLPRIVATE
bool isInHiddenTextFrame(
SwShellCursor* pShellCursor);
272 SAL_DLLPRIVATE
bool GoStartWordImpl();
273 SAL_DLLPRIVATE
bool GoEndWordImpl();
274 SAL_DLLPRIVATE
bool GoNextWordImpl();
275 SAL_DLLPRIVATE
bool GoPrevWordImpl();
276 SAL_DLLPRIVATE
bool GoNextSentenceImpl();
277 SAL_DLLPRIVATE
bool GoEndSentenceImpl();
278 SAL_DLLPRIVATE
bool GoStartSentenceImpl();
282 SAL_DLLPRIVATE
bool CallCursorFN( FNCursor );
283 SAL_DLLPRIVATE
bool CallCursorShellFN( FNCursorShell );
287 SAL_DLLPRIVATE
void sendLOKCursorUpdates();
296 int CompareCursorStackMkCurrPt()
const;
298 bool SelTableRowOrCol(
bool bRow,
bool bRowSimple =
false );
300 bool SetInFrontOfLabel(
bool bNew );
302 void RefreshBlockCursor();
306 SAL_DLLPRIVATE
void UpdateMarkedListLevel();
321 SwPaM * CreateCursor();
323 void DestroyCursor();
325 void TableCursorToCursor();
327 void CursorToBlockCursor();
329 void BlockCursorToCursor();
334 void ExtendedSelectAll(
bool bFootnotes =
true);
336 ::std::optional<::std::pair<SwNode const*, ::std::vector<SwTableNode*>>> ExtendedSelectedAll()
const;
341 SwCursor* GetCursor(
bool bMakeTableCursor =
true )
const;
347 void SetSelection(
const SwPaM& rCursor);
350 void ParkCursor(
const SwNode &rIdx );
354 inline SwPaM* GetStackCursor()
const;
359 void EndAction(
const bool bIdleEnd =
false );
365 {
return LeftRight(
true, nCnt, nMode, bAllowVisual ); }
367 {
return LeftRight(
false, nCnt, nMode, bAllowVisual ); }
368 bool Up( sal_uInt16 nCnt = 1 ) {
return UpDown(
true, nCnt ); }
369 bool Down( sal_uInt16 nCnt = 1 ) {
return UpDown(
false, nCnt ); }
371 bool RightMargin(
bool bAPI =
false) {
return LRMargin(
false, bAPI ); }
372 bool SttEndDoc(
bool bStt );
393 sal_Int32 FindAttrs(
const SfxItemSet& rSet,
bool bNoCollections,
404 int SetCursor(
const Point &rPt,
bool bOnlyText =
false,
bool bBlock =
true );
419 inline void SetMark();
420 inline bool HasMark()
const;
431 void NormalizePam(
bool bPointFirst =
true);
434 bool TestCurrPam(
const Point & rPt,
435 bool bTstHit =
false);
440 enum class PopMode { DeleteCurrent, DeleteStack };
456 void SttCursorMove();
457 void EndCursorMove(
const bool bIdleEnd =
false );
465 void ShellLoseFocus();
466 void ShellGetFocus();
472 void ShowCursors(
bool bCursorVis );
482 SwContentFrame *GetCurrFrame(
const bool bCalcFrame =
true )
const;
486 bool IsCursorReadonly()
const;
490 bool HasReadonlySel(
bool isReplace =
false)
const;
491 bool HasHiddenSections()
const;
495 void SetReadOnlyAvailable(
bool bFlag );
496 bool IsOverReadOnlyPos(
const Point& rPt )
const;
515 bool HasSelection()
const;
518 inline bool IsSelection()
const;
520 inline bool IsMultiSelection()
const;
523 bool IsSelFullPara()
const;
528 bool ShouldWait()
const;
531 bool IsSelOnePara()
const;
549 void GetPageNum( sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum,
550 bool bAtCursorPos =
true,
const bool bCalcFrame =
true );
553 sal_uInt16 GetPageNumSeqNonEmpty();
556 sal_uInt16 GetNextPrevPageNum(
bool bNext =
true );
561 sal_uInt16 GetPageCnt();
567 void GoNextPrevCursorSetSearchLabel(
const bool bNext);
572 const OUString& rName,
576 const OUString& rName,
578 const OUString& rCondition);
579 bool GotoMark( const ::sw::mark::IMark*
const pMark );
580 bool GotoMark( const ::sw::mark::IMark*
const pMark,
bool bAtStart );
581 bool GoNextBookmark();
582 bool GoPrevBookmark();
584 bool IsFormProtected();
585 ::sw::mark::IFieldmark* GetCurrentFieldmark();
586 sw::mark::IFieldmark* GetFieldmarkAfter(
bool bLoop);
587 sw::mark::IFieldmark* GetFieldmarkBefore(
bool bLoop);
588 bool GotoFieldmark( const ::sw::mark::IFieldmark*
const pMark );
592 void UpdateCursorPos();
596 OUString GetSelText()
const;
600 bool MoveOutOfTable();
601 bool TrySelectOuterTable();
602 bool MoveStartText();
604 bool IsCursorInFootnote()
const;
606 inline Point& GetCursorDocPos()
const;
608 Point GetCursorPagePos()
const;
609 inline bool IsCursorPtAtEnd()
const;
611 inline const SwPaM* GetTableCrs()
const;
612 inline SwPaM* GetTableCrs();
614 bool IsTableComplexForChart();
616 OUString GetBoxNms()
const;
619 bool GoNextCell(
bool bAppendLine =
true );
622 bool GotoTable(
const OUString& rName );
634 bool GotoOutline(
const OUString& rName );
642 bool bWithChildren,
bool bKillPams =
true );
644 bool GotoNextOutline();
645 bool GotoPrevOutline();
663 {
return const_cast<SwCursorShell*
>(
this)->getShellCursor( bBlock ); }
672 size_t UpdateTableSelBoxes();
674 bool GotoFootnoteText();
675 bool GotoFootnoteAnchor();
676 bool GotoPrevFootnoteAnchor();
677 bool GotoNextFootnoteAnchor();
679 void GotoFlyAnchor();
680 bool GotoHeaderText();
681 bool GotoFooterText();
683 bool SetCursorInHdFt(
size_t nDescNo,
bool bInHeader,
bool bEven =
false,
bool bFirst =
false);
686 bool IsInHeaderFooter(
bool* pbInHeader =
nullptr )
const;
688 bool GotoNextTOXBase(
const OUString* =
nullptr );
689 bool GotoPrevTOXBase(
const OUString* =
nullptr );
690 void GotoTOXMarkBase();
692 bool GotoNxtPrvTOXMark(
bool bNext =
true );
698 bool GotoNxtPrvTableFormula(
bool bNext =
true,
699 bool bOnlyErrors =
false );
702 bool SelectNxtPrvHyperlink(
bool bNext );
704 bool GotoRefMark(
const OUString& rRefMark, sal_uInt16 nSubType,
709 bool ExtendSelection(
bool bEnd =
true, sal_Int32 nCount = 1 );
714 bool SetVisibleCursor(
const Point &rPt );
715 inline void UnSetVisibleCursor();
723 const bool bAddSetExpressionFieldsToInputFields =
true );
729 void GotoFormControl(
bool bNext);
735 const SwPaM* pCursor,
737 static SwField* GetFieldAtCursor(
738 const SwPaM* pCursor,
739 const bool bIncludeInputFieldAtStart );
740 SwField* GetCurField(
const bool bIncludeInputFieldAtStart =
false )
const;
741 bool CursorInsideInputField()
const;
743 static bool PosInsideInputField(
const SwPosition& rPos );
744 bool DocPtInsideInputField(
const Point& rDocPt )
const;
745 static sal_Int32 StartOfInputFieldAtPos(
const SwPosition& rPos );
746 static sal_Int32 EndOfInputFieldAtPos(
const SwPosition& rPos );
750 sal_uInt16 GetCursorCnt(
bool bAll =
true )
const;
757 bool GoNextSentence();
758 bool GoStartSentence();
759 bool GoEndSentence();
760 bool SelectWord(
const Point* pPt );
761 void ExpandToSentenceBorders();
764 bool IsStartWord( sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES )
const;
765 bool IsEndWord( sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES )
const;
766 bool IsInWord( sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES )
const;
767 bool IsStartSentence()
const;
768 bool IsEndSentence()
const;
769 bool IsSttPara()
const;
770 bool IsEndPara()
const;
771 bool IsEndOfTable()
const;
772 bool IsStartOfDoc()
const;
773 bool IsEndOfDoc()
const;
774 bool IsInFrontOfLabel()
const;
782 bool ParkTableCursor();
792 bool GotoRegion( std::u16string_view rName );
795 virtual void MakeSelVisible();
798 bool FindValidContentNode(
bool bOnlyText );
800 bool GetContentAtPos(
const Point& rPt,
802 bool bSetCursor =
false,
803 SwRect* pFieldRect =
nullptr );
808 void GetSmartTagRect(
const Point& rPt,
SwRect& rSelectRect );
811 void GetSmartTagTerm( std::vector< OUString >& rSmartTagTypes,
812 css::uno::Sequence< css::uno::Reference< css::container::XStringKeyMap > >& rStringKeyMaps,
813 css::uno::Reference<css::text::XTextRange>& rRange )
const;
815 bool IsPageAtPos(
const Point &rPt )
const;
817 bool SelectTextAttr( sal_uInt16 nWhich,
bool bExpand,
const SwTextAttr* pAttr =
nullptr );
821 bool SelectTextModel(sal_Int32 nStart, sal_Int32 nEnd);
822#ifdef SW_DLLIMPLEMENTATION
828 bool CheckTableBoxContent(
const SwPosition* pPos =
nullptr );
829 void SaveTableBoxContent(
const SwPosition* pPos =
nullptr );
830 void ClearTableBoxContent();
831 bool EndAllTableBoxEdit();
843 SwRect& rRect, sal_Int16& rOrient );
854 bool IsInVerticalText(
const Point* pPt =
nullptr )
const;
856 bool IsInRightToLeftText()
const;
858 static void FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage);
859 bool bColumnChange();
860 static void FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection);
861 static void FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn);
864 bool IsInHiddenRange(
const bool bSelect);
867 void ClearUpCursors();
871 m_bMacroExecAllowed = _bMacroExecAllowed;
875 return m_bMacroExecAllowed;
887 OUString GetCursorDescr()
const;
891 OUString getPageRectangles();
Access to the block cursor.
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
tools::Long m_nLeftFramePos
bool Pop(PopMode, ::std::optional< SwCallLink > &roLink)
tools::Long GetUpDownX() const
bool IsAtLeftMargin() const
void SetAutoUpdateCells(bool bFlag)
const SwPaM * GetTableCrs() const
bool m_bSetCursorInReadOnly
void SetOverwriteCursor(bool bFlag)
bool IsReadOnlyAvailable() const
void SetMacroExecAllowed(const bool _bMacroExecAllowed)
bool m_bInCMvVisportChgd
Flag for CursorMoves.
bool m_bSendAccessibleCursorEvents
SwShellCursor * GetCursor_()
const SwRect & GetCharRect() const
const Link< LinkParamNone *, void > & GetChgLnk() const
bool IsMacroExecAllowed() const
Point & GetCursorDocPos() const
Point m_aOldRBPos
Right/Bottom of last VisArea.
SwTable::SearchType m_eEnhancedTableSel
SwPaM * GetStackCursor() const
tools::Long m_nUpDownX
try to move the cursor on up/down always in the same column
SwNodeIndex * m_pBoxIdx
for recognizing of the changed
bool m_bChgCallFlag
attribute change inside Start- and EndAction
const SwShellCursor * GetCursor_() const
void SetFlyMacroLnk(const Link< const SwFlyFrameFormat *, void > &rLnk)
bool IsMultiSelection() const
CursorMoveState m_eMvState
Status for Cursor-Travelling - GetModelPositionForViewPoint.
bool IsCursorVisible() const
Point m_aCursorHeight
height & offset from visible Cursor
SwBlockCursor * m_pBlockCursor
interface of cursor for block (=rectangular) selection
bool m_bAllProtect
Flag for areas.
bool RightMargin(bool bAPI=false)
bool IsSelTableCells() const
SwShellTableCursor * GetTableCursor()
void SetSelTableCells(bool bFlag)
bool m_bCallChgLnk
flag for derived classes
SwTableBox * m_pBoxPtr
table row
SwMoveFnCollection const & MakeFindRange(SwDocPositions, SwDocPositions, SwPaM *) const
Link< const SwFlyFrameFormat *, void > m_aFlyMacroLnk
Link will be called, if the Cursor is set into a fly.
const SwShellTableCursor * GetTableCursor() const
void UnsetEnhancedTableSelection()
bool Right(sal_uInt16 nCnt, SwCursorSkipMode nMode, bool bAllowVisual=false)
SwVisibleCursor * m_pVisibleCursor
the visible cursor
SwShellCursor * m_pStackCursor
stack for the cursor
bool IsAtRightMargin() const
const Link< const SwFlyFrameFormat *, void > & GetFlyMacroLnk() const
const Link< SwCursorShell &, void > & GetGrfArrivedLnk() const
bool IsAutoUpdateCells() const
bool IsSendAccessibleCursorEvents() const
bool Down(sal_uInt16 nCnt=1)
const SwShellCursor * getShellCursor(bool bBlock) const
Link< SwCursorShell &, void > m_aGrfArrivedLnk
Link calls to UI if a graphic is arrived.
SwNodeType m_nCurrentNdTyp
bool IsOverwriteCursor() const
bool m_bSVCursorVis
SV-Cursor visible/invisible.
OUString m_sMarkedListId
table rows or columns selected by not cell by cell
SwRect m_aCharRect
Char-SRectangle on which the cursor is located.
SwTable::SearchType GetEnhancedTableSelection() const
SwShellTableCursor * m_pTableCursor
table Cursor; only in tables when the selection lays over 2 columns
void SetChgLnk(const Link< LinkParamNone *, void > &rLnk)
CursorFlag
for calling UpdateCursor
@ CHKRANGE
check overlapping PaMs
bool Left(sal_uInt16 nCnt, SwCursorSkipMode nMode, bool bAllowVisual=false)
bool HasShellFocus() const
void SetGrfArrivedLnk(const Link< SwCursorShell &, void > &rLnk)
SwNodeOffset m_nCurrentNode
Link< LinkParamNone *, void > m_aChgLnk
link will be called by every attribute/ format changes at cursor position.
bool m_bHasFocus
Shell is "active" in a window.
SwShellCursor * m_pCurrentCursor
current cursor
bool IsCursorPtAtEnd() const
bool Up(sal_uInt16 nCnt=1)
sal_Int32 m_nCurrentContent
void SetSendAccessibleCursorEvents(bool bEnable)
bool IsAllProtect() const
void UnSetVisibleCursor()
bool m_bVisPortChgd
in VisPortChg-Call
SwMoveFnCollection const & MakeFindRange(SwDocPositions, SwDocPositions, SwPaM *) const
set range for search in document
Instances of SwFields and those derived from it occur 0 to n times.
Base class of all fields.
SfxPoolItem subclass that wraps an SwContentControl.
Base class of the Writer layout elements.
Marks a node in the document model.
Base class of the Writer document model elements.
PaM is Point and Mark: a selection of the document model.
const SwPosition * End() const
const SwPosition * GetPoint() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Of course Writer needs its own rectangles.
bool Overlaps(const SwRect &rRect) const
vector_type::size_type size_type
The root element of a Writer document layout.
SwSelPaintRects is a base class of SwShellCursor, which stores the overlay for the cursor/selection: ...
Represents the current text cursor of one opened edit window.
SwShellCursor * GetNext()
const Point & GetPtPos() const
virtual void SetMark() override
Unless this is called, the getter method of Mark will return Point.
SwTableBox is one table cell in the document model.
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
SwTextAttr subclass that tracks the location of the wrapped SwFormatContentControl.
Represents the style of a paragraph.
SwTextAttr subclass that tracks the location of the wrapped SwFormatURL.
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
void EndAction(const bool bIdleEnd=false)
const SwRect & VisArea() const
virtual void VisPortChgd(const SwRect &)
void SetDragCursor(bool bFlag=true)
std::vector< Value >::size_type size_type
The Undo actions need to create new Shell cursors.
virtual SwCursor & GetCurrentShellCursor()=0
virtual SwCursor & CreateNewShellCursor()=0
static SwCursorShell::StartsWith StartsWith(SwStartNode const &rStart)
@ CurrAttrs
only for debugging
@ TableBoxValue
only for debugging
bool(* SwWhichTable)(SwPaM &, SwMoveFnCollection const &, bool bInReadOnly)
SwContentFrame *(* SwPosColumn)(const SwLayoutFrame *)
bool(* SwWhichPara)(SwPaM &, SwMoveFnCollection const &)
SwLayoutFrame *(* SwWhichColumn)(const SwLayoutFrame *)
bool(* SwWhichRegion)(SwPaM &, SwMoveFnCollection const &, bool bInReadOnly)
SwLayoutFrame *(* SwWhichPage)(const SwLayoutFrame *)
SwContentFrame *(* SwPosPage)(const SwLayoutFrame *)
bool(* SwWhichSection)(SwPaM &, SwMoveFnCollection const &)
struct _xmlTextWriter * xmlTextWriterPtr
Dialog to specify the properties of date form field.
std::optional< OUString > ReplaceBackReferences(const i18nutil::SearchOptions2 &rSearchOpt, SwPaM *const pPam, SwRootFrame const *const pLayout)
Helperfunction to resolve backward references in regular expressions.
bool GetRanges(std::vector< std::shared_ptr< SwUnoCursor > > &rRanges, SwDoc &rDoc, SwPaM const &rDelPam)
bool ReplaceImpl(SwPaM &rCursor, OUString const &rReplacement, bool const bRegExp, SwDoc &rDoc, SwRootFrame const *const pLayout)
union SwContentAtPos::@21 aFnd
const SwRangeRedline * pRedl
bool IsInProtectSect() const
is the node in a protected section?
const SfxPoolItem * pAttr
SwContentAtPos(IsAttrAtPos eGetAtPos)
const SwTextAttr * pFndTextAttr
IsAttrAtPos eContentAtPos
const sw::mark::IFieldmark * pFieldmark
Marks a position in the document model.
bool GetAutoSumSel(const SwCursorShell &rShell, SwCellFrames &rBoxes)
std::deque< SwCellFrame * > SwCellFrames
constexpr OUStringLiteral UPDOWN(u"UpDown")