LCOV - code coverage report
Current view: top level - sw/source/core/inc - MarkManager.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 1 100.0 %
Date: 2015-06-13 12:38:46 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 <unordered_set>
      26             : #include <unordered_map>
      27             : 
      28             : namespace sw {
      29             :     namespace mark {
      30             : 
      31        5898 :     class MarkManager
      32             :         : private ::boost::noncopyable
      33             :         , virtual public IDocumentMarkAccess
      34             :     {
      35             :         public:
      36             :             MarkManager(/*[in/out]*/ SwDoc& rDoc);
      37             :             // IDocumentMarkAccess
      38             :             virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM, const OUString& rName, IDocumentMarkAccess::MarkType eMark) SAL_OVERRIDE;
      39             : 
      40             :             virtual sw::mark::IFieldmark* makeFieldBookmark( const SwPaM& rPaM,
      41             :                 const OUString& rName,
      42             :                 const OUString& rType) SAL_OVERRIDE;
      43             :             virtual sw::mark::IFieldmark* makeNoTextFieldBookmark( const SwPaM& rPaM,
      44             :                 const OUString& rName,
      45             :                 const OUString& rType) SAL_OVERRIDE;
      46             : 
      47             :             virtual ::sw::mark::IMark* getMarkForTextNode(const SwTextNode& rTextNode, IDocumentMarkAccess::MarkType eMark) SAL_OVERRIDE;
      48             : 
      49             :             virtual sw::mark::IMark* makeAnnotationMark(
      50             :                 const SwPaM& rPaM,
      51             :                 const OUString& rName ) SAL_OVERRIDE;
      52             : 
      53             :             virtual void repositionMark(::sw::mark::IMark* io_pMark, const SwPaM& rPaM) SAL_OVERRIDE;
      54             :             virtual bool renameMark(::sw::mark::IMark* io_pMark, const OUString& rNewName) SAL_OVERRIDE;
      55             :             virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const sal_Int32 nOffset) SAL_OVERRIDE;
      56             :             virtual void correctMarksRelative(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const sal_Int32 nOffset) SAL_OVERRIDE;
      57             : 
      58             :             virtual void deleteMarks(const SwNodeIndex& rStt, const SwNodeIndex& rEnd, ::std::vector< ::sw::mark::SaveBookmark>* pSaveBkmk, const SwIndex* pSttIdx, const SwIndex* pEndIdx) SAL_OVERRIDE;
      59             : 
      60             :             // deleters
      61             :             virtual ::boost::shared_ptr<ILazyDeleter>
      62             :                 deleteMark(const const_iterator_t& ppMark) SAL_OVERRIDE;
      63             :             virtual void deleteMark(const ::sw::mark::IMark* const pMark) SAL_OVERRIDE;
      64             :             virtual void clearAllMarks() SAL_OVERRIDE;
      65             : 
      66             :             // marks
      67             :             virtual const_iterator_t getAllMarksBegin() const SAL_OVERRIDE;
      68             :             virtual const_iterator_t getAllMarksEnd() const SAL_OVERRIDE;
      69             :             virtual sal_Int32 getAllMarksCount() const SAL_OVERRIDE;
      70             :             virtual const_iterator_t findMark(const OUString& rName) const SAL_OVERRIDE;
      71             : 
      72             :             // bookmarks
      73             :             virtual const_iterator_t getBookmarksBegin() const SAL_OVERRIDE;
      74             :             virtual const_iterator_t getBookmarksEnd() const SAL_OVERRIDE;
      75             :             virtual sal_Int32 getBookmarksCount() const SAL_OVERRIDE;
      76             :             virtual const_iterator_t findBookmark(const OUString& rName) const SAL_OVERRIDE;
      77             : 
      78             :             // Fieldmarks
      79             :             virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& rPos) const SAL_OVERRIDE;
      80             :             virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& rPos) const SAL_OVERRIDE;
      81             :             virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& rPos) const SAL_OVERRIDE;
      82             : 
      83             :             virtual ::sw::mark::IFieldmark* getDropDownFor(const SwPosition &rPos) const SAL_OVERRIDE;
      84             :             virtual std::vector< ::sw::mark::IFieldmark* > getDropDownsFor(const SwPaM &rPaM) const SAL_OVERRIDE;
      85             : 
      86             :             void dumpAsXml(struct _xmlTextWriter* pWriter) const;
      87             : 
      88             :             // Annotation Marks
      89             :             virtual const_iterator_t getAnnotationMarksBegin() const SAL_OVERRIDE;
      90             :             virtual const_iterator_t getAnnotationMarksEnd() const SAL_OVERRIDE;
      91             :             virtual sal_Int32 getAnnotationMarksCount() const SAL_OVERRIDE;
      92             :             virtual const_iterator_t findAnnotationMark( const OUString& rName ) const SAL_OVERRIDE;
      93             :             virtual sw::mark::IMark* getAnnotationMarkFor(const SwPosition& rPos) const SAL_OVERRIDE;
      94             : 
      95             :             virtual void assureSortedMarkContainers() const SAL_OVERRIDE;
      96             : 
      97             :         private:
      98             :             // make names
      99             :             OUString getUniqueMarkName(const OUString& rName) const;
     100             :             void sortMarks();
     101             :             void sortSubsetMarks();
     102             : 
     103             :             // container for all marks
     104             :             container_t m_vAllMarks;
     105             : 
     106             :             // additional container for bookmarks
     107             :             container_t m_vBookmarks;
     108             :             // additional container for fieldmarks
     109             :             container_t m_vFieldmarks;
     110             : 
     111             :             std::unordered_set<OUString, OUStringHash> m_aMarkNamesSet;
     112             : 
     113             :             // container for annotation marks
     114             :             container_t m_vAnnotationMarks;
     115             : 
     116             :             // container for all marks except annotation marks
     117             :             container_t m_vCommonMarks;
     118             : 
     119             :             SwDoc * const m_pDoc;
     120             :     };
     121             :     } // namespace mark
     122             : }
     123             : 
     124             : #endif
     125             : 
     126             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11