1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SW_BOOKMARK_MARKMANAGER_HXX 25 #define _SW_BOOKMARK_MARKMANAGER_HXX 26 27 #include <IMark.hxx> 28 #include <IDocumentMarkAccess.hxx> 29 30 namespace sw { namespace mark 31 { 32 class MarkManager 33 : private ::boost::noncopyable 34 , virtual public IDocumentMarkAccess 35 { 36 public: 37 MarkManager(/*[in/out]*/ SwDoc& rDoc); 38 #if OSL_DEBUG_LEVEL > 1 39 void dumpFieldmarks( ) const; 40 #endif 41 // IDocumentMarkAccess 42 virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM, const ::rtl::OUString& rName, IDocumentMarkAccess::MarkType eMark); 43 44 virtual sw::mark::IFieldmark* makeFieldBookmark( const SwPaM& rPaM, 45 const rtl::OUString& rName, 46 const rtl::OUString& rType); 47 virtual sw::mark::IFieldmark* makeNoTextFieldBookmark( const SwPaM& rPaM, 48 const rtl::OUString& rName, 49 const rtl::OUString& rType); 50 51 virtual ::sw::mark::IMark* getMarkForTxtNode(const SwTxtNode& rTxtNode, IDocumentMarkAccess::MarkType eMark); 52 53 virtual void repositionMark(::sw::mark::IMark* io_pMark, const SwPaM& rPaM); 54 virtual bool renameMark(::sw::mark::IMark* io_pMark, const ::rtl::OUString& rNewName); 55 virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset); 56 virtual void correctMarksRelative(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset); 57 58 virtual void deleteMarks(const SwNodeIndex& rStt, const SwNodeIndex& rEnd, ::std::vector< ::sw::mark::SaveBookmark>* pSaveBkmk, const SwIndex* pSttIdx, const SwIndex* pEndIdx); 59 60 // deleters 61 virtual void deleteMark(const const_iterator_t ppMark); 62 virtual void deleteMark(const ::sw::mark::IMark* const pMark); 63 virtual void clearAllMarks(); 64 65 // marks 66 virtual const_iterator_t getMarksBegin() const; 67 virtual const_iterator_t getMarksEnd() const; 68 virtual sal_Int32 getMarksCount() const; 69 virtual const_iterator_t findMark(const ::rtl::OUString& rName) const; 70 71 // bookmarks 72 virtual const_iterator_t getBookmarksBegin() const; 73 virtual const_iterator_t getBookmarksEnd() const; 74 virtual sal_Int32 getBookmarksCount() const; 75 virtual const_iterator_t findBookmark(const ::rtl::OUString& rName) const; 76 77 // Fieldmarks 78 virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& rPos) const; 79 virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& rPos) const; 80 virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& rPos) const; 81 82 private: 83 // make names 84 ::rtl::OUString getUniqueMarkName(const ::rtl::OUString& rName) const; 85 void sortMarks(); 86 87 container_t m_vMarks; 88 container_t m_vBookmarks; 89 container_t m_vFieldmarks; 90 SwDoc * const m_pDoc; 91 }; 92 }} 93 #endif 94