LCOV - code coverage report
Current view: top level - sc/source/filter/inc - tool.h (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 25 0.0 %
Date: 2012-08-25 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 2 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef SC_TOOL_H
      30                 :            : #define SC_TOOL_H
      31                 :            : 
      32                 :            : #include <attrib.hxx>    //!!! noch noetig?????
      33                 :            : #include <document.hxx>
      34                 :            : 
      35                 :            : // Defaultwerte
      36                 :            : const sal_uInt8 nDezStd = 0;        // Dezimalstellen fuer Standard-Zellen
      37                 :            : const sal_uInt8 nDezFloat = 2;  //        "         "  Float-Zellen
      38                 :            : 
      39                 :            : void        PutFormString( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Char *pString );
      40                 :            : 
      41                 :            : void        SetFormat( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt8 nFormat, sal_uInt8 nSt );
      42                 :            : 
      43                 :            : void        InitPage( void );
      44                 :            : 
      45                 :            : String      DosToSystem( sal_Char *pSource );
      46                 :            : 
      47                 :            : double      SnumToDouble( sal_Int16 nVal );
      48                 :            : 
      49                 :            : double          Snum32ToDouble( sal_uInt32 nValue );
      50                 :            : 
      51                 :            : typedef sal_uInt16 StampTyp;
      52                 :            : 
      53                 :            : #define MAKE_STAMP(nF,nS) ((nS&0x0F)+((nF&0x7F)*16))
      54                 :            :             // Bit 0...3  = Bit 0...3 von Stellenzahl
      55                 :            :             // Bit 4...10 = Bit 0...6 von Formatbyte
      56                 :            : 
      57                 :            : class FormIdent
      58                 :            : {
      59                 :            : private:
      60                 :            :     StampTyp        nStamp;         // Identifikations-Schluessel
      61                 :            :     SfxUInt32Item*  pAttr;          // zugehoeriges Attribut
      62                 :            : public:
      63                 :          0 :                     FormIdent( void )
      64                 :            :                     {
      65                 :          0 :                         nStamp = 0;
      66                 :          0 :                         pAttr = NULL;
      67                 :          0 :                     }
      68                 :            : 
      69                 :          0 :                     FormIdent( sal_uInt8 nFormat, sal_uInt8 nSt, SfxUInt32Item& rAttr )
      70                 :            :                     {
      71                 :          0 :                         nStamp = MAKE_STAMP( nFormat, nSt );
      72                 :          0 :                         pAttr = &rAttr;
      73                 :          0 :                     }
      74                 :            : 
      75                 :            :                     FormIdent( sal_uInt8 nFormat, sal_uInt8 nSt )
      76                 :            :                     {
      77                 :            :                         nStamp = MAKE_STAMP( nFormat, nSt );
      78                 :            :                         pAttr = NULL;
      79                 :            :                     }
      80                 :            : 
      81                 :            :     sal_Bool            operator ==( const FormIdent& rComp ) const
      82                 :            :                     {
      83                 :            :                         return ( nStamp == rComp.nStamp );
      84                 :            :                     }
      85                 :            : 
      86                 :            :     sal_Bool            operator ==( const StampTyp& rStamp ) const
      87                 :            :                     {
      88                 :            :                         return ( nStamp == rStamp );
      89                 :            :                     }
      90                 :            : 
      91                 :          0 :     StampTyp        GetStamp( void ) const
      92                 :            :                     {
      93                 :          0 :                         return nStamp;
      94                 :            :                     }
      95                 :            : 
      96                 :          0 :     SfxUInt32Item*  GetAttr( void )
      97                 :            :                     {
      98                 :          0 :                         return pAttr;
      99                 :            :                     }
     100                 :            : 
     101                 :          0 :     void            SetStamp( sal_uInt8 nFormat, sal_uInt8 nSt )
     102                 :            :                     {
     103                 :          0 :                         nStamp = MAKE_STAMP( nFormat, nSt );
     104                 :          0 :                     }
     105                 :            : };
     106                 :            : 
     107                 :            : 
     108                 :            : #define __nSize 2048
     109                 :            : 
     110                 :            : 
     111                 :            : 
     112                 :            : 
     113                 :            : class FormCache
     114                 :            : {
     115                 :            : private:
     116                 :            :     FormIdent           aIdents[ __nSize ]; //gepufferte Formate
     117                 :            :     sal_Bool                bValid[ __nSize ];
     118                 :            :     FormIdent           aCompareIdent;      // zum Vergleichen
     119                 :            :     sal_uInt8               nDefaultFormat;     // Defaultformat der Datei
     120                 :            :     SvNumberFormatter*  pFormTable;         // Value-Format-Table-Anker
     121                 :            :     StampTyp            nIndex;
     122                 :            :     LanguageType        eLanguage;          // Systemsprache
     123                 :            : 
     124                 :            :     SfxUInt32Item*      NewAttr( sal_uInt8 nFormat, sal_uInt8 nSt );
     125                 :            : public:
     126                 :            :                         FormCache( ScDocument*, sal_uInt8 nNewDefaultFormat = 0xFF );
     127                 :            :                         ~FormCache();
     128                 :            : 
     129                 :            :     inline const SfxUInt32Item* GetAttr( sal_uInt8 nFormat, sal_uInt8 nSt );
     130                 :            :     void                SetDefaultFormat( sal_uInt8 nD = 0xFF )
     131                 :            :                         {
     132                 :            :                             nDefaultFormat = nD;
     133                 :            :                         }
     134                 :            : };
     135                 :            : 
     136                 :            : 
     137                 :          0 : inline const SfxUInt32Item* FormCache::GetAttr( sal_uInt8 nFormat, sal_uInt8 nSt )
     138                 :            : {
     139                 :            :     // PREC:    nFormat = Lotus-Format-Byte
     140                 :            :     //          nSt = Stellenzahl
     141                 :            :     // POST:    return = zu nFormat und nSt passendes SC-Format
     142                 :            :     SfxUInt32Item*      pAttr;
     143                 :            :     SfxUInt32Item*      pRet;
     144                 :            : 
     145                 :          0 :     aCompareIdent.SetStamp( nFormat, nSt );
     146                 :          0 :     nIndex = aCompareIdent.GetStamp();
     147                 :            :     OSL_ENSURE( nIndex < __nSize, "FormCache::GetAttr(): Uuuuuuups... so nicht!" );
     148         [ #  # ]:          0 :     if( bValid[ nIndex ] )
     149                 :          0 :         pRet = aIdents[ nIndex ].GetAttr();
     150                 :            :     else
     151                 :            :     {
     152                 :            :         // neues Attribut anlegen
     153                 :          0 :         pAttr = NewAttr( nFormat, nSt );
     154                 :            :         OSL_ENSURE( pAttr, "FormCache::GetAttr(): Nix Speicherus" );
     155                 :            : 
     156                 :          0 :         aIdents[ nIndex ] = FormIdent( nFormat, nSt, *pAttr );
     157                 :          0 :         bValid[ nIndex ] = sal_True;
     158                 :            : 
     159                 :          0 :         pRet = pAttr;
     160                 :            :     }
     161                 :          0 :     return pRet;
     162                 :            : }
     163                 :            : 
     164                 :            : #endif
     165                 :            : 
     166                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10