LCOV - code coverage report
Current view: top level - libreoffice/writerfilter/source/doctok - WW8FKPImpl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 44 0.0 %
Date: 2012-12-27 Functions: 0 29 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_WW8_FKP_IMPL_HXX
      21             : #define INCLUDED_WW8_FKP_IMPL_HXX
      22             : 
      23             : #include <set>
      24             : #include <deque>
      25             : #include <WW8FKP.hxx>
      26             : 
      27             : #include <resourcemodel/OutputWithDepth.hxx>
      28             : 
      29             : namespace writerfilter {
      30             : namespace doctok
      31             : {
      32             : /**
      33             :    Implementation class for formatted disk pages.
      34             :  */
      35           0 : class WW8FKPImpl : public WW8FKP
      36             : {
      37             :     sal_uInt32 mnPageNumber;
      38             :     bool mbComplex;
      39             : 
      40             : public:
      41           0 :     WW8FKPImpl(WW8Stream & rStream, sal_uInt32 nPageNumber, bool bComplex)
      42             :     : WW8FKP(rStream, nPageNumber * 512), mnPageNumber(nPageNumber),
      43           0 :       mbComplex(bComplex)
      44             :     {
      45           0 :     }
      46             : 
      47           0 :     virtual sal_uInt32 getPageNumber() const { return mnPageNumber; }
      48             : 
      49           0 :     virtual sal_uInt32 getEntryCount() const { return getU8(511); }
      50           0 :     virtual sal_uInt32 getRgb() const { return 4 * (getEntryCount() + 1); }
      51           0 :     virtual Fc getFc(sal_uInt32 nIndex) const
      52           0 :     { return Fc(getU32(nIndex * 4), mbComplex); }
      53           0 :     virtual Fc getFirstFc() const { return getFc(0); }
      54           0 :     virtual Fc getLastFc() const { return getFc(getEntryCount()); }
      55             : 
      56           0 :     virtual bool contains(const Fc & rFc) const
      57           0 :     { return getFirstFc() <= rFc && rFc < getLastFc(); }
      58             : 
      59             :     virtual sal_uInt32 getIndex(const Fc & rFc) const;
      60             : 
      61             :     friend bool operator < (const WW8FKPImpl & rA,
      62             :                             const WW8FKPImpl & rB);
      63             : };
      64             : 
      65             : /**
      66             :    Implementation class for formatted disk pages containing character
      67             :    properties.
      68             :  */
      69           0 : class WW8CHPFKPImpl : public WW8FKPImpl
      70             : {
      71             : public:
      72           0 :     WW8CHPFKPImpl(WW8Stream & rStream, sal_uInt32 nPageNumber,
      73             :                   bool bComplex)
      74           0 :     : WW8FKPImpl(rStream, nPageNumber, bComplex)
      75             :     {
      76           0 :     }
      77             : 
      78             :     virtual writerfilter::Reference<Properties>::Pointer_t
      79             :     getProperties(const Fc & rFc) const;
      80             : 
      81             :     virtual void dump(OutputWithDepth<string> & o) const;
      82             : };
      83             : 
      84             : /**
      85             :    Implementation class for formatted disk pages containing paragraph
      86             :    properties.
      87             :  */
      88           0 : class WW8PAPFKPImpl : public WW8FKPImpl
      89             : {
      90             : public:
      91           0 :     WW8PAPFKPImpl(WW8Stream & rStream, sal_uInt32 nPageNumber,
      92             :                   bool bComplex)
      93           0 :     : WW8FKPImpl(rStream, nPageNumber, bComplex)
      94             :     {
      95           0 :     }
      96             : 
      97             :     virtual writerfilter::Reference<Properties>::Pointer_t
      98             :     getProperties(const Fc & rFc) const;
      99             : 
     100             :     virtual void dump(OutputWithDepth<string> & o) const;
     101             : };
     102             : 
     103             : /**
     104             :    Tuple of page number and formattet disk page.
     105             :  */
     106           0 : class PageNumberAndFKP
     107             : {
     108             :     /// page number
     109             :     sal_uInt32 mnPageNumber;
     110             : 
     111             :     /// pointer to formatted disk page
     112             :     WW8FKP::Pointer_t mpFKP;
     113             : 
     114             : public:
     115           0 :     PageNumberAndFKP(sal_uInt32 nPageNumber, WW8FKP::Pointer_t pFKP)
     116           0 :     : mnPageNumber(nPageNumber), mpFKP(pFKP)
     117             :     {
     118           0 :     }
     119             : 
     120             :     /**
     121             :        Return page number.
     122             :      */
     123             :     sal_uInt32 getPageNumber() const { return mnPageNumber; }
     124             : 
     125             :     /**
     126             :        Return formatted disk page.
     127             :      */
     128           0 :     const WW8FKP::Pointer_t getFKP() const { return mpFKP; }
     129             : 
     130             :     friend bool operator < (const PageNumberAndFKP & rA,
     131             :                             const PageNumberAndFKP & rB);
     132             : };
     133             : 
     134             : /**
     135             :    Cache for formatted disk pages.
     136             :  */
     137             : class WW8FKPCacheImpl : public WW8FKPCache
     138             : {
     139             :     /// size of the cache
     140             :     sal_uInt32 mnCacheSize;
     141             : 
     142             :     /// set of tuples of page number and FKP
     143             :     typedef set<PageNumberAndFKP> PageNumbersAndFKPs;
     144             : 
     145             :     ///
     146             :     typedef deque<sal_uInt32> PageNumbers;
     147             : 
     148             :     PageNumbers mPageNumbers;
     149             :     PageNumbersAndFKPs mPageNumbersAndFKPs;
     150             : 
     151             : protected:
     152             :     WW8Stream::Pointer_t mpStream;
     153             :     virtual WW8FKP::Pointer_t createFKP(sal_uInt32 nPageNumber,
     154             :                                         bool bComplex) = 0;
     155             : 
     156             : public:
     157           0 :     WW8FKPCacheImpl(WW8Stream::Pointer_t rpStream, sal_uInt32 nCacheSize)
     158           0 :     : mnCacheSize(nCacheSize), mpStream(rpStream)
     159             :     {
     160           0 :     }
     161             : 
     162           0 :     virtual ~WW8FKPCacheImpl()
     163           0 :     {
     164           0 :     }
     165             : 
     166             :     WW8FKP::Pointer_t get(sal_uInt32 nPageNumber, bool bComplex);
     167             : };
     168             : 
     169             : class WW8CHPFKPCacheImpl : public WW8FKPCacheImpl
     170             : {
     171             :     virtual WW8FKP::Pointer_t createFKP(sal_uInt32 nPageNumber,
     172             :                                         bool bComplex);
     173             : 
     174             : public:
     175           0 :     WW8CHPFKPCacheImpl(WW8Stream::Pointer_t rpStream,
     176             :                        sal_uInt32 nCacheSize)
     177           0 :     : WW8FKPCacheImpl(rpStream, nCacheSize)
     178             :     {
     179           0 :     }
     180             : 
     181           0 :     virtual ~WW8CHPFKPCacheImpl()
     182           0 :     {
     183           0 :     }
     184             : };
     185             : 
     186             : class WW8PAPFKPCacheImpl : public WW8FKPCacheImpl
     187             : {
     188             :     virtual WW8FKP::Pointer_t createFKP(sal_uInt32 nPageNumber,
     189             :                                         bool bComplex);
     190             : 
     191             : public:
     192           0 :     WW8PAPFKPCacheImpl(WW8Stream::Pointer_t rpStream,
     193             :                        sal_uInt32 nCacheSize)
     194           0 :     : WW8FKPCacheImpl(rpStream, nCacheSize)
     195             :     {
     196           0 :     }
     197             : 
     198           0 :     virtual ~WW8PAPFKPCacheImpl()
     199           0 :     {
     200           0 :     }
     201             : };
     202             : }}
     203             : 
     204             : #endif // INCLUDED_WW8_FKP_IMPL_HXX
     205             : 
     206             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10