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