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
64 struct SearchOptions2;
115 aFnd.pField =
nullptr;
137bool GetRanges(std::vector<std::shared_ptr<SwUnoCursor>> & rRanges,
159 SCROLLWIN = (1 << 1),
164 SAL_DLLPRIVATE
void UpdateCursor(
166 bool bIdleEnd =
false );
239 SAL_DLLPRIVATE
void MoveCursorToNum();
252 SAL_DLLPRIVATE
void MarkListLevel(
const OUString& sListId,
256 bool LeftRight(
bool, sal_uInt16, sal_uInt16,
bool );
257 SAL_DLLPRIVATE
bool UpDown(
bool, sal_uInt16 );
258 SAL_DLLPRIVATE
bool LRMargin(
bool,
bool bAPI =
false );
259 SAL_DLLPRIVATE
bool IsAtLRMargin(
bool,
bool bAPI =
false )
const;
261 SAL_DLLPRIVATE
bool isInHiddenTextFrame(
SwShellCursor* pShellCursor);
263 SAL_DLLPRIVATE
bool GoStartWordImpl();
264 SAL_DLLPRIVATE
bool GoEndWordImpl();
265 SAL_DLLPRIVATE
bool GoNextWordImpl();
266 SAL_DLLPRIVATE
bool GoPrevWordImpl();
267 SAL_DLLPRIVATE
bool GoNextSentenceImpl();
268 SAL_DLLPRIVATE
bool GoEndSentenceImpl();
269 SAL_DLLPRIVATE
bool GoStartSentenceImpl();
273 SAL_DLLPRIVATE
bool CallCursorFN( FNCursor );
274 SAL_DLLPRIVATE
bool CallCursorShellFN( FNCursorShell );
278 SAL_DLLPRIVATE
void sendLOKCursorUpdates();
287 int CompareCursorStackMkCurrPt()
const;
289 bool SelTableRowOrCol(
bool bRow,
bool bRowSimple =
false );
291 bool SetInFrontOfLabel(
bool bNew );
293 void RefreshBlockCursor();
297 SAL_DLLPRIVATE
void UpdateMarkedListLevel();
312 SwPaM * CreateCursor();
314 void DestroyCursor();
316 void TableCursorToCursor();
318 void CursorToBlockCursor();
320 void BlockCursorToCursor();
325 void ExtendedSelectAll(
bool bFootnotes =
true);
327 bool ExtendedSelectedAll();
329 bool StartsWithTable();
331 SwCursor* GetCursor(
bool bMakeTableCursor =
true )
const;
337 void SetSelection(
const SwPaM& rCursor);
344 inline SwPaM* GetStackCursor()
const;
349 void EndAction(
const bool bIdleEnd =
false );
354 bool Left( sal_uInt16 nCnt, sal_uInt16 nMode,
bool bAllowVisual =
false )
355 {
return LeftRight(
true, nCnt, nMode, bAllowVisual ); }
356 bool Right( sal_uInt16 nCnt, sal_uInt16 nMode,
bool bAllowVisual =
false )
357 {
return LeftRight(
false, nCnt, nMode, bAllowVisual ); }
358 bool Up( sal_uInt16 nCnt = 1 ) {
return UpDown(
true, nCnt ); }
359 bool Down( sal_uInt16 nCnt = 1 ) {
return UpDown(
false, nCnt ); }
361 bool RightMargin(
bool bAPI =
false) {
return LRMargin(
false, bAPI ); }
362 bool SttEndDoc(
bool bStt );
394 int SetCursor(
const Point &rPt,
bool bOnlyText =
false,
bool bBlock =
true );
409 inline void SetMark();
410 inline bool HasMark()
const;
421 void NormalizePam(
bool bPointFirst =
true);
424 bool TestCurrPam(
const Point & rPt,
425 bool bTstHit =
false);
430 enum class PopMode { DeleteCurrent, DeleteStack };
445 void SttCursorMove();
446 void EndCursorMove(
const bool bIdleEnd =
false );
454 void ShellLoseFocus();
455 void ShellGetFocus();
461 void ShowCursors(
bool bCursorVis );
468 SwContentFrame *GetCurrFrame(
const bool bCalcFrame =
true )
const;
472 bool IsCursorReadonly()
const;
476 bool HasReadonlySel()
const;
480 void SetReadOnlyAvailable(
bool bFlag );
481 bool IsOverReadOnlyPos(
const Point& rPt )
const;
500 bool HasSelection()
const;
503 inline bool IsSelection()
const;
505 inline bool IsMultiSelection()
const;
508 bool IsSelFullPara()
const;
513 bool ShouldWait()
const;
516 bool IsSelOnePara()
const;
534 void GetPageNum( sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum,
535 bool bAtCursorPos =
true,
const bool bCalcFrame =
true );
538 sal_uInt16 GetPageNumSeqNonEmpty();
541 sal_uInt16 GetNextPrevPageNum(
bool bNext =
true );
544 bool GotoPage( sal_uInt16 nPage );
546 sal_uInt16 GetPageCnt();
552 void GoNextPrevCursorSetSearchLabel(
const bool bNext);
557 const OUString& rName,
561 const OUString& rName,
563 const OUString& rCondition);
564 bool GotoMark( const ::sw::mark::IMark*
const pMark );
565 bool GotoMark( const ::sw::mark::IMark*
const pMark,
bool bAtStart );
566 bool GoNextBookmark();
567 bool GoPrevBookmark();
569 bool IsFormProtected();
573 bool GotoFieldmark( const ::sw::mark::IFieldmark*
const pMark );
577 void UpdateCursorPos();
581 OUString GetSelText()
const;
586 bool IsCursorInFootnote()
const;
588 inline Point& GetCursorDocPos()
const;
589 inline bool IsCursorPtAtEnd()
const;
591 inline const SwPaM* GetTableCrs()
const;
592 inline SwPaM* GetTableCrs();
594 bool IsTableComplexForChart();
596 OUString GetBoxNms()
const;
599 bool GoNextCell(
bool bAppendLine =
true );
602 bool GotoTable(
const OUString& rName );
614 bool GotoOutline(
const OUString& rName );
622 bool bWithChildren,
bool bKillPams =
true );
624 bool GotoNextOutline();
625 bool GotoPrevOutline();
643 {
return const_cast<SwCursorShell*
>(
this)->getShellCursor( bBlock ); }
652 size_t UpdateTableSelBoxes();
654 bool GotoFootnoteText();
655 bool GotoFootnoteAnchor();
656 bool GotoPrevFootnoteAnchor();
657 bool GotoNextFootnoteAnchor();
659 void GotoFlyAnchor();
660 bool GotoHeaderText();
661 bool GotoFooterText();
663 bool SetCursorInHdFt(
size_t nDescNo,
bool bInHeader );
666 bool IsInHeaderFooter(
bool* pbInHeader =
nullptr )
const;
668 bool GotoNextTOXBase(
const OUString* =
nullptr );
669 bool GotoPrevTOXBase(
const OUString* =
nullptr );
670 void GotoTOXMarkBase();
672 bool GotoNxtPrvTOXMark(
bool bNext =
true );
678 bool GotoNxtPrvTableFormula(
bool bNext =
true,
679 bool bOnlyErrors =
false );
682 bool SelectNxtPrvHyperlink(
bool bNext );
684 bool GotoRefMark(
const OUString& rRefMark, sal_uInt16 nSubType,
689 bool ExtendSelection(
bool bEnd =
true, sal_Int32 nCount = 1 );
694 bool SetVisibleCursor(
const Point &rPt );
695 inline void UnSetVisibleCursor();
703 const bool bAddSetExpressionFieldsToInputFields =
true );
711 const bool bIncludeInputFieldAtStart );
713 const SwPaM* pCursor,
714 const bool bIncludeInputFieldAtStart );
715 static SwField* GetFieldAtCursor(
716 const SwPaM* pCursor,
717 const bool bIncludeInputFieldAtStart );
718 SwField* GetCurField(
const bool bIncludeInputFieldAtStart =
false )
const;
719 bool CursorInsideInputField()
const;
720 bool CursorInsideContentControl()
const;
721 static bool PosInsideInputField(
const SwPosition& rPos );
722 bool DocPtInsideInputField(
const Point& rDocPt )
const;
723 static sal_Int32 StartOfInputFieldAtPos(
const SwPosition& rPos );
724 static sal_Int32 EndOfInputFieldAtPos(
const SwPosition& rPos );
728 sal_uInt16 GetCursorCnt(
bool bAll =
true )
const;
735 bool GoNextSentence();
736 bool GoStartSentence();
737 bool GoEndSentence();
738 bool SelectWord(
const Point* pPt );
739 void ExpandToSentenceBorders();
742 bool IsStartWord( sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES )
const;
743 bool IsEndWord( sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES )
const;
744 bool IsInWord( sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES )
const;
745 bool IsStartSentence()
const;
746 bool IsEndSentence()
const;
747 bool IsSttPara()
const;
748 bool IsEndPara()
const;
749 bool IsEndOfTable()
const;
750 bool IsStartOfDoc()
const;
751 bool IsEndOfDoc()
const;
752 bool IsInFrontOfLabel()
const;
760 bool ParkTableCursor();
770 bool GotoRegion( std::u16string_view rName );
773 virtual void MakeSelVisible();
776 bool FindValidContentNode(
bool bOnlyText );
778 bool GetContentAtPos(
const Point& rPt,
780 bool bSetCursor =
false,
781 SwRect* pFieldRect =
nullptr );
786 void GetSmartTagRect(
const Point& rPt,
SwRect& rSelectRect );
789 void GetSmartTagTerm( std::vector< OUString >& rSmartTagTypes,
790 css::uno::Sequence< css::uno::Reference< css::container::XStringKeyMap > >& rStringKeyMaps,
791 css::uno::Reference<css::text::XTextRange>& rRange )
const;
793 bool IsPageAtPos(
const Point &rPt )
const;
795 bool SelectTextAttr( sal_uInt16 nWhich,
bool bExpand,
const SwTextAttr* pAttr =
nullptr );
799 bool SelectTextModel(sal_Int32 nStart, sal_Int32 nEnd);
800#ifdef SW_DLLIMPLEMENTATION
806 bool CheckTableBoxContent(
const SwPosition* pPos =
nullptr );
807 void SaveTableBoxContent(
const SwPosition* pPos =
nullptr );
808 void ClearTableBoxContent();
809 bool EndAllTableBoxEdit();
820 bool GetShadowCursorPos(
const Point& rPt,
SwFillMode eFillMode,
821 SwRect& rRect, sal_Int16& rOrient );
822 bool SetShadowCursorPos(
const Point& rPt,
SwFillMode eFillMode );
830 SAL_DLLPRIVATE
SvxFrameDirection GetTextDirection(
const Point* pPt =
nullptr )
const;
832 bool IsInVerticalText(
const Point* pPt =
nullptr )
const;
834 bool IsInRightToLeftText()
const;
836 static void FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage);
837 bool bColumnChange();
838 static void FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection);
839 static void FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn);
842 bool SelectHiddenRange();
845 void ClearUpCursors();
849 m_bMacroExecAllowed = _bMacroExecAllowed;
853 return m_bMacroExecAllowed;
865 OUString GetCursorDescr()
const;
869 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
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.
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
bool Left(sal_uInt16 nCnt, sal_uInt16 nMode, bool bAllowVisual=false)
SwTableBox * m_pBoxPtr
table row
bool Right(sal_uInt16 nCnt, sal_uInt16 nMode, bool bAllowVisual=false)
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()
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 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 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
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.
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Marks a node in the document model.
SwTableNode * FindTableNode()
Search table node, in which it is.
PaM is Point and Mark: a selection of the document model.
SwNode & GetNode(bool bPoint=true) 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.
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,...
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")