update dev300-m58
[ooovba.git] / sw / source / core / inc / MarkManager.hxx
blobfd20406e27d07ca6e14df8c3706338b94eff3e3c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: $
10 * $Revision: $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SW_BOOKMARK_MARKMANAGER_HXX
32 #define _SW_BOOKMARK_MARKMANAGER_HXX
34 #include <IMark.hxx>
35 #include <IDocumentMarkAccess.hxx>
37 namespace sw { namespace mark
39 class MarkManager
40 : private ::boost::noncopyable
41 , virtual public IDocumentMarkAccess
43 public:
44 MarkManager(/*[in/out]*/ SwDoc& rDoc);
46 void dumpFieldmarks( ) const;
48 // IDocumentMarkAccess
49 virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM, const ::rtl::OUString& rName, IDocumentMarkAccess::MarkType eMark);
51 virtual sw::mark::IMark* makeFieldBookmark( const SwPaM& rPaM,
52 const rtl::OUString& rName,
53 const rtl::OUString& rType);
54 virtual sw::mark::IMark* makeNoTextFieldBookmark( const SwPaM& rPaM,
55 const rtl::OUString& rName,
56 const rtl::OUString& rType);
58 virtual ::sw::mark::IMark* getMarkForTxtNode(const SwTxtNode& rTxtNode, IDocumentMarkAccess::MarkType eMark);
60 virtual void repositionMark(::sw::mark::IMark* io_pMark, const SwPaM& rPaM);
61 virtual bool renameMark(::sw::mark::IMark* io_pMark, const ::rtl::OUString& rNewName);
62 virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset);
63 virtual void correctMarksRelative(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset);
65 virtual void deleteMarks(const SwNodeIndex& rStt, const SwNodeIndex& rEnd, ::std::vector< ::sw::mark::SaveBookmark>* pSaveBkmk, const SwIndex* pSttIdx, const SwIndex* pEndIdx);
67 // deleters
68 virtual void deleteMark(const const_iterator_t ppMark);
69 virtual void deleteMark(const ::sw::mark::IMark* const pMark);
70 virtual void clearAllMarks();
72 // marks
73 virtual const_iterator_t getMarksBegin() const;
74 virtual const_iterator_t getMarksEnd() const;
75 virtual sal_Int32 getMarksCount() const;
76 virtual const_iterator_t findMark(const ::rtl::OUString& rName) const;
78 // bookmarks
79 virtual const_iterator_t getBookmarksBegin() const;
80 virtual const_iterator_t getBookmarksEnd() const;
81 virtual sal_Int32 getBookmarksCount() const;
82 virtual const_iterator_t findBookmark(const ::rtl::OUString& rName) const;
84 // Fieldmarks
85 virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& rPos) const;
86 virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& rPos) const;
87 virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& rPos) const;
89 private:
90 // make names
91 ::rtl::OUString getUniqueMarkName(const ::rtl::OUString& rName) const;
92 void sortMarks();
94 container_t m_vMarks;
95 container_t m_vBookmarks;
96 container_t m_vFieldmarks;
97 SwDoc * const m_pDoc;
100 #endif