LCOV - code coverage report
Current view: top level - libreoffice/sc/source/filter/inc - lotattr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 12 16.7 %
Date: 2012-12-27 Functions: 3 6 50.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 SC_LOTATTR_HXX
      21             : #define SC_LOTATTR_HXX
      22             : 
      23             : #include <boost/ptr_container/ptr_vector.hpp>
      24             : 
      25             : #include <tools/solar.h>
      26             : 
      27             : #include "address.hxx"
      28             : #include "scitems.hxx"
      29             : 
      30             : class ScDocumentPool;
      31             : class ScPatternAttr;
      32             : class SvxColorItem;
      33             : class Color;
      34             : class LotAttrTable;
      35             : struct LOTUS_ROOT;
      36             : 
      37             : namespace editeng { class SvxBorderLine; }
      38             : 
      39             : struct LotAttrWK3
      40             : {
      41             :     sal_uInt8 nFont;
      42             :     sal_uInt8 nLineStyle;
      43             :     sal_uInt8 nFontCol;
      44             :     sal_uInt8 nBack;
      45             : 
      46           0 :     inline bool HasStyles () const
      47             :     {
      48           0 :         return ( nFont || nLineStyle || nFontCol || ( nBack & 0x7F ) );
      49             :                     // !! ohne Center-Bit!!
      50             :     }
      51             : 
      52           0 :     inline bool IsCentered () const
      53             :     {
      54           0 :         return ( nBack & 0x80 );
      55             :     }
      56             : };
      57             : 
      58             : class LotAttrCache
      59             : {
      60             : public:
      61             : 
      62             :     LotAttrCache(LOTUS_ROOT* pLotRoot);
      63             : 
      64             :     ~LotAttrCache();
      65             : 
      66             :     const ScPatternAttr& GetPattAttr( const LotAttrWK3& );
      67             : 
      68             : private:
      69             : 
      70             :     friend class LotAttrTable;
      71             : 
      72             :     struct ENTRY
      73             :     {
      74             :         ScPatternAttr*  pPattAttr;
      75             :         sal_uInt32          nHash0;
      76             : 
      77             :         ENTRY (ScPatternAttr* p);
      78             : 
      79             :         ~ENTRY ();
      80             : 
      81             :         inline bool operator == (const ENTRY &r) const { return nHash0 == r.nHash0; }
      82             : 
      83             :         inline bool operator == (const sal_uInt32 &r) const { return nHash0 == r; }
      84             :     };
      85             : 
      86           0 :     inline static void  MakeHash( const LotAttrWK3& rAttr, sal_uInt32& rOut )
      87             :     {
      88           0 :         ( ( sal_uInt8* ) &rOut )[ 0 ] = rAttr.nFont & 0x7F;
      89           0 :         ( ( sal_uInt8* ) &rOut )[ 1 ] = rAttr.nLineStyle;
      90           0 :         ( ( sal_uInt8* ) &rOut )[ 2 ] = rAttr.nFontCol;
      91           0 :         ( ( sal_uInt8* ) &rOut )[ 3 ] = rAttr.nBack;
      92           0 :     }
      93             : 
      94             :     static void LotusToScBorderLine( sal_uInt8 nLine, ::editeng::SvxBorderLine& );
      95             : 
      96             :     const SvxColorItem& GetColorItem( const sal_uInt8 nLotIndex ) const;
      97             : 
      98             :     const Color& GetColor( const sal_uInt8 nLotIndex ) const;
      99             : 
     100             :     ScDocumentPool*     pDocPool;
     101             :     SvxColorItem*       ppColorItems[6];        // 0 und 7 fehlen!
     102             :     SvxColorItem*       pBlack;
     103             :     SvxColorItem*       pWhite;
     104             :     Color*              pColTab;
     105             :     boost::ptr_vector<ENTRY> aEntries;
     106             : 
     107             :     LOTUS_ROOT* mpLotusRoot;
     108             : };
     109             : 
     110             : 
     111        2048 : class LotAttrCol
     112             : {
     113             : public:
     114             :     void SetAttr (const SCROW nRow, const ScPatternAttr&);
     115             : 
     116             :     void Apply (const SCCOL nCol, const SCTAB nTab );
     117             : private:
     118             : 
     119             :     struct ENTRY
     120             :     {
     121             :         const ScPatternAttr* pPattAttr;
     122             :         SCROW nFirstRow;
     123             :         SCROW nLastRow;
     124             :     };
     125             : 
     126             :     boost::ptr_vector<ENTRY> aEntries;
     127             : };
     128             : 
     129             : 
     130           1 : class LotAttrTable
     131             : {
     132             : public:
     133             :     LotAttrTable(LOTUS_ROOT* pLotRoot);
     134             : 
     135             :     void SetAttr( const SCCOL nColFirst, const SCCOL nColLast, const SCROW nRow, const LotAttrWK3& );
     136             : 
     137             :     void Apply( const SCTAB nTabNum );
     138             : 
     139             : private:
     140             : 
     141             :     LotAttrCol pCols[ MAXCOLCOUNT ];
     142             :     LotAttrCache aAttrCache;
     143             : };
     144             : 
     145             : #endif
     146             : 
     147             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10