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

Generated by: LCOV version 1.10