LCOV - code coverage report
Current view: top level - sc/source/filter/excel - frmbase.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 29 109 26.6 %
Date: 2012-08-25 Functions: 9 19 47.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 116 5.2 %

           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                 :            : 
      30                 :            : #include "formel.hxx"
      31                 :            : 
      32                 :        110 : _ScRangeListTabs::_ScRangeListTabs()
      33                 :            : {
      34                 :        110 : }
      35                 :            : 
      36                 :        110 : _ScRangeListTabs::~_ScRangeListTabs()
      37                 :            : {
      38                 :        110 : }
      39                 :            : 
      40                 :            : 
      41                 :          0 : void _ScRangeListTabs::Append( ScSingleRefData a, SCTAB nTab, const bool b )
      42                 :            : {
      43         [ #  # ]:          0 :     if( b )
      44                 :            :     {
      45         [ #  # ]:          0 :         if( a.nTab > MAXTAB )
      46                 :          0 :             a.nTab = MAXTAB;
      47                 :            : 
      48         [ #  # ]:          0 :         if( a.nCol > MAXCOL )
      49                 :          0 :             a.nCol = MAXCOL;
      50                 :            : 
      51         [ #  # ]:          0 :         if( a.nRow > MAXROW )
      52                 :          0 :             a.nRow = MAXROW;
      53                 :            :     }
      54                 :            :     else
      55                 :            :     {
      56                 :            :         OSL_ENSURE( ValidTab(a.nTab), "-_ScRangeListTabs::Append(): Luegen haben kurze Abstuerze!" );
      57                 :            :     }
      58                 :            : 
      59         [ #  # ]:          0 :     if( nTab == SCTAB_MAX)
      60                 :            :         return;
      61         [ #  # ]:          0 :     if( nTab < 0)
      62                 :          0 :         nTab = a.nTab;
      63                 :            : 
      64 [ #  # ][ #  # ]:          0 :     if (nTab < 0 || MAXTAB < nTab)
      65                 :            :         return;
      66                 :            : 
      67         [ #  # ]:          0 :     TabRangeType::iterator itr = maTabRanges.find(nTab);
      68 [ #  # ][ #  # ]:          0 :     if (itr == maTabRanges.end())
                 [ #  # ]
      69                 :            :     {
      70                 :            :         // No entry for this table yet.  Insert a new one.
      71                 :            :         std::pair<TabRangeType::iterator, bool> r =
      72 [ #  # ][ #  # ]:          0 :             maTabRanges.insert(nTab, new RangeListType);
                 [ #  # ]
      73                 :            : 
      74         [ #  # ]:          0 :         if (!r.second)
      75                 :            :             // Insertion failed.
      76                 :            :             return;
      77                 :            : 
      78                 :          0 :         itr = r.first;
      79                 :            :     }
      80 [ #  # ][ #  # ]:          0 :     itr->second->push_back(ScRange(a.nCol,a.nRow,a.nTab));
      81                 :            : }
      82                 :            : 
      83                 :          0 : void _ScRangeListTabs::Append( ScComplexRefData a, SCTAB nTab, bool b )
      84                 :            : {
      85         [ #  # ]:          0 :     if( b )
      86                 :            :     {
      87                 :            :         // ignore 3D ranges
      88         [ #  # ]:          0 :         if( a.Ref1.nTab != a.Ref2.nTab )
      89                 :            :             return;
      90                 :            : 
      91                 :          0 :         SCsTAB& rTab = a.Ref1.nTab;
      92         [ #  # ]:          0 :         if( rTab > MAXTAB )
      93                 :          0 :             rTab = MAXTAB;
      94         [ #  # ]:          0 :         else if( rTab < 0 )
      95                 :          0 :             rTab = 0;
      96                 :            : 
      97                 :          0 :         SCsCOL& rCol1 = a.Ref1.nCol;
      98         [ #  # ]:          0 :         if( rCol1 > MAXCOL )
      99                 :          0 :             rCol1 = MAXCOL;
     100         [ #  # ]:          0 :         else if( rCol1 < 0 )
     101                 :          0 :             rCol1 = 0;
     102                 :            : 
     103                 :          0 :         SCsROW& rRow1 = a.Ref1.nRow;
     104         [ #  # ]:          0 :         if( rRow1 > MAXROW )
     105                 :          0 :             rRow1 = MAXROW;
     106         [ #  # ]:          0 :         else if( rRow1 < 0 )
     107                 :          0 :             rRow1 = 0;
     108                 :            : 
     109                 :          0 :         SCsCOL& rCol2 = a.Ref2.nCol;
     110         [ #  # ]:          0 :         if( rCol2 > MAXCOL )
     111                 :          0 :             rCol2 = MAXCOL;
     112         [ #  # ]:          0 :         else if( rCol2 < 0 )
     113                 :          0 :             rCol2 = 0;
     114                 :            : 
     115                 :          0 :         SCsROW& rRow2 = a.Ref2.nRow;
     116         [ #  # ]:          0 :         if( rRow2 > MAXROW )
     117                 :          0 :             rRow2 = MAXROW;
     118         [ #  # ]:          0 :         else if( rRow2 < 0 )
     119                 :          0 :             rRow2 = 0;
     120                 :            :     }
     121                 :            :     else
     122                 :            :     {
     123                 :            :         OSL_ENSURE( ValidTab(a.Ref1.nTab),
     124                 :            :             "-_ScRangeListTabs::Append(): Luegen haben kurze Abstuerze!" );
     125                 :            :         OSL_ENSURE( a.Ref1.nTab == a.Ref2.nTab,
     126                 :            :             "+_ScRangeListTabs::Append(): 3D-Ranges werden in SC nicht unterstuetzt!" );
     127                 :            :     }
     128                 :            : 
     129         [ #  # ]:          0 :     if( nTab == SCTAB_MAX)
     130                 :            :         return;
     131                 :            : 
     132         [ #  # ]:          0 :     if( nTab < -1)
     133                 :          0 :         nTab = a.Ref1.nTab;
     134                 :            : 
     135 [ #  # ][ #  # ]:          0 :     if (nTab < 0 || MAXTAB < nTab)
     136                 :            :         return;
     137                 :            : 
     138         [ #  # ]:          0 :     TabRangeType::iterator itr = maTabRanges.find(nTab);
     139 [ #  # ][ #  # ]:          0 :     if (itr == maTabRanges.end())
                 [ #  # ]
     140                 :            :     {
     141                 :            :         // No entry for this table yet.  Insert a new one.
     142                 :            :         std::pair<TabRangeType::iterator, bool> r =
     143 [ #  # ][ #  # ]:          0 :             maTabRanges.insert(nTab, new RangeListType);
                 [ #  # ]
     144                 :            : 
     145         [ #  # ]:          0 :         if (!r.second)
     146                 :            :             // Insertion failed.
     147                 :            :             return;
     148                 :            : 
     149                 :          0 :         itr = r.first;
     150                 :            :     }
     151         [ #  # ]:          0 :     itr->second->push_back(
     152                 :            :         ScRange(a.Ref1.nCol,a.Ref1.nRow,a.Ref1.nTab,
     153         [ #  # ]:          0 :                 a.Ref2.nCol,a.Ref2.nRow,a.Ref2.nTab));
     154                 :            : }
     155                 :            : 
     156                 :          0 : const ScRange* _ScRangeListTabs::First( SCTAB n )
     157                 :            : {
     158                 :            :     OSL_ENSURE( ValidTab(n), "-_ScRangeListTabs::First(): Und tschuessssssss!" );
     159                 :            : 
     160         [ #  # ]:          0 :     TabRangeType::iterator itr = maTabRanges.find(n);
     161 [ #  # ][ #  # ]:          0 :     if (itr == maTabRanges.end())
                 [ #  # ]
     162                 :            :         // No range list exists for this table.
     163                 :          0 :         return NULL;
     164                 :            : 
     165         [ #  # ]:          0 :     const RangeListType& rList = *itr->second;
     166                 :          0 :     maItrCur = rList.begin();
     167                 :          0 :     maItrCurEnd = rList.end();
     168         [ #  # ]:          0 :     return rList.empty() ? NULL : &(*maItrCur);
     169                 :            : }
     170                 :            : 
     171                 :          0 : const ScRange* _ScRangeListTabs::Next ()
     172                 :            : {
     173                 :          0 :     ++maItrCur;
     174         [ #  # ]:          0 :     if (maItrCur == maItrCurEnd)
     175                 :          0 :         return NULL;
     176                 :            : 
     177                 :          0 :     return &(*maItrCur);
     178                 :            : }
     179                 :            : 
     180                 :        113 : ConverterBase::ConverterBase( sal_uInt16 nNewBuffer ) :
     181                 :            :     aEingPos( 0, 0, 0 ),
     182                 :            :     eStatus( ConvOK ),
     183         [ +  - ]:        113 :     nBufferSize( nNewBuffer )
     184                 :            : {
     185                 :            :     OSL_ENSURE( nNewBuffer > 0, "ConverterBase::ConverterBase - nNewBuffer == 0!" );
     186         [ +  - ]:        113 :     pBuffer = new sal_Char[ nNewBuffer ];
     187                 :        113 : }
     188                 :            : 
     189         [ +  - ]:        113 : ConverterBase::~ConverterBase()
     190                 :            : {
     191         [ +  - ]:        113 :     delete[] pBuffer;
     192         [ -  + ]:        113 : }
     193                 :            : 
     194                 :       1914 : void ConverterBase::Reset()
     195                 :            : {
     196                 :       1914 :     eStatus = ConvOK;
     197                 :       1914 :     aPool.Reset();
     198                 :       1914 :     aStack.Reset();
     199                 :       1914 : }
     200                 :            : 
     201                 :            : 
     202                 :            : 
     203                 :            : 
     204                 :        110 : ExcelConverterBase::ExcelConverterBase( sal_uInt16 nNewBuffer ) :
     205                 :        110 :     ConverterBase( nNewBuffer )
     206                 :            : {
     207                 :        110 : }
     208                 :            : 
     209                 :        110 : ExcelConverterBase::~ExcelConverterBase()
     210                 :            : {
     211         [ -  + ]:        110 : }
     212                 :            : 
     213                 :       1779 : void ExcelConverterBase::Reset( const ScAddress& rEingPos )
     214                 :            : {
     215                 :       1779 :     ConverterBase::Reset();
     216                 :       1779 :     aEingPos = rEingPos;
     217                 :       1779 : }
     218                 :            : 
     219                 :        135 : void ExcelConverterBase::Reset()
     220                 :            : {
     221                 :        135 :     ConverterBase::Reset();
     222                 :        135 :     aEingPos.Set( 0, 0, 0 );
     223                 :        135 : }
     224                 :            : 
     225                 :            : 
     226                 :            : 
     227                 :            : 
     228                 :          0 : LotusConverterBase::LotusConverterBase( SvStream &rStr, sal_uInt16 nNewBuffer ) :
     229                 :            :     ConverterBase( nNewBuffer ),
     230                 :            :     aIn( rStr ),
     231                 :          0 :     nBytesLeft( 0 )
     232                 :            : {
     233                 :          0 : }
     234                 :            : 
     235                 :          0 : LotusConverterBase::~LotusConverterBase()
     236                 :            : {
     237         [ #  # ]:          0 : }
     238                 :            : 
     239                 :          0 : void LotusConverterBase::Reset( const ScAddress& rEingPos )
     240                 :            : {
     241                 :          0 :     ConverterBase::Reset();
     242                 :          0 :     nBytesLeft = 0;
     243                 :          0 :     aEingPos = rEingPos;
     244                 :          0 : }
     245                 :            : 
     246                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10