LibreOffice Module sw (master)  1
IDocumentMarkAccess.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_SW_INC_IDOCUMENTMARKACCESS_HXX
21 #define INCLUDED_SW_INC_IDOCUMENTMARKACCESS_HXX
22 
23 #include <sal/types.h>
24 #include "IMark.hxx"
25 #include <memory>
26 
27 class SwPaM;
28 struct SwPosition;
29 class SwTextNode;
30 class SwCursorShell;
31 
32 namespace sw { namespace mark {
33  class SaveBookmark; // FIXME: Ugly: SaveBookmark is a core-internal class, and should not be used in the interface
34 }}
35 
39 {
40  public:
41  enum class MarkType
42  {
45  BOOKMARK,
53  };
54 
55  typedef std::vector< ::sw::mark::IMark* > container_t;
56  typedef container_t::iterator iterator_t;
57  typedef container_t::const_iterator const_iterator_t;
58  typedef container_t::const_reverse_iterator const_reverse_iterator_t;
59 
63  struct ILazyDeleter { virtual ~ILazyDeleter() { } };
64 
82  virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM,
83  const OUString& rProposedName,
84  MarkType eMark, ::sw::mark::InsertMode eMode) = 0;
85 
86  virtual sw::mark::IFieldmark* makeFieldBookmark( const SwPaM& rPaM,
87  const OUString& rName,
88  const OUString& rType) = 0;
90  const OUString& rName,
91  const OUString& rType) = 0;
92 
94  const SwPaM& rPaM,
95  const OUString& rName ) = 0;
96 
109  virtual ::sw::mark::IMark* getMarkForTextNode(const SwTextNode& rTextNode,
110  MarkType eMark) =0;
111 
120  virtual void repositionMark(::sw::mark::IMark* io_pMark,
121  const SwPaM& rPaM) =0;
122 
132  virtual bool renameMark(::sw::mark::IMark* io_pMark,
133  const OUString& rNewName) =0;
134 
147  virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode,
148  const SwPosition& rNewPos,
149  const sal_Int32 nOffset) =0;
150 
165  virtual void correctMarksRelative(const SwNodeIndex& rOldNode,
166  const SwPosition& rNewPos,
167  const sal_Int32 nOffset) =0;
168 
174  virtual void deleteMarks(
175  const SwNodeIndex& rStt,
176  const SwNodeIndex& rEnd,
177  std::vector< ::sw::mark::SaveBookmark>* pSaveBkmk, // Ugly: SaveBookmark is core-internal
178  const SwIndex* pSttIdx,
179  const SwIndex* pEndIdx) =0;
180 
186  virtual std::unique_ptr<ILazyDeleter>
188 
194  virtual void deleteMark(const ::sw::mark::IMark* const pMark) =0;
195 
198  virtual void clearAllMarks() =0;
199 
200  virtual void assureSortedMarkContainers() const = 0;
201 
204  virtual const_iterator_t getAllMarksBegin() const =0;
205 
208  virtual const_iterator_t getAllMarksEnd() const =0;
209 
214  virtual sal_Int32 getAllMarksCount() const =0;
215 
224  virtual const_iterator_t findMark(const OUString& rMark) const =0;
225 
231  virtual const_iterator_t findFirstMarkStartsBefore(const SwPosition& rPos) const =0;
232 
233  // interface IBookmarks (BOOKMARK, CROSSREF_NUMITEM_BOOKMARK, CROSSREF_HEADING_BOOKMARK )
234 
237  virtual const_iterator_t getBookmarksBegin() const =0;
238 
241  virtual const_iterator_t getBookmarksEnd() const =0;
242 
245  virtual sal_Int32 getBookmarksCount() const =0;
246 
255  virtual const_iterator_t findBookmark(const OUString& rMark) const =0;
256 
262  virtual const_iterator_t findFirstBookmarkStartsAfter(const SwPosition& rPos) const =0;
263 
264 
265  // Fieldmarks
266  virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& pos) const =0;
267  virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& pos) const =0;
268  virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& pos) const =0;
269 
270  virtual ::sw::mark::IFieldmark* getDropDownFor(const SwPosition& pos) const=0;
271  virtual std::vector< ::sw::mark::IFieldmark* > getDropDownsFor(const SwPaM &rPaM) const=0;
272 
273  virtual void deleteFieldmarkAt(const SwPosition& rPos) = 0;
274  virtual ::sw::mark::IFieldmark* changeNonTextFieldmarkType(::sw::mark::IFieldmark* pFieldmark, const OUString& rNewType) = 0;
275 
276  virtual void NotifyCursorUpdate(const SwCursorShell& rCursorShell) = 0;
277  virtual void ClearFieldActivation() = 0;
278 
279  // Annotation Marks
280  virtual const_iterator_t getAnnotationMarksBegin() const = 0;
281  virtual const_iterator_t getAnnotationMarksEnd() const = 0;
282  virtual sal_Int32 getAnnotationMarksCount() const = 0;
283  virtual const_iterator_t findAnnotationMark( const OUString& rName ) const = 0;
284  virtual sw::mark::IMark* getAnnotationMarkFor(const SwPosition& rPosition) const = 0;
290  virtual const_iterator_t findFirstAnnotationStartsAfter(const SwPosition& rPos) const =0;
291 
294  static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark& rMark);
295 
297  static SW_DLLPUBLIC bool IsLegalPaMForCrossRefHeadingBookmark( const SwPaM& rPaM );
298  protected:
299  virtual ~IDocumentMarkAccess() {};
300 };
301 
302 #endif // IDOCUMENTBOOKMARKACCESS_HXX_INCLUDED
303 
304 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
container_t::iterator iterator_t
virtual ::sw::mark::IFieldmark * getFieldmarkAfter(const SwPosition &pos) const =0
virtual const_iterator_t findFirstMarkStartsBefore(const SwPosition &rPos) const =0
Find the first Mark that does not start before.
virtual void clearAllMarks()=0
Clear (deletes) all marks.
Marks a position in the document model.
Definition: pam.hxx:35
virtual const_iterator_t getAnnotationMarksEnd() const =0
To avoid recursive calls of deleteMark, the removal of dummy characters of fieldmarks has to be delay...
virtual sal_Int32 getBookmarksCount() const =0
returns the number of IBookmarks.
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
Definition: docbm.cxx:349
virtual void correctMarksRelative(const SwNodeIndex &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset)=0
Corrects marks (relative) This method uses the previous position of the mark in the paragraph as offs...
Provides access to the marks of a document.
virtual const_iterator_t findFirstBookmarkStartsAfter(const SwPosition &rPos) const =0
Finds the first mark that is starting after.
virtual ::sw::mark::IMark * makeMark(const SwPaM &rPaM, const OUString &rProposedName, MarkType eMark,::sw::mark::InsertMode eMode)=0
Generates a new mark in the document for a certain selection.
virtual void assureSortedMarkContainers() const =0
Dialog to specify the properties of drop-down form field.
Definition: accfrmobj.cxx:40
virtual sal_Int32 getAnnotationMarksCount() const =0
virtual ::sw::mark::IFieldmark * getDropDownFor(const SwPosition &pos) const =0
container_t::const_reverse_iterator const_reverse_iterator_t
static SW_DLLPUBLIC OUString GetCrossRefHeadingBookmarkNamePrefix()
Definition: docbm.cxx:381
static SW_DLLPUBLIC bool IsLegalPaMForCrossRefHeadingBookmark(const SwPaM &rPaM)
Definition: docbm.cxx:386
virtual const_iterator_t findMark(const OUString &rMark) const =0
Finds a mark by name.
virtual ::sw::mark::IFieldmark * getFieldmarkFor(const SwPosition &pos) const =0
virtual sw::mark::IMark * makeAnnotationMark(const SwPaM &rPaM, const OUString &rName)=0
virtual std::vector< ::sw::mark::IFieldmark * > getDropDownsFor(const SwPaM &rPaM) const =0
virtual const_iterator_t findFirstAnnotationStartsAfter(const SwPosition &rPos) const =0
Finds the first mark that is starting after.
virtual void NotifyCursorUpdate(const SwCursorShell &rCursorShell)=0
virtual const_iterator_t findAnnotationMark(const OUString &rName) const =0
std::vector< ::sw::mark::IMark * > container_t
virtual void repositionMark(::sw::mark::IMark *io_pMark, const SwPaM &rPaM)=0
Moves an existing mark to a new selection and performs needed updates.
virtual std::unique_ptr< ILazyDeleter > deleteMark(const IDocumentMarkAccess::const_iterator_t &ppMark)=0
Deletes a mark.
virtual const_iterator_t getAllMarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence of marks.
container_t::const_iterator const_iterator_t
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
virtual const_iterator_t getBookmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of IBookmarks.
virtual void ClearFieldActivation()=0
virtual const_iterator_t getAllMarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of marks.
virtual void deleteMarks(const SwNodeIndex &rStt, const SwNodeIndex &rEnd, std::vector< ::sw::mark::SaveBookmark > *pSaveBkmk, const SwIndex *pSttIdx, const SwIndex *pEndIdx)=0
Deletes marks in a range.
Marks a character position inside a document model node.
Definition: index.hxx:37
virtual sw::mark::IFieldmark * makeFieldBookmark(const SwPaM &rPaM, const OUString &rName, const OUString &rType)=0
virtual const_iterator_t getAnnotationMarksBegin() const =0
virtual const_iterator_t findBookmark(const OUString &rMark) const =0
Finds a bookmark by name.
Marks a node in the document model.
Definition: ndindex.hxx:31
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
virtual void deleteFieldmarkAt(const SwPosition &rPos)=0
virtual sw::mark::IFieldmark * makeNoTextFieldBookmark(const SwPaM &rPaM, const OUString &rName, const OUString &rType)=0
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
virtual sw::mark::IMark * getAnnotationMarkFor(const SwPosition &rPosition) const =0
virtual sal_Int32 getAllMarksCount() const =0
returns the number of marks.
virtual ::sw::mark::IMark * getMarkForTextNode(const SwTextNode &rTextNode, MarkType eMark)=0
Returns a mark in the document for a paragraph.
virtual const_iterator_t getBookmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
virtual void correctMarksAbsolute(const SwNodeIndex &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset)=0
Corrects marks (absolute) This method ignores the previous position of the mark in the paragraph...
virtual ::sw::mark::IFieldmark * changeNonTextFieldmarkType(::sw::mark::IFieldmark *pFieldmark, const OUString &rNewType)=0
virtual bool renameMark(::sw::mark::IMark *io_pMark, const OUString &rNewName)=0
Renames an existing Mark, if possible.
virtual ::sw::mark::IFieldmark * getFieldmarkBefore(const SwPosition &pos) const =0
InsertMode
Definition: IMark.hxx:31