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;
118 aFnd.pField =
nullptr;
140bool GetRanges(std::vector<std::shared_ptr<SwUnoCursor>> & rRanges,
147 ,
public sw::BroadcastingModify
162 SCROLLWIN = (1 << 1),
167 SAL_DLLPRIVATE
void UpdateCursor(
169 bool bIdleEnd =
false );
246 SAL_DLLPRIVATE
void MoveCursorToNum();
259 SAL_DLLPRIVATE
void MarkListLevel(
const OUString& sListId,
264 SAL_DLLPRIVATE
bool UpDown(
bool, sal_uInt16 );
265 SAL_DLLPRIVATE
bool LRMargin(
bool,
bool bAPI =
false );
266 SAL_DLLPRIVATE
bool IsAtLRMargin(
bool,
bool bAPI =
false )
const;
268 SAL_DLLPRIVATE
bool isInHiddenTextFrame(
SwShellCursor* pShellCursor);
270 SAL_DLLPRIVATE
bool GoStartWordImpl();
271 SAL_DLLPRIVATE
bool GoEndWordImpl();
272 SAL_DLLPRIVATE
bool GoNextWordImpl();
273 SAL_DLLPRIVATE
bool GoPrevWordImpl();
274 SAL_DLLPRIVATE
bool GoNextSentenceImpl();
275 SAL_DLLPRIVATE
bool GoEndSentenceImpl();
276 SAL_DLLPRIVATE
bool GoStartSentenceImpl();
280 SAL_DLLPRIVATE
bool CallCursorFN( FNCursor );
281 SAL_DLLPRIVATE
bool CallCursorShellFN( FNCursorShell );
285 SAL_DLLPRIVATE
void sendLOKCursorUpdates();
294 int CompareCursorStackMkCurrPt()
const;
296 bool SelTableRowOrCol(
bool bRow,
bool bRowSimple =
false );
298 bool SetInFrontOfLabel(
bool bNew );
300 void RefreshBlockCursor();
304 SAL_DLLPRIVATE
void UpdateMarkedListLevel();
319 SwPaM * CreateCursor();
321 void DestroyCursor();
323 void TableCursorToCursor();
325 void CursorToBlockCursor();
327 void BlockCursorToCursor();
332 void ExtendedSelectAll(
bool bFootnotes =
true);
334 bool ExtendedSelectedAll();
336 bool StartsWithTable();
338 SwCursor* GetCursor(
bool bMakeTableCursor =
true )
const;
344 void SetSelection(
const SwPaM& rCursor);
347 void ParkCursor(
const SwNode &rIdx );
351 inline SwPaM* GetStackCursor()
const;
356 void EndAction(
const bool bIdleEnd =
false );
362 {
return LeftRight(
true, nCnt, nMode, bAllowVisual ); }
364 {
return LeftRight(
false, nCnt, nMode, bAllowVisual ); }
365 bool Up( sal_uInt16 nCnt = 1 ) {
return UpDown(
true, nCnt ); }
366 bool Down( sal_uInt16 nCnt = 1 ) {
return UpDown(
false, nCnt ); }
368 bool RightMargin(
bool bAPI =
false) {
return LRMargin(
false, bAPI ); }
369 bool SttEndDoc(
bool bStt );
390 sal_Int32 FindAttrs(
const SfxItemSet& rSet,
bool bNoCollections,
401 int SetCursor(
const Point &rPt,
bool bOnlyText =
false,
bool bBlock =
true );
416 inline void SetMark();
417 inline bool HasMark()
const;
428 void NormalizePam(
bool bPointFirst =
true);
431 bool TestCurrPam(
const Point & rPt,
432 bool bTstHit =
false);
437 enum class PopMode { DeleteCurrent, DeleteStack };
453 void SttCursorMove();
454 void EndCursorMove(
const bool bIdleEnd =
false );
462 void ShellLoseFocus();
463 void ShellGetFocus();
469 void ShowCursors(
bool bCursorVis );
479 SwContentFrame *GetCurrFrame(
const bool bCalcFrame =
true )
const;
483 bool IsCursorReadonly()
const;
487 bool HasReadonlySel(
bool isReplace =
false)
const;
491 void SetReadOnlyAvailable(
bool bFlag );
492 bool IsOverReadOnlyPos(
const Point& rPt )
const;
511 bool HasSelection()
const;
514 inline bool IsSelection()
const;
516 inline bool IsMultiSelection()
const;
519 bool IsSelFullPara()
const;
524 bool ShouldWait()
const;
527 bool IsSelOnePara()
const;
545 void GetPageNum( sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum,
546 bool bAtCursorPos =
true,
const bool bCalcFrame =
true );
549 sal_uInt16 GetPageNumSeqNonEmpty();
552 sal_uInt16 GetNextPrevPageNum(
bool bNext =
true );
555 bool GotoPage( sal_uInt16 nPage );
557 sal_uInt16 GetPageCnt();
563 void GoNextPrevCursorSetSearchLabel(
const bool bNext);
568 const OUString& rName,
572 const OUString& rName,
574 const OUString& rCondition);
575 bool GotoMark( const ::sw::mark::IMark*
const pMark );
576 bool GotoMark( const ::sw::mark::IMark*
const pMark,
bool bAtStart );
577 bool GoNextBookmark();
578 bool GoPrevBookmark();
580 bool IsFormProtected();
581 ::sw::mark::IFieldmark* GetCurrentFieldmark();
582 sw::mark::IFieldmark* GetFieldmarkAfter(
bool bLoop);
583 sw::mark::IFieldmark* GetFieldmarkBefore(
bool bLoop);
584 bool GotoFieldmark( const ::sw::mark::IFieldmark*
const pMark );
588 void UpdateCursorPos();
592 OUString GetSelText()
const;
597 bool IsCursorInFootnote()
const;
599 inline Point& GetCursorDocPos()
const;
600 inline bool IsCursorPtAtEnd()
const;
602 inline const SwPaM* GetTableCrs()
const;
603 inline SwPaM* GetTableCrs();
605 bool IsTableComplexForChart();
607 OUString GetBoxNms()
const;
610 bool GoNextCell(
bool bAppendLine =
true );
613 bool GotoTable(
const OUString& rName );
625 bool GotoOutline(
const OUString& rName );
633 bool bWithChildren,
bool bKillPams =
true );
635 bool GotoNextOutline();
636 bool GotoPrevOutline();
654 {
return const_cast<SwCursorShell*
>(
this)->getShellCursor( bBlock ); }
663 size_t UpdateTableSelBoxes();
665 bool GotoFootnoteText();
666 bool GotoFootnoteAnchor();
667 bool GotoPrevFootnoteAnchor();
668 bool GotoNextFootnoteAnchor();
670 void GotoFlyAnchor();
671 bool GotoHeaderText();
672 bool GotoFooterText();
674 bool SetCursorInHdFt(
size_t nDescNo,
bool bInHeader );
677 bool IsInHeaderFooter(
bool* pbInHeader =
nullptr )
const;
679 bool GotoNextTOXBase(
const OUString* =
nullptr );
680 bool GotoPrevTOXBase(
const OUString* =
nullptr );
681 void GotoTOXMarkBase();
683 bool GotoNxtPrvTOXMark(
bool bNext =
true );
689 bool GotoNxtPrvTableFormula(
bool bNext =
true,
690 bool bOnlyErrors =
false );
693 bool SelectNxtPrvHyperlink(
bool bNext );
695 bool GotoRefMark(
const OUString& rRefMark, sal_uInt16 nSubType,
700 bool ExtendSelection(
bool bEnd =
true, sal_Int32 nCount = 1 );
705 bool SetVisibleCursor(
const Point &rPt );
706 inline void UnSetVisibleCursor();
714 const bool bAddSetExpressionFieldsToInputFields =
true );
724 const SwPaM* pCursor,
726 static SwField* GetFieldAtCursor(
727 const SwPaM* pCursor,
728 const bool bIncludeInputFieldAtStart );
729 SwField* GetCurField(
const bool bIncludeInputFieldAtStart =
false )
const;
730 bool CursorInsideInputField()
const;
732 static bool PosInsideInputField(
const SwPosition& rPos );
733 bool DocPtInsideInputField(
const Point& rDocPt )
const;
734 static sal_Int32 StartOfInputFieldAtPos(
const SwPosition& rPos );
735 static sal_Int32 EndOfInputFieldAtPos(
const SwPosition& rPos );
739 sal_uInt16 GetCursorCnt(
bool bAll =
true )
const;
746 bool GoNextSentence();
747 bool GoStartSentence();
748 bool GoEndSentence();
749 bool SelectWord(
const Point* pPt );
750 void ExpandToSentenceBorders();
753 bool IsStartWord( sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES )
const;
754 bool IsEndWord( sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES )
const;
755 bool IsInWord( sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES )
const;
756 bool IsStartSentence()
const;
757 bool IsEndSentence()
const;
758 bool IsSttPara()
const;
759 bool IsEndPara()
const;
760 bool IsEndOfTable()
const;
761 bool IsStartOfDoc()
const;
762 bool IsEndOfDoc()
const;
763 bool IsInFrontOfLabel()
const;
771 bool ParkTableCursor();
781 bool GotoRegion( std::u16string_view rName );
784 virtual void MakeSelVisible();
787 bool FindValidContentNode(
bool bOnlyText );
789 bool GetContentAtPos(
const Point& rPt,
791 bool bSetCursor =
false,
792 SwRect* pFieldRect =
nullptr );
797 void GetSmartTagRect(
const Point& rPt,
SwRect& rSelectRect );
800 void GetSmartTagTerm( std::vector< OUString >& rSmartTagTypes,
801 css::uno::Sequence< css::uno::Reference< css::container::XStringKeyMap > >& rStringKeyMaps,
802 css::uno::Reference<css::text::XTextRange>& rRange )
const;
804 bool IsPageAtPos(
const Point &rPt )
const;
806 bool SelectTextAttr( sal_uInt16 nWhich,
bool bExpand,
const SwTextAttr* pAttr =
nullptr );
810 bool SelectTextModel(sal_Int32 nStart, sal_Int32 nEnd);
811#ifdef SW_DLLIMPLEMENTATION
817 bool CheckTableBoxContent(
const SwPosition* pPos =
nullptr );
818 void SaveTableBoxContent(
const SwPosition* pPos =
nullptr );
819 void ClearTableBoxContent();
820 bool EndAllTableBoxEdit();
831 bool GetShadowCursorPos(
const Point& rPt,
SwFillMode eFillMode,
832 SwRect& rRect, sal_Int16& rOrient );
833 bool SetShadowCursorPos(
const Point& rPt,
SwFillMode eFillMode );
841 SAL_DLLPRIVATE
SvxFrameDirection GetTextDirection(
const Point* pPt =
nullptr )
const;
843 bool IsInVerticalText(
const Point* pPt =
nullptr )
const;
845 bool IsInRightToLeftText()
const;
847 static void FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage);
848 bool bColumnChange();
849 static void FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection);
850 static void FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn);
853 bool SelectHiddenRange();
856 void ClearUpCursors();
860 m_bMacroExecAllowed = _bMacroExecAllowed;
864 return m_bMacroExecAllowed;
876 OUString GetCursorDescr()
const;
880 OUString getPageRectangles();
struct _xmlTextWriter * xmlTextWriterPtr
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)
const SwTableNode * IsCursorInTable() const
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.
SwTableNode * FindTableNode()
Search table node, in which it is.
PaM is Point and Mark: a selection of the document model.
SwNode & GetPointNode() const
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.
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
@ 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 &)
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)
const SwRangeRedline * pRedl
union SwContentAtPos::@24 aFnd
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")