11d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 31d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 41d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 51d2dbeb0SAndrew Rist * distributed with this work for additional information 61d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 71d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 81d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 91d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 101d2dbeb0SAndrew Rist * 111d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 121d2dbeb0SAndrew Rist * 131d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 141d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 151d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 161d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 171d2dbeb0SAndrew Rist * specific language governing permissions and limitations 181d2dbeb0SAndrew Rist * under the License. 191d2dbeb0SAndrew Rist * 201d2dbeb0SAndrew Rist *************************************************************/ 211d2dbeb0SAndrew Rist 221d2dbeb0SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SW_BOOKMARK_MARKMANAGER_HXX 25cdf0e10cSrcweir #define _SW_BOOKMARK_MARKMANAGER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <IMark.hxx> 28cdf0e10cSrcweir #include <IDocumentMarkAccess.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir namespace sw { namespace mark 31cdf0e10cSrcweir { 32cdf0e10cSrcweir class MarkManager 33cdf0e10cSrcweir : private ::boost::noncopyable 34cdf0e10cSrcweir , virtual public IDocumentMarkAccess 35cdf0e10cSrcweir { 36cdf0e10cSrcweir public: 37cdf0e10cSrcweir MarkManager(/*[in/out]*/ SwDoc& rDoc); 38cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 39cdf0e10cSrcweir void dumpFieldmarks( ) const; 40cdf0e10cSrcweir #endif 41cdf0e10cSrcweir // IDocumentMarkAccess 42cdf0e10cSrcweir virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM, const ::rtl::OUString& rName, IDocumentMarkAccess::MarkType eMark); 43cdf0e10cSrcweir 44cdf0e10cSrcweir virtual sw::mark::IFieldmark* makeFieldBookmark( const SwPaM& rPaM, 45cdf0e10cSrcweir const rtl::OUString& rName, 46cdf0e10cSrcweir const rtl::OUString& rType); 47cdf0e10cSrcweir virtual sw::mark::IFieldmark* makeNoTextFieldBookmark( const SwPaM& rPaM, 48cdf0e10cSrcweir const rtl::OUString& rName, 49cdf0e10cSrcweir const rtl::OUString& rType); 50cdf0e10cSrcweir 51cdf0e10cSrcweir virtual ::sw::mark::IMark* getMarkForTxtNode(const SwTxtNode& rTxtNode, IDocumentMarkAccess::MarkType eMark); 52cdf0e10cSrcweir 53dec99bbdSOliver-Rainer Wittmann virtual sw::mark::IMark* makeAnnotationMark( 54dec99bbdSOliver-Rainer Wittmann const SwPaM& rPaM, 55dec99bbdSOliver-Rainer Wittmann const ::rtl::OUString& rName ); 56dec99bbdSOliver-Rainer Wittmann 57dec99bbdSOliver-Rainer Wittmann 58cdf0e10cSrcweir virtual void repositionMark(::sw::mark::IMark* io_pMark, const SwPaM& rPaM); 59cdf0e10cSrcweir virtual bool renameMark(::sw::mark::IMark* io_pMark, const ::rtl::OUString& rNewName); 60cdf0e10cSrcweir virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset); 61cdf0e10cSrcweir virtual void correctMarksRelative(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset); 62cdf0e10cSrcweir 63cdf0e10cSrcweir virtual void deleteMarks(const SwNodeIndex& rStt, const SwNodeIndex& rEnd, ::std::vector< ::sw::mark::SaveBookmark>* pSaveBkmk, const SwIndex* pSttIdx, const SwIndex* pEndIdx); 64cdf0e10cSrcweir 65cdf0e10cSrcweir // deleters 66cdf0e10cSrcweir virtual void deleteMark(const const_iterator_t ppMark); 67cdf0e10cSrcweir virtual void deleteMark(const ::sw::mark::IMark* const pMark); 68cdf0e10cSrcweir virtual void clearAllMarks(); 69cdf0e10cSrcweir 70cdf0e10cSrcweir // marks 71dec99bbdSOliver-Rainer Wittmann virtual const_iterator_t getAllMarksBegin() const; 72dec99bbdSOliver-Rainer Wittmann virtual const_iterator_t getAllMarksEnd() const; 73dec99bbdSOliver-Rainer Wittmann virtual sal_Int32 getAllMarksCount() const; 74cdf0e10cSrcweir virtual const_iterator_t findMark(const ::rtl::OUString& rName) const; 75cdf0e10cSrcweir 76cdf0e10cSrcweir // bookmarks 77cdf0e10cSrcweir virtual const_iterator_t getBookmarksBegin() const; 78cdf0e10cSrcweir virtual const_iterator_t getBookmarksEnd() const; 79cdf0e10cSrcweir virtual sal_Int32 getBookmarksCount() const; 80cdf0e10cSrcweir virtual const_iterator_t findBookmark(const ::rtl::OUString& rName) const; 81cdf0e10cSrcweir 82cdf0e10cSrcweir // Fieldmarks 83cdf0e10cSrcweir virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& rPos) const; 84cdf0e10cSrcweir virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& rPos) const; 85cdf0e10cSrcweir virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& rPos) const; 86cdf0e10cSrcweir 87dec99bbdSOliver-Rainer Wittmann // Annotation Marks 88dec99bbdSOliver-Rainer Wittmann virtual const_iterator_t getAnnotationMarksBegin() const; 89dec99bbdSOliver-Rainer Wittmann virtual const_iterator_t getAnnotationMarksEnd() const; 90dec99bbdSOliver-Rainer Wittmann virtual sal_Int32 getAnnotationMarksCount() const; 91dec99bbdSOliver-Rainer Wittmann virtual const_iterator_t findAnnotationMark( const ::rtl::OUString& rName ) const; 92dec99bbdSOliver-Rainer Wittmann 93*edfeb9b7SOliver-Rainer Wittmann virtual void assureSortedMarkContainers() const; 94*edfeb9b7SOliver-Rainer Wittmann 95cdf0e10cSrcweir private: 96cdf0e10cSrcweir // make names 97cdf0e10cSrcweir ::rtl::OUString getUniqueMarkName(const ::rtl::OUString& rName) const; 98cdf0e10cSrcweir void sortMarks(); 99fb3f75f2SOliver-Rainer Wittmann void sortSubsetMarks(); 100cdf0e10cSrcweir 101dec99bbdSOliver-Rainer Wittmann // container for all marks 102dec99bbdSOliver-Rainer Wittmann container_t m_vAllMarks; 103dec99bbdSOliver-Rainer Wittmann 104dec99bbdSOliver-Rainer Wittmann // additional container for bookmarks 105cdf0e10cSrcweir container_t m_vBookmarks; 106dec99bbdSOliver-Rainer Wittmann // additional container for fieldmarks 107cdf0e10cSrcweir container_t m_vFieldmarks; 108dec99bbdSOliver-Rainer Wittmann 109dec99bbdSOliver-Rainer Wittmann // container for annotation marks 110dec99bbdSOliver-Rainer Wittmann container_t m_vAnnotationMarks; 111dec99bbdSOliver-Rainer Wittmann 112dec99bbdSOliver-Rainer Wittmann // container for all marks except annotation marks 113dec99bbdSOliver-Rainer Wittmann container_t m_vCommonMarks; 114dec99bbdSOliver-Rainer Wittmann 115cdf0e10cSrcweir SwDoc * const m_pDoc; 116cdf0e10cSrcweir }; 117cdf0e10cSrcweir }} 118cdf0e10cSrcweir #endif 119