LCOV - code coverage report
Current view: top level - sw/source/core/inc - MarkManager.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 1 100.0 %
Date: 2014-11-03 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_SW_SOURCE_CORE_INC_MARKMANAGER_HXX
      21             : #define INCLUDED_SW_SOURCE_CORE_INC_MARKMANAGER_HXX
      22             : 
      23             : #include <IMark.hxx>
      24             : #include <IDocumentMarkAccess.hxx>
      25             : #include <boost/unordered_set.hpp>
      26             : #include <boost/unordered_map.hpp>
      27             : 
      28             : namespace sw {
      29             :     namespace mark {
      30             :     typedef boost::unordered_map<OUString, sal_Int32, OUStringHash> MarkBasenameMapUniqueOffset_t;
      31             : 
      32       10090 :     class MarkManager
      33             :         : private ::boost::noncopyable
      34             :         , virtual public IDocumentMarkAccess
      35             :     {
      36             :         public:
      37             :             MarkManager(/*[in/out]*/ SwDoc& rDoc);
      38             :             // IDocumentMarkAccess
      39             :             virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM, const OUString& rName, IDocumentMarkAccess::MarkType eMark) SAL_OVERRIDE;
      40             : 
      41             :             virtual sw::mark::IFieldmark* makeFieldBookmark( const SwPaM& rPaM,
      42             :                 const OUString& rName,
      43             :                 const OUString& rType) SAL_OVERRIDE;
      44             :             virtual sw::mark::IFieldmark* makeNoTextFieldBookmark( const SwPaM& rPaM,
      45             :                 const OUString& rName,
      46             :                 const OUString& rType) SAL_OVERRIDE;
      47             : 
      48             :             virtual ::sw::mark::IMark* getMarkForTxtNode(const SwTxtNode& rTxtNode, IDocumentMarkAccess::MarkType eMark) SAL_OVERRIDE;
      49             : 
      50             :             virtual sw::mark::IMark* makeAnnotationMark(
      51             :                 const SwPaM& rPaM,
      52             :                 const ::rtl::OUString& rName ) SAL_OVERRIDE;
      53             : 
      54             :             virtual void repositionMark(::sw::mark::IMark* io_pMark, const SwPaM& rPaM) SAL_OVERRIDE;
      55             :             virtual bool renameMark(::sw::mark::IMark* io_pMark, const OUString& rNewName) SAL_OVERRIDE;
      56             :             virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const sal_Int32 nOffset) SAL_OVERRIDE;
      57             :             virtual void correctMarksRelative(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const sal_Int32 nOffset) SAL_OVERRIDE;
      58             : 
      59             :             virtual void deleteMarks(const SwNodeIndex& rStt, const SwNodeIndex& rEnd, ::std::vector< ::sw::mark::SaveBookmark>* pSaveBkmk, const SwIndex* pSttIdx, const SwIndex* pEndIdx) SAL_OVERRIDE;
      60             : 
      61             :             // deleters
      62             :             virtual ::boost::shared_ptr<ILazyDeleter>
      63             :                 deleteMark(const const_iterator_t ppMark) SAL_OVERRIDE;
      64             :             virtual void deleteMark(const ::sw::mark::IMark* const pMark) SAL_OVERRIDE;
      65             :             virtual void clearAllMarks() SAL_OVERRIDE;
      66             : 
      67             :             // marks
      68             :             virtual const_iterator_t getAllMarksBegin() const SAL_OVERRIDE;
      69             :             virtual const_iterator_t getAllMarksEnd() const SAL_OVERRIDE;
      70             :             virtual sal_Int32 getAllMarksCount() const SAL_OVERRIDE;
      71             :             virtual const_iterator_t findMark(const OUString& rName) const SAL_OVERRIDE;
      72             :             virtual bool hasMark(const OUString& rName) const;
      73             : 
      74             :             // bookmarks
      75             :             virtual const_iterator_t getBookmarksBegin() const SAL_OVERRIDE;
      76             :             virtual const_iterator_t getBookmarksEnd() const SAL_OVERRIDE;
      77             :             virtual sal_Int32 getBookmarksCount() const SAL_OVERRIDE;
      78             :             virtual const_iterator_t findBookmark(const OUString& rName) const SAL_OVERRIDE;
      79             : 
      80             :             // Fieldmarks
      81             :             virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& rPos) const SAL_OVERRIDE;
      82             :             virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& rPos) const SAL_OVERRIDE;
      83             :             virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& rPos) const SAL_OVERRIDE;
      84             : 
      85             :             virtual ::sw::mark::IFieldmark* getDropDownFor(const SwPosition &rPos) const SAL_OVERRIDE;
      86             :             virtual std::vector< ::sw::mark::IFieldmark* > getDropDownsFor(const SwPaM &rPaM) const SAL_OVERRIDE;
      87             : 
      88             :             void dumpAsXml(xmlTextWriterPtr w) const;
      89             : 
      90             :             // Annotation Marks
      91             :             virtual const_iterator_t getAnnotationMarksBegin() const SAL_OVERRIDE;
      92             :             virtual const_iterator_t getAnnotationMarksEnd() const SAL_OVERRIDE;
      93             :             virtual sal_Int32 getAnnotationMarksCount() const SAL_OVERRIDE;
      94             :             virtual const_iterator_t findAnnotationMark( const ::rtl::OUString& rName ) const SAL_OVERRIDE;
      95             :             virtual sw::mark::IMark* getAnnotationMarkFor(const SwPosition& rPos) const SAL_OVERRIDE;
      96             : 
      97             :             virtual void assureSortedMarkContainers() const SAL_OVERRIDE;
      98             : 
      99             :         private:
     100             :             // make names
     101             :             OUString getUniqueMarkName(const OUString& rName) const;
     102             :             void sortMarks();
     103             :             void sortSubsetMarks();
     104             : 
     105             :             // container for all marks
     106             :             container_t m_vAllMarks;
     107             : 
     108             :             // additional container for bookmarks
     109             :             container_t m_vBookmarks;
     110             :             // additional container for fieldmarks
     111             :             container_t m_vFieldmarks;
     112             : 
     113             :             boost::unordered_set<OUString, OUStringHash> m_aMarkNamesSet;
     114             :             mutable MarkBasenameMapUniqueOffset_t m_aMarkBasenameMapUniqueOffset;
     115             : 
     116             :             // container for annotation marks
     117             :             container_t m_vAnnotationMarks;
     118             : 
     119             :             // container for all marks except annotation marks
     120             :             container_t m_vCommonMarks;
     121             : 
     122             :             SwDoc * const m_pDoc;
     123             :     };
     124             :     } // namespace mark
     125             : }
     126             : 
     127             : #endif
     128             : 
     129             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10