LCOV - code coverage report
Current view: top level - sw/inc - IDocumentMarkAccess.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 3 0.0 %
Date: 2014-04-14 Functions: 0 6 0.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_INC_IDOCUMENTMARKACCESS_HXX
      21             : #define INCLUDED_SW_INC_IDOCUMENTMARKACCESS_HXX
      22             : 
      23             : #include <sal/types.h>
      24             : #include <IMark.hxx>
      25             : #include <boost/shared_ptr.hpp>
      26             : 
      27             : class SwPaM;
      28             : class KeyCode;
      29             : struct SwPosition;
      30             : class SwTxtNode;
      31             : 
      32             : namespace sw { namespace mark {
      33             :     class SaveBookmark; // FIXME: Ugly: SaveBookmark is a core-internal class, and should not be used in the interface
      34             : }}
      35             : 
      36             : /** Provides access to the marks of a document.
      37             : */
      38           0 : class IDocumentMarkAccess
      39             : {
      40             :     public:
      41             :         enum MarkType
      42             :         {
      43             :             UNO_BOOKMARK,
      44             :             DDE_BOOKMARK,
      45             :             BOOKMARK,
      46             :             CROSSREF_HEADING_BOOKMARK,
      47             :             CROSSREF_NUMITEM_BOOKMARK,
      48             :             ANNOTATIONMARK,
      49             :             TEXT_FIELDMARK,
      50             :             CHECKBOX_FIELDMARK,
      51             :             NAVIGATOR_REMINDER
      52             :         };
      53             : 
      54             :         typedef ::boost::shared_ptr< ::sw::mark::IMark> pMark_t;
      55             :         typedef ::std::vector< pMark_t > container_t;
      56             :         typedef container_t::iterator iterator_t;
      57             :         typedef container_t::const_iterator const_iterator_t;
      58             :         typedef container_t::const_reverse_iterator const_reverse_iterator_t;
      59             : 
      60             :         /// To avoid recursive calls of deleteMark, the removal of dummy
      61             :         /// characters of fieldmarks has to be delayed; this is the baseclass
      62             :         /// that can be subclassed for that purpose.
      63           0 :         struct ILazyDeleter { virtual ~ILazyDeleter() { } };
      64             : 
      65             :         /** Generates a new mark in the document for a certain selection.
      66             : 
      67             :            @param rPaM
      68             :            [in] the selection being marked.
      69             : 
      70             :            @param rProposedName
      71             :            [in] the proposed name of the new mark.
      72             : 
      73             :            @param eMark
      74             :            [in] the type of the new mark.
      75             : 
      76             :            @returns
      77             :            a pointer to the new mark (name might have changed).
      78             :         */
      79             :         virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM,
      80             :             const OUString& rProposedName,
      81             :             MarkType eMark) =0;
      82             : 
      83             :         virtual sw::mark::IFieldmark* makeFieldBookmark( const SwPaM& rPaM,
      84             :             const OUString& rName,
      85             :             const OUString& rType) = 0;
      86             :         virtual sw::mark::IFieldmark* makeNoTextFieldBookmark( const SwPaM& rPaM,
      87             :             const OUString& rName,
      88             :             const OUString& rType) = 0;
      89             : 
      90             :         virtual sw::mark::IMark* makeAnnotationMark(
      91             :             const SwPaM& rPaM,
      92             :             const ::rtl::OUString& rName ) = 0;
      93             : 
      94             :         /** Returns a mark in the document for a paragraph.
      95             :             If there is none, a mark will be created.
      96             : 
      97             :            @param rTxtNode
      98             :            [in] the paragraph being marked (a selection over the paragraph is marked)
      99             : 
     100             :            @param eMark
     101             :            [in] the type of the new mark.
     102             : 
     103             :            @returns
     104             :            a pointer to the new mark (name might have changed).
     105             :         */
     106             :         virtual ::sw::mark::IMark* getMarkForTxtNode(const SwTxtNode& rTxtNode,
     107             :             MarkType eMark) =0;
     108             : 
     109             :         /** Moves an existing mark to a new selection and performs needed updates.
     110             :             @param io_pMark
     111             :             [in/out] the mark to be moved
     112             : 
     113             :             @param rPaM
     114             :             [in] new selection to be marked
     115             :         */
     116             : 
     117             :         virtual void repositionMark(::sw::mark::IMark* io_pMark,
     118             :             const SwPaM& rPaM) =0;
     119             : 
     120             :         /** Renames an existing Mark, if possible.
     121             :             @param io_pMark
     122             :             [in/out] the mark to be renamed
     123             : 
     124             :             @param rNewName
     125             :             [in] new name for the mark
     126             : 
     127             :             @returns false, if renaming failed (because the name is already in use)
     128             :         */
     129             :             virtual bool renameMark(::sw::mark::IMark* io_pMark,
     130             :                 const OUString& rNewName) =0;
     131             : 
     132             :         /** Corrects marks (absolute)
     133             :             This method ignores the previous position of the mark in the paragraph
     134             : 
     135             :             @param rOldNode
     136             :             [in] the node from which nodes should be moved
     137             : 
     138             :             @param rNewPos
     139             :             [in] new position to which marks will be moved, if nOffset == 0
     140             : 
     141             :             @param nOffset
     142             :             [in] the offset by which the mark gets positioned of rNewPos
     143             :         */
     144             :         virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode,
     145             :             const SwPosition& rNewPos,
     146             :             const sal_Int32 nOffset) =0;
     147             : 
     148             :         /** Corrects marks (relative)
     149             :             This method uses the previous position of the mark in the paragraph as offset
     150             : 
     151             :             @param rOldNode
     152             :             [in] the node from which nodes should be moved
     153             : 
     154             :             @param rNewPos
     155             :             [in] new position to which marks from the start of the paragraph will be
     156             :                  moved, if nOffset == 0
     157             : 
     158             :             @param nOffset
     159             :             [in] the offset by which the mark gets positioned of rNewPos in addition to
     160             :                  its old position in the paragraph
     161             :         */
     162             :         virtual void correctMarksRelative(const SwNodeIndex& rOldNode,
     163             :             const SwPosition& rNewPos,
     164             :             const sal_Int32 nOffset) =0;
     165             : 
     166             :         /** Deletes marks in a range
     167             : 
     168             :             Note: navigator reminders are excluded
     169             : 
     170             :         */
     171             :         virtual void deleteMarks(
     172             :             const SwNodeIndex& rStt,
     173             :             const SwNodeIndex& rEnd,
     174             :             ::std::vector< ::sw::mark::SaveBookmark>* pSaveBkmk, // Ugly: SaveBookmark is core-internal
     175             :             const SwIndex* pSttIdx,
     176             :             const SwIndex* pEndIdx) =0;
     177             : 
     178             :         /** Deletes a mark.
     179             : 
     180             :             @param ppMark
     181             :             [in] an iterator pointing to the Mark to be deleted.
     182             :         */
     183             :         virtual ::boost::shared_ptr<ILazyDeleter>
     184             :             deleteMark(const IDocumentMarkAccess::const_iterator_t ppMark) =0;
     185             : 
     186             :         /** Deletes a mark.
     187             : 
     188             :             @param ppMark
     189             :             [in] the name of the mark to be deleted.
     190             :         */
     191             :         virtual void deleteMark(const ::sw::mark::IMark* const pMark) =0;
     192             : 
     193             :         /** Clear (deletes) all marks.
     194             :         */
     195             :         virtual void clearAllMarks() =0;
     196             : 
     197             :         virtual void assureSortedMarkContainers() const = 0;
     198             : 
     199             :         /** returns a STL-like random access iterator to the begin of the sequence of marks.
     200             :         */
     201             :         virtual const_iterator_t getAllMarksBegin() const =0;
     202             : 
     203             :         /** returns a STL-like random access iterator to the end of the sequence of marks.
     204             :         */
     205             :         virtual const_iterator_t getAllMarksEnd() const =0;
     206             : 
     207             :         /** returns the number of marks.
     208             : 
     209             :             Note: annotation marks are excluded
     210             :         */
     211             :         virtual sal_Int32 getAllMarksCount() const =0;
     212             : 
     213             :         /** Finds a mark by name.
     214             : 
     215             :             @param rName
     216             :             [in] the name of the mark to find.
     217             : 
     218             :             @returns
     219             :             an iterator pointing to the mark, or pointing to getAllMarksEnd() if nothing was found.
     220             :         */
     221             :         virtual const_iterator_t findMark(const OUString& rMark) const =0;
     222             : 
     223             :         // interface IBookmarks (BOOKMARK, CROSSREF_NUMITEM_BOOKMARK, CROSSREF_HEADING_BOOKMARK )
     224             : 
     225             :         /** returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
     226             :         */
     227             :         virtual const_iterator_t getBookmarksBegin() const =0;
     228             : 
     229             :         /** returns a STL-like random access iterator to the end of the sequence of IBookmarks.
     230             :         */
     231             :         virtual const_iterator_t getBookmarksEnd() const =0;
     232             : 
     233             :         /** returns the number of IBookmarks.
     234             :         */
     235             :         virtual sal_Int32 getBookmarksCount() const =0;
     236             : 
     237             :         /** Finds a bookmark by name.
     238             : 
     239             :             @param rName
     240             :             [in] the name of the bookmark to find.
     241             : 
     242             :             @returns
     243             :             an iterator pointing to the bookmark, or getBookmarksEnd() if nothing was found.
     244             :         */
     245             :         virtual const_iterator_t findBookmark(const OUString& rMark) const =0;
     246             : 
     247             :         // Fieldmarks
     248             :         virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& pos) const =0;
     249             :         virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& pos) const =0;
     250             :         virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& pos) const =0;
     251             : 
     252             :         virtual ::sw::mark::IFieldmark* getDropDownFor(const SwPosition& pos) const=0;
     253             :         virtual std::vector< ::sw::mark::IFieldmark* > getDropDownsFor(const SwPaM &rPaM) const=0;
     254             : 
     255             :         // Marks exclusive annotation marks
     256             :         virtual const_iterator_t getCommonMarksBegin() const = 0;
     257             :         virtual const_iterator_t getCommonMarksEnd() const = 0;
     258             :         virtual sal_Int32 getCommonMarksCount() const = 0;
     259             : 
     260             :         // Annotation Marks
     261             :         virtual const_iterator_t getAnnotationMarksBegin() const = 0;
     262             :         virtual const_iterator_t getAnnotationMarksEnd() const = 0;
     263             :         virtual sal_Int32 getAnnotationMarksCount() const = 0;
     264             :         virtual const_iterator_t findAnnotationMark( const ::rtl::OUString& rName ) const = 0;
     265             : 
     266             :         /** Returns the MarkType used to create the mark
     267             :         */
     268             :         static SAL_DLLPUBLIC_EXPORT MarkType GetType(const ::sw::mark::IMark& rMark);
     269             : 
     270             :         static SAL_DLLPUBLIC_EXPORT OUString GetCrossRefHeadingBookmarkNamePrefix();
     271             :         static SAL_DLLPUBLIC_EXPORT bool IsLegalPaMForCrossRefHeadingBookmark( const SwPaM& rPaM );
     272             :     protected:
     273           0 :         virtual ~IDocumentMarkAccess() {};
     274             : };
     275             : 
     276             : #endif // IDOCUMENTBOOKMARKACCESS_HXX_INCLUDED
     277             : 
     278             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10