LCOV - code coverage report
Current view: top level - sc/source/filter/inc - dif.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 26 0.0 %
Date: 2012-08-25 Functions: 0 9 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 32 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_DIF_HXX
      30                 :            : #define SC_DIF_HXX
      31                 :            : 
      32                 :            : #include <boost/ptr_container/ptr_vector.hpp>
      33                 :            : 
      34                 :            : #include <tools/string.hxx>
      35                 :            : #include <rtl/ustring.hxx>
      36                 :            : 
      37                 :            : #include "address.hxx"
      38                 :            : #include "global.hxx"
      39                 :            : 
      40                 :            : class SvStream;
      41                 :            : class SvNumberFormatter;
      42                 :            : class ScDocument;
      43                 :            : class ScPatternAttr;
      44                 :            : 
      45                 :            : extern const sal_Unicode pKeyTABLE[];
      46                 :            : extern const sal_Unicode pKeyVECTORS[];
      47                 :            : extern const sal_Unicode pKeyTUPLES[];
      48                 :            : extern const sal_Unicode pKeyDATA[];
      49                 :            : extern const sal_Unicode pKeyBOT[];
      50                 :            : extern const sal_Unicode pKeyEOD[];
      51                 :            : extern const sal_Unicode pKeyTRUE[];
      52                 :            : extern const sal_Unicode pKeyFALSE[];
      53                 :            : extern const sal_Unicode pKeyNA[];
      54                 :            : extern const sal_Unicode pKeyV[];
      55                 :            : extern const sal_Unicode pKey1_0[];
      56                 :            : 
      57                 :            : enum TOPIC
      58                 :            : {
      59                 :            :     T_UNKNOWN,
      60                 :            :     T_TABLE, T_VECTORS, T_TUPLES, T_DATA, T_LABEL, T_COMMENT, T_SIZE,
      61                 :            :     T_PERIODICITY, T_MAJORSTART, T_MINORSTART, T_TRUELENGTH, T_UINITS,
      62                 :            :     T_DISPLAYUNITS,
      63                 :            :     T_END
      64                 :            : };
      65                 :            : 
      66                 :            : enum DATASET { D_BOT, D_EOD, D_NUMERIC, D_STRING, D_UNKNOWN, D_SYNT_ERROR };
      67                 :            : 
      68                 :            : class DifAttrCache;
      69                 :            : class ScPatternAttr;
      70                 :            : 
      71                 :          0 : class DifParser
      72                 :            : {
      73                 :            : public:
      74                 :            :     String              aData;
      75                 :            :     double              fVal;
      76                 :            :     sal_uInt32              nVector;
      77                 :            :     sal_uInt32              nVal;
      78                 :            :     sal_uInt32              nNumFormat;
      79                 :            :     CharSet             eCharSet;
      80                 :            : private:
      81                 :            :     SvNumberFormatter*  pNumFormatter;
      82                 :            :     SvStream&           rIn;
      83                 :            :     sal_Bool                bPlain;
      84                 :            :     rtl::OUString       aLookAheadLine;
      85                 :            : 
      86                 :            :     bool                ReadNextLine( rtl::OUString& rStr );
      87                 :            :     bool                LookAhead();
      88                 :            :     DATASET             GetNumberDataset( const sal_Unicode* pPossibleNumericData );
      89                 :            :     static inline sal_Bool  IsBOT( const sal_Unicode* pRef );
      90                 :            :     static inline sal_Bool  IsEOD( const sal_Unicode* pRef );
      91                 :            :     static inline sal_Bool  Is1_0( const sal_Unicode* pRef );
      92                 :            : public:
      93                 :            :                         DifParser( SvStream&, const sal_uInt32 nOption, ScDocument&, CharSet );
      94                 :            : 
      95                 :            :     TOPIC               GetNextTopic( void );
      96                 :            : 
      97                 :            :     DATASET             GetNextDataset( void );
      98                 :            : 
      99                 :            :     const sal_Unicode*  ScanIntVal( const sal_Unicode* pStart, sal_uInt32& rRet );
     100                 :            :     sal_Bool                ScanFloatVal( const sal_Unicode* pStart );
     101                 :            : 
     102                 :            :     inline sal_Bool         IsNumber( const sal_Unicode cChar );
     103                 :            :     inline sal_Bool         IsNumberEnding( const sal_Unicode cChar );
     104                 :            : 
     105                 :            :     static inline sal_Bool  IsV( const sal_Unicode* pRef );
     106                 :            : 
     107                 :            :     inline sal_Bool         IsPlain( void ) const;
     108                 :            : };
     109                 :            : 
     110                 :          0 : inline sal_Bool DifParser::IsBOT( const sal_Unicode* pRef )
     111                 :            : {
     112                 :          0 :     return  (   pRef[ 0 ] == pKeyBOT[0] &&
     113                 :          0 :                 pRef[ 1 ] == pKeyBOT[1] &&
     114                 :          0 :                 pRef[ 2 ] == pKeyBOT[2] &&
     115 [ #  # ][ #  # ]:          0 :                 pRef[ 3 ] == pKeyBOT[3] );
         [ #  # ][ #  # ]
     116                 :            : }
     117                 :            : 
     118                 :          0 : inline sal_Bool DifParser::IsEOD( const sal_Unicode* pRef )
     119                 :            : {
     120                 :          0 :     return  (   pRef[ 0 ] == pKeyEOD[0] &&
     121                 :          0 :                 pRef[ 1 ] == pKeyEOD[1] &&
     122                 :          0 :                 pRef[ 2 ] == pKeyEOD[2] &&
     123 [ #  # ][ #  # ]:          0 :                 pRef[ 3 ] == pKeyEOD[3] );
         [ #  # ][ #  # ]
     124                 :            : }
     125                 :            : 
     126                 :          0 : inline sal_Bool DifParser::Is1_0( const sal_Unicode* pRef )
     127                 :            : {
     128                 :          0 :     return  (   pRef[ 0 ] == pKey1_0[0] &&
     129                 :          0 :                 pRef[ 1 ] == pKey1_0[1] &&
     130                 :          0 :                 pRef[ 2 ] == pKey1_0[2] &&
     131 [ #  # ][ #  # ]:          0 :                 pRef[ 3 ] == pKey1_0[3] );
         [ #  # ][ #  # ]
     132                 :            : }
     133                 :            : 
     134                 :          0 : inline sal_Bool DifParser::IsV( const sal_Unicode* pRef )
     135                 :            : {
     136                 :          0 :     return  (   pRef[ 0 ] == pKeyV[0] &&
     137 [ #  # ][ #  # ]:          0 :                 pRef[ 1 ] == pKeyV[1]   );
     138                 :            : }
     139                 :            : 
     140                 :          0 : inline sal_Bool DifParser::IsNumber( const sal_Unicode cChar )
     141                 :            : {
     142 [ #  # ][ #  # ]:          0 :     return ( cChar >= '0' && cChar <= '9' );
     143                 :            : }
     144                 :            : 
     145                 :          0 : inline sal_Bool DifParser::IsNumberEnding( const sal_Unicode cChar )
     146                 :            : {
     147                 :          0 :     return ( cChar == 0x00 );
     148                 :            : }
     149                 :            : 
     150                 :          0 : inline sal_Bool DifParser::IsPlain( void ) const
     151                 :            : {
     152                 :          0 :     return bPlain;
     153                 :            : }
     154                 :            : 
     155                 :          0 : class DifColumn
     156                 :            : {
     157                 :            :     friend class DifAttrCache;
     158                 :            : 
     159                 :            :     struct ENTRY
     160                 :            :     {
     161                 :            :         sal_uInt32 nNumFormat;
     162                 :            :         SCROW nStart;
     163                 :            :         SCROW nEnd;
     164                 :            :     };
     165                 :            : 
     166                 :            :     ENTRY *pAkt;
     167                 :            :     boost::ptr_vector<ENTRY> aEntries;
     168                 :            : 
     169                 :            :     DifColumn();
     170                 :            : 
     171                 :            :     void SetLogical( SCROW nRow );
     172                 :            : 
     173                 :            :     void SetNumFormat( SCROW nRow, const sal_uInt32 nNumFormat );
     174                 :            : 
     175                 :            :     void NewEntry( const SCROW nPos, const sal_uInt32 nNumFormat );
     176                 :            : 
     177                 :            :     void Apply( ScDocument&, const SCCOL nCol, const SCTAB nTab, const ScPatternAttr& );
     178                 :            : 
     179                 :            :     void Apply( ScDocument &rDoc, const SCCOL nCol, const SCTAB nTab );
     180                 :            : };
     181                 :            : 
     182                 :            : class DifAttrCache
     183                 :            : {
     184                 :            : public:
     185                 :            : 
     186                 :            :     DifAttrCache( const sal_Bool bPlain );
     187                 :            : 
     188                 :            :     ~DifAttrCache();
     189                 :            : 
     190                 :            :     void SetLogical( const SCCOL nCol, const SCROW nRow );
     191                 :            : 
     192                 :            :     void SetNumFormat( const SCCOL nCol, const SCROW nRow, const sal_uInt32 nNumFormat );
     193                 :            : 
     194                 :            :     void Apply( ScDocument&, SCTAB nTab );
     195                 :            : 
     196                 :            : private:
     197                 :            : 
     198                 :            :     DifColumn**         ppCols;
     199                 :            :     sal_Bool                bPlain;
     200                 :            : };
     201                 :            : 
     202                 :            : #endif
     203                 :            : 
     204                 :            : 
     205                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10