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 sw::mark::IMark* makeAnnotationMark( 54 const SwPaM& rPaM, 55 const ::rtl::OUString& rName ); 56 57 58 virtual void repositionMark(::sw::mark::IMark* io_pMark, const SwPaM& rPaM); 59 virtual bool renameMark(::sw::mark::IMark* io_pMark, const ::rtl::OUString& rNewName); 60 virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset); 61 virtual void correctMarksRelative(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset); 62 63 virtual void deleteMarks(const SwNodeIndex& rStt, const SwNodeIndex& rEnd, ::std::vector< ::sw::mark::SaveBookmark>* pSaveBkmk, const SwIndex* pSttIdx, const SwIndex* pEndIdx); 64 65 // deleters 66 virtual void deleteMark(const const_iterator_t ppMark); 67 virtual void deleteMark(const ::sw::mark::IMark* const pMark); 68 virtual void clearAllMarks(); 69 70 // marks 71 virtual const_iterator_t getAllMarksBegin() const; 72 virtual const_iterator_t getAllMarksEnd() const; 73 virtual sal_Int32 getAllMarksCount() const; 74 virtual const_iterator_t findMark(const ::rtl::OUString& rName) const; 75 76 // bookmarks 77 virtual const_iterator_t getBookmarksBegin() const; 78 virtual const_iterator_t getBookmarksEnd() const; 79 virtual sal_Int32 getBookmarksCount() const; 80 virtual const_iterator_t findBookmark(const ::rtl::OUString& rName) const; 81 82 // Fieldmarks 83 virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& rPos) const; 84 virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& rPos) const; 85 virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& rPos) const; 86 87 // Annotation Marks 88 virtual const_iterator_t getAnnotationMarksBegin() const; 89 virtual const_iterator_t getAnnotationMarksEnd() const; 90 virtual sal_Int32 getAnnotationMarksCount() const; 91 virtual const_iterator_t findAnnotationMark( const ::rtl::OUString& rName ) const; 92 93 virtual void assureSortedMarkContainers() const; 94 95 private: 96 // make names 97 ::rtl::OUString getUniqueMarkName(const ::rtl::OUString& rName) const; 98 void sortMarks(); 99 void sortSubsetMarks(); 100 101 // container for all marks 102 container_t m_vAllMarks; 103 104 // additional container for bookmarks 105 container_t m_vBookmarks; 106 // additional container for fieldmarks 107 container_t m_vFieldmarks; 108 109 // container for annotation marks 110 container_t m_vAnnotationMarks; 111 112 // container for all marks except annotation marks 113 container_t m_vCommonMarks; 114 115 SwDoc * const m_pDoc; 116 }; 117 }} 118 #endif 119