LCOV - code coverage report
Current view: top level - sw/source/core/inc - MarkManager.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2012-08-25 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4 10 40.0 %

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

Generated by: LCOV version 1.10