nss: upgrade to release 3.73
[LibreOffice.git] / sw / source / core / inc / MarkManager.hxx
bloba25e414f8aa2e7be578f86b95183f2fa3d0cc93a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SW_SOURCE_CORE_INC_MARKMANAGER_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_MARKMANAGER_HXX
23 #include <IMark.hxx>
24 #include <IDocumentMarkAccess.hxx>
25 #include <unordered_map>
26 #include <memory>
28 class SwCursorShell;
30 namespace sw::mark {
31 typedef std::unordered_map<OUString, sal_Int32> MarkBasenameMapUniqueOffset_t;
33 class FieldmarkWithDropDownButton;
35 class MarkManager
36 : virtual public IDocumentMarkAccess
38 public:
39 MarkManager(/*[in/out]*/ SwDoc& rDoc);
40 // IDocumentMarkAccess
41 virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM,
42 const OUString& rName, IDocumentMarkAccess::MarkType eMark,
43 sw::mark::InsertMode eMode,
44 SwPosition const* pSepPos = nullptr) override;
46 virtual sw::mark::IFieldmark* makeFieldBookmark( const SwPaM& rPaM,
47 const OUString& rName,
48 const OUString& rType,
49 SwPosition const* pSepPos = nullptr) override;
50 virtual sw::mark::IFieldmark* makeNoTextFieldBookmark( const SwPaM& rPaM,
51 const OUString& rName,
52 const OUString& rType) override;
54 virtual ::sw::mark::IMark* getMarkForTextNode(const SwTextNode& rTextNode, IDocumentMarkAccess::MarkType eMark) override;
56 virtual sw::mark::IMark* makeAnnotationMark(
57 const SwPaM& rPaM,
58 const OUString& rName ) override;
60 virtual void repositionMark(::sw::mark::IMark* io_pMark, const SwPaM& rPaM) override;
61 virtual bool renameMark(::sw::mark::IMark* io_pMark, const OUString& rNewName) override;
62 virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const sal_Int32 nOffset) override;
63 virtual void correctMarksRelative(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const sal_Int32 nOffset) override;
65 virtual void deleteMarks(const SwNodeIndex& rStt, const SwNodeIndex& rEnd, std::vector< ::sw::mark::SaveBookmark>* pSaveBkmk, const SwIndex* pSttIdx, const SwIndex* pEndIdx) override;
67 // deleters
68 virtual std::unique_ptr<ILazyDeleter>
69 deleteMark(const const_iterator_t& ppMark) override;
70 virtual void deleteMark(const ::sw::mark::IMark* const pMark) override;
71 virtual void clearAllMarks() override;
73 // marks
74 virtual const_iterator_t getAllMarksBegin() const override;
75 virtual const_iterator_t getAllMarksEnd() const override;
76 virtual sal_Int32 getAllMarksCount() const override;
77 virtual const_iterator_t findMark(const OUString& rName) const override;
79 // bookmarks
80 virtual bool isBookmarkDeleted(SwPaM const& rPaM) const override;
81 virtual const_iterator_t getBookmarksBegin() const override;
82 virtual const_iterator_t getBookmarksEnd() const override;
83 virtual sal_Int32 getBookmarksCount() const override;
84 virtual const_iterator_t findBookmark(const OUString& rName) const override;
85 virtual const_iterator_t findFirstBookmarkStartsAfter(const SwPosition& rPos) const override;
87 // Fieldmarks
88 virtual const_iterator_t getFieldmarksBegin() const override;
89 virtual const_iterator_t getFieldmarksEnd() const override;
90 virtual ::sw::mark::IFieldmark* getFieldmarkAt(const SwPosition& rPos) const override;
91 virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& rPos) const override;
92 virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& rPos) const override;
93 virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& rPos) const override;
95 virtual ::sw::mark::IFieldmark* getDropDownFor(const SwPosition &rPos) const override;
96 virtual std::vector< ::sw::mark::IFieldmark* > getDropDownsFor(const SwPaM &rPaM) const override;
98 virtual void deleteFieldmarkAt(const SwPosition& rPos) override;
99 virtual ::sw::mark::IFieldmark* changeFormFieldmarkType(::sw::mark::IFieldmark* pFieldmark, const OUString& rNewType) override;
101 virtual void NotifyCursorUpdate(const SwCursorShell& rCursorShell) override;
102 virtual void ClearFieldActivation() override;
104 void dumpAsXml(xmlTextWriterPtr pWriter) const;
106 // Annotation Marks
107 virtual const_iterator_t getAnnotationMarksBegin() const override;
108 virtual const_iterator_t getAnnotationMarksEnd() const override;
109 virtual sal_Int32 getAnnotationMarksCount() const override;
110 virtual const_iterator_t findAnnotationMark( const OUString& rName ) const override;
111 virtual sw::mark::IMark* getAnnotationMarkFor(const SwPosition& rPos) const override;
112 virtual const_iterator_t findFirstAnnotationStartsAfter(const SwPosition& rPos) const override;
114 virtual void assureSortedMarkContainers() const override;
116 typedef std::vector<sw::mark::MarkBase*> container_t;
118 private:
120 MarkManager(MarkManager const&) = delete;
121 MarkManager& operator=(MarkManager const&) = delete;
123 // make names
124 OUString getUniqueMarkName(const OUString& rName) const;
126 void sortSubsetMarks();
127 void sortMarks();
129 // container for all marks, this container owns the objects it points to
130 container_t m_vAllMarks;
132 // additional container for bookmarks
133 container_t m_vBookmarks;
134 // additional container for fieldmarks
135 container_t m_vFieldmarks;
137 mutable MarkBasenameMapUniqueOffset_t m_aMarkBasenameMapUniqueOffset;
139 // container for annotation marks
140 container_t m_vAnnotationMarks;
142 SwDoc& m_rDoc;
144 sw::mark::FieldmarkWithDropDownButton* m_pLastActiveFieldmark;
149 #endif
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */