LCOV - code coverage report
Current view: top level - sc/source/core/data - autonamecache.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 31 0.0 %
Date: 2014-04-14 Functions: 0 3 0.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 <unotools/transliterationwrapper.hxx>
      21             : 
      22             : #include "autonamecache.hxx"
      23             : #include "dociter.hxx"
      24             : #include "queryparam.hxx"
      25             : #include "formulacell.hxx"
      26             : #include "cellvalue.hxx"
      27             : #include "editutil.hxx"
      28             : #include "document.hxx"
      29             : 
      30           0 : ScAutoNameCache::ScAutoNameCache( ScDocument* pD ) :
      31             :     pDoc( pD ),
      32           0 :     nCurrentTab( 0 )    // doesn't matter - aNames is empty
      33             : {
      34           0 : }
      35             : 
      36           0 : ScAutoNameCache::~ScAutoNameCache()
      37             : {
      38           0 : }
      39             : 
      40           0 : const ScAutoNameAddresses& ScAutoNameCache::GetNameOccurrences( const OUString& rName, SCTAB nTab )
      41             : {
      42           0 :     if ( nTab != nCurrentTab )
      43             :     {
      44             :         // the lists are valid only for one sheet, so they are cleared when another sheet is used
      45           0 :         aNames.clear();
      46           0 :         nCurrentTab = nTab;
      47             :     }
      48             : 
      49           0 :     ScAutoNameHashMap::const_iterator aFound = aNames.find( rName );
      50           0 :     if ( aFound != aNames.end() )
      51           0 :         return aFound->second;          // already initialized
      52             : 
      53           0 :     ScAutoNameAddresses& rAddresses = aNames[rName];
      54             : 
      55           0 :     ScCellIterator aIter( pDoc, ScRange( 0, 0, nCurrentTab, MAXCOL, MAXROW, nCurrentTab ) );
      56           0 :     for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
      57             :     {
      58             :         // don't check code length here, always use the stored result
      59             :         // (AutoCalc is disabled during CompileXML)
      60           0 :         if (aIter.hasString())
      61             :         {
      62           0 :             OUString aStr;
      63           0 :             switch (aIter.getType())
      64             :             {
      65             :                 case CELLTYPE_STRING:
      66           0 :                     aStr = aIter.getString();
      67           0 :                 break;
      68             :                 case CELLTYPE_FORMULA:
      69           0 :                     aStr = aIter.getFormulaCell()->GetString().getString();
      70           0 :                 break;
      71             :                 case CELLTYPE_EDIT:
      72             :                 {
      73           0 :                     const EditTextObject* p = aIter.getEditText();
      74           0 :                     if (p)
      75           0 :                         aStr = ScEditUtil::GetMultilineString(*p); // string with line separators between paragraphs
      76             :                 }
      77           0 :                 break;
      78             :                 case CELLTYPE_NONE:
      79             :                 case CELLTYPE_VALUE:
      80             :                     ;   // nothing, prevent compiler warning
      81           0 :                 break;
      82             :             }
      83           0 :             if ( ScGlobal::GetpTransliteration()->isEqual( aStr, rName ) )
      84             :             {
      85           0 :                 rAddresses.push_back(aIter.GetPos());
      86           0 :             }
      87             :         }
      88             :     }
      89             : 
      90           0 :     return rAddresses;
      91             : }
      92             : 
      93             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10