diff options
Diffstat (limited to 'sw/inc/IDocumentMarkAccess.hxx')
-rw-r--r-- | sw/inc/IDocumentMarkAccess.hxx | 57 |
1 files changed, 39 insertions, 18 deletions
diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx index 1ad39701d02b..bc8f2e1c03d6 100644 --- a/sw/inc/IDocumentMarkAccess.hxx +++ b/sw/inc/IDocumentMarkAccess.hxx @@ -17,12 +17,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_IDOCUMENTMARKACCESS_HXX -#define INCLUDED_SW_INC_IDOCUMENTMARKACCESS_HXX +#pragma once #include <sal/types.h> #include "IMark.hxx" #include <memory> +#include <optional> class SwPaM; struct SwPosition; @@ -60,7 +60,7 @@ class IDocumentMarkAccess class SW_DLLPUBLIC iterator { private: - std::unique_ptr<std::vector<::sw::mark::MarkBase*>::const_iterator> m_pIter; + std::optional<std::vector<::sw::mark::MarkBase*>::const_iterator> m_pIter; public: // MarkManager implementation needs to get the real iterator @@ -78,7 +78,6 @@ class IDocumentMarkAccess iterator& operator=(iterator const& rOther); iterator(iterator && rOther) noexcept; iterator& operator=(iterator && rOther) noexcept; - ~iterator(); // FIXME unfortunately there's a requirement on input iterator // and forward iterator to return reference, which isn't @@ -197,7 +196,7 @@ class IDocumentMarkAccess @param nOffset [in] the offset by which the mark gets positioned of rNewPos */ - virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode, + virtual void correctMarksAbsolute(const SwNode& rOldNode, const SwPosition& rNewPos, const sal_Int32 nOffset) =0; @@ -215,7 +214,7 @@ class IDocumentMarkAccess [in] the offset by which the mark gets positioned of rNewPos in addition to its old position in the paragraph */ - virtual void correctMarksRelative(const SwNodeIndex& rOldNode, + virtual void correctMarksRelative(const SwNode& rOldNode, const SwPosition& rNewPos, const sal_Int32 nOffset) =0; @@ -225,19 +224,23 @@ class IDocumentMarkAccess */ virtual void deleteMarks( - const SwNodeIndex& rStt, - const SwNodeIndex& rEnd, + const SwNode& rStt, + const SwNode& rEnd, std::vector< ::sw::mark::SaveBookmark>* pSaveBkmk, // Ugly: SaveBookmark is core-internal - const SwIndex* pSttIdx, - const SwIndex* pEndIdx) =0; + std::optional<sal_Int32> oStartContentIdx, + std::optional<sal_Int32> oEndContentIdx, + bool isReplace) = 0; /** Deletes a mark. @param ppMark [in] an iterator pointing to the Mark to be deleted. + @param isMoveNodes + [in] the mark is deleted only temporarily for a node move, do not + remove fieldmark chars. */ virtual std::unique_ptr<ILazyDeleter> - deleteMark(const IDocumentMarkAccess::const_iterator_t& ppMark) =0; + deleteMark(const IDocumentMarkAccess::const_iterator_t& ppMark, bool isMoveNodes) =0; /** Deletes a mark. @@ -276,10 +279,17 @@ class IDocumentMarkAccess */ virtual const_iterator_t findMark(const OUString& rMark) const =0; + /** Find the first Mark that does not start before. + + @returns + an iterator pointing to the mark, or pointing to getAllMarksEnd() if nothing was found. + */ + virtual const_iterator_t findFirstMarkNotStartsBefore(const SwPosition& rPos) const =0; + // interface IBookmarks (BOOKMARK, CROSSREF_NUMITEM_BOOKMARK, CROSSREF_HEADING_BOOKMARK ) /** check if the selection would delete a BOOKMARK */ - virtual bool isBookmarkDeleted(SwPaM const& rPaM) const =0; + virtual bool isBookmarkDeleted(SwPaM const& rPaM, bool isReplace) const =0; /** returns a STL-like random access iterator to the begin of the sequence the IBookmarks. */ @@ -310,6 +320,8 @@ class IDocumentMarkAccess */ virtual const_iterator_t findFirstBookmarkStartsAfter(const SwPosition& rPos) const =0; + /// Get the innermost bookmark that contains rPos. + virtual sw::mark::IMark* getOneInnermostBookmarkFor(const SwPosition& rPos) const = 0; // Fieldmarks /** returns a STL-like random access iterator to the begin of the sequence of fieldmarks. @@ -320,14 +332,17 @@ class IDocumentMarkAccess */ virtual const_iterator_t getFieldmarksEnd() const =0; + /// returns the number of IFieldmarks. + virtual sal_Int32 getFieldmarksCount() const = 0; + /// get Fieldmark for CH_TXT_ATR_FIELDSTART/CH_TXT_ATR_FIELDEND at rPos virtual ::sw::mark::IFieldmark* getFieldmarkAt(const SwPosition& rPos) const =0; - virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& pos) const =0; - virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& pos) const =0; - virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& pos) const =0; + virtual sw::mark::IFieldmark* getInnerFieldmarkFor(const SwPosition& pos) const = 0; + virtual sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& pos, bool bLoop) const =0; + virtual sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& pos, bool bLoop) const =0; virtual ::sw::mark::IFieldmark* getDropDownFor(const SwPosition& pos) const=0; - virtual std::vector< ::sw::mark::IFieldmark* > getDropDownsFor(const SwPaM &rPaM) const=0; + virtual std::vector<::sw::mark::IFieldmark*> getNoTextFieldmarksIn(const SwPaM &rPaM) const=0; virtual void deleteFieldmarkAt(const SwPosition& rPos) = 0; virtual ::sw::mark::IFieldmark* changeFormFieldmarkType(::sw::mark::IFieldmark* pFieldmark, const OUString& rNewType) = 0; @@ -341,6 +356,14 @@ class IDocumentMarkAccess virtual sal_Int32 getAnnotationMarksCount() const = 0; virtual const_iterator_t findAnnotationMark( const OUString& rName ) const = 0; virtual sw::mark::IMark* getAnnotationMarkFor(const SwPosition& rPosition) const = 0; + // handle and restore text ranges of annotations of tracked deletions + // based on the helper bookmarks (which can survive I/O and hiding redlines) + virtual ::sw::mark::IMark* makeAnnotationBookmark(const SwPaM& rPaM, + const OUString& rProposedName, + MarkType eMark, ::sw::mark::InsertMode eMode, + SwPosition const* pSepPos = nullptr) = 0; + virtual const_iterator_t findAnnotationBookmark( const OUString& rName ) const = 0; + virtual void restoreAnnotationMarks(bool bDelete = true) = 0; /** Finds the first mark that is starting after. @returns @@ -360,6 +383,4 @@ class IDocumentMarkAccess virtual ~IDocumentMarkAccess() {}; }; -#endif // IDOCUMENTBOOKMARKACCESS_HXX_INCLUDED - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |