LCOV - code coverage report
Current view: top level - libreoffice/writerfilter/source/doctok - XNoteHelper.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 4 0.0 %
Date: 2012-12-27 Functions: 0 4 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_X_NOTE_HELPER_HXX
      21             : #define INCLUDED_X_NOTE_HELPER_HXX
      22             : 
      23             : #include <PLCF.hxx>
      24             : #include <WW8DocumentImpl.hxx>
      25             : 
      26             : namespace writerfilter {
      27             : namespace doctok
      28             : {
      29             : /**
      30             :    A helper class for footnotes and endnotes and annotations(aka X-notes).
      31             :  */
      32             : template <class T>
      33           0 : class XNoteHelper
      34             : {
      35             :     /// Character positions of X-notes in footnote document
      36             :     WW8StructBase::Pointer_t mpCps;
      37             : 
      38             :     /// Character positions of references to X-notes
      39             :     typename PLCF<T>::Pointer_t mpRefs;
      40             : 
      41             :     /// piece table for CP to FC conversion
      42             :     WW8PieceTable::Pointer_t mpPieceTable;
      43             : 
      44             :     /// the document
      45             :     WW8DocumentImpl * mpDocument;
      46             : 
      47             :     /// type of X-notes handled by this helper (PROP_FOOTNOTE, PROP_ENDNOTE)
      48             :     PropertyType meType;
      49             : 
      50             :     /// offset in document where X-note subdocument starts
      51             :     CpAndFc mCpAndFcOffset;
      52             : 
      53             :     /**
      54             :        Return CpAndFc in document for X-note.
      55             : 
      56             :        @param nPos     index of X-note
      57             :     */
      58             :     CpAndFc getCpAndFc(sal_uInt32 nPos);
      59             : 
      60             :     /**
      61             :        Return CpAndFc in document for reference to a certain X-note.
      62             : 
      63             :        @param nPos     index of the X-note
      64             :      */
      65             :     CpAndFc getRefCpAndFc(sal_uInt32 nPos);
      66             : 
      67             : public:
      68             :     typedef boost::shared_ptr<XNoteHelper> Pointer_t;
      69             : 
      70           0 :     XNoteHelper(WW8StructBase::Pointer_t pCps,
      71             :                 typename PLCF<T>::Pointer_t pRefs,
      72             :                 WW8PieceTable::Pointer_t pPieceTable,
      73             :                 WW8DocumentImpl * pDocument,
      74             :                 PropertyType eType,
      75             :                 CpAndFc cpAndFcOffset)
      76             :     : mpCps(pCps), mpRefs(pRefs), mpPieceTable(pPieceTable),
      77           0 :       mpDocument(pDocument), meType(eType), mCpAndFcOffset(cpAndFcOffset)
      78             :     {
      79           0 :     }
      80             : 
      81             :     /**
      82             :        Initialize.
      83             : 
      84             :        Generates CpAndFcs in document for X-notes.
      85             :      */
      86             :     void init();
      87             : 
      88             :     /**
      89             :        Return number of X-notes.
      90             :      */
      91             :     sal_uInt32 getCount() const;
      92             : 
      93             :     /**
      94             :        Return index of CpAndFc.
      95             : 
      96             :        @param rCpAndFc    the CpAndFc to search
      97             : 
      98             :        @return the index of the rCpAndFc found or getCount() otherwise
      99             :      */
     100             :     sal_uInt32 getIndexOfCpAndFc(const CpAndFc & rCpAndFc);
     101             : 
     102             :     /**
     103             :         Return subdocument containing X-note.
     104             : 
     105             :         @param nIndex  index of X-note.
     106             :     */
     107             :     writerfilter::Reference<Stream>::Pointer_t get(sal_uInt32 nIndex);
     108             : 
     109             :     /**
     110             :        Return subdocument containing X-note.
     111             : 
     112             :        @param rCpAndFc     CpAndFc of the X-note's reference
     113             :     */
     114             :     writerfilter::Reference<Stream>::Pointer_t get(const CpAndFc & rCpAndFc);
     115             : 
     116             :     /**
     117             :        Return reference data structure of X-note.
     118             : 
     119             :        @param nIndex    index of X-note
     120             :     */
     121             :     T * getRef(sal_uInt32 nIndex);
     122             : 
     123             :     /**
     124             :        Return reference data structure of X-note.
     125             : 
     126             :        @param rCpAndFc     CpAndFc for the X-note's reference
     127             :     */
     128             :     T * getRef(const CpAndFc & rCpAndFc);
     129             : };
     130             : 
     131             : }}
     132             : 
     133             : #endif // INCLUDED_X_NOTE_HELPER_HXX
     134             : 
     135             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10