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

Generated by: LCOV version 1.11