sw/inc/IDocumentFieldsAccess.hxx | 5 + sw/inc/IDocumentMarkAccess.hxx | 20 ++-- sw/inc/IMark.hxx | 19 ++-- sw/inc/SwRewriter.hxx | 6 + sw/inc/crsrsh.hxx | 7 - sw/inc/doc.hxx | 3 sw/inc/docufld.hxx | 17 +-- sw/inc/editsh.hxx | 2 sw/inc/fmtrfmrk.hxx | 9 + sw/inc/mdiexp.hxx | 3 sw/inc/names.hxx | 31 ++++++ sw/inc/ndtxt.hxx | 3 sw/inc/reffld.hxx | 11 +- sw/inc/view.hxx | 3 sw/qa/core/doc/doc.cxx | 2 sw/qa/core/layout/layout.cxx | 2 sw/qa/core/macros-test.cxx | 4 sw/qa/core/txtnode/txtnode.cxx | 6 - sw/qa/core/uwriter.cxx | 30 +++--- sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 2 sw/qa/extras/uiwriter/uiwriter.cxx | 48 +++++----- sw/qa/extras/uiwriter/uiwriter3.cxx | 17 +-- sw/qa/extras/uiwriter/uiwriter4.cxx | 16 +-- sw/qa/extras/uiwriter/uiwriter6.cxx | 4 sw/qa/extras/uiwriter/uiwriter7.cxx | 40 ++++---- sw/qa/extras/uiwriter/uiwriter8.cxx | 15 +-- sw/qa/extras/uiwriter/uiwriter9.cxx | 4 sw/qa/extras/ww8export/ww8export4.cxx | 2 sw/qa/uibase/shells/shells.cxx | 25 ++--- sw/source/core/access/accpara.cxx | 2 sw/source/core/bastyp/init.cxx | 2 sw/source/core/crsr/annotationmark.cxx | 4 sw/source/core/crsr/bookmark.cxx | 26 ++--- sw/source/core/crsr/crbm.cxx | 4 sw/source/core/crsr/crossrefbookmark.cxx | 14 +- sw/source/core/crsr/crstrvl.cxx | 2 sw/source/core/doc/DocumentContentOperationsManager.cxx | 8 - sw/source/core/doc/DocumentLinksAdministrationManager.cxx | 2 sw/source/core/doc/doc.cxx | 6 - sw/source/core/doc/docbm.cxx | 66 +++++++------- sw/source/core/edit/editsh.cxx | 2 sw/source/core/fields/docufld.cxx | 26 +++-- sw/source/core/fields/reffld.cxx | 31 +++--- sw/source/core/inc/MarkManager.hxx | 24 ++--- sw/source/core/inc/UndoBookmark.hxx | 10 +- sw/source/core/inc/annotationmark.hxx | 2 sw/source/core/inc/crossrefbookmark.hxx | 10 +- sw/source/core/inc/mvsave.hxx | 2 sw/source/core/inc/rolbck.hxx | 10 +- sw/source/core/inc/scriptinfo.hxx | 4 sw/source/core/text/EnhancedPDFExportHelper.cxx | 16 +-- sw/source/core/text/porlay.cxx | 17 +-- sw/source/core/text/porrst.cxx | 4 sw/source/core/text/porrst.hxx | 5 - sw/source/core/tox/txmsrt.cxx | 2 sw/source/core/txtnode/atrref.cxx | 8 - sw/source/core/txtnode/ndtxt.cxx | 4 sw/source/core/undo/rolbck.cxx | 2 sw/source/core/undo/unbkmk.cxx | 8 - sw/source/core/unocore/unobkm.cxx | 14 +- sw/source/core/unocore/unocoll.cxx | 10 +- sw/source/core/unocore/unofield.cxx | 8 - sw/source/core/unocore/unoobj2.cxx | 2 sw/source/core/unocore/unorefmk.cxx | 10 +- sw/source/filter/basflt/fltshell.cxx | 4 sw/source/filter/html/htmlfld.cxx | 2 sw/source/filter/html/swhtml.cxx | 6 - sw/source/filter/html/wrthtml.cxx | 2 sw/source/filter/ww8/docxattributeoutput.cxx | 19 ++-- sw/source/filter/ww8/docxattributeoutput.hxx | 10 +- sw/source/filter/ww8/docxexport.cxx | 8 - sw/source/filter/ww8/rtfattributeoutput.cxx | 16 +-- sw/source/filter/ww8/rtfattributeoutput.hxx | 5 - sw/source/filter/ww8/rtfexport.cxx | 8 - sw/source/filter/ww8/wrtw8nds.cxx | 12 +- sw/source/filter/ww8/wrtw8sty.cxx | 6 - sw/source/filter/ww8/wrtww8.cxx | 8 - sw/source/filter/ww8/ww8atr.cxx | 16 +-- sw/source/filter/ww8/ww8par.cxx | 4 sw/source/filter/ww8/ww8par.hxx | 6 - sw/source/filter/ww8/ww8par3.cxx | 14 +- sw/source/filter/ww8/ww8par5.cxx | 52 +++++------ sw/source/ui/dbui/dbinsdlg.cxx | 2 sw/source/ui/dialog/uiregionsw.cxx | 2 sw/source/ui/fldui/fldref.cxx | 16 +-- sw/source/ui/inc/bookmark.hxx | 2 sw/source/ui/misc/bookmark.cxx | 28 ++--- sw/source/ui/vba/vbaformfield.cxx | 2 sw/source/ui/vba/vbaformfields.cxx | 5 - sw/source/uibase/dbui/dbmgr.cxx | 2 sw/source/uibase/dochdl/swdtflvr.cxx | 16 +-- sw/source/uibase/docvw/AnnotationWin.cxx | 2 sw/source/uibase/docvw/AnnotationWin2.cxx | 2 sw/source/uibase/docvw/edtwin2.cxx | 6 - sw/source/uibase/docvw/edtwin3.cxx | 2 sw/source/uibase/fldui/fldmgr.cxx | 10 +- sw/source/uibase/inc/conttree.hxx | 2 sw/source/uibase/inc/fldmgr.hxx | 5 - sw/source/uibase/inc/wrtsh.hxx | 4 sw/source/uibase/shells/basesh.cxx | 8 - sw/source/uibase/shells/textfld.cxx | 14 +- sw/source/uibase/shells/textsh1.cxx | 20 ++-- sw/source/uibase/uiview/view2.cxx | 14 +- sw/source/uibase/uiview/viewmdi.cxx | 2 sw/source/uibase/uno/loktxdoc.cxx | 16 +-- sw/source/uibase/utlui/bookctrl.cxx | 2 sw/source/uibase/utlui/content.cxx | 38 ++++---- sw/source/uibase/wrtsh/move.cxx | 2 sw/source/uibase/wrtsh/wrtsh2.cxx | 2 sw/source/uibase/wrtsh/wrtsh3.cxx | 2 110 files changed, 611 insertions(+), 538 deletions(-)
New commits: commit ac0a285f1fd0c411abffa73458969a4dfe8dbbd8 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Apr 15 08:21:54 2025 +0200 Commit: Noel Grandin <noelgran...@gmail.com> CommitDate: Tue Apr 15 12:33:50 2025 +0200 Make reference marker names typesafe by creating a wrapper class, to make it obvious in the code what kind of name we are dealing with. The new class is in sw/inc/names.hxx Change-Id: I889c3a56c1cbc451a9a88c4e4340fe4b3183cc2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184192 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/sw/inc/IDocumentFieldsAccess.hxx b/sw/inc/IDocumentFieldsAccess.hxx index 1ef5f3d1400a..b496b800202f 100644 --- a/sw/inc/IDocumentFieldsAccess.hxx +++ b/sw/inc/IDocumentFieldsAccess.hxx @@ -25,6 +25,7 @@ #include <sal/types.h> #include "swtypes.hxx" #include "nodeoffset.hxx" +#include "names.hxx" #include <unordered_map> class SwFieldTypes; @@ -59,6 +60,10 @@ namespace com::sun::star::uno { class Any; } virtual SwFieldType* GetFieldType(SwFieldIds nResId, const OUString& rName, bool bDbFieldMatching) const = 0; + // convenience method + SwFieldType* GetFieldType(SwFieldIds nResId, const ReferenceMarkerName& rName, bool bDbFieldMatching) const + { return GetFieldType(nResId, rName.toString(), bDbFieldMatching); } + virtual void RemoveFieldType(size_t nField) = 0; virtual void UpdateFields(bool bCloseDB, bool bSetModified = true) = 0; diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx index bfec4c53bfcd..1093aa497581 100644 --- a/sw/inc/IDocumentMarkAccess.hxx +++ b/sw/inc/IDocumentMarkAccess.hxx @@ -82,21 +82,21 @@ class IDocumentMarkAccess a pointer to the new mark (name might have changed). */ virtual ::sw::mark::MarkBase* makeMark(const SwPaM& rPaM, - const OUString& rProposedName, + const ReferenceMarkerName& rProposedName, MarkType eMark, ::sw::mark::InsertMode eMode, SwPosition const* pSepPos = nullptr) = 0; virtual sw::mark::Fieldmark* makeFieldBookmark( const SwPaM& rPaM, - const OUString& rName, + const ReferenceMarkerName& rName, const OUString& rType, SwPosition const* pSepPos = nullptr) = 0; virtual sw::mark::Fieldmark* makeNoTextFieldBookmark( const SwPaM& rPaM, - const OUString& rName, + const ReferenceMarkerName& rName, const OUString& rType) = 0; virtual sw::mark::MarkBase* makeAnnotationMark( const SwPaM& rPaM, - const OUString& rName ) = 0; + const ReferenceMarkerName& rName ) = 0; /** Returns a mark in the document for a paragraph. If there is none, a mark will be created. @@ -134,7 +134,7 @@ class IDocumentMarkAccess @returns false, if renaming failed (because the name is already in use) */ virtual bool renameMark(::sw::mark::MarkBase* io_pMark, - const OUString& rNewName) =0; + const ReferenceMarkerName& rNewName) =0; /** Corrects marks (absolute) This method ignores the previous position of the mark in the paragraph @@ -236,7 +236,7 @@ class IDocumentMarkAccess @returns an iterator pointing to the mark, or pointing to getAllMarksEnd() if nothing was found. */ - virtual const_iterator findMark(const OUString& rMark) const =0; + virtual const_iterator findMark(const ReferenceMarkerName& rMark) const =0; /** Find the first Bookmark that does not start before. @@ -270,7 +270,7 @@ class IDocumentMarkAccess @returns an iterator pointing to the bookmark, or getBookmarksEnd() if nothing was found. */ - virtual std::vector<sw::mark::Bookmark*>::const_iterator findBookmark(const OUString& rMark) const =0; + virtual std::vector<sw::mark::Bookmark*>::const_iterator findBookmark(const ReferenceMarkerName& rMark) const =0; /** Finds the first mark that is starting after. @@ -313,12 +313,12 @@ class IDocumentMarkAccess virtual std::vector<sw::mark::AnnotationMark*>::const_iterator getAnnotationMarksBegin() const = 0; virtual std::vector<sw::mark::AnnotationMark*>::const_iterator getAnnotationMarksEnd() const = 0; virtual sal_Int32 getAnnotationMarksCount() const = 0; - virtual std::vector<sw::mark::AnnotationMark*>::const_iterator findAnnotationMark( const OUString& rName ) const = 0; + virtual std::vector<sw::mark::AnnotationMark*>::const_iterator findAnnotationMark( const ReferenceMarkerName& rName ) const = 0; virtual sw::mark::AnnotationMark* 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::Bookmark* makeAnnotationBookmark(const SwPaM& rPaM, - const OUString& rProposedName, + const ReferenceMarkerName& rProposedName, ::sw::mark::InsertMode eMode, SwPosition const* pSepPos = nullptr) = 0; /** Find the first AnnotationMark that does not start before. @@ -328,7 +328,7 @@ class IDocumentMarkAccess */ virtual std::vector<sw::mark::AnnotationMark*>::const_iterator findFirstAnnotationMarkNotStartsBefore(const SwPosition& rPos) const =0; virtual std::vector<sw::mark::AnnotationMark*>::const_iterator findFirstAnnotationMarkNotStartsBefore(const SwNode& rPos) const =0; - virtual std::vector<sw::mark::Bookmark*>::const_iterator findAnnotationBookmark( const OUString& rName ) const = 0; + virtual std::vector<sw::mark::Bookmark*>::const_iterator findAnnotationBookmark( const ReferenceMarkerName& rName ) const = 0; virtual void restoreAnnotationMarks(bool bDelete = true) = 0; /** Returns the MarkType used to create the mark diff --git a/sw/inc/IMark.hxx b/sw/inc/IMark.hxx index fc69edfca651..5976a9c5b35b 100644 --- a/sw/inc/IMark.hxx +++ b/sw/inc/IMark.hxx @@ -29,6 +29,7 @@ #include "swrect.hxx" #include "calbck.hxx" #include "pam.hxx" +#include "names.hxx" #include "swdllapi.h" #include <map> #include <memory> @@ -61,7 +62,7 @@ namespace sw::mark //getters SwPosition& GetMarkPos() const { return const_cast<SwPosition&>(*m_oPos1); } - const OUString& GetName() const + const ReferenceMarkerName& GetName() const { return m_aName; } // GetOtherMarkPos() is only guaranteed to return a valid // reference if IsExpanded() returned true @@ -108,7 +109,7 @@ namespace sw::mark virtual bool IsExpanded() const { return m_oPos2.has_value(); } - void SetName(const OUString& rName) + void SetName(const ReferenceMarkerName& rName) { m_aName = rName; } virtual void SetMarkPos(const SwPosition& rNewPos); virtual void SetOtherMarkPos(const SwPosition& rNewPos); @@ -136,15 +137,15 @@ namespace sw::mark { return m_wXBookmark; } void SetXBookmark(rtl::Reference<SwXBookmark> const& xBkmk); - static OUString GenerateNewName(std::u16string_view rPrefix); + static ReferenceMarkerName GenerateNewName(std::u16string_view rPrefix); protected: // SwClient void SwClientNotify(const SwModify&, const SfxHint&) override; - MarkBase(const SwPaM& rPaM, OUString aName); + MarkBase(const SwPaM& rPaM, ReferenceMarkerName aName); std::optional<SwPosition> m_oPos1; std::optional<SwPosition> m_oPos2; - OUString m_aName; + ReferenceMarkerName m_aName; unotools::WeakReference<SwXBookmark> m_wXBookmark; }; @@ -190,7 +191,7 @@ namespace sw::mark public: Bookmark(const SwPaM& rPaM, const vcl::KeyCode& rCode, - const OUString& rName); + const ReferenceMarkerName& rName); void InitDoc(SwDoc& io_Doc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override; void DeregisterFromDoc(SwDoc& io_rDoc) override; @@ -271,7 +272,7 @@ namespace sw::mark : public Fieldmark { public: - TextFieldmark(const SwPaM& rPaM, const OUString& rName); + TextFieldmark(const SwPaM& rPaM, const ReferenceMarkerName& rName); ~TextFieldmark(); void InitDoc(SwDoc& io_rDoc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override; void ReleaseDoc(SwDoc& rDoc) override; @@ -300,7 +301,7 @@ namespace sw::mark : public NonTextFieldmark { public: - CheckboxFieldmark(const SwPaM& rPaM, const OUString& rName); + CheckboxFieldmark(const SwPaM& rPaM, const ReferenceMarkerName& rName); bool IsChecked() const; void SetChecked(bool checked); OUString GetContent() const override; @@ -328,7 +329,7 @@ namespace sw::mark : public FieldmarkWithDropDownButton { public: - DropDownFieldmark(const SwPaM& rPaM, const OUString& rName); + DropDownFieldmark(const SwPaM& rPaM, const ReferenceMarkerName& rName); ~DropDownFieldmark() override; void ShowButton(SwEditWin* pEditWin) override; diff --git a/sw/inc/SwRewriter.hxx b/sw/inc/SwRewriter.hxx index e41a076568ba..f4191c3fa3f0 100644 --- a/sw/inc/SwRewriter.hxx +++ b/sw/inc/SwRewriter.hxx @@ -21,6 +21,7 @@ #include <vector> #include <rtl/ustring.hxx> #include "swdllapi.h" +#include "names.hxx" enum SwUndoArg { @@ -39,6 +40,11 @@ public: SwRewriter(); void AddRule(SwUndoArg eWhat, const OUString& rWith); + // convenience method + void AddRule(SwUndoArg eWhat, const ReferenceMarkerName& rWith) + { + AddRule(eWhat, rWith.toString()); + } OUString Apply(const OUString& rStr) const; diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index e0bfd7b5e487..3d2db39bb09b 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -62,6 +62,7 @@ class SwPostItField; class SwTextField; class SwTextFootnote; class SwTextContentControl; +class ReferenceMarkerName; namespace i18nutil { struct SearchOptions2; @@ -592,11 +593,11 @@ public: // at CurrentCursor.SPoint SW_DLLPUBLIC ::sw::mark::MarkBase* SetBookmark( const vcl::KeyCode&, - const OUString& rName, + const ReferenceMarkerName& rName, IDocumentMarkAccess::MarkType eMark = IDocumentMarkAccess::MarkType::BOOKMARK); SW_DLLPUBLIC ::sw::mark::MarkBase* SetBookmark2( const vcl::KeyCode&, - const OUString& rName, + const ReferenceMarkerName& rName, bool bHide, const OUString& rCondition); SW_DLLPUBLIC bool GotoMark( const ::sw::mark::MarkBase* const pMark ); // sets CurrentCursor.SPoint @@ -724,7 +725,7 @@ public: // on graphics bool SelectNxtPrvHyperlink( bool bNext ); - bool GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType, + bool GotoRefMark( const ReferenceMarkerName& rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uInt16 nFlags ); // get the nth character from the start or end of the current selection diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index a36490211855..2ee90daac79f 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -138,6 +138,7 @@ class SwContentControlManager; enum class SvMacroItemId : sal_uInt16; enum class SvxFrameDirection; enum class RndStdIds; +class ReferenceMarkerName; namespace sw::mark { class MarkManager; } namespace sw { @@ -1328,7 +1329,7 @@ public: void SetTableName( SwFrameFormat& rTableFormat, const OUString &rNewName ); // @return the reference in document that is set for name. - const SwFormatRefMark* GetRefMark( std::u16string_view rName ) const; + const SwFormatRefMark* GetRefMark( const ReferenceMarkerName& rName ) const; // @return RefMark via index - for UNO. const SwFormatRefMark* GetRefMark( sal_uInt16 nIndex ) const; diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx index 2e762987b01a..9e3d66e53970 100644 --- a/sw/inc/docufld.hxx +++ b/sw/inc/docufld.hxx @@ -30,6 +30,7 @@ #include <svl/macitem.hxx> #include "fldbas.hxx" +#include "names.hxx" class SetGetExpFields; class SwTextField; @@ -454,7 +455,7 @@ class SW_DLLPUBLIC SwPostItField final : public SwField OUString m_sText; OUString m_sAuthor; OUString m_sInitials; ///< Initials of the author. - OUString m_sName; ///< Name of the comment. + ReferenceMarkerName m_sName; ///< Name of the comment. DateTime m_aDateTime; bool m_bResolved; std::optional<OutlinerParaObject> mpText; @@ -463,7 +464,7 @@ class SW_DLLPUBLIC SwPostItField final : public SwField sal_uInt32 m_nParentId; sal_uInt32 m_nParaId; sal_uInt32 m_nParentPostItId; - OUString m_sParentName; /// Parent comment's name. + ReferenceMarkerName m_sParentName; /// Parent comment's name. public: static sal_uInt32 s_nLastPostItId; @@ -472,14 +473,14 @@ public: OUString aAuthor, OUString aText, OUString aInitials, - OUString aName, + ReferenceMarkerName aName, const DateTime& rDate, const bool bResolved = false, const sal_uInt32 nPostItId = 0, const sal_uInt32 nParentId = 0, const sal_uInt32 nParaId = 0, const sal_uInt32 nParentPostItId = 0, - const OUString aParentName = OUString()); + const ReferenceMarkerName aParentName = ReferenceMarkerName()); SwPostItField(const SwPostItField&) = delete; SwPostItField* operator=(const SwPostItField&) = delete; @@ -510,10 +511,10 @@ public: virtual void SetPar2(const OUString& rStr) override; const OUString& GetText() const { return m_sText; } const OUString& GetInitials() const { return m_sInitials;} - void SetName(const OUString& rStr); - const OUString& GetName() const { return m_sName;} - const OUString& GetParentName() const { return m_sParentName; } - void SetParentName(const OUString& rStr); + void SetName(const ReferenceMarkerName& rStr); + const ReferenceMarkerName& GetName() const { return m_sName;} + const ReferenceMarkerName& GetParentName() const { return m_sParentName; } + void SetParentName(const ReferenceMarkerName& rStr); const OutlinerParaObject* GetTextObject() const { return mpText ? &*mpText : nullptr;} void SetTextObject( std::optional<OutlinerParaObject> pText ); diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 3568be169fad..f973da20c81d 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -835,7 +835,7 @@ public: void SetLinguRange( SwDocPositions eStart, SwDocPositions eEnd ); /// @return reference set in document according to given name. - const SwFormatRefMark* GetRefMark( std::u16string_view rName ) const; + const SwFormatRefMark* GetRefMark( const ReferenceMarkerName& rName ) const; /** @return names of all references set in document. If ArrayPointer == 0 then return only whether a RefMark is set in document. */ diff --git a/sw/inc/fmtrfmrk.hxx b/sw/inc/fmtrfmrk.hxx index b5a7b96cddc1..8eeca942c6cf 100644 --- a/sw/inc/fmtrfmrk.hxx +++ b/sw/inc/fmtrfmrk.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/text/XTextContent.hpp> #include "calbck.hxx" +#include "names.hxx" class SwTextRefMark; class SwXReferenceMark; @@ -43,13 +44,13 @@ class SAL_DLLPUBLIC_RTTI SwFormatRefMark final : public SfxPoolItem SwTextRefMark* m_pTextAttr; SwFormatRefMark& operator=(const SwFormatRefMark& rRefMark) = delete; - OUString m_aRefName; + ReferenceMarkerName m_aRefName; unotools::WeakReference<SwXReferenceMark> m_wXReferenceMark; public: DECLARE_ITEM_TYPE_FUNCTION(SwFormatRefMark) - SwFormatRefMark( OUString aText ); + SwFormatRefMark( ReferenceMarkerName aText ); SwFormatRefMark( const SwFormatRefMark& rRefMark ); virtual ~SwFormatRefMark( ) override; @@ -61,8 +62,8 @@ public: const SwTextRefMark *GetTextRefMark() const { return m_pTextAttr; } - OUString &GetRefName() { return m_aRefName; } - const OUString &GetRefName() const { return m_aRefName; } + ReferenceMarkerName &GetRefName() { return m_aRefName; } + const ReferenceMarkerName &GetRefName() const { return m_aRefName; } unotools::WeakReference<SwXReferenceMark> const& GetXRefMark() const { return m_wXReferenceMark; } diff --git a/sw/inc/mdiexp.hxx b/sw/inc/mdiexp.hxx index 6d4af73bd80b..2e98f0c44f29 100644 --- a/sw/inc/mdiexp.hxx +++ b/sw/inc/mdiexp.hxx @@ -30,6 +30,7 @@ class SwRect; class Size; class SwViewShell; class SwDocShell; +class ReferenceMarkerName; extern void ScrollMDI(SwViewShell const * pVwSh, const SwRect &, sal_uInt16 nRangeX, sal_uInt16 nRangeY , ScrollSizeMode eScrollSizeMode = ScrollSizeMode::ScrollSizeDefault); @@ -52,6 +53,6 @@ void RepaintPagePreview( SwViewShell const * pVwSh, const SwRect& rRect ); // Read ChgMode for tables from configuration. TableChgMode GetTableChgDefaultMode(); -bool JumpToSwMark( SwViewShell const * pVwSh, std::u16string_view rMark ); +bool JumpToSwMark( SwViewShell const * pVwSh, const ReferenceMarkerName& rMark ); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/names.hxx b/sw/inc/names.hxx index fe15221d2c7a..088c2ffcfd9c 100644 --- a/sw/inc/names.hxx +++ b/sw/inc/names.hxx @@ -32,4 +32,35 @@ private: OUString m_s; }; +class ReferenceMarkerName +{ +public: + ReferenceMarkerName() {} + explicit ReferenceMarkerName(const OUString& s) + : m_s(s) + { + } + const OUString& toString() const { return m_s; } + bool isEmpty() const { return m_s.isEmpty(); } + bool operator==(const ReferenceMarkerName& s) const = default; + bool operator==(const OUString& s) const { return m_s == s; } + bool operator==(std::u16string_view s) const { return m_s == s; } + bool operator<(const ReferenceMarkerName& s) const { return m_s < s.m_s; } + bool operator>(const ReferenceMarkerName& s) const { return m_s > s.m_s; } + +private: + OUString m_s; +}; + +namespace std +{ +template <> struct hash<ReferenceMarkerName> +{ + std::size_t operator()(ReferenceMarkerName const& s) const + { + return std::hash<OUString>()(s.toString()); + } +}; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index d8cad0462c9e..86f106644974 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -46,6 +46,7 @@ class SvxFirstLineIndentItem; class SvxTextLeftMarginItem; struct SvxFontUnitMetrics; class SwXParagraph; +class ReferenceMarkerName; namespace utl { class TransliterationWrapper; @@ -393,7 +394,7 @@ public: */ static void EstablishParentChildRelationsOfComments(const SwTextNode* pDest, std::map<sal_Int32, sal_Int32>& idMapForComments, - std::map<sal_Int32, OUString>& nameMapForComments); + std::map<sal_Int32, ReferenceMarkerName>& nameMapForComments); void CutText(SwTextNode * const pDest, const SwContentIndex & rStart, const sal_Int32 nLen); diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx index defa7f4f7dfe..1ce70d6eca35 100644 --- a/sw/inc/reffld.hxx +++ b/sw/inc/reffld.hxx @@ -22,6 +22,7 @@ #include <tools/solar.h> #include "fldbas.hxx" +#include "names.hxx" class SfxPoolItem; class SwDoc; @@ -94,7 +95,7 @@ public: void MergeWithOtherDoc( SwDoc& rDestDoc ); - static SwTextNode* FindAnchor( SwDoc* pDoc, const OUString& rRefMark, + static SwTextNode* FindAnchor( SwDoc* pDoc, const ReferenceMarkerName& rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uInt16 nFlags, sal_Int32* pStart, sal_Int32* pEnd = nullptr, SwRootFrame const* pLayout = nullptr, @@ -103,7 +104,7 @@ public: void UpdateStyleReferences(); private: - static SwTextNode* FindAnchorRefStyle( SwDoc* pDoc, const OUString& rRefMark, + static SwTextNode* FindAnchorRefStyle( SwDoc* pDoc, const ReferenceMarkerName& rRefMark, sal_uInt16 nFlags, sal_Int32* pStart, sal_Int32* pEnd, SwRootFrame const* pLayout, @@ -122,7 +123,7 @@ private: class SAL_DLLPUBLIC_RTTI SwGetRefField final : public SwField { private: - OUString m_sSetRefName; + ReferenceMarkerName m_sSetRefName; OUString m_sSetReferenceLanguage; OUString m_sText; ///< result OUString m_sTextRLHidden; ///< result for layout with redlines hidden @@ -134,14 +135,14 @@ private: virtual OUString ExpandImpl(SwRootFrame const* pLayout) const override; virtual std::unique_ptr<SwField> Copy() const override; public: - SW_DLLPUBLIC SwGetRefField( SwGetRefFieldType*, OUString aSetRef, OUString aReferenceLanguage, + SW_DLLPUBLIC SwGetRefField( SwGetRefFieldType*, ReferenceMarkerName aSetRef, OUString aReferenceLanguage, sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uInt16 nFlags, sal_uLong nFormat ); SW_DLLPUBLIC virtual ~SwGetRefField() override; virtual OUString GetFieldName() const override; - const OUString& GetSetRefName() const { return m_sSetRefName; } + const ReferenceMarkerName& GetSetRefName() const { return m_sSetRefName; } // #i81002# /** The <SwTextField> instance, which represents the text attribute for the diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index 42da42cea7ee..5e5dad6f73b7 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -71,6 +71,7 @@ class SwCursorShell; enum class SvxSearchCmd; enum class SelectionType : sal_Int32; class SwNode; +class ReferenceMarkerName; namespace com::sun::star::view { class XSelectionSupplier; } namespace sfx2 { class FileDialogHelper; } @@ -616,7 +617,7 @@ public: void SetCursorAtTop( bool bFlag, bool bCenter = false ) { m_bTopCursor = bFlag; m_bCenterCursor = bCenter; } - bool JumpToSwMark( std::u16string_view rMark ); + bool JumpToSwMark( const ReferenceMarkerName& rMark ); tools::Long InsertDoc( sal_uInt16 nSlotId, const OUString& rFileName, const OUString& rFilterName, sal_Int16 nVersion = 0 ); diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx index 9b724e4d77c0..336d03c404cb 100644 --- a/sw/qa/core/doc/doc.cxx +++ b/sw/qa/core/doc/doc.cxx @@ -327,7 +327,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testCopyBookmarks) for (auto it = pDoc->getIDocumentMarkAccess()->getBookmarksBegin(); it != pDoc->getIDocumentMarkAccess()->getBookmarksEnd(); ++it) { - if ((*it)->GetName().indexOf("Copy") == -1) + if ((*it)->GetName().toString().indexOf("Copy") == -1) { ++nActual; } diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index 3a9e06de4caa..046243bcd3f5 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -967,7 +967,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testPageRemoveFlyTable) pWrtShell->Reformat(); // Then make sure that the 2nd table below the bookmark has no unwanted top margin: - pWrtShell->GotoMark(u"test"_ustr); + pWrtShell->GotoMark(ReferenceMarkerName(u"test"_ustr)); pWrtShell->Down(/*bSelect=*/false, /*nCount=*/1, /*bBasicCall=*/false); pWrtShell->Down(/*bSelect=*/false, /*nCount=*/1, /*bBasicCall=*/false); SwCursor* pCursor = pWrtShell->GetCursor(); diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index 22d8126fa039..5afa86b459e8 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -193,7 +193,7 @@ void SwMacrosTest::testBookmarkDeleteAndJoin() aPaM.Move(fnMoveForward, GoInDoc); IDocumentMarkAccess & rIDMA = *pDoc->getIDocumentMarkAccess(); sw::mark::MarkBase *pMark = - rIDMA.makeMark(aPaM, u"test"_ustr, IDocumentMarkAccess::MarkType::BOOKMARK, + rIDMA.makeMark(aPaM, ReferenceMarkerName(u"test"_ustr), IDocumentMarkAccess::MarkType::BOOKMARK, ::sw::mark::InsertMode::New); CPPUNIT_ASSERT(pMark); // select so pMark start position is on a node that is fully deleted @@ -228,7 +228,7 @@ void SwMacrosTest::testBookmarkDeleteTdf90816() aPaM.Move(fnMoveBackward, GoInContent); IDocumentMarkAccess & rIDMA = *pDoc->getIDocumentMarkAccess(); sw::mark::MarkBase *pMark = - rIDMA.makeMark(aPaM, u"test"_ustr, IDocumentMarkAccess::MarkType::BOOKMARK, + rIDMA.makeMark(aPaM, ReferenceMarkerName(u"test"_ustr), IDocumentMarkAccess::MarkType::BOOKMARK, ::sw::mark::InsertMode::New); CPPUNIT_ASSERT(pMark); diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx index 97d565d0eff9..c4fee7887228 100644 --- a/sw/qa/core/txtnode/txtnode.cxx +++ b/sw/qa/core/txtnode/txtnode.cxx @@ -582,8 +582,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testCopyCommentsWithReplies) } // parents (original-copied), replies (original-copied) - CPPUNIT_ASSERT_EQUAL(comments[0]->GetName(), comments[1]->GetParentName()); - CPPUNIT_ASSERT_EQUAL(comments[2]->GetName(), comments[3]->GetParentName()); + CPPUNIT_ASSERT_EQUAL(comments[0]->GetName().toString(), + comments[1]->GetParentName().toString()); + CPPUNIT_ASSERT_EQUAL(comments[2]->GetName().toString(), + comments[3]->GetParentName().toString()); } CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testNodeSplitStyleListLevel) diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index e4be7b98737e..7613bc3249aa 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -355,7 +355,7 @@ static SwTextNode* getModelToViewTestDocument2(SwDoc *pDoc) pDoc->getIDocumentContentOperations().InsertString(aPaM, u"AAAAA"_ustr); IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess(); sw::mark::Fieldmark *pFieldmark = - pMarksAccess->makeNoTextFieldBookmark(aPaM, u"test"_ustr, ODF_FORMDROPDOWN); + pMarksAccess->makeNoTextFieldBookmark(aPaM, ReferenceMarkerName(u"test"_ustr), ODF_FORMDROPDOWN); CPPUNIT_ASSERT(pFieldmark); uno::Sequence< OUString > vListEntries { u"BBBBB"_ustr }; (*pFieldmark->GetParameters())[ODF_FORMDROPDOWN_LISTENTRY] <<= vListEntries; @@ -718,7 +718,7 @@ void SwDocTest::testSwScanner() const sal_Int32 nNextPos = aPaM.GetPoint()->GetContentIndex(); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(nPos+1), nNextPos); - SwFormatRefMark aRef(u"refmark"_ustr); + SwFormatRefMark aRef(ReferenceMarkerName(u"refmark"_ustr)); pTA = pTextNode->InsertItem(aRef, nNextPos, nNextPos); CPPUNIT_ASSERT(pTA); @@ -734,7 +734,7 @@ void SwDocTest::testSwScanner() DateTime aDate(DateTime::SYSTEM); SwPostItField aPostIt( static_cast<SwPostItFieldType*>(m_pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Postit)), u"An Author"_ustr, - u"Some Text"_ustr, u"Initials"_ustr, u"Name"_ustr, aDate ); + u"Some Text"_ustr, u"Initials"_ustr, ReferenceMarkerName(u"Name"_ustr), aDate ); m_pDoc->getIDocumentContentOperations().InsertPoolItem(aPaM, SwFormatField(aPostIt)); m_pDoc->getIDocumentContentOperations().InsertString(aPaM, u"Apple"_ustr); @@ -1457,21 +1457,21 @@ void SwDocTest::testMarkMove() m_pDoc->getIDocumentContentOperations().InsertString(aPaM, u"Paragraph 1"_ustr); aPaM.SetMark(); aPaM.GetMark()->nContent -= aPaM.GetMark()->GetContentIndex(); - pMarksAccess->makeMark(aPaM, u"Para1"_ustr, + pMarksAccess->makeMark(aPaM, ReferenceMarkerName(u"Para1"_ustr), IDocumentMarkAccess::MarkType::BOOKMARK, sw::mark::InsertMode::New); m_pDoc->getIDocumentContentOperations().AppendTextNode(*aPaM.GetPoint()); m_pDoc->getIDocumentContentOperations().InsertString(aPaM, u"Paragraph 2"_ustr); aPaM.SetMark(); aPaM.GetMark()->nContent -= aPaM.GetMark()->GetContentIndex(); - pMarksAccess->makeMark(aPaM, u"Para2"_ustr, + pMarksAccess->makeMark(aPaM, ReferenceMarkerName(u"Para2"_ustr), IDocumentMarkAccess::MarkType::BOOKMARK, sw::mark::InsertMode::New); m_pDoc->getIDocumentContentOperations().AppendTextNode(*aPaM.GetPoint()); m_pDoc->getIDocumentContentOperations().InsertString(aPaM, u"Paragraph 3"_ustr); aPaM.SetMark(); aPaM.GetMark()->nContent -= aPaM.GetMark()->GetContentIndex(); - pMarksAccess->makeMark(aPaM, u"Para3"_ustr, + pMarksAccess->makeMark(aPaM, ReferenceMarkerName(u"Para3"_ustr), IDocumentMarkAccess::MarkType::BOOKMARK, sw::mark::InsertMode::New); } @@ -1481,9 +1481,9 @@ void SwDocTest::testMarkMove() SwTextNode& rParaNode2 = dynamic_cast<SwTextNode&>(aIdx.GetNode()); rParaNode2.JoinNext(); } - ::sw::mark::MarkBase* pBM1 = *pMarksAccess->findMark(u"Para1"_ustr); - ::sw::mark::MarkBase* pBM2 = *pMarksAccess->findMark(u"Para2"_ustr); - ::sw::mark::MarkBase* pBM3 = *pMarksAccess->findMark(u"Para3"_ustr); + ::sw::mark::MarkBase* pBM1 = *pMarksAccess->findMark(ReferenceMarkerName(u"Para1"_ustr)); + ::sw::mark::MarkBase* pBM2 = *pMarksAccess->findMark(ReferenceMarkerName(u"Para2"_ustr)); + ::sw::mark::MarkBase* pBM3 = *pMarksAccess->findMark(ReferenceMarkerName(u"Para3"_ustr)); CPPUNIT_ASSERT_EQUAL(sal_Int32(0) , pBM1->GetMarkStart().GetContentIndex()); CPPUNIT_ASSERT_EQUAL(sal_Int32(11), pBM1->GetMarkEnd().GetContentIndex()); @@ -1518,9 +1518,9 @@ void SwDocTest::testMarkMove() aPaM.GetMark()->nContent += 6; m_pDoc->getIDocumentContentOperations().DeleteAndJoin(aPaM); } - pBM1 = *pMarksAccess->findMark(u"Para1"_ustr); - pBM2 = *pMarksAccess->findMark(u"Para2"_ustr); - pBM3 = *pMarksAccess->findMark(u"Para3"_ustr); + pBM1 = *pMarksAccess->findMark(ReferenceMarkerName(u"Para1"_ustr)); + pBM2 = *pMarksAccess->findMark(ReferenceMarkerName(u"Para2"_ustr)); + pBM3 = *pMarksAccess->findMark(ReferenceMarkerName(u"Para3"_ustr)); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pBM1->GetMarkStart().GetContentIndex()); CPPUNIT_ASSERT_EQUAL(sal_Int32(6), pBM1->GetMarkEnd().GetContentIndex()); @@ -1554,9 +1554,9 @@ void SwDocTest::testMarkMove() aPos.nContent += 8; m_pDoc->getIDocumentContentOperations().SplitNode(aPos, false); } - pBM1 = *pMarksAccess->findMark(u"Para1"_ustr); - pBM2 = *pMarksAccess->findMark(u"Para2"_ustr); - pBM3 = *pMarksAccess->findMark(u"Para3"_ustr); + pBM1 = *pMarksAccess->findMark(ReferenceMarkerName(u"Para1"_ustr)); + pBM2 = *pMarksAccess->findMark(ReferenceMarkerName(u"Para2"_ustr)); + pBM3 = *pMarksAccess->findMark(ReferenceMarkerName(u"Para3"_ustr)); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pBM1->GetMarkStart().GetContentIndex()); CPPUNIT_ASSERT_EQUAL(sal_Int32(6), pBM1->GetMarkEnd().GetContentIndex()); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index 384551f3f806..6589dd76d03d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -1022,7 +1022,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf151548_activeContentDemo, "tdf151548_activeConte IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); for(auto aIter = pMarkAccess->getFieldmarksBegin(); aIter != pMarkAccess->getFieldmarksEnd(); ++aIter) { - const OUString sName = (*aIter)->GetName(); + const ReferenceMarkerName sName = (*aIter)->GetName(); CPPUNIT_ASSERT(sName == "Check1" || sName == "Text1" || sName == "Dropdown1"); } } diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index dd683c11acce..4c2536a7ae0a 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -446,7 +446,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testBookmarkCopy) rIDCO.InsertString(aPaM, u"bar"_ustr); aPaM.SetMark(); aPaM.MovePara(GoCurrPara, fnParaStart); - rIDMA.makeMark(aPaM, u"Mark"_ustr, IDocumentMarkAccess::MarkType::BOOKMARK, + rIDMA.makeMark(aPaM, ReferenceMarkerName(u"Mark"_ustr), IDocumentMarkAccess::MarkType::BOOKMARK, ::sw::mark::InsertMode::New); aPaM.Exchange(); aPaM.DeleteMark(); @@ -1513,7 +1513,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testBookmarkUndo) IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); SwPaM aPaM( SwNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1) ); - pMarkAccess->makeMark(aPaM, u"Mark"_ustr, IDocumentMarkAccess::MarkType::BOOKMARK, + pMarkAccess->makeMark(aPaM, ReferenceMarkerName(u"Mark"_ustr), IDocumentMarkAccess::MarkType::BOOKMARK, ::sw::mark::InsertMode::New); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount()); rUndoManager.Undo(); @@ -1521,20 +1521,20 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testBookmarkUndo) rUndoManager.Redo(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount()); - auto ppBkmk = pMarkAccess->findMark(u"Mark"_ustr); + auto ppBkmk = pMarkAccess->findMark(ReferenceMarkerName(u"Mark"_ustr)); CPPUNIT_ASSERT(ppBkmk != pMarkAccess->getAllMarksEnd()); - pMarkAccess->renameMark(*ppBkmk, u"Mark_"_ustr); - CPPUNIT_ASSERT(bool(pMarkAccess->findMark(u"Mark"_ustr) == pMarkAccess->getAllMarksEnd())); - CPPUNIT_ASSERT(pMarkAccess->findMark(u"Mark_"_ustr) != pMarkAccess->getAllMarksEnd()); + pMarkAccess->renameMark(*ppBkmk, ReferenceMarkerName(u"Mark_"_ustr)); + CPPUNIT_ASSERT(bool(pMarkAccess->findMark(ReferenceMarkerName(u"Mark"_ustr)) == pMarkAccess->getAllMarksEnd())); + CPPUNIT_ASSERT(pMarkAccess->findMark(ReferenceMarkerName(u"Mark_"_ustr)) != pMarkAccess->getAllMarksEnd()); rUndoManager.Undo(); - CPPUNIT_ASSERT(pMarkAccess->findMark(u"Mark"_ustr) != pMarkAccess->getAllMarksEnd()); - CPPUNIT_ASSERT(bool(pMarkAccess->findMark(u"Mark_"_ustr) == pMarkAccess->getAllMarksEnd())); + CPPUNIT_ASSERT(pMarkAccess->findMark(ReferenceMarkerName(u"Mark"_ustr)) != pMarkAccess->getAllMarksEnd()); + CPPUNIT_ASSERT(bool(pMarkAccess->findMark(ReferenceMarkerName(u"Mark_"_ustr)) == pMarkAccess->getAllMarksEnd())); rUndoManager.Redo(); - CPPUNIT_ASSERT(bool(pMarkAccess->findMark(u"Mark"_ustr) == pMarkAccess->getAllMarksEnd())); - CPPUNIT_ASSERT(pMarkAccess->findMark(u"Mark_"_ustr) != pMarkAccess->getAllMarksEnd()); + CPPUNIT_ASSERT(bool(pMarkAccess->findMark(ReferenceMarkerName(u"Mark"_ustr)) == pMarkAccess->getAllMarksEnd())); + CPPUNIT_ASSERT(pMarkAccess->findMark(ReferenceMarkerName(u"Mark_"_ustr)) != pMarkAccess->getAllMarksEnd()); - pMarkAccess->deleteMark(pMarkAccess->findMark(u"Mark_"_ustr), false); + pMarkAccess->deleteMark(pMarkAccess->findMark(ReferenceMarkerName(u"Mark_"_ustr)), false); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount()); rUndoManager.Undo(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount()); @@ -1553,7 +1553,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf148389_Left) pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 3, /*bBasicCall=*/false); IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); - auto pMark = pMarkAccess->makeMark(*pWrtShell->GetCursor(), u"Mark"_ustr, + auto pMark = pMarkAccess->makeMark(*pWrtShell->GetCursor(), ReferenceMarkerName(u"Mark"_ustr), IDocumentMarkAccess::MarkType::BOOKMARK, ::sw::mark::InsertMode::New); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount()); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 4, /*bBasicCall=*/false); @@ -1616,7 +1616,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf148389_Right) pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 3, /*bBasicCall=*/false); IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); - auto pMark = pMarkAccess->makeMark(*pWrtShell->GetCursor(), u"Mark"_ustr, + auto pMark = pMarkAccess->makeMark(*pWrtShell->GetCursor(), ReferenceMarkerName(u"Mark"_ustr), IDocumentMarkAccess::MarkType::BOOKMARK, ::sw::mark::InsertMode::New); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount()); pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 2, /*bBasicCall=*/false); @@ -1918,7 +1918,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf63214) aPaM.SetMark(); aPaM.Move(fnMoveForward, GoInContent); //Inserting a crossRefBookmark - pMarkAccess->makeMark(aPaM, u"Bookmark"_ustr, + pMarkAccess->makeMark(aPaM, ReferenceMarkerName(u"Bookmark"_ustr), IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK, ::sw::mark::InsertMode::New); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount()); @@ -1950,7 +1950,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf51741) IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); SwPaM aPaM( SwNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1) ); //Modification 1 - pMarkAccess->makeMark(aPaM, u"Mark"_ustr, IDocumentMarkAccess::MarkType::BOOKMARK, + pMarkAccess->makeMark(aPaM, ReferenceMarkerName(u"Mark"_ustr), IDocumentMarkAccess::MarkType::BOOKMARK, ::sw::mark::InsertMode::New); CPPUNIT_ASSERT(pWrtShell->IsModified()); pWrtShell->ResetModified(); @@ -1965,28 +1965,28 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf51741) CPPUNIT_ASSERT(pWrtShell->IsModified()); pWrtShell->ResetModified(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount()); - auto ppBkmk = pMarkAccess->findMark(u"Mark"_ustr); + auto ppBkmk = pMarkAccess->findMark(ReferenceMarkerName(u"Mark"_ustr)); CPPUNIT_ASSERT(ppBkmk != pMarkAccess->getAllMarksEnd()); //Modification 4 - pMarkAccess->renameMark(*ppBkmk, u"Mark_"_ustr); + pMarkAccess->renameMark(*ppBkmk, ReferenceMarkerName(u"Mark_"_ustr)); CPPUNIT_ASSERT(pWrtShell->IsModified()); pWrtShell->ResetModified(); - CPPUNIT_ASSERT(bool(pMarkAccess->findMark(u"Mark"_ustr) == pMarkAccess->getAllMarksEnd())); - CPPUNIT_ASSERT(pMarkAccess->findMark(u"Mark_"_ustr) != pMarkAccess->getAllMarksEnd()); + CPPUNIT_ASSERT(bool(pMarkAccess->findMark(ReferenceMarkerName(u"Mark"_ustr)) == pMarkAccess->getAllMarksEnd())); + CPPUNIT_ASSERT(pMarkAccess->findMark(ReferenceMarkerName(u"Mark_"_ustr)) != pMarkAccess->getAllMarksEnd()); //Modification 5 rUndoManager.Undo(); CPPUNIT_ASSERT(pWrtShell->IsModified()); pWrtShell->ResetModified(); - CPPUNIT_ASSERT(pMarkAccess->findMark(u"Mark"_ustr) != pMarkAccess->getAllMarksEnd()); - CPPUNIT_ASSERT(bool(pMarkAccess->findMark(u"Mark_"_ustr) == pMarkAccess->getAllMarksEnd())); + CPPUNIT_ASSERT(pMarkAccess->findMark(ReferenceMarkerName(u"Mark"_ustr)) != pMarkAccess->getAllMarksEnd()); + CPPUNIT_ASSERT(bool(pMarkAccess->findMark(ReferenceMarkerName(u"Mark_"_ustr)) == pMarkAccess->getAllMarksEnd())); //Modification 6 rUndoManager.Redo(); CPPUNIT_ASSERT(pWrtShell->IsModified()); pWrtShell->ResetModified(); - CPPUNIT_ASSERT(bool(pMarkAccess->findMark(u"Mark"_ustr) == pMarkAccess->getAllMarksEnd())); - CPPUNIT_ASSERT(pMarkAccess->findMark(u"Mark_"_ustr) != pMarkAccess->getAllMarksEnd()); + CPPUNIT_ASSERT(bool(pMarkAccess->findMark(ReferenceMarkerName(u"Mark"_ustr)) == pMarkAccess->getAllMarksEnd())); + CPPUNIT_ASSERT(pMarkAccess->findMark(ReferenceMarkerName(u"Mark_"_ustr)) != pMarkAccess->getAllMarksEnd()); //Modification 7 - pMarkAccess->deleteMark(pMarkAccess->findMark(u"Mark_"_ustr), false); + pMarkAccess->deleteMark(pMarkAccess->findMark(ReferenceMarkerName(u"Mark_"_ustr)), false); CPPUNIT_ASSERT(pWrtShell->IsModified()); pWrtShell->ResetModified(); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pMarkAccess->getAllMarksCount()); diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 2d2ad13e20bb..e8ef268fd6fe 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -1451,11 +1451,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147206) IDocumentMarkAccess& rIDMA(*pDoc->getIDocumentMarkAccess()); auto const headingMark = std::find_if(rIDMA.getAllMarksBegin(), rIDMA.getAllMarksEnd(), [](auto const* const it) { - return it->GetName().startsWith( + return it->GetName().toString().startsWith( IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix()); }); CPPUNIT_ASSERT(headingMark != rIDMA.getAllMarksEnd()); - OUString const headingLink("#" + (*headingMark)->GetName()); + OUString const headingLink("#" + (*headingMark)->GetName().toString()); // select tox entry pWrtShell->SttEndDoc(false); @@ -1840,7 +1840,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks) pWrtShell->Push(); OUString const url(aSet.GetItem<SwFormatINetFormat>(RES_TXTATR_INETFMT)->GetValue()); CPPUNIT_ASSERT_EQUAL(u"#1%19the%20tocmark%19C%7Ctoxmark"_ustr, url); - rView.JumpToSwMark(url.subView(1)); // SfxApplication::OpenDocExec_Impl eats the "#" + rView.JumpToSwMark( + ReferenceMarkerName(url.copy(1))); // SfxApplication::OpenDocExec_Impl eats the "#" CPPUNIT_ASSERT_EQUAL(OUString(OUStringChar(CH_TXTATR_INWORD) + "tocmark"), pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText()); pWrtShell->Pop(SwCursorShell::PopMode::DeleteCurrent); @@ -1855,7 +1856,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks) pWrtShell->Push(); OUString const url(aSet.GetItem<SwFormatINetFormat>(RES_TXTATR_INETFMT)->GetValue()); CPPUNIT_ASSERT_EQUAL(u"#__RefHeading___Toc105_706348105"_ustr, url); - rView.JumpToSwMark(url.subView(1)); + rView.JumpToSwMark(ReferenceMarkerName(url.copy(1))); CPPUNIT_ASSERT_EQUAL(u"foo"_ustr, pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText()); pWrtShell->Pop(SwCursorShell::PopMode::DeleteCurrent); @@ -1876,7 +1877,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks) OUString const url(aSet.GetItem<SwFormatINetFormat>(RES_TXTATR_INETFMT)->GetValue()); CPPUNIT_ASSERT_EQUAL(u"#1%19the%20udmark%19UUser-Defined%20Index%7Ctoxmark"_ustr, url); // User-Defined => User-Defined Index, tdf#161574 - rView.JumpToSwMark(url.subView(1)); + rView.JumpToSwMark(ReferenceMarkerName(url.copy(1))); CPPUNIT_ASSERT_EQUAL(OUString(OUStringChar(CH_TXTATR_INWORD) + "udmark the first"), pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText()); pWrtShell->Pop(SwCursorShell::PopMode::DeleteCurrent); @@ -1892,7 +1893,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks) OUString const url(aSet.GetItem<SwFormatINetFormat>(RES_TXTATR_INETFMT)->GetValue()); CPPUNIT_ASSERT_EQUAL(u"#2%19the%20udmark%19UUser-Defined%20Index%7Ctoxmark"_ustr, url); // User-Defined => User-Defined Index, tdf#161574 - rView.JumpToSwMark(url.subView(1)); + rView.JumpToSwMark(ReferenceMarkerName(url.copy(1))); CPPUNIT_ASSERT_EQUAL(OUString(OUStringChar(CH_TXTATR_INWORD) + "udmark the 2nd"), pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText()); pWrtShell->Pop(SwCursorShell::PopMode::DeleteCurrent); @@ -1907,7 +1908,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks) pWrtShell->Push(); OUString const url(aSet.GetItem<SwFormatINetFormat>(RES_TXTATR_INETFMT)->GetValue()); CPPUNIT_ASSERT_EQUAL(u"#__RefHeading___Toc105_706348105"_ustr, url); - rView.JumpToSwMark(url.subView(1)); + rView.JumpToSwMark(ReferenceMarkerName(url.copy(1))); CPPUNIT_ASSERT_EQUAL(u"foo"_ustr, pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText()); pWrtShell->Pop(SwCursorShell::PopMode::DeleteCurrent); @@ -1927,7 +1928,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks) pWrtShell->Push(); OUString const url(aSet.GetItem<SwFormatINetFormat>(RES_TXTATR_INETFMT)->GetValue()); CPPUNIT_ASSERT_EQUAL(u"#1%19the%20udmark%19UNewUD!%7C%7Ctoxmark"_ustr, url); - rView.JumpToSwMark(url.subView(1)); + rView.JumpToSwMark(ReferenceMarkerName(url.copy(1))); CPPUNIT_ASSERT_EQUAL(u"the udmark"_ustr, pWrtShell->GetCursor()->GetPointNode().GetTextNode()->GetText()); pWrtShell->Pop(SwCursorShell::PopMode::DeleteCurrent); diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index 0e272ac06c70..1edb7bbc84ec 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -542,8 +542,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf96479) SwPaM aPaM(aIdx); IDocumentMarkAccess& rIDMA = *pDoc->getIDocumentMarkAccess(); sw::mark::MarkBase* pMark - = rIDMA.makeMark(aPaM, u"original"_ustr, IDocumentMarkAccess::MarkType::BOOKMARK, - ::sw::mark::InsertMode::New); + = rIDMA.makeMark(aPaM, ReferenceMarkerName(u"original"_ustr), + IDocumentMarkAccess::MarkType::BOOKMARK, ::sw::mark::InsertMode::New); CPPUNIT_ASSERT(!pMark->IsExpanded()); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), rIDMA.getBookmarksCount()); @@ -696,9 +696,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkText) lcl_selectCharacters(aPaM, 0, 3); IDocumentMarkAccess& rIDMA = *pDoc->getIDocumentMarkAccess(); - sw::mark::MarkBase* pMark = rIDMA.makeMark(aPaM, u"testBookmark"_ustr, - IDocumentMarkAccess::MarkType::BOOKMARK, - ::sw::mark::InsertMode::New); + sw::mark::MarkBase* pMark = rIDMA.makeMark( + aPaM, ReferenceMarkerName(u"testBookmark"_ustr), + IDocumentMarkAccess::MarkType::BOOKMARK, ::sw::mark::InsertMode::New); // verify CPPUNIT_ASSERT(pMark->IsExpanded()); @@ -774,9 +774,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkTextAndAddNew) lcl_selectCharacters(aPaM, 0, 3); IDocumentMarkAccess& rIDMA = *pDoc->getIDocumentMarkAccess(); - sw::mark::MarkBase* pMark = rIDMA.makeMark(aPaM, u"testBookmark"_ustr, - IDocumentMarkAccess::MarkType::BOOKMARK, - ::sw::mark::InsertMode::New); + sw::mark::MarkBase* pMark = rIDMA.makeMark( + aPaM, ReferenceMarkerName(u"testBookmark"_ustr), + IDocumentMarkAccess::MarkType::BOOKMARK, ::sw::mark::InsertMode::New); // verify CPPUNIT_ASSERT(pMark->IsExpanded()); diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index e73a6ca4c929..23462f9fe54c 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -2479,8 +2479,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testInconsistentBookmark) aPaM.SetMark(); aPaM.MovePara(GoCurrPara, fnParaStart); aPaM.MovePara(GoCurrPara, fnParaEnd); - rIDMA.makeMark(aPaM, u"Mark"_ustr, IDocumentMarkAccess::MarkType::BOOKMARK, - ::sw::mark::InsertMode::New); + rIDMA.makeMark(aPaM, ReferenceMarkerName(u"Mark"_ustr), + IDocumentMarkAccess::MarkType::BOOKMARK, ::sw::mark::InsertMode::New); aPaM.Exchange(); aPaM.DeleteMark(); } diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx index abb115312b0b..6cc4fe65e1f5 100644 --- a/sw/qa/extras/uiwriter/uiwriter7.cxx +++ b/sw/qa/extras/uiwriter/uiwriter7.cxx @@ -821,16 +821,16 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf77342) //moving cursor to the starting of document pWrtShell->StartOfSection(); //inserting reference field 1 - SwGetRefField aField1(pRefType, u""_ustr, u""_ustr, REF_FOOTNOTE, sal_uInt16(0), sal_uInt16(0), - REF_CONTENT); + SwGetRefField aField1(pRefType, ReferenceMarkerName(u""_ustr), u""_ustr, REF_FOOTNOTE, + sal_uInt16(0), sal_uInt16(0), REF_CONTENT); pWrtShell->InsertField2(aField1); //inserting second footnote pWrtShell->InsertFootnote(u""_ustr); pWrtShell->StartOfSection(); pCursor->Move(fnMoveForward); //inserting reference field 2 - SwGetRefField aField2(pRefType, u""_ustr, u""_ustr, REF_FOOTNOTE, sal_uInt16(1), sal_uInt16(0), - REF_CONTENT); + SwGetRefField aField2(pRefType, ReferenceMarkerName(u""_ustr), u""_ustr, REF_FOOTNOTE, + sal_uInt16(1), sal_uInt16(0), REF_CONTENT); pWrtShell->InsertField2(aField2); //inserting third footnote pWrtShell->InsertFootnote(u""_ustr); @@ -838,8 +838,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf77342) pCursor->Move(fnMoveForward); pCursor->Move(fnMoveForward); //inserting reference field 3 - SwGetRefField aField3(pRefType, u""_ustr, u""_ustr, REF_FOOTNOTE, sal_uInt16(2), sal_uInt16(0), - REF_CONTENT); + SwGetRefField aField3(pRefType, ReferenceMarkerName(u""_ustr), u""_ustr, REF_FOOTNOTE, + sal_uInt16(2), sal_uInt16(0), REF_CONTENT); pWrtShell->InsertField2(aField3); //updating the fields IDocumentFieldsAccess& rField(pDoc->getIDocumentFieldsAccess()); @@ -1080,8 +1080,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf63553) //moving cursor to the starting of document pWrtShell->StartOfSection(); //inserting reference field 1 - SwGetRefField aGetField1(pRefType, u"Illustration"_ustr, u""_ustr, REF_SEQUENCEFLD, - sal_uInt16(0), sal_uInt16(0), REF_CONTENT); + SwGetRefField aGetField1(pRefType, ReferenceMarkerName(u"Illustration"_ustr), u""_ustr, + REF_SEQUENCEFLD, sal_uInt16(0), sal_uInt16(0), REF_CONTENT); pWrtShell->InsertField2(aGetField1); //now we have ref1-seq1 //moving the cursor @@ -1093,8 +1093,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf63553) pWrtShell->StartOfSection(); pCursor->Move(fnMoveForward); //inserting reference field 2 - SwGetRefField aGetField2(pRefType, u"Illustration"_ustr, u""_ustr, REF_SEQUENCEFLD, - sal_uInt16(1), sal_uInt16(0), REF_CONTENT); + SwGetRefField aGetField2(pRefType, ReferenceMarkerName(u"Illustration"_ustr), u""_ustr, + REF_SEQUENCEFLD, sal_uInt16(1), sal_uInt16(0), REF_CONTENT); pWrtShell->InsertField2(aGetField2); //now we have ref1-ref2-seq1-seq2 //moving the cursor @@ -1107,8 +1107,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf63553) pCursor->Move(fnMoveForward); pCursor->Move(fnMoveForward); //inserting reference field 3 - SwGetRefField aGetField3(pRefType, u"Illustration"_ustr, u""_ustr, REF_SEQUENCEFLD, - sal_uInt16(2), sal_uInt16(0), REF_CONTENT); + SwGetRefField aGetField3(pRefType, ReferenceMarkerName(u"Illustration"_ustr), u""_ustr, + REF_SEQUENCEFLD, sal_uInt16(2), sal_uInt16(0), REF_CONTENT); pWrtShell->InsertField2(aGetField3); //now after insertion we have ref1-ref2-ref3-seq1-seq2-seq3 //updating the fields @@ -2354,20 +2354,20 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf94804) IDocumentMarkAccess* pIDMAccess(pDoc->getIDocumentMarkAccess()); //make first bookmark, CROSSREF_HEADING, with *empty* name sw::mark::MarkBase* pMark1(pIDMAccess->makeMark( - *pCrsr, u""_ustr, IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK, - ::sw::mark::InsertMode::New)); + *pCrsr, ReferenceMarkerName(u""_ustr), + IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK, ::sw::mark::InsertMode::New)); //get the new(autogenerated) bookmark name - OUString bookmark1name = pMark1->GetName(); + ReferenceMarkerName bookmark1name = pMark1->GetName(); //match the bookmark name, it should be like "__RefHeading__**" - CPPUNIT_ASSERT(bookmark1name.match("__RefHeading__")); + CPPUNIT_ASSERT(bookmark1name.toString().match("__RefHeading__")); //make second bookmark, CROSSREF_NUMITEM, with *empty* name sw::mark::MarkBase* pMark2(pIDMAccess->makeMark( - *pCrsr, u""_ustr, IDocumentMarkAccess::MarkType::CROSSREF_NUMITEM_BOOKMARK, - ::sw::mark::InsertMode::New)); + *pCrsr, ReferenceMarkerName(u""_ustr), + IDocumentMarkAccess::MarkType::CROSSREF_NUMITEM_BOOKMARK, ::sw::mark::InsertMode::New)); //get the new(autogenerated) bookmark name - OUString bookmark2name = pMark2->GetName(); + ReferenceMarkerName bookmark2name = pMark2->GetName(); //match the bookmark name, it should be like "__RefNumPara__**" - CPPUNIT_ASSERT(bookmark2name.match("__RefNumPara__")); + CPPUNIT_ASSERT(bookmark2name.toString().match("__RefNumPara__")); } CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testUnicodeNotationToggle) diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx index deace483779b..22d50d7a9bd4 100644 --- a/sw/qa/extras/uiwriter/uiwriter8.cxx +++ b/sw/qa/extras/uiwriter/uiwriter8.cxx @@ -2844,8 +2844,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf128106) return pHintA->GetTextNode().GetIndex() < pHintB->GetTextNode().GetIndex(); }); CPPUNIT_ASSERT_EQUAL(sal_uInt16(REF_BOOKMARK), fields[0]->GetField()->GetSubType()); - CPPUNIT_ASSERT_EQUAL(u"bookmarkchapter1_text"_ustr, - static_cast<SwGetRefField const*>(fields[0]->GetField())->GetSetRefName()); + CPPUNIT_ASSERT_EQUAL( + u"bookmarkchapter1_text"_ustr, + static_cast<SwGetRefField const*>(fields[0]->GetField())->GetSetRefName().toString()); CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, static_cast<SwGetRefField const*>(fields[0]->GetField()) ->GetExpandedTextOfReferencedTextNode(*pWrtShell->GetLayout())); @@ -2855,13 +2856,15 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf128106) CPPUNIT_ASSERT_EQUAL(u"Chapter 2"_ustr, static_cast<SwGetRefField const*>(fields[1]->GetField())->GetPar2()); CPPUNIT_ASSERT_EQUAL(sal_uInt16(REF_BOOKMARK), fields[2]->GetField()->GetSubType()); - CPPUNIT_ASSERT_EQUAL(u"Bookmarkchapter1"_ustr, - static_cast<SwGetRefField const*>(fields[2]->GetField())->GetSetRefName()); + CPPUNIT_ASSERT_EQUAL( + u"Bookmarkchapter1"_ustr, + static_cast<SwGetRefField const*>(fields[2]->GetField())->GetSetRefName().toString()); CPPUNIT_ASSERT_EQUAL(u"Chapter 1"_ustr, static_cast<SwGetRefField const*>(fields[2]->GetField())->GetPar2()); CPPUNIT_ASSERT_EQUAL(sal_uInt16(REF_BOOKMARK), fields[3]->GetField()->GetSubType()); - CPPUNIT_ASSERT_EQUAL(u"bookmarkchapter1_text"_ustr, - static_cast<SwGetRefField const*>(fields[3]->GetField())->GetSetRefName()); + CPPUNIT_ASSERT_EQUAL( + u"bookmarkchapter1_text"_ustr, + static_cast<SwGetRefField const*>(fields[3]->GetField())->GetSetRefName().toString()); CPPUNIT_ASSERT_EQUAL(u"Text"_ustr, static_cast<SwGetRefField const*>(fields[3]->GetField())->GetPar2()); CPPUNIT_ASSERT_EQUAL(sal_uInt16(REF_BOOKMARK), fields[4]->GetField()->GetSubType()); diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index d42c7fc06ee7..b7fdb55ac9b3 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -387,8 +387,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159816) // Add a bookmark at the very end IDocumentMarkAccess& rIDMA(*pDoc->getIDocumentMarkAccess()); - rIDMA.makeMark(*pWrtShell->GetCursor(), u"Mark"_ustr, IDocumentMarkAccess::MarkType::BOOKMARK, - sw::mark::InsertMode::New); + rIDMA.makeMark(*pWrtShell->GetCursor(), ReferenceMarkerName(u"Mark"_ustr), + IDocumentMarkAccess::MarkType::BOOKMARK, sw::mark::InsertMode::New); // Get coordinates of the end point in the document SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index e2c923e5b5e7..3cbf9b78a977 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -112,7 +112,7 @@ DECLARE_WW8EXPORT_TEST(testTdf151548_formFieldMacros, "tdf151548_formFieldMacros IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); for(auto aIter = pMarkAccess->getFieldmarksBegin(); aIter != pMarkAccess->getFieldmarksEnd(); ++aIter) { - const OUString sName = (*aIter)->GetName(); + const ReferenceMarkerName sName = (*aIter)->GetName(); CPPUNIT_ASSERT(sName == "Check1" || sName == "Check2" || sName == "Text1" || sName == "Dropdown1"); } } diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx index 999a1aa54109..7fde600d2b17 100644 --- a/sw/qa/uibase/shells/shells.cxx +++ b/sw/qa/uibase/shells/shells.cxx @@ -451,7 +451,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testInsertBookmark) for (auto it = rIDMA.getBookmarksBegin(); it != rIDMA.getBookmarksEnd(); ++it) { sw::mark::MarkBase* pMark = *it; - CPPUNIT_ASSERT_EQUAL(aExpectedBookmarkName, pMark->GetName()); + CPPUNIT_ASSERT_EQUAL(aExpectedBookmarkName, pMark->GetName().toString()); SwPaM aPam(pMark->GetMarkStart(), pMark->GetMarkEnd()); OUString aActualResult = aPam.GetText(); // Without the accompanying fix in place, this test would have failed with: @@ -469,7 +469,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testGotoMark) SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); pWrtShell->SplitNode(); pWrtShell->SttEndDoc(/*bStt=*/false); - pWrtShell->SetBookmark(vcl::KeyCode(), u"mybookmark"_ustr); + pWrtShell->SetBookmark(vcl::KeyCode(), ReferenceMarkerName(u"mybookmark"_ustr)); SwNodeOffset nExpected = pWrtShell->GetCursor()->GetPointNode().GetIndex(); // When jumping to that mark from the doc start: @@ -498,10 +498,10 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateBookmarks) pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); - pWrtShell->SetBookmark(vcl::KeyCode(), u"ZOTERO_BREF_GiQ7DAWQYWLy"_ustr); + pWrtShell->SetBookmark(vcl::KeyCode(), ReferenceMarkerName(u"ZOTERO_BREF_GiQ7DAWQYWLy"_ustr)); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); - pWrtShell->SetBookmark(vcl::KeyCode(), u"ZOTERO_BREF_PRxDGUb4SWXF"_ustr); + pWrtShell->SetBookmark(vcl::KeyCode(), ReferenceMarkerName(u"ZOTERO_BREF_PRxDGUb4SWXF"_ustr)); // When updating the content of bookmarks: pWrtShell->SttEndDoc(/*bStt=*/true); @@ -552,7 +552,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateBookmarks) // Without the accompanying fix in place, this test would have failed, ZOTERO_BREF_GiQ7DAWQYWLy // was not renamed to ZOTERO_BREF_new1. - auto it = pDoc->getIDocumentMarkAccess()->findMark(u"ZOTERO_BREF_new1"_ustr); + auto it + = pDoc->getIDocumentMarkAccess()->findMark(ReferenceMarkerName(u"ZOTERO_BREF_new1"_ustr)); CPPUNIT_ASSERT(it != pDoc->getIDocumentMarkAccess()->getAllMarksEnd()); } @@ -1113,7 +1114,7 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateBookmark) pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 2, /*bBasicCall=*/false); - pWrtShell->SetBookmark(vcl::KeyCode(), u"ZOTERO_BREF_old"_ustr); + pWrtShell->SetBookmark(vcl::KeyCode(), ReferenceMarkerName(u"ZOTERO_BREF_old"_ustr)); // When updating the content of the bookmark under the cursor: pWrtShell->SttEndDoc(/*bStt=*/true); @@ -1150,7 +1151,8 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateBookmark) // - Actual : ABCD // i.e. it was not possible to update just the bookmark under cursor. CPPUNIT_ASSERT_EQUAL(u"Anew resultD"_ustr, aActual); - auto it = pDoc->getIDocumentMarkAccess()->findMark(u"ZOTERO_BREF_new"_ustr); + auto it + = pDoc->getIDocumentMarkAccess()->findMark(ReferenceMarkerName(u"ZOTERO_BREF_new"_ustr)); CPPUNIT_ASSERT(it != pDoc->getIDocumentMarkAccess()->getAllMarksEnd()); } @@ -1215,10 +1217,10 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDeleteBookmarks) pWrtShell->SttEndDoc(/*bStt=*/true); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); - pWrtShell->SetBookmark(vcl::KeyCode(), u"ZOTERO_BREF_GiQ7DAWQYWLy"_ustr); + pWrtShell->SetBookmark(vcl::KeyCode(), ReferenceMarkerName(u"ZOTERO_BREF_GiQ7DAWQYWLy"_ustr)); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 1, /*bBasicCall=*/false); pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); - pWrtShell->SetBookmark(vcl::KeyCode(), u"other"_ustr); + pWrtShell->SetBookmark(vcl::KeyCode(), ReferenceMarkerName(u"other"_ustr)); // When deleting 1 matching bookmark: pWrtShell->SttEndDoc(/*bStt=*/true); @@ -1234,11 +1236,12 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testDeleteBookmarks) dispatchCommand(mxComponent, u".uno:DeleteBookmarks"_ustr, aArgs); // Then make sure that only the other bookmark is kept: - auto it = pDoc->getIDocumentMarkAccess()->findMark(u"ZOTERO_BREF_GiQ7DAWQYWLy"_ustr); + auto it = pDoc->getIDocumentMarkAccess()->findMark( + ReferenceMarkerName(u"ZOTERO_BREF_GiQ7DAWQYWLy"_ustr)); // Without the accompanying fix in place, this test would have failed, the matching bookmark was // not removed. CPPUNIT_ASSERT(bool(it == pDoc->getIDocumentMarkAccess()->getAllMarksEnd())); - it = pDoc->getIDocumentMarkAccess()->findMark(u"other"_ustr); + it = pDoc->getIDocumentMarkAccess()->findMark(ReferenceMarkerName(u"other"_ustr)); CPPUNIT_ASSERT(it != pDoc->getIDocumentMarkAccess()->getAllMarksEnd()); } diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 6820bb36f689..f7d6c8371f26 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1134,7 +1134,7 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) sEntry = "Insert Reference"; break; case REF_SEQUENCEFLD: - sEntry = static_cast<const SwGetRefField*>(pField)->GetSetRefName(); + sEntry = static_cast<const SwGetRefField*>(pField)->GetSetRefName().toString(); break; case REF_STYLE: sEntry = "StyleRef"; diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index da24bbaf4d5e..34c4103593d7 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -330,7 +330,7 @@ ItemInfoPackage& getItemInfoPackageSwAttributes() { RES_CHRATR_BIDIRTL, new SfxInt16Item( RES_CHRATR_BIDIRTL, sal_Int16(-1) ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_CHRATR_IDCTHINT, new SfxInt16Item( RES_CHRATR_IDCTHINT, sal_Int16(-1) ), 0, SFX_ITEMINFOFLAG_NONE }, - { RES_TXTATR_REFMARK, new SwFormatRefMark( OUString() ), 0, SFX_ITEMINFOFLAG_NONE }, + { RES_TXTATR_REFMARK, new SwFormatRefMark( ReferenceMarkerName() ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_TOXMARK, createSwTOXMarkForItemInfoPackage(), 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_META, SwFormatMeta::CreatePoolDefault(RES_TXTATR_META), 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_METAFIELD, SwFormatMeta::CreatePoolDefault(RES_TXTATR_METAFIELD), 0, SFX_ITEMINFOFLAG_NONE }, diff --git a/sw/source/core/crsr/annotationmark.cxx b/sw/source/core/crsr/annotationmark.cxx index af3f7c656b64..c6ff8f9103e8 100644 --- a/sw/source/core/crsr/annotationmark.cxx +++ b/sw/source/core/crsr/annotationmark.cxx @@ -35,10 +35,10 @@ namespace sw::mark { AnnotationMark::AnnotationMark( const SwPaM& rPaM, - const OUString& rName ) + const ReferenceMarkerName& rName ) : MarkBase( rPaM, rName ) { - if ( rName.getLength() == 0 ) + if ( rName.toString().getLength() == 0 ) { SetName( MarkBase::GenerateNewName(u"__Annotation__") ); } diff --git a/sw/source/core/crsr/bookmark.cxx b/sw/source/core/crsr/bookmark.cxx index 47f855334635..0584568639f5 100644 --- a/sw/source/core/crsr/bookmark.cxx +++ b/sw/source/core/crsr/bookmark.cxx @@ -270,7 +270,7 @@ namespace namespace sw::mark { MarkBase::MarkBase(const SwPaM& aPaM, - OUString aName) + ReferenceMarkerName aName) : m_oPos1(*aPaM.GetPoint()) , m_aName(std::move(aName)) { @@ -309,7 +309,7 @@ namespace sw::mark OUString MarkBase::ToString( ) const { - return "Mark: ( Name, [ Node1, Index1 ] ): ( " + m_aName + ", [ " + return "Mark: ( Name, [ Node1, Index1 ] ): ( " + m_aName.toString() + ", [ " + OUString::number( sal_Int32(GetMarkPos().GetNodeIndex()) ) + ", " + OUString::number( GetMarkPos().GetContentIndex( ) ) + " ] )"; } @@ -317,7 +317,7 @@ namespace sw::mark void MarkBase::dumpAsXml(xmlTextWriterPtr pWriter) const { (void)xmlTextWriterStartElement(pWriter, BAD_CAST("MarkBase")); - (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(m_aName.toUtf8().getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(m_aName.toString().toUtf8().getStr())); (void)xmlTextWriterStartElement(pWriter, BAD_CAST("markPos")); GetMarkPos().dumpAsXml(pWriter); (void)xmlTextWriterEndElement(pWriter); @@ -333,14 +333,14 @@ namespace sw::mark MarkBase::~MarkBase() { } - OUString MarkBase::GenerateNewName(std::u16string_view rPrefix) + ReferenceMarkerName MarkBase::GenerateNewName(std::u16string_view rPrefix) { static bool bHack = (getenv("LIBO_ONEWAY_STABLE_ODF_EXPORT") != nullptr); if (bHack) { static sal_Int64 nIdCounter = SAL_CONST_INT64(6000000000); - return rPrefix + OUString::number(nIdCounter++); + return ReferenceMarkerName(rPrefix + OUString::number(nIdCounter++)); } else { @@ -354,7 +354,7 @@ namespace sw::mark nCount = 0; } // putting the counter in front of the random parts will speed up string comparisons - return rPrefix + OUString::number(nCount++) + sUniquePostfix; + return ReferenceMarkerName(rPrefix + OUString::number(nCount++) + sUniquePostfix); } } @@ -408,7 +408,7 @@ namespace sw::mark Bookmark::Bookmark(const SwPaM& aPaM, const vcl::KeyCode& rCode, - const OUString& rName) + const ReferenceMarkerName& rName) : DdeBookmark(aPaM) , m_aCode(rCode) , m_bHidden(false) @@ -425,13 +425,13 @@ namespace sw::mark if (!pViewShell) return; - OUString fieldCommand = GetName(); + ReferenceMarkerName fieldCommand = GetName(); tools::JsonWriter aJson; aJson.put("commandName", ".uno:DeleteBookmark"); aJson.put("success", true); { auto result = aJson.startNode("result"); - aJson.put("DeleteBookmark", fieldCommand); + aJson.put("DeleteBookmark", fieldCommand.toString()); } pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_UNO_COMMAND_RESULT, aJson.finishAndGetAsOString()); @@ -539,7 +539,7 @@ namespace sw::mark OUString Fieldmark::ToString( ) const { - return "Fieldmark: ( Name, Type, [ Nd1, Id1 ], [ Nd2, Id2 ] ): ( " + m_aName + ", " + return "Fieldmark: ( Name, Type, [ Nd1, Id1 ], [ Nd2, Id2 ] ): ( " + m_aName.toString() + ", " + m_aFieldname + ", [ " + OUString::number( sal_Int32(GetMarkPos().GetNodeIndex( )) ) + ", " + OUString::number( GetMarkPos( ).GetContentIndex( ) ) + " ], [" + OUString::number( sal_Int32(GetOtherMarkPos().GetNodeIndex( )) ) + ", " @@ -572,7 +572,7 @@ namespace sw::mark (void)xmlTextWriterEndElement(pWriter); } - TextFieldmark::TextFieldmark(const SwPaM& rPaM, const OUString& rName) + TextFieldmark::TextFieldmark(const SwPaM& rPaM, const ReferenceMarkerName& rName) : Fieldmark(rPaM) , m_pDocumentContentOperationsManager(nullptr) { @@ -705,7 +705,7 @@ namespace sw::mark } - CheckboxFieldmark::CheckboxFieldmark(const SwPaM& rPaM, const OUString& rName) + CheckboxFieldmark::CheckboxFieldmark(const SwPaM& rPaM, const ReferenceMarkerName& rName) : NonTextFieldmark(rPaM) { if (!rName.isEmpty()) @@ -769,7 +769,7 @@ namespace sw::mark m_pButton->LaunchPopup(); } - DropDownFieldmark::DropDownFieldmark(const SwPaM& rPaM, const OUString& rName) + DropDownFieldmark::DropDownFieldmark(const SwPaM& rPaM, const ReferenceMarkerName& rName) : FieldmarkWithDropDownButton(rPaM) { if (!rName.isEmpty()) diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx index bf9cc7e9c805..3fad19ae7caf 100644 --- a/sw/source/core/crsr/crbm.cxx +++ b/sw/source/core/crsr/crbm.cxx @@ -77,7 +77,7 @@ namespace // at CurrentCursor.SPoint ::sw::mark::MarkBase* SwCursorShell::SetBookmark( const vcl::KeyCode& rCode, - const OUString& rName, + const ReferenceMarkerName& rName, IDocumentMarkAccess::MarkType eMark) { StartAction(); @@ -99,7 +99,7 @@ namespace // at CurrentCursor.SPoint ::sw::mark::MarkBase* SwCursorShell::SetBookmark2( const vcl::KeyCode& rCode, - const OUString& rName, + const ReferenceMarkerName& rName, bool bHide, const OUString& rCondition) { diff --git a/sw/source/core/crsr/crossrefbookmark.cxx b/sw/source/core/crsr/crossrefbookmark.cxx index 8b61f709eb02..992b0c072faf 100644 --- a/sw/source/core/crsr/crossrefbookmark.cxx +++ b/sw/source/core/crsr/crossrefbookmark.cxx @@ -35,7 +35,7 @@ namespace sw::mark { CrossRefBookmark::CrossRefBookmark(const SwPaM& rPaM, const vcl::KeyCode& rCode, - const OUString& rName, + const ReferenceMarkerName& rName, std::u16string_view rPrefix) : Bookmark( // ensure that m_pPos2 is null by only passing start to super @@ -70,24 +70,24 @@ namespace sw::mark CrossRefHeadingBookmark::CrossRefHeadingBookmark(const SwPaM& rPaM, const vcl::KeyCode& rCode, - const OUString& rName) + const ReferenceMarkerName& rName) : CrossRefBookmark(rPaM, rCode, rName, Concat2View(IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix()+"_Toc")) { } - bool CrossRefHeadingBookmark::IsLegalName(std::u16string_view rName) + bool CrossRefHeadingBookmark::IsLegalName(const ReferenceMarkerName& rName) { - return o3tl::starts_with(rName, IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix()); + return o3tl::starts_with(rName.toString(), IDocumentMarkAccess::GetCrossRefHeadingBookmarkNamePrefix()); } CrossRefNumItemBookmark::CrossRefNumItemBookmark(const SwPaM& rPaM, const vcl::KeyCode& rCode, - const OUString& rName) + const ReferenceMarkerName& rName) : CrossRefBookmark(rPaM, rCode, rName, CrossRefNumItemBookmark_NamePrefix) { } - bool CrossRefNumItemBookmark::IsLegalName(std::u16string_view rName) + bool CrossRefNumItemBookmark::IsLegalName(const ReferenceMarkerName& rName) { - return o3tl::starts_with(rName, CrossRefNumItemBookmark_NamePrefix); + return o3tl::starts_with(rName.toString(), CrossRefNumItemBookmark_NamePrefix); } } diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 0420d799d4a0..b6143e0306b7 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -1451,7 +1451,7 @@ void SwCursorShell::MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineN } /// jump to reference marker -bool SwCursorShell::GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType, +bool SwCursorShell::GotoRefMark( const ReferenceMarkerName& rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uInt16 nFlags ) { CurrShell aCurr( this ); diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 24f4b9156a3a..5f6c3fed08dd 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -297,14 +297,14 @@ namespace sw lcl_SetCpyPos(pMark->GetOtherMarkPos(), rStt, *pCpyStt, *aTmpPam.GetMark(), nDelCount); } - OUString sRequestedName = pMark->GetName(); + ReferenceMarkerName sRequestedName = pMark->GetName(); if (flags & SwCopyFlags::IsMoveToFly) { assert(&rSrcDoc == &rDestDoc); // Ensure the name can be given to NewMark, since this is ultimately a move auto pSoonToBeDeletedMark = const_cast<sw::mark::MarkBase*>(pMark); rDestDoc.getIDocumentMarkAccess()->renameMark(pSoonToBeDeletedMark, - sRequestedName + "COPY_IS_MOVE"); + ReferenceMarkerName(sRequestedName.toString() + "COPY_IS_MOVE")); } ::sw::mark::MarkBase* const pNewMark = rDestDoc.getIDocumentMarkAccess()->makeMark( @@ -4742,7 +4742,7 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt // If any Redline will change (split!) the node const ::sw::mark::MarkBase* pBkmk = m_rDoc.getIDocumentMarkAccess()->makeMark( aDelPam, - OUString(), IDocumentMarkAccess::MarkType::UNO_BOOKMARK, + ReferenceMarkerName(), IDocumentMarkAccess::MarkType::UNO_BOOKMARK, ::sw::mark::InsertMode::New); m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags( @@ -4843,7 +4843,7 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt // If any Redline will change (split!) the node const ::sw::mark::MarkBase* pBkmk = m_rDoc.getIDocumentMarkAccess()->makeMark( aDelPam, - OUString(), IDocumentMarkAccess::MarkType::UNO_BOOKMARK, + ReferenceMarkerName(), IDocumentMarkAccess::MarkType::UNO_BOOKMARK, ::sw::mark::InsertMode::New); aDelPam.GetPoint()->Assign( SwNodeOffset(0) ); diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx index 3c084ad6124f..07b02cf9565e 100644 --- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx @@ -87,7 +87,7 @@ namespace { if ( (bCaseSensitive && (pBkmk->GetName() == sNameLc)) || - (!bCaseSensitive && GetAppCharClass().lowercase(pBkmk->GetName()) == sNameLc) + (!bCaseSensitive && GetAppCharClass().lowercase(pBkmk->GetName().toString()) == sNameLc) ) { return pBkmk; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 62ae23a07e46..3f415c717f9d 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1070,7 +1070,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting( } /// @return the reference in the doc for the name -const SwFormatRefMark* SwDoc::GetRefMark( std::u16string_view rName ) const +const SwFormatRefMark* SwDoc::GetRefMark( const ReferenceMarkerName& rName ) const { const SwFormatRefMark* pRet = nullptr; ForEachRefMark( @@ -1118,8 +1118,8 @@ sal_uInt16 SwDoc::GetRefMarks( std::vector<OUString>* pNames ) const { if( pNames ) { - OUString aTmp(rRefMark.GetRefName()); - pNames->insert(pNames->begin() + nCount, aTmp); + ReferenceMarkerName aTmp(rRefMark.GetRefName()); + pNames->insert(pNames->begin() + nCount, aTmp.toString()); } ++nCount; return true; diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index a9c50cdd8b4a..224b2aba3851 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -379,7 +379,7 @@ namespace }; template <class container_t> - auto lcl_FindMarkByName(const OUString& rName, const container_t& container) + auto lcl_FindMarkByName(const ReferenceMarkerName& rName, const container_t& container) { return find_if(begin(container), end(container), [&rName](const auto* item) { return item->GetName() == rName; }); @@ -403,7 +403,7 @@ namespace sal_Int32(pEndPos->GetNodeIndex()) << "," << pEndPos->GetContentIndex() << " " << typeid(*pMark).name() << " " << - pMark->GetName()); + pMark->GetName().toString()); } #else (void) rMarks; @@ -501,7 +501,7 @@ namespace sw::mark { } ::sw::mark::MarkBase* MarkManager::makeMark(const SwPaM& rPaM, - const OUString& rName, + const ReferenceMarkerName& rName, const IDocumentMarkAccess::MarkType eType, sw::mark::InsertMode const eMode, SwPosition const*const pSepPos) @@ -513,7 +513,7 @@ namespace sw::mark if(rPaM.HasMark()) pPos2 = rPaM.GetMark(); SAL_INFO("sw.core", - rName << " " << + rName.toString() << " " << sal_Int32(pPos1->GetNodeIndex() )<< "," << pPos1->GetContentIndex() << " " << sal_Int32(pPos2->GetNodeIndex()) << "," << @@ -674,7 +674,7 @@ namespace sw::mark ::sw::mark::Fieldmark* MarkManager::makeFieldBookmark( const SwPaM& rPaM, - const OUString& rName, + const ReferenceMarkerName& rName, const OUString& rType, SwPosition const*const pSepPos) { @@ -714,7 +714,7 @@ namespace sw::mark ::sw::mark::Fieldmark* MarkManager::makeNoTextFieldBookmark( const SwPaM& rPaM, - const OUString& rName, + const ReferenceMarkerName& rName, const OUString& rType) { // Disable undo, because we handle it using SwUndoInsNoTextFieldmark @@ -770,12 +770,12 @@ namespace sw::mark if(ppExistingMark != m_vBookmarks.end()) return *ppExistingMark; const SwPaM aPaM(aPos); - return makeMark(aPaM, OUString(), eType, sw::mark::InsertMode::New); + return makeMark(aPaM, ReferenceMarkerName(), eType, sw::mark::InsertMode::New); } sw::mark::MarkBase* MarkManager::makeAnnotationMark( const SwPaM& rPaM, - const OUString& rName ) + const ReferenceMarkerName& rName ) { return makeMark(rPaM, rName, IDocumentMarkAccess::MarkType::ANNOTATIONMARK, sw::mark::InsertMode::New); @@ -810,7 +810,7 @@ namespace sw::mark bool MarkManager::renameMark( ::sw::mark::MarkBase* io_pMark, - const OUString& rNewName ) + const ReferenceMarkerName& rNewName ) { assert(&io_pMark->GetMarkPos().GetDoc() == &m_rDoc && "<MarkManager::renameMark(..)>" @@ -819,7 +819,7 @@ namespace sw::mark return true; if (lcl_FindMarkByName(rNewName, m_vAllMarks) != m_vAllMarks.end()) return false; - const OUString sOldName(io_pMark->GetName()); + const ReferenceMarkerName sOldName(io_pMark->GetName()); io_pMark->SetName(rNewName); if (dynamic_cast< ::sw::mark::Bookmark* >(io_pMark)) @@ -1330,21 +1330,16 @@ namespace sw::mark m_vAllMarks.clear(); } - IDocumentMarkAccess::const_iterator MarkManager::findMark(const OUString& rName) const + IDocumentMarkAccess::const_iterator MarkManager::findMark(const ReferenceMarkerName& rName) const { return lcl_FindMarkByName(rName, m_vAllMarks); } - std::vector<sw::mark::Bookmark*>::const_iterator MarkManager::findBookmark(const OUString& rName) const + std::vector<sw::mark::Bookmark*>::const_iterator MarkManager::findBookmark(const ReferenceMarkerName& rName) const { return lcl_FindMarkByName(rName, m_vBookmarks); } - std::vector<sw::mark::AnnotationMark*>::const_iterator MarkManager::findAnnotationMark( const OUString& rName ) const - { - return lcl_FindMarkByName(rName, m_vAnnotationMarks); - } - // find the first Bookmark that does not start before std::vector<sw::mark::Bookmark*>::const_iterator MarkManager::findFirstBookmarkNotStartsBefore(const SwPosition& rPos) const { @@ -1519,7 +1514,7 @@ namespace sw::mark return nullptr; // Store attributes needed to create the new fieldmark - OUString sName = pFieldmark->GetName(); + ReferenceMarkerName sName = pFieldmark->GetName(); SwPaM const aPaM(pFieldmark->GetMarkStart()); // Remove the old fieldmark and create a new one with the new type @@ -1679,6 +1674,11 @@ namespace sw::mark return m_vAnnotationMarks.size(); } + std::vector<sw::mark::AnnotationMark*>::const_iterator MarkManager::findAnnotationMark( const ReferenceMarkerName& rName ) const + { + return lcl_FindMarkByName( rName, m_vAnnotationMarks ); + } + AnnotationMark* MarkManager::getAnnotationMarkFor(const SwPosition& rPos) const { auto const pAnnotationMark = find_if( @@ -1692,11 +1692,11 @@ namespace sw::mark // create helper bookmark for annotations on tracked deletions ::sw::mark::Bookmark* MarkManager::makeAnnotationBookmark(const SwPaM& rPaM, - const OUString& rName, + const ReferenceMarkerName& rName, sw::mark::InsertMode const eMode, SwPosition const*const pSepPos) { - OUString sAnnotationBookmarkName(rName + S_ANNOTATION_BOOKMARK); + ReferenceMarkerName sAnnotationBookmarkName(rName.toString() + S_ANNOTATION_BOOKMARK); return static_cast<sw::mark::Bookmark*>(makeMark( rPaM, sAnnotationBookmarkName, MarkType::BOOKMARK, eMode, pSepPos)); } @@ -1721,9 +1721,9 @@ namespace sw::mark } // find helper bookmark of annotations on tracked deletions - std::vector<sw::mark::Bookmark*>::const_iterator MarkManager::findAnnotationBookmark(const OUString& rName) const + std::vector<sw::mark::Bookmark*>::const_iterator MarkManager::findAnnotationBookmark(const ReferenceMarkerName& rName) const { - OUString sAnnotationBookmarkName(rName + S_ANNOTATION_BOOKMARK); + ReferenceMarkerName sAnnotationBookmarkName(rName.toString() + S_ANNOTATION_BOOKMARK); return findBookmark(sAnnotationBookmarkName); } @@ -1734,13 +1734,13 @@ namespace sw::mark for (auto iter = getBookmarksBegin(); iter != getBookmarksEnd(); ) { - const OUString & rBookmarkName = (**iter).GetName(); + const ReferenceMarkerName & rBookmarkName = (**iter).GetName(); sal_Int32 nPos; - if ( rBookmarkName.startsWith("__Annotation__") && - (nPos = rBookmarkName.indexOf(S_ANNOTATION_BOOKMARK)) > -1 ) + if ( rBookmarkName.toString().startsWith("__Annotation__") && + (nPos = rBookmarkName.toString().indexOf(S_ANNOTATION_BOOKMARK)) > -1 ) { ::sw::UndoGuard const undoGuard(m_rDoc.GetIDocumentUndoRedo()); - auto pMark = findAnnotationMark(rBookmarkName.copy(0, nPos)); + auto pMark = findAnnotationMark(ReferenceMarkerName(rBookmarkName.toString().copy(0, nPos))); if ( pMark != getAnnotationMarksEnd() ) { const SwPaM aPam((**iter).GetMarkStart(), (**pMark).GetMarkEnd()); @@ -1760,16 +1760,16 @@ namespace sw::mark } } - OUString MarkManager::getUniqueMarkName(const OUString& rName) const + ReferenceMarkerName MarkManager::getUniqueMarkName(const ReferenceMarkerName& rName) const { - OSL_ENSURE(rName.getLength(), + OSL_ENSURE(rName.toString().getLength(), "<MarkManager::getUniqueMarkName(..)> - a name should be proposed"); if( m_rDoc.IsInMailMerge()) { - OUString newName = rName + "MailMergeMark" + OUString newName = rName.toString() + "MailMergeMark" + DateTimeToOUString( DateTime( DateTime::SYSTEM ) ) + OUString::number( m_vAllMarks.size() + 1 ); - return newName; + return ReferenceMarkerName(newName); } if (lcl_FindMarkByName(rName, m_vAllMarks) == m_vAllMarks.end()) @@ -1785,19 +1785,19 @@ namespace sw::mark sal_Int32 nCnt = 1; MarkBasenameMapUniqueOffset_t::const_iterator aIter = m_aMarkBasenameMapUniqueOffset.find(rName); if(aIter != m_aMarkBasenameMapUniqueOffset.end()) nCnt = aIter->second; - OUString aPrefix = SwResId(STR_MARK_COPY).replaceFirst("%1", rName); + OUString aPrefix = SwResId(STR_MARK_COPY).replaceFirst("%1", rName.toString()); while(nCnt < SAL_MAX_INT32) { sTmp = aPrefix + OUString::number(nCnt); nCnt++; - if (lcl_FindMarkByName(sTmp, m_vAllMarks) == m_vAllMarks.end()) + if (lcl_FindMarkByName(ReferenceMarkerName(sTmp), m_vAllMarks) == m_vAllMarks.end()) { break; } } m_aMarkBasenameMapUniqueOffset[rName] = nCnt; - return sTmp; + return ReferenceMarkerName(sTmp); } void MarkManager::assureSortedMarkContainers() const diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index df06d04efc18..f9d5f62206c7 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -432,7 +432,7 @@ const SwDocStat& SwEditShell::GetUpdatedDocStat() } /// get the reference of a given name in the Doc -const SwFormatRefMark* SwEditShell::GetRefMark( std::u16string_view rName ) const +const SwFormatRefMark* SwEditShell::GetRefMark( const ReferenceMarkerName& rName ) const { return GetDoc()->GetRefMark( rName ); } diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 68576689f1ac..5c60bbeac639 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1790,14 +1790,14 @@ SwPostItField::SwPostItField( SwPostItFieldType* pT, OUString aAuthor, OUString aText, OUString aInitials, - OUString aName, + ReferenceMarkerName aName, const DateTime& rDateTime, const bool bResolved, const sal_uInt32 nPostItId, const sal_uInt32 nParentId, const sal_uInt32 nParaId, const sal_uInt32 nParentPostItId, - OUString aParentName + ReferenceMarkerName aParentName ) : SwField( pT ) , m_sText( std::move(aText) ) @@ -1886,12 +1886,12 @@ OUString SwPostItField::GetPar2() const } -void SwPostItField::SetName(const OUString& rName) +void SwPostItField::SetName(const ReferenceMarkerName& rName) { m_sName = rName; } -void SwPostItField::SetParentName(const OUString& rName) +void SwPostItField::SetParentName(const ReferenceMarkerName& rName) { m_sParentName = rName; } @@ -1948,10 +1948,10 @@ bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const rAny <<= m_sInitials; break; case FIELD_PROP_PAR4: - rAny <<= m_sName; + rAny <<= m_sName.toString(); break; case FIELD_PROP_PAR7: // PAR5 (Parent Para Id) and PAR6 (Para Id) are skipped - they are not written into xml. Used for file conversion. - rAny <<= m_sParentName; + rAny <<= m_sParentName.toString(); break; case FIELD_PROP_BOOL1: rAny <<= m_bResolved; @@ -2018,10 +2018,18 @@ bool SwPostItField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) rAny >>= m_sInitials; break; case FIELD_PROP_PAR4: - rAny >>= m_sName; + { + OUString tmp; + if (rAny >>= tmp) + m_sName = ReferenceMarkerName(tmp); + } break; case FIELD_PROP_PAR7: // PAR5 (Parent Para Id) and PAR6 (Para Id) are skipped - they are not written into xml. Used for file conversion. - rAny >>= m_sParentName; + { + OUString tmp; + if (rAny >>= tmp) + m_sParentName = ReferenceMarkerName(tmp); + } break; case FIELD_PROP_BOOL1: rAny >>= m_bResolved; @@ -2066,7 +2074,7 @@ bool SwPostItField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) void SwPostItField::dumpAsXml(xmlTextWriterPtr pWriter) const { (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwPostItField")); - (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(GetName().toUtf8().getStr())); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(GetName().toString().toUtf8().getStr())); SwField::dumpAsXml(pWriter); diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index aa69195b6c2b..23f9cef32939 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -351,7 +351,7 @@ static void lcl_formatReferenceLanguage( OUString& rRefText, /// get references SwGetRefField::SwGetRefField( SwGetRefFieldType* pFieldType, - OUString aSetRef, OUString aSetReferenceLanguage, sal_uInt16 nSubTyp, + ReferenceMarkerName aSetRef, OUString aSetReferenceLanguage, sal_uInt16 nSubTyp, sal_uInt16 nSequenceNo, sal_uInt16 nFlags, sal_uLong nFormat ) : SwField(pFieldType, nFormat), m_sSetRefName(std::move(aSetRef)), @@ -453,7 +453,7 @@ OUString SwGetRefField::GetFieldName() const const OUString aName = GetTyp()->GetName(); if ( !aName.isEmpty() || !m_sSetRefName.isEmpty() ) { - return aName + " " + m_sSetRefName; + return aName + " " + m_sSetRefName.toString(); } return ExpandImpl(nullptr); } @@ -529,9 +529,9 @@ void SwGetRefField::UpdateField(const SwTextField* pFieldTextAttr, SwFrame* pFra // where is the category name (e.g. "Illustration")? const OUString aText = pTextNd->GetText(); - const sal_Int32 nCatStart = aText.indexOf(m_sSetRefName); + const sal_Int32 nCatStart = aText.indexOf(m_sSetRefName.toString()); const bool bHasCat = nCatStart>=0; - const sal_Int32 nCatEnd = bHasCat ? nCatStart + m_sSetRefName.getLength() : -1; + const sal_Int32 nCatEnd = bHasCat ? nCatStart + m_sSetRefName.toString().getLength() : -1; // length of the referenced text const sal_Int32 nLen = aText.getLength(); @@ -883,13 +883,13 @@ std::unique_ptr<SwField> SwGetRefField::Copy() const /// get reference name OUString SwGetRefField::GetPar1() const { - return m_sSetRefName; + return m_sSetRefName.toString(); } /// set reference name void SwGetRefField::SetPar1( const OUString& rName ) { - m_sSetRefName = rName; + m_sSetRefName = ReferenceMarkerName(rName); } OUString SwGetRefField::GetPar2() const @@ -1328,7 +1328,7 @@ namespace } } -SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark, +SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const ReferenceMarkerName& rRefMark, sal_uInt16 nSubType, sal_uInt16 nSeqNo, sal_uInt16 nFlags, sal_Int32* pStart, sal_Int32* pEnd, SwRootFrame const* const pLayout, const SwTextNode* pSelf, SwFrame* pContentFrame) @@ -1455,7 +1455,7 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark, return pTextNd; } -SwTextNode* SwGetRefFieldType::FindAnchorRefStyle(SwDoc* pDoc, const OUString& rRefMark, +SwTextNode* SwGetRefFieldType::FindAnchorRefStyle(SwDoc* pDoc, const ReferenceMarkerName& rRefMark, sal_uInt16 nFlags, sal_Int32* pStart, sal_Int32* pEnd, SwRootFrame const* const pLayout, const SwTextNode* pSelf, SwFrame* pContentFrame) @@ -1504,10 +1504,11 @@ SwTextNode* SwGetRefFieldType::FindAnchorRefStyle(SwDoc* pDoc, const OUString& r } // undocumented Word feature: 1 = "Heading 1" etc. + const OUString& sRefMarkStr = rRefMark.toString(); OUString const styleName( - (rRefMark.getLength() == 1 && '1' <= rRefMark[0] && rRefMark[0] <= '9') - ? SwStyleNameMapper::GetProgName(RES_POOLCOLL_HEADLINE1 + rRefMark[0] - '1', rRefMark).toString() - : rRefMark); + (sRefMarkStr.getLength() == 1 && '1' <= sRefMarkStr[0] && sRefMarkStr[0] <= '9') + ? SwStyleNameMapper::GetProgName(RES_POOLCOLL_HEADLINE1 + sRefMarkStr[0] - '1', sRefMarkStr).toString() + : sRefMarkStr); switch (elementType) { @@ -1679,7 +1680,7 @@ namespace { struct RefIdsMap { private: - OUString aName; + ReferenceMarkerName aName; std::set<sal_uInt16> aIds; std::set<sal_uInt16> aDstIds; std::map<sal_uInt16, sal_uInt16> sequencedIds; /// ID numbers sorted by sequence number. @@ -1692,11 +1693,11 @@ private: static sal_uInt16 GetFirstUnusedId( std::set<sal_uInt16> &rIds ); public: - explicit RefIdsMap( OUString _aName ) : aName(std::move( _aName )), bInit( false ) {} + explicit RefIdsMap( ReferenceMarkerName _aName ) : aName(std::move( _aName )), bInit( false ) {} void Check( SwDoc& rDoc, SwDoc& rDestDoc, SwGetRefField& rField, bool bField ); - const OUString& GetName() const { return aName; } + const ReferenceMarkerName& GetName() const { return aName; } }; } @@ -1843,7 +1844,7 @@ void SwGetRefFieldType::MergeWithOtherDoc( SwDoc& rDestDoc ) // then there are RefFields in the DescDox - so all RefFields in the SourceDoc // need to be converted to have unique IDs for both documents - RefIdsMap aFntMap { OUString() }; + RefIdsMap aFntMap { ReferenceMarkerName() }; std::vector<std::unique_ptr<RefIdsMap>> aFieldMap; std::vector<SwFormatField*> vFields; diff --git a/sw/source/core/inc/MarkManager.hxx b/sw/source/core/inc/MarkManager.hxx index b174a13fa54f..55ad5920f074 100644 --- a/sw/source/core/inc/MarkManager.hxx +++ b/sw/source/core/inc/MarkManager.hxx @@ -29,7 +29,7 @@ class SwCursorShell; class SfxViewShell; namespace sw::mark { - typedef std::unordered_map<OUString, sal_Int32> MarkBasenameMapUniqueOffset_t; + typedef std::unordered_map<ReferenceMarkerName, sal_Int32> MarkBasenameMapUniqueOffset_t; class AnnotationMark; class FieldmarkWithDropDownButton; @@ -41,26 +41,26 @@ namespace sw::mark { MarkManager(/*[in/out]*/ SwDoc& rDoc); // IDocumentMarkAccess virtual ::sw::mark::MarkBase* makeMark(const SwPaM& rPaM, - const OUString& rName, IDocumentMarkAccess::MarkType eMark, + const ReferenceMarkerName& rName, IDocumentMarkAccess::MarkType eMark, sw::mark::InsertMode eMode, SwPosition const* pSepPos = nullptr) override; virtual sw::mark::Fieldmark* makeFieldBookmark( const SwPaM& rPaM, - const OUString& rName, + const ReferenceMarkerName& rName, const OUString& rType, SwPosition const* pSepPos = nullptr) override; virtual sw::mark::Fieldmark* makeNoTextFieldBookmark( const SwPaM& rPaM, - const OUString& rName, + const ReferenceMarkerName& rName, const OUString& rType) override; virtual ::sw::mark::MarkBase* getMarkForTextNode(const SwTextNode& rTextNode, IDocumentMarkAccess::MarkType eMark) override; virtual sw::mark::MarkBase* makeAnnotationMark( const SwPaM& rPaM, - const OUString& rName ) override; + const ReferenceMarkerName& rName ) override; virtual void repositionMark(::sw::mark::MarkBase* io_pMark, const SwPaM& rPaM) override; - virtual bool renameMark(::sw::mark::MarkBase* io_pMark, const OUString& rNewName) override; + virtual bool renameMark(::sw::mark::MarkBase* io_pMark, const ReferenceMarkerName& rNewName) override; virtual void correctMarksAbsolute(const SwNode& rOldNode, const SwPosition& rNewPos, const sal_Int32 nOffset) override; virtual void correctMarksRelative(const SwNode& rOldNode, const SwPosition& rNewPos, const sal_Int32 nOffset) override; @@ -81,7 +81,7 @@ namespace sw::mark { virtual const_iterator getAllMarksBegin() const override; virtual const_iterator getAllMarksEnd() const override; -e ... etc. - the rest is truncated