diff options
Diffstat (limited to 'sw/inc/crsrsh.hxx')
-rw-r--r-- | sw/inc/crsrsh.hxx | 286 |
1 files changed, 160 insertions, 126 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 2fbb94509c6e..5b0031882487 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -26,6 +26,9 @@ #include <vcl/keycod.hxx> #include <o3tl/typed_flags_set.hxx> +#ifdef SW_DLLIMPLEMENTATION +#include <TextFrameIndex.hxx> +#endif #include "IShellCursorSupplier.hxx" #include "swdllapi.h" #include "docary.hxx" @@ -39,9 +42,11 @@ #include "node.hxx" #include "fldbas.hxx" #include "IDocumentMarkAccess.hxx" +#include <optional> class SfxItemSet; class SfxPoolItem; +class SwCallLink; class SwContentFrame; class SwUnoCursor; class SwFormatField; @@ -55,6 +60,8 @@ class SwRangeRedline; class SwBlockCursor; class SwPostItField; class SwTextField; +class SwTextFootnote; +class SwTextContentControl; namespace i18nutil { struct SearchOptions2; @@ -79,14 +86,18 @@ enum class IsAttrAtPos NumLabel = 0x0200, ContentCheck = 0x0400, SmartTag = 0x0800, - FormControl = 0x1000 + FormControl = 0x1000, + TableRedline = 0x2000, + TableColRedline = 0x4000, #ifdef DBG_UTIL - ,CurrAttrs = 0x2000 ///< only for debugging - ,TableBoxValue = 0x4000 ///< only for debugging + CurrAttrs = 0x8000, ///< only for debugging + TableBoxValue = 0x10000, ///< only for debugging #endif + ContentControl = 0x20000, + AllowContaining = 0x40000, // With Outline, finds an outline node for non-outline position }; namespace o3tl { - template<> struct typed_flags<IsAttrAtPos> : is_typed_flags<IsAttrAtPos, 0x7fff> {}; + template<> struct typed_flags<IsAttrAtPos> : is_typed_flags<IsAttrAtPos, 0x7ffff> {}; } struct SwContentAtPos @@ -133,7 +144,7 @@ bool GetRanges(std::vector<std::shared_ptr<SwUnoCursor>> & rRanges, } // namespace sw -class SW_DLLPUBLIC SwCursorShell +class SAL_DLLPUBLIC_RTTI SwCursorShell : public SwViewShell , public sw::BroadcastingModify , public ::sw::IShellCursorSupplier @@ -155,7 +166,7 @@ public: READONLY = (1 << 3) ///< make visible in spite of Readonly }; - SAL_DLLPRIVATE void UpdateCursor( + SW_DLLPUBLIC void UpdateCursor( sal_uInt16 eFlags = SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE, bool bIdleEnd = false ); @@ -187,7 +198,7 @@ private: tools::Long m_nUpDownX; /**< try to move the cursor on up/down always in the same column */ tools::Long m_nLeftFramePos; - sal_uLong m_nCurrentNode; // save CursorPos at Start-Action + SwNodeOffset m_nCurrentNode; // save CursorPos at Start-Action sal_Int32 m_nCurrentContent; SwNodeType m_nCurrentNdTyp; @@ -226,13 +237,17 @@ private: bool m_bSetCursorInReadOnly : 1;// true -> Cursor is allowed in ReadOnly-Areas bool m_bOverwriteCursor : 1; // true -> show Overwrite Cursor + // true -> send accessible events when cursor changes + // (set to false when using internal-only helper cursor) + bool m_bSendAccessibleCursorEvents : 1; + bool m_bMacroExecAllowed : 1; SwFrame* m_oldColFrame; - SAL_DLLPRIVATE void MoveCursorToNum(); + void MoveCursorToNum(); - SAL_DLLPRIVATE void ParkPams( SwPaM* pDelRg, SwShellCursor** ppDelRing ); + void ParkPams( SwPaM* pDelRg, SwShellCursor** ppDelRing ); /** Mark a certain list level of a certain list @@ -243,33 +258,33 @@ private: An empty sListId denotes that no level of a list is marked. */ - SAL_DLLPRIVATE void MarkListLevel( const OUString& sListId, + void MarkListLevel( const OUString& sListId, const int nLevel ); // private method(s) accessed from public inline method(s) must be exported. - bool LeftRight( bool, sal_uInt16, sal_uInt16, bool ); - SAL_DLLPRIVATE bool UpDown( bool, sal_uInt16 ); - SAL_DLLPRIVATE bool LRMargin( bool, bool bAPI = false ); - SAL_DLLPRIVATE bool IsAtLRMargin( bool, bool bAPI = false ) const; + SW_DLLPUBLIC bool LeftRight( bool, sal_uInt16, SwCursorSkipMode, bool ); + bool UpDown( bool, sal_uInt16 ); + bool LRMargin( bool, bool bAPI = false ); + bool IsAtLRMargin( bool, bool bAPI = false ) const; - SAL_DLLPRIVATE bool isInHiddenTextFrame(SwShellCursor* pShellCursor); + bool isInHiddenFrame(SwShellCursor* pShellCursor); - SAL_DLLPRIVATE bool GoStartWordImpl(); - SAL_DLLPRIVATE bool GoEndWordImpl(); - SAL_DLLPRIVATE bool GoNextWordImpl(); - SAL_DLLPRIVATE bool GoPrevWordImpl(); - SAL_DLLPRIVATE bool GoNextSentenceImpl(); - SAL_DLLPRIVATE bool GoEndSentenceImpl(); - SAL_DLLPRIVATE bool GoStartSentenceImpl(); + bool GoStartWordImpl(); + bool GoEndWordImpl(); + bool GoNextWordImpl(); + bool GoPrevWordImpl(); + bool GoNextSentenceImpl(); + bool GoEndSentenceImpl(); + bool GoStartSentenceImpl(); typedef bool (SwCursor::*FNCursor)(); typedef bool (SwCursorShell::*FNCursorShell)(); - SAL_DLLPRIVATE bool CallCursorFN( FNCursor ); - SAL_DLLPRIVATE bool CallCursorShellFN( FNCursorShell ); + bool CallCursorFN( FNCursor ); + bool CallCursorShellFN( FNCursorShell ); - SAL_DLLPRIVATE const SwRangeRedline* GotoRedline_( SwRedlineTable::size_type nArrPos, bool bSelect ); + const SwRangeRedline* GotoRedline_( SwRedlineTable::size_type nArrPos, bool bSelect ); - SAL_DLLPRIVATE void sendLOKCursorUpdates(); + void sendLOKCursorUpdates(); protected: inline SwMoveFnCollection const & MakeFindRange( SwDocPositions, SwDocPositions, SwPaM* ) const; @@ -280,7 +295,7 @@ protected: */ int CompareCursorStackMkCurrPt() const; - bool SelTableRowOrCol( bool bRow, bool bRowSimple = false ); + SW_DLLPUBLIC bool SelTableRowOrCol( bool bRow, bool bRowSimple = false ); bool SetInFrontOfLabel( bool bNew ); @@ -288,7 +303,7 @@ protected: /** Updates the marked list level according to the cursor. */ - SAL_DLLPRIVATE void UpdateMarkedListLevel(); + void UpdateMarkedListLevel(); protected: virtual void SwClientNotify(const SwModify&, const SfxHint&) override; @@ -300,12 +315,12 @@ public: virtual ~SwCursorShell() override; // create new cursor and append the old one - virtual SwPaM & CreateNewShellCursor() override; - virtual SwPaM & GetCurrentShellCursor() override; + virtual SwCursor & CreateNewShellCursor() override; + SW_DLLPUBLIC virtual SwCursor & GetCurrentShellCursor() override; - SwPaM * CreateCursor(); + SW_DLLPUBLIC SwPaM * CreateCursor(); ///< delete the current cursor and make the following into the current - void DestroyCursor(); + SW_DLLPUBLIC void DestroyCursor(); ///< transform TableCursor to normal cursor, nullify Tablemode void TableCursorToCursor(); ///< enter block mode, change normal cursor into block cursor @@ -318,12 +333,12 @@ public: // only for usage in special cases allowed! void ExtendedSelectAll(bool bFootnotes = true); /// If ExtendedSelectAll() was called and selection didn't change since then. - bool ExtendedSelectedAll(); - /// If document body starts with a table. - bool StartsWithTable(); + ::std::optional<::std::pair<SwNode const*, ::std::vector<SwTableNode*>>> ExtendedSelectedAll() const; + enum class StartsWith { None, Table, HiddenPara, HiddenSection }; + /// If document body starts with a table or starts/ends with hidden paragraph. + StartsWith StartsWith_(); - SwPaM* GetCursor( bool bMakeTableCursor = true ) const; - inline SwCursor* GetSwCursor() const; + SW_DLLPUBLIC SwCursor* GetCursor( bool bMakeTableCursor = true ) const; // return only the current cursor SwShellCursor* GetCursor_() { return m_pCurrentCursor; } const SwShellCursor* GetCursor_() const { return m_pCurrentCursor; } @@ -332,50 +347,50 @@ public: void SetSelection(const SwPaM& rCursor); // remove all cursors from ContentNodes and set to 0 - void ParkCursor( const SwNodeIndex &rIdx ); + void ParkCursor( const SwNode &rIdx ); // return the current cursor stack // (required in EditShell when deleting contents) inline SwPaM* GetStackCursor() const; // start parenthesing, hide SV-Cursor and selected areas - void StartAction(); + SW_DLLPUBLIC void StartAction(); // end parenthesing, show SV-Cursor and selected areas - void EndAction( const bool bIdleEnd = false, const bool DoSetPosX = false ); + SW_DLLPUBLIC void EndAction( const bool bIdleEnd = false ); // basic cursor travelling tools::Long GetUpDownX() const { return m_nUpDownX; } - bool Left( sal_uInt16 nCnt, sal_uInt16 nMode, bool bAllowVisual = false ) + bool Left( sal_uInt16 nCnt, SwCursorSkipMode nMode, bool bAllowVisual = false ) { return LeftRight( true, nCnt, nMode, bAllowVisual ); } - bool Right( sal_uInt16 nCnt, sal_uInt16 nMode, bool bAllowVisual = false ) + bool Right( sal_uInt16 nCnt, SwCursorSkipMode nMode, bool bAllowVisual = false ) { return LeftRight( false, nCnt, nMode, bAllowVisual ); } bool Up( sal_uInt16 nCnt = 1 ) { return UpDown( true, nCnt ); } bool Down( sal_uInt16 nCnt = 1 ) { return UpDown( false, nCnt ); } bool LeftMargin() { return LRMargin( true ); } bool RightMargin(bool bAPI = false) { return LRMargin( false, bAPI ); } - bool SttEndDoc( bool bStt ); + SW_DLLPUBLIC bool SttEndDoc( bool bStt ); bool MovePage( SwWhichPage, SwPosPage ); - bool MovePara( SwWhichPara, SwMoveFnCollection const & ); - bool MoveSection( SwWhichSection, SwMoveFnCollection const & ); - bool MoveTable( SwWhichTable, SwMoveFnCollection const & ); + SW_DLLPUBLIC bool MovePara( SwWhichPara, SwMoveFnCollection const & ); + SW_DLLPUBLIC bool MoveSection( SwWhichSection, SwMoveFnCollection const & ); + SW_DLLPUBLIC bool MoveTable( SwWhichTable, SwMoveFnCollection const & ); void MoveColumn( SwWhichColumn, SwPosColumn ); bool MoveRegion( SwWhichRegion, SwMoveFnCollection const & ); // note: DO NOT call it FindText because windows.h - sal_uLong Find_Text( const i18nutil::SearchOptions2& rSearchOpt, + SW_DLLPUBLIC sal_Int32 Find_Text( const i18nutil::SearchOptions2& rSearchOpt, bool bSearchInNotes, SwDocPositions eStart, SwDocPositions eEnd, bool& bCancel, FindRanges eRng, bool bReplace = false ); - sal_uLong FindFormat( const SwTextFormatColl& rFormatColl, + sal_Int32 FindFormat( const SwTextFormatColl& rFormatColl, SwDocPositions eStart, SwDocPositions eEnd, bool& bCancel, FindRanges eRng, const SwTextFormatColl* pReplFormat ); - sal_uLong FindAttrs( const SfxItemSet& rSet, bool bNoCollections, + sal_Int32 FindAttrs( const SfxItemSet& rSet, bool bNoCollections, SwDocPositions eStart, SwDocPositions eEnd, bool& bCancel, FindRanges eRng, @@ -386,7 +401,15 @@ public: // return values: // CRSR_POSCHG: when cursor was corrected from SPoint by the layout // CRSR_POSOLD: when the cursor was not changed - int SetCursor( const Point &rPt, bool bOnlyText = false, bool bBlock = true ); + /** + * @param bFieldInfo + * false: Over the last half of the character, place cursor behind it. This is used when + * the cursor is actually being moved by the user to the closest valid point. + * true: Place the cursor at the start of the character/field. This is used when setting + * the cursor is done in order to get at the properties under the mouse pointer. + */ + SW_DLLPUBLIC int SetCursor(const Point& rPt, bool bOnlyText = false, bool bBlock = true, + bool bFieldInfo = false); /* * Notification that the visible area was changed. m_aVisArea is reset, then @@ -404,7 +427,7 @@ public: inline void SetMark(); inline bool HasMark() const; - void ClearMark(); + SW_DLLPUBLIC void ClearMark(); /** Ensure point and mark of the current PaM are in a specific order. @@ -413,15 +436,15 @@ public: swap the PaM. false: If the mark is behind the point then swap the PaM. */ - void NormalizePam(bool bPointFirst = true); + SW_DLLPUBLIC void NormalizePam(bool bPointFirst = true); - void SwapPam(); - bool TestCurrPam( const Point & rPt, + SW_DLLPUBLIC void SwapPam(); + SW_DLLPUBLIC bool TestCurrPam( const Point & rPt, bool bTstHit = false); // only exact matches void KillPams(); /// store a copy of the current cursor on the cursor stack - void Push(); + SW_DLLPUBLIC void Push(); enum class PopMode { DeleteCurrent, DeleteStack }; /* * Delete a cursor @@ -430,15 +453,16 @@ public: * stack * @return <true> if there was one on the stack, <false> otherwise */ - bool Pop(PopMode); + bool Pop(PopMode, ::std::optional<SwCallLink>& roLink); + SW_DLLPUBLIC bool Pop(PopMode); /* * Combine 2 Cursors. * Delete the topmost from the stack and move its Mark into the current. */ void Combine(); - void SttCursorMove(); - void EndCursorMove( const bool bIdleEnd = false ); + SW_DLLPUBLIC void SttCursorMove(); + SW_DLLPUBLIC void EndCursorMove( const bool bIdleEnd = false ); /* * When the focus is lost the selected ranges are not displayed anymore. @@ -450,8 +474,8 @@ public: void ShellGetFocus(); // Methods for displaying or hiding the visible text cursor. - void ShowCursor(); - void HideCursor(); + SW_DLLPUBLIC void ShowCursor(); + SW_DLLPUBLIC void HideCursor(); // Methods for displaying or hiding the selected ranges with visible cursor. void ShowCursors( bool bCursorVis ); void HideCursors(); @@ -459,16 +483,20 @@ public: bool IsOverwriteCursor() const { return m_bOverwriteCursor; } void SetOverwriteCursor( bool bFlag ) { m_bOverwriteCursor = bFlag; } + bool IsSendAccessibleCursorEvents() const { return m_bSendAccessibleCursorEvents; }; + void SetSendAccessibleCursorEvents(bool bEnable) { m_bSendAccessibleCursorEvents = bEnable; }; + // Return current frame in which the cursor is placed. - SwContentFrame *GetCurrFrame( const bool bCalcFrame = true ) const; + SW_DLLPUBLIC SwContentFrame *GetCurrFrame( const bool bCalcFrame = true ) const; //true if cursor is hidden because of readonly. //false if it is working despite readonly. - bool IsCursorReadonly() const; + SW_DLLPUBLIC bool IsCursorReadonly() const; // Cursor is placed in something that is protected or selection contains // something that is protected. - bool HasReadonlySel() const; + SW_DLLPUBLIC bool HasReadonlySel(bool isReplace = false) const; + bool HasHiddenSections() const; // Can the cursor be set to read only ranges? bool IsReadOnlyAvailable() const { return m_bSetCursorInReadOnly; } @@ -492,7 +520,7 @@ public: // Check if the current cursor contains a selection, i.e. // if Mark is set and SPoint and Mark are different. - bool HasSelection() const; + SW_DLLPUBLIC bool HasSelection() const; // Check if a selection exists, i.e. if the current cursor comprises a selection. inline bool IsSelection() const; @@ -517,7 +545,7 @@ public: /* * Returns if cursor is wholly or partly within visible range. */ - bool IsCursorVisible() const { return VisArea().IsOver( GetCharRect() ); } + bool IsCursorVisible() const { return VisArea().Overlaps( GetCharRect() ); } /* * Returns SwRect, at which the character is located. */ @@ -526,11 +554,11 @@ public: // Return current page number: // true: in which cursor is located. // false: which is visible at the upper margin. - void GetPageNum( sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum, + SW_DLLPUBLIC void GetPageNum( sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum, bool bAtCursorPos = true, const bool bCalcFrame = true ); // Returns current page's sequential number (1-based),in which cursor is located, ignoring autoinserted empty pages. // Returns 0 on error - sal_uInt16 GetPageNumSeqNonEmpty(); + SW_DLLPUBLIC sal_uInt16 GetPageNumSeqNonEmpty(); // Determine how "empty pages" are handled // (used in PhyPage). sal_uInt16 GetNextPrevPageNum( bool bNext = true ); @@ -538,34 +566,34 @@ public: // Move cursor at the beginning of page "nPage". bool GotoPage( sal_uInt16 nPage ); - sal_uInt16 GetPageCnt(); + SW_DLLPUBLIC sal_uInt16 GetPageCnt(); bool GoNextCursor(); bool GoPrevCursor(); - bool GoNextPrevCursorSetSearchLabel(const bool bNext); + void GoNextPrevCursorSetSearchLabel(const bool bNext); // at CurrentCursor.SPoint - ::sw::mark::IMark* SetBookmark( + SW_DLLPUBLIC ::sw::mark::IMark* SetBookmark( const vcl::KeyCode&, const OUString& rName, IDocumentMarkAccess::MarkType eMark = IDocumentMarkAccess::MarkType::BOOKMARK); - ::sw::mark::IMark* SetBookmark2( + SW_DLLPUBLIC ::sw::mark::IMark* SetBookmark2( const vcl::KeyCode&, const OUString& rName, bool bHide, const OUString& rCondition); - bool GotoMark( const ::sw::mark::IMark* const pMark ); // sets CurrentCursor.SPoint + SW_DLLPUBLIC bool GotoMark( const ::sw::mark::IMark* const pMark ); // sets CurrentCursor.SPoint bool GotoMark( const ::sw::mark::IMark* const pMark, bool bAtStart ); bool GoNextBookmark(); // true, if there was one bool GoPrevBookmark(); bool IsFormProtected(); ::sw::mark::IFieldmark* GetCurrentFieldmark(); - ::sw::mark::IFieldmark* GetFieldmarkAfter(); - ::sw::mark::IFieldmark* GetFieldmarkBefore(); - bool GotoFieldmark( const ::sw::mark::IFieldmark* const pMark ); + sw::mark::IFieldmark* GetFieldmarkAfter(bool bLoop); + sw::mark::IFieldmark* GetFieldmarkBefore(bool bLoop); + bool GotoFieldmark( const ::sw::mark::IFieldmark* const pMark, bool completeSelection = false ); // update Cursr, i.e. reset it into content should only be called when the // cursor was set to a random position e.g. when deleting frames @@ -573,14 +601,19 @@ public: // get the selected text at the current cursor. It will be filled with // fields etc. - OUString GetSelText() const; + SW_DLLPUBLIC OUString GetSelText() const; - // Check of SPoint or Mark of current cursor are placed within a table. - inline const SwTableNode* IsCursorInTable() const; + /// Check if Point of current cursor is placed within a table. + SW_DLLPUBLIC const SwTableNode* IsCursorInTable() const; + bool MoveOutOfTable(); + bool TrySelectOuterTable(); + bool MoveStartText(); - bool IsCursorInFootnote() const; + SW_DLLPUBLIC bool IsCursorInFootnote() const; inline Point& GetCursorDocPos() const; + // get cursor position relative to the page it is in + Point GetCursorPagePos() const; inline bool IsCursorPtAtEnd() const; inline const SwPaM* GetTableCrs() const; @@ -591,8 +624,8 @@ public: OUString GetBoxNms() const; // set Cursor to the next/previous cell - bool GoNextCell( bool bAppendLine = true ); - bool GoPrevCell(); + SW_DLLPUBLIC bool GoNextCell( bool bAppendLine = true ); + SW_DLLPUBLIC bool GoPrevCell(); // go to this box (if available and inside of table) bool GotoTable( const OUString& rName ); @@ -601,7 +634,7 @@ public: bool SelTableCol() { return SelTableRowOrCol( false ); } bool SelTableBox(); - bool SelTable(); + SW_DLLPUBLIC bool SelTable(); void GotoNextNum(); void GotoPrevNum(); @@ -610,10 +643,10 @@ public: // to the next/previous or the given OutlineNode void GotoOutline( SwOutlineNodes::size_type nIdx ); // find the "outline position" in the nodes array of the current chapter - SwOutlineNodes::size_type GetOutlinePos(sal_uInt8 nLevel = UCHAR_MAX, SwPaM* pPaM = nullptr); + SW_DLLPUBLIC SwOutlineNodes::size_type GetOutlinePos(sal_uInt8 nLevel = UCHAR_MAX, SwPaM* pPaM = nullptr); // select the given range of OutlineNodes. Optionally including the children // the sal_uInt16s are the positions in OutlineNodes-Array (EditShell) - bool MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineNodes::size_type nEndPos, + void MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineNodes::size_type nEndPos, bool bWithChildren, bool bKillPams = true ); bool GotoNextOutline(); @@ -633,7 +666,7 @@ public: m_pBlockCursor if exist and of interest (param bBlock) otherwise m_pCurrentCursor */ - SwShellCursor* getShellCursor( bool bBlock ); + SW_DLLPUBLIC SwShellCursor* getShellCursor( bool bBlock ); const SwShellCursor* getShellCursor( bool bBlock ) const { return const_cast<SwCursorShell*>(this)->getShellCursor( bBlock ); } @@ -646,19 +679,19 @@ public: SwShellTableCursor* GetTableCursor() { return m_pTableCursor; } size_t UpdateTableSelBoxes(); - bool GotoFootnoteText(); ///< jump from content to footnote + SW_DLLPUBLIC bool GotoFootnoteText(); ///< jump from content to footnote bool GotoFootnoteAnchor(); ///< jump from footnote to anchor - bool GotoPrevFootnoteAnchor(); - bool GotoNextFootnoteAnchor(); + SW_DLLPUBLIC bool GotoPrevFootnoteAnchor(); + SW_DLLPUBLIC bool GotoNextFootnoteAnchor(); void GotoFlyAnchor(); ///< jump from the frame to the anchor - bool GotoHeaderText(); ///< jump from the content to the header + SW_DLLPUBLIC bool GotoHeaderText(); ///< jump from the content to the header bool GotoFooterText(); ///< jump from the content to the footer // jump to the header/footer of the given or current PageDesc - bool SetCursorInHdFt( size_t nDescNo, bool bInHeader ); + bool SetCursorInHdFt(size_t nDescNo, bool bInHeader, bool bEven = false, bool bFirst = false); // is point of cursor in header/footer. pbInHeader return true if it is // in a headerframe otherwise in a footerframe - bool IsInHeaderFooter( bool* pbInHeader = nullptr ) const; + SW_DLLPUBLIC bool IsInHeaderFooter( bool* pbInHeader = nullptr ) const; bool GotoNextTOXBase( const OUString* = nullptr ); bool GotoPrevTOXBase( const OUString* = nullptr ); @@ -666,7 +699,7 @@ public: // jump to the next or previous index entry bool GotoNxtPrvTOXMark( bool bNext = true ); // jump to the next/previous index mark of this type - const SwTOXMark& GotoTOXMark( const SwTOXMark& rStart, SwTOXSearch eDir ); + SW_DLLPUBLIC const SwTOXMark& GotoTOXMark( const SwTOXMark& rStart, SwTOXSearch eDir ); // jump to the next or previous table formula // optionally only to broken formulas @@ -677,7 +710,7 @@ public: bool SelectNxtPrvHyperlink( bool bNext ); bool GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType, - sal_uInt16 nSeqNo ); + sal_uInt16 nSeqNo, sal_uInt16 nFlags ); // get the nth character from the start or end of the current selection sal_Unicode GetChar( bool bEnd = true, tools::Long nOffset = 0 ); @@ -688,7 +721,7 @@ public: // (This is needed for displaying the Drag&Drop/Copy-Cursor.) bool SetVisibleCursor( const Point &rPt ); inline void UnSetVisibleCursor(); - SwVisibleCursor* GetVisibleCursor() const; + SW_DLLPUBLIC SwVisibleCursor* GetVisibleCursor() const; // jump to the next or previous field of the corresponding type bool MoveFieldType( @@ -699,34 +732,39 @@ public: bool GotoFormatField( const SwFormatField& rField ); + bool GotoFormatContentControl(const SwFormatContentControl& rContentControl); + + SW_DLLPUBLIC void GotoFormControl(bool bNext); + static SwTextField* GetTextFieldAtPos( const SwPosition* pPos, - const bool bIncludeInputFieldAtStart ); + ::sw::GetTextAttrMode eMode); static SwTextField* GetTextFieldAtCursor( const SwPaM* pCursor, - const bool bIncludeInputFieldAtStart ); - static SwField* GetFieldAtCursor( + ::sw::GetTextAttrMode eMode); + SW_DLLPUBLIC static SwField* GetFieldAtCursor( const SwPaM* pCursor, const bool bIncludeInputFieldAtStart ); - SwField* GetCurField( const bool bIncludeInputFieldAtStart = false ) const; - bool CursorInsideInputField() const; - static bool PosInsideInputField( const SwPosition& rPos ); + SW_DLLPUBLIC SwField* GetCurField( const bool bIncludeInputFieldAtStart = false ) const; + SW_DLLPUBLIC bool CursorInsideInputField() const; + SW_DLLPUBLIC SwTextContentControl* CursorInsideContentControl() const; + SW_DLLPUBLIC static bool PosInsideInputField( const SwPosition& rPos ); bool DocPtInsideInputField( const Point& rDocPt ) const; static sal_Int32 StartOfInputFieldAtPos( const SwPosition& rPos ); static sal_Int32 EndOfInputFieldAtPos( const SwPosition& rPos ); // Return number of cursors in ring (The flag indicates whether // only cursors containing selections are requested). - sal_uInt16 GetCursorCnt( bool bAll = true ) const; + SW_DLLPUBLIC sal_uInt16 GetCursorCnt( bool bAll = true ) const; // Char Travelling - methods (in crstrvl1.cxx) bool GoStartWord(); bool GoEndWord(); bool GoNextWord(); - bool GoPrevWord(); + SW_DLLPUBLIC bool GoPrevWord(); bool GoNextSentence(); - bool GoStartSentence(); - bool GoEndSentence(); + SW_DLLPUBLIC bool GoStartSentence(); + SW_DLLPUBLIC bool GoEndSentence(); bool SelectWord( const Point* pPt ); void ExpandToSentenceBorders(); @@ -736,11 +774,11 @@ public: bool IsInWord( sal_Int16 nWordType = css::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) const; bool IsStartSentence() const; bool IsEndSentence() const; - bool IsSttPara() const; - bool IsEndPara() const; + SW_DLLPUBLIC bool IsSttPara() const; + SW_DLLPUBLIC bool IsEndPara() const; bool IsEndOfTable() const; ///< at the very last SwPosition inside a table bool IsStartOfDoc() const; - bool IsEndOfDoc() const; + SW_DLLPUBLIC bool IsEndOfDoc() const; bool IsInFrontOfLabel() const; bool IsAtLeftMargin() const { return IsAtLRMargin( true ); } bool IsAtRightMargin() const { return IsAtLRMargin( false, true/*bAPI*/ ); } @@ -767,7 +805,7 @@ public: // set the cursor to a NOT protected/hidden node bool FindValidContentNode( bool bOnlyText ); - bool GetContentAtPos( const Point& rPt, + SW_DLLPUBLIC bool GetContentAtPos( const Point& rPt, SwContentAtPos& rContentAtPos, bool bSetCursor = false, SwRect* pFieldRect = nullptr ); @@ -788,8 +826,12 @@ public: bool GotoINetAttr( const SwTextINetFormat& rAttr ); const SwFormatINetFormat* FindINetAttr( std::u16string_view rName ) const; - bool SelectText( const sal_Int32 nStart, - const sal_Int32 nEnd ); + SW_DLLPUBLIC bool SelectTextModel(sal_Int32 nStart, sal_Int32 nEnd); +#ifdef SW_DLLIMPLEMENTATION + bool SelectTextView(TextFrameIndex nStart, TextFrameIndex nEnd); + // result is only valid while cursor isn't moved! + TextFrameIndex GetCursorPointAsViewIndex() const; +#endif bool CheckTableBoxContent( const SwPosition* pPos = nullptr ); void SaveTableBoxContent( const SwPosition* pPos = nullptr ); @@ -807,13 +849,15 @@ public: bool GetShadowCursorPos( const Point& rPt, SwFillMode eFillMode, SwRect& rRect, sal_Int16& rOrient ); - bool SetShadowCursorPos( const Point& rPt, SwFillMode eFillMode ); + SW_DLLPUBLIC bool SetShadowCursorPos( const Point& rPt, SwFillMode eFillMode ); const SwRangeRedline* SelNextRedline(); const SwRangeRedline* SelPrevRedline(); - const SwRangeRedline* GotoRedline( SwRedlineTable::size_type nArrPos, bool bSelect ); + SW_DLLPUBLIC const SwRangeRedline* GotoRedline( SwRedlineTable::size_type nArrPos, bool bSelect ); + + bool GotoFootnoteAnchor(const SwTextFootnote& rTextFootnote); - SAL_DLLPRIVATE SvxFrameDirection GetTextDirection( const Point* pPt = nullptr ) const; + SvxFrameDirection GetTextDirection( const Point* pPt = nullptr ) const; // is cursor or the point in/over a vertical formatted text? bool IsInVerticalText( const Point* pPt = nullptr ) const; // is cursor or the point in/over a right to left formatted text? @@ -823,9 +867,9 @@ public: bool bColumnChange(); static void FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection); static void FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn); - // If the current cursor position is inside a hidden range, the hidden range - // is selected and true is returned: - bool SelectHiddenRange(); + // If the current cursor position is inside a hidden range true is returned. If bSelect is + // true, the hidden range is selected. If bSelect is false, the hidden range is not selected. + bool IsInHiddenRange(const bool bSelect); // remove all invalid cursors void ClearUpCursors(); @@ -865,11 +909,6 @@ inline SwMoveFnCollection const & SwCursorShell::MakeFindRange( return m_pCurrentCursor->MakeFindRange( nStt, nEnd, pPam ); } -inline SwCursor* SwCursorShell::GetSwCursor() const -{ - return static_cast<SwCursor*>(GetCursor()); -} - inline SwPaM* SwCursorShell::GetStackCursor() const { return m_pStackCursor; } inline void SwCursorShell::SetMark() { m_pCurrentCursor->SetMark(); } @@ -886,11 +925,6 @@ inline bool SwCursorShell::IsMultiSelection() const return m_pCurrentCursor->GetNext() != m_pCurrentCursor; } -inline const SwTableNode* SwCursorShell::IsCursorInTable() const -{ - return m_pCurrentCursor->GetNode().FindTableNode(); -} - inline bool SwCursorShell::IsCursorPtAtEnd() const { return m_pCurrentCursor->End() == m_pCurrentCursor->GetPoint(); |