LCOV - code coverage report
Current view: top level - libreoffice/sc/source/filter/lotus - tool.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 58 281 20.6 %
Date: 2012-12-27 Functions: 10 22 45.5 %
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 "scitems.hxx"
      21             : #include <svx/algitem.hxx>
      22             : #include <editeng/justifyitem.hxx>
      23             : #include <svl/zforlist.hxx>
      24             : #include <tools/solar.h>
      25             : 
      26             : #include "cell.hxx"
      27             : #include "rangenam.hxx"
      28             : #include "compiler.hxx"
      29             : 
      30             : #include "tool.h"
      31             : #include "decl.h"
      32             : #include "root.hxx"
      33             : #include "lotrange.hxx"
      34             : #include "namebuff.hxx"
      35             : #include "ftools.hxx"
      36             : 
      37             : #include <math.h>
      38             : 
      39             : #ifdef _MSC_VER
      40             : #pragma optimize("",off)
      41             : #endif
      42             : 
      43             : //--------------------------------------------------------- EXTERNE VARIABLEN -
      44             : extern WKTYP                eTyp;           // -> filter.cxx, aktueller Dateityp
      45             : extern ScDocument*          pDoc;           // -> filter.cxx, Aufhaenger zum Dokumentzugriff
      46             : 
      47             : //--------------------------------------------------------- GLOBALE VARIABLEN -
      48             : sal_uInt8                       nDefaultFormat; // -> op.cpp, Standard-Zellenformat
      49             : 
      50             : extern SvxHorJustifyItem    *pAttrRight, *pAttrLeft, *pAttrCenter, *pAttrRepeat, *pAttrStandard;
      51             : extern ScProtectionAttr*    pAttrUnprot;
      52             : extern SfxUInt32Item**      pAttrValForms;
      53             : 
      54             : SvxHorJustifyItem           *pAttrRight, *pAttrLeft, *pAttrCenter, *pAttrRepeat, *pAttrStandard;
      55             :                                                     // -> in memory.cxx initialisiert
      56             : ScProtectionAttr*           pAttrUnprot;            // ->  " memory.cxx    "
      57             : 
      58             : extern FormCache*           pValueFormCache;        // -> in memory.cxx initialisiert
      59             : FormCache*                  pValueFormCache;
      60             : 
      61             : SCCOL                       LotusRangeList::nEingCol;
      62             : SCROW                       LotusRangeList::nEingRow;
      63             : 
      64             : 
      65             : 
      66             : 
      67           2 : void PutFormString( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Char* pString )
      68             : {
      69             :     // Label-Format-Auswertung
      70             :     OSL_ENSURE( pString != NULL, "PutFormString(): pString == NULL" );
      71           2 :     if (!pString)
      72           2 :         return;
      73             : 
      74             :     sal_Char            cForm;
      75           2 :     SvxHorJustifyItem*  pJustify = NULL;
      76             : 
      77           2 :     cForm = *pString;
      78             : 
      79           2 :     switch( cForm )
      80             :     {
      81             :         case '"':   // rechtsbuendig
      82           0 :             pJustify = pAttrRight;
      83           0 :             pString++;
      84           0 :             break;
      85             :         case '\'':  // linksbuendig
      86           2 :             pJustify = pAttrLeft;
      87           2 :             pString++;
      88           2 :             break;
      89             :         case '^':   // zentriert
      90           0 :             pJustify = pAttrCenter;
      91           0 :             pString++;
      92           0 :             break;
      93             :         case '|':   // printer command
      94           0 :             pString = NULL;
      95           0 :             break;
      96             :         case '\\':  // Wiederholung
      97           0 :             pJustify = pAttrRepeat;
      98           0 :             pString++;
      99           0 :             break;
     100             :         default:    // kenn' ich nicht!
     101           0 :             pJustify = pAttrStandard;
     102             :     }
     103             : 
     104           2 :     pDoc->ApplyAttr( nCol, nRow, nTab, *pJustify );
     105           2 :     ScStringCell*       pZelle = new ScStringCell( String( pString, pLotusRoot->eCharsetQ ) );
     106           2 :     pDoc->PutCell( nCol, nRow, nTab, pZelle, true );
     107             : }
     108             : 
     109             : 
     110             : 
     111             : 
     112           0 : void SetFormat( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt8 nFormat, sal_uInt8 nSt )
     113             : {
     114             :     //  PREC:   nSt = Standard-Dezimalstellenanzahl
     115           0 :     pDoc->ApplyAttr( nCol, nRow, nTab, *( pValueFormCache->GetAttr( nFormat, nSt ) ) );
     116             : 
     117           0 :     ScProtectionAttr aAttr;
     118             : 
     119           0 :     aAttr.SetProtection( nFormat & 0x80 );
     120             : 
     121           0 :     pDoc->ApplyAttr( nCol, nRow, nTab, aAttr );
     122           0 : }
     123             : 
     124           1 : void InitPage( void )
     125             : {   // Seitenformat initialisieren, d.h. Default-Werte von SC holen
     126             :     //scGetPageFormat( 0, &aPage );
     127           1 : }
     128             : 
     129             : 
     130           0 : double SnumToDouble( sal_Int16 nVal )
     131             : {
     132             :     const double pFacts[ 8 ] = {
     133             :         5000.0,
     134             :         500.0,
     135             :         0.05,
     136             :         0.005,
     137             :         0.0005,
     138             :         0.00005,
     139             :         0.0625,
     140           0 :         0.015625 };
     141             : 
     142             :     double      fVal;
     143             : 
     144           0 :     if( nVal & 0x0001 )
     145             :     {
     146           0 :         fVal = pFacts[ ( nVal >> 1 ) & 0x0007 ];
     147           0 :         fVal *= ( sal_Int16 ) ( nVal >> 4 );
     148             :     }
     149             :     else
     150           0 :         fVal = ( sal_Int16 ) ( nVal >> 1 );
     151             : 
     152           0 :     return fVal;
     153             : }
     154             : 
     155           8 : double Snum32ToDouble( sal_uInt32 nValue )
     156             : {
     157             :     double fValue, temp;
     158             : 
     159           8 :     fValue = nValue >> 6;
     160           8 :     temp = nValue & 0x0f;
     161           8 :     if (temp)
     162             :     {
     163           0 :         if (nValue & 0x00000010)
     164           0 :                 fValue /= pow((double)10, temp);
     165             :         else
     166           0 :         fValue *= pow((double)10, temp);
     167             :     }
     168             : 
     169           8 :     if ((nValue & 0x00000020))
     170           0 :         fValue = -fValue;
     171           8 :     return fValue;
     172             : }
     173             : 
     174             : 
     175           1 : FormCache::FormCache( ScDocument* pDoc1, sal_uInt8 nNewDefaultFormat )
     176             : {   // Default-Format ist 'Default'
     177           1 :     nDefaultFormat = nNewDefaultFormat;
     178           1 :     pFormTable = pDoc1->GetFormatTable();
     179        2049 :     for( sal_uInt16 nC = 0 ; nC < __nSize ; nC++ )
     180        2048 :         bValid[ nC ] = false;
     181           1 :     eLanguage = ScGlobal::eLnge;
     182           1 : }
     183             : 
     184             : 
     185           1 : FormCache::~FormCache()
     186             : {
     187        2049 :     for( sal_uInt16 nC = 0 ; nC < __nSize ; nC++ )
     188        2048 :         delete aIdents[ nC ].GetAttr();
     189           1 : }
     190             : 
     191             : 
     192           0 : SfxUInt32Item* FormCache::NewAttr( sal_uInt8 nFormat, sal_uInt8 nSt )
     193             : {
     194             :     // neues Format erzeugen
     195             :     sal_uInt8       nL, nH; // Low-/High-Nibble
     196           0 :     sal_uInt8       nForm = nFormat;
     197           0 :     OUString          aFormString;
     198           0 :     sal_Int16       eType = NUMBERFORMAT_ALL;
     199             :     sal_uInt32      nIndex1;
     200             :     sal_uInt32      nHandle;
     201           0 :     NfIndexTableOffset eIndexTableOffset = NF_NUMERIC_START;
     202           0 :     sal_Bool        bDefault = false;
     203             : 
     204           0 :     if( nForm == 0xFF ) // Default-Format?
     205           0 :         nForm = nDefaultFormat;
     206             : 
     207             :     // Aufdroeseln in Low- und High-Nibble
     208           0 :     nL = nFormat & 0x0F;
     209           0 :     nH = ( nFormat & 0xF0 ) / 16;
     210             : 
     211           0 :     nH &= 0x07;     // Bits 4-6 'rausziehen
     212           0 :     switch( nH )
     213             :     {
     214             :         case 0x00:  // Festkommaformat (fixed)
     215             :             //fStandard;nL;
     216             :             nIndex1 = pFormTable->GetStandardFormat(
     217           0 :                 NUMBERFORMAT_NUMBER, eLanguage );
     218             :             aFormString = pFormTable->GenerateFormat(nIndex1,
     219           0 :                 eLanguage, false, false, nL, 1);
     220           0 :             break;
     221             :         case 0x01:  // Exponentdarstellung (scientific notation)
     222             :             //fExponent;nL;
     223             :             nIndex1 = pFormTable->GetStandardFormat(
     224           0 :                 NUMBERFORMAT_SCIENTIFIC, eLanguage );
     225             :             aFormString = pFormTable->GenerateFormat(nIndex1,
     226           0 :                 eLanguage, false, false, nL, 1);
     227           0 :             break;
     228             :         case 0x02:  // Waehrungsdarstellung (currency)
     229             :             //fMoney;nL;
     230             :             nIndex1 = pFormTable->GetStandardFormat(
     231           0 :                 NUMBERFORMAT_CURRENCY, eLanguage );
     232             :             aFormString = pFormTable->GenerateFormat(nIndex1,
     233           0 :                 eLanguage, false, false, nL, 1);
     234           0 :             break;
     235             :         case 0x03:  // Prozent
     236             :             //fPercent;nL;
     237             :             nIndex1 = pFormTable->GetStandardFormat(
     238           0 :                 NUMBERFORMAT_PERCENT, eLanguage );
     239             :             aFormString = pFormTable->GenerateFormat(nIndex1,
     240           0 :                 eLanguage, false, false, nL, 1);
     241           0 :             break;
     242             :         case 0x04:  // Komma
     243             :             //fStandard;nL;
     244             :             nIndex1 = pFormTable->GetStandardFormat(
     245           0 :                 NUMBERFORMAT_NUMBER, eLanguage );
     246             :             aFormString = pFormTable->GenerateFormat(nIndex1,
     247           0 :                 eLanguage, sal_True, false, nL, 1);
     248           0 :             break;
     249             :         case 0x05:  // frei
     250             :             //fStandard;nL;
     251             :             nIndex1 = pFormTable->GetStandardFormat(
     252           0 :                 NUMBERFORMAT_NUMBER, eLanguage );
     253             :             aFormString = pFormTable->GenerateFormat(nIndex1,
     254           0 :                 eLanguage, false, false, nL, 1);
     255           0 :             break;
     256             :         case 0x06:  // frei
     257             :             //fStandard;nL;
     258             :             nIndex1 = pFormTable->GetStandardFormat(
     259           0 :                 NUMBERFORMAT_NUMBER, eLanguage );
     260             :             aFormString = pFormTable->GenerateFormat(nIndex1,
     261           0 :                 eLanguage, false, false, nL, 1);
     262           0 :             nIndex1 = 0;
     263           0 :             break;
     264             :         case 0x07:  // Spezialformat
     265           0 :             switch( nL )
     266             :             {
     267             :                 case 0x00:  // +/-
     268             :                     //fStandard;nSt;
     269             :                     nIndex1 = pFormTable->GetStandardFormat(
     270           0 :                         NUMBERFORMAT_NUMBER, eLanguage );
     271             :                     aFormString = pFormTable->GenerateFormat(nIndex1,
     272           0 :                         eLanguage, false, sal_True, nSt, 1);
     273           0 :                     break;
     274             :                 case 0x01:  // generelles Format
     275             :                     //fStandard;nSt;
     276             :                     nIndex1 = pFormTable->GetStandardFormat(
     277           0 :                         NUMBERFORMAT_NUMBER, eLanguage );
     278             :                     aFormString = pFormTable->GenerateFormat(nIndex1,
     279           0 :                         eLanguage, false, false, nSt, 1);
     280           0 :                     break;
     281             :                 case 0x02:  // Datum: Tag, Monat, Jahr
     282             :                     //fDate;dfDayMonthYearLong;
     283           0 :                     eType = NUMBERFORMAT_DATE;
     284           0 :                     eIndexTableOffset = NF_DATE_SYS_DDMMYYYY;
     285           0 :                     break;
     286             :                 case 0x03:  // Datum: Tag, Monat
     287             :                     //fDate;dfDayMonthLong;
     288           0 :                     eType = NUMBERFORMAT_DATE;
     289           0 :                     aFormString = pFormTable->GetKeyword( eLanguage, NF_KEY_DD);
     290           0 :                     aFormString += pFormTable->GetDateSep();    // matches last eLanguage
     291           0 :                     aFormString += pFormTable->GetKeyword( eLanguage, NF_KEY_MMMM);
     292           0 :                     break;
     293             :                 case 0x04:  // Datum: Monat, Jahr
     294             :                     //fDate;dfMonthYearLong;
     295           0 :                     eType = NUMBERFORMAT_DATE;
     296           0 :                     aFormString = pFormTable->GetKeyword( eLanguage, NF_KEY_MM);
     297           0 :                     aFormString += pFormTable->GetDateSep();    // matches last eLanguage
     298           0 :                     aFormString += pFormTable->GetKeyword( eLanguage, NF_KEY_YYYY);
     299           0 :                     break;
     300             :                 case 0x05:  // Textformate
     301             :                     //fString;nSt;
     302           0 :                     eType = NUMBERFORMAT_TEXT;
     303           0 :                     eIndexTableOffset = NF_TEXT;
     304           0 :                     break;
     305             :                 case 0x06:  // versteckt
     306             :                     //wFlag |= paHideAll;bSetFormat = sal_False;
     307           0 :                     eType = NUMBERFORMAT_NUMBER;
     308           0 :                     aFormString = "\"\"";
     309           0 :                     break;
     310             :                 case 0x07:  // Time: hour, min, sec
     311             :                     //fTime;tfHourMinSec24;
     312           0 :                     eType = NUMBERFORMAT_TIME;
     313           0 :                     eIndexTableOffset = NF_TIME_HHMMSS;
     314           0 :                     break;
     315             :                 case 0x08:  // Time: hour, min
     316             :                     //fTime;tfHourMin24;
     317           0 :                     eType = NUMBERFORMAT_TIME;
     318           0 :                     eIndexTableOffset = NF_TIME_HHMM;
     319           0 :                     break;
     320             :                 case 0x09:  // Date, intern sal_Int32 1
     321             :                     //fDate;dfDayMonthYearLong;
     322           0 :                     eType = NUMBERFORMAT_DATE;
     323           0 :                     eIndexTableOffset = NF_DATE_SYS_DDMMYYYY;
     324           0 :                     break;
     325             :                 case 0x0A:  // Date, intern sal_Int32 2
     326             :                     //fDate;dfDayMonthYearLong;
     327           0 :                     eType = NUMBERFORMAT_DATE;
     328           0 :                     eIndexTableOffset = NF_DATE_SYS_DDMMYYYY;
     329           0 :                     break;
     330             :                 case 0x0B:  // Time, intern sal_Int32 1
     331             :                     //fTime;tfHourMinSec24;
     332           0 :                     eType = NUMBERFORMAT_TIME;
     333           0 :                     eIndexTableOffset = NF_TIME_HHMMSS;
     334           0 :                     break;
     335             :                 case 0x0C:  // Time, intern sal_Int32 2
     336             :                     //fTime;tfHourMinSec24;
     337           0 :                     eType = NUMBERFORMAT_TIME;
     338           0 :                     eIndexTableOffset = NF_TIME_HHMMSS;
     339           0 :                     break;
     340             :                 case 0x0F:  // Standardeinstellung
     341             :                     //fStandard;nSt;
     342           0 :                     bDefault = sal_True;
     343           0 :                     break;
     344             :                 default:
     345             :                     //fStandard;nSt;
     346           0 :                     bDefault = sal_True;
     347           0 :                     break;
     348             :             }
     349           0 :             break;
     350             :         default:
     351             :             //fStandard;nL;
     352             :             nIndex1 = pFormTable->GetStandardFormat(
     353           0 :                 NUMBERFORMAT_NUMBER, eLanguage );
     354             :             aFormString = pFormTable->GenerateFormat(nIndex1,
     355           0 :                 eLanguage, false, false, nL, 1);
     356           0 :             nIndex1 = 0;
     357           0 :             break;
     358             :     }
     359             : 
     360             :     // Format in Table schieben
     361           0 :     if( bDefault )
     362           0 :         nHandle = 0;
     363           0 :     else if (eIndexTableOffset != NF_NUMERIC_START)
     364           0 :         nHandle = pFormTable->GetFormatIndex( eIndexTableOffset, eLanguage);
     365             :     else
     366             :     {
     367             :         sal_Int32  nDummy;
     368           0 :         pFormTable->PutEntry( aFormString, nDummy, eType, nHandle, eLanguage );
     369             :     }
     370             : 
     371           0 :     return new SfxUInt32Item( ATTR_VALUE_FORMAT, ( sal_uInt32 ) nHandle );
     372             : }
     373             : 
     374             : 
     375             : 
     376             : 
     377           0 : void LotusRange::MakeHash( void )
     378             : {
     379             :     // 33222222222211111111110000000000
     380             :     // 10987654321098765432109876543210
     381             :     //                         ******** nColS
     382             :     //                   ********       nColE
     383             :     //     ****************             nRowS
     384             :     // ****************                 nRowE
     385           0 :     nHash =  static_cast<sal_uInt32>(nColStart);
     386           0 :     nHash += static_cast<sal_uInt32>(nColEnd) << 6;
     387           0 :     nHash += static_cast<sal_uInt32>(nRowStart) << 12;
     388           0 :     nHash += static_cast<sal_uInt32>(nRowEnd ) << 16;
     389           0 : }
     390             : 
     391             : 
     392           0 : LotusRange::LotusRange( SCCOL nCol, SCROW nRow )
     393             : {
     394           0 :     nColStart = nColEnd = nCol;
     395           0 :     nRowStart = nRowEnd = nRow;
     396           0 :     nId = ID_FAIL;
     397           0 :     MakeHash();
     398           0 : }
     399             : 
     400             : 
     401           0 : LotusRange::LotusRange( SCCOL nCS, SCROW nRS, SCCOL nCE, SCROW nRE )
     402             : {
     403           0 :     nColStart = nCS;
     404           0 :     nColEnd = nCE;
     405           0 :     nRowStart = nRS;
     406           0 :     nRowEnd = nRE;
     407           0 :     nId = ID_FAIL;
     408           0 :     MakeHash();
     409           0 : }
     410             : 
     411             : 
     412           0 : LotusRange::LotusRange( const LotusRange& rCpy )
     413             : {
     414           0 :     Copy( rCpy );
     415           0 : }
     416             : 
     417             : 
     418             : 
     419             : 
     420             : 
     421           1 : LotusRangeList::LotusRangeList( void )
     422             : {
     423           1 :     aComplRef.InitFlags();
     424             : 
     425             :     ScSingleRefData*    pSingRef;
     426           1 :     nIdCnt = 1;
     427             : 
     428           1 :     pSingRef = &aComplRef.Ref1;
     429           1 :     pSingRef->nTab = pSingRef->nRelTab = 0;
     430           1 :     pSingRef->SetColRel( false );
     431           1 :     pSingRef->SetRowRel( false );
     432           1 :     pSingRef->SetTabRel( sal_True );
     433           1 :     pSingRef->SetFlag3D( false );
     434             : 
     435           1 :     pSingRef = &aComplRef.Ref2;
     436           1 :     pSingRef->nTab = pSingRef->nRelTab = 0;
     437           1 :     pSingRef->SetColRel( false );
     438           1 :     pSingRef->SetRowRel( false );
     439           1 :     pSingRef->SetTabRel( sal_True );
     440           1 :     pSingRef->SetFlag3D( false );
     441           1 : }
     442             : 
     443           2 : LotusRangeList::~LotusRangeList ()
     444             : {
     445           1 :     std::vector<LotusRange*>::iterator pIter;
     446           1 :     for (pIter = maRanges.begin(); pIter != maRanges.end(); ++pIter)
     447           0 :         delete (*pIter);
     448           1 : }
     449             : 
     450           0 : LR_ID LotusRangeList::GetIndex( const LotusRange &rRef )
     451             : {
     452           0 :     std::vector<LotusRange*>::iterator pIter;
     453           0 :     for (pIter = maRanges.begin(); pIter != maRanges.end(); ++pIter)
     454             :     {
     455           0 :         if (rRef == *(*pIter))
     456           0 :             return (*pIter)->nId;
     457             :     }
     458             : 
     459           0 :     return ID_FAIL;
     460             : }
     461             : 
     462             : 
     463           0 : void LotusRangeList::Append( LotusRange* pLR, const String& rName )
     464             : {
     465             :     OSL_ENSURE( pLR, "*LotusRangeList::Append(): das wird nichts!" );
     466           0 :     maRanges.push_back(pLR);
     467             : 
     468           0 :     ScTokenArray    aTokArray;
     469             : 
     470           0 :     ScSingleRefData*    pSingRef = &aComplRef.Ref1;
     471             : 
     472           0 :     pSingRef->nCol = pLR->nColStart;
     473           0 :     pSingRef->nRow = pLR->nRowStart;
     474             : 
     475           0 :     if( pLR->IsSingle() )
     476           0 :         aTokArray.AddSingleReference( *pSingRef );
     477             :     else
     478             :     {
     479           0 :         pSingRef = &aComplRef.Ref2;
     480           0 :         pSingRef->nCol = pLR->nColEnd;
     481           0 :         pSingRef->nRow = pLR->nRowEnd;
     482           0 :         aTokArray.AddDoubleReference( aComplRef );
     483             :     }
     484             : 
     485             :     ScRangeData*    pData = new ScRangeData(
     486           0 :         pLotusRoot->pDoc, rName, aTokArray );
     487             : 
     488           0 :     pLotusRoot->pScRangeName->insert( pData );
     489             : 
     490           0 :     pLR->SetId( nIdCnt );
     491             : 
     492           0 :     nIdCnt++;
     493           0 : }
     494             : 
     495             : 
     496             : 
     497             : 
     498           1 : RangeNameBufferWK3::RangeNameBufferWK3( void )
     499             : {
     500           1 :     pScTokenArray = new ScTokenArray;
     501           1 :     nIntCount = 1;
     502           1 : }
     503             : 
     504             : 
     505           3 : RangeNameBufferWK3::~RangeNameBufferWK3()
     506             : {
     507           1 :     delete pScTokenArray;
     508           2 : }
     509             : 
     510             : 
     511           0 : void RangeNameBufferWK3::Add( const String& rOrgName, const ScComplexRefData& rCRD )
     512             : {
     513           0 :     String              aScName( rOrgName );
     514           0 :     ScfTools::ConvertToScDefinedName( aScName );
     515             : 
     516           0 :     Entry aInsert( rOrgName, aScName, rCRD );
     517             : 
     518           0 :     pScTokenArray->Clear();
     519             : 
     520           0 :     register const ScSingleRefData& rRef1 = rCRD.Ref1;
     521           0 :     register const ScSingleRefData& rRef2 = rCRD.Ref2;
     522             : 
     523           0 :     if( rRef1.nCol == rRef2.nCol && rRef1.nRow == rRef2.nRow && rRef1.nTab == rRef2.nTab )
     524             :     {
     525           0 :         pScTokenArray->AddSingleReference( rCRD.Ref1 );
     526           0 :         aInsert.bSingleRef = sal_True;
     527             :     }
     528             :     else
     529             :     {
     530           0 :         pScTokenArray->AddDoubleReference( rCRD );
     531           0 :         aInsert.bSingleRef = false;
     532             :     }
     533             : 
     534           0 :     ScRangeData*        pData = new ScRangeData( pLotusRoot->pDoc, aScName, *pScTokenArray );
     535             : 
     536           0 :     aInsert.nRelInd = nIntCount;
     537           0 :     pData->SetIndex( nIntCount );
     538           0 :     nIntCount++;
     539             : 
     540           0 :     maEntries.push_back( aInsert );
     541           0 :     pLotusRoot->pScRangeName->insert( pData );
     542           0 : }
     543             : 
     544             : 
     545           0 : sal_Bool RangeNameBufferWK3::FindRel( const String& rRef, sal_uInt16& rIndex )
     546             : {
     547           0 :     StringHashEntry     aRef( rRef );
     548             : 
     549           0 :     std::vector<Entry>::const_iterator itr;
     550           0 :     for ( itr = maEntries.begin(); itr != maEntries.end(); ++itr )
     551             :     {
     552           0 :         if ( aRef == itr->aStrHashEntry )
     553             :         {
     554           0 :             rIndex = itr->nRelInd;
     555           0 :             return true;
     556             :         }
     557             :     }
     558             : 
     559           0 :     return false;
     560             : }
     561             : 
     562             : 
     563           0 : sal_Bool RangeNameBufferWK3::FindAbs( const String& rRef, sal_uInt16& rIndex )
     564             : {
     565           0 :     String              aTmp( rRef );
     566           0 :     StringHashEntry     aRef( aTmp.Erase( 0, 1 ) ); // ohne '$' suchen!
     567             : 
     568           0 :     std::vector<Entry>::iterator itr;
     569           0 :     for ( itr = maEntries.begin(); itr != maEntries.end(); ++itr )
     570             :     {
     571           0 :         if ( aRef == itr->aStrHashEntry )
     572             :         {
     573             :             // eventuell neuen Range Name aufbauen
     574           0 :             if( itr->nAbsInd )
     575           0 :                 rIndex = itr->nAbsInd;
     576             :             else
     577             :             {
     578           0 :                 ScSingleRefData*        pRef = &itr->aScComplexRefDataRel.Ref1;
     579           0 :                 pScTokenArray->Clear();
     580             : 
     581           0 :                 pRef->SetColRel( false );
     582           0 :                 pRef->SetRowRel( false );
     583           0 :                 pRef->SetTabRel( sal_True );
     584             : 
     585           0 :                 if( itr->bSingleRef )
     586           0 :                     pScTokenArray->AddSingleReference( *pRef );
     587             :                 else
     588             :                 {
     589           0 :                     pRef = &itr->aScComplexRefDataRel.Ref2;
     590           0 :                     pRef->SetColRel( false );
     591           0 :                     pRef->SetRowRel( false );
     592           0 :                     pRef->SetTabRel( sal_True );
     593           0 :                     pScTokenArray->AddDoubleReference( itr->aScComplexRefDataRel );
     594             :                 }
     595             : 
     596           0 :                 ScRangeData*    pData = new ScRangeData( pLotusRoot->pDoc, itr->aScAbsName, *pScTokenArray );
     597             : 
     598           0 :                 rIndex = itr->nAbsInd = nIntCount;
     599           0 :                 pData->SetIndex( rIndex );
     600           0 :                 nIntCount++;
     601             : 
     602           0 :                 pLotusRoot->pScRangeName->insert( pData );
     603             :             }
     604             : 
     605           0 :             return true;
     606             :         }
     607             :     }
     608             : 
     609           0 :     return false;
     610             : }
     611             : 
     612             : 
     613             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10