LCOV - code coverage report
Current view: top level - sc/source/core/data - mtvelements.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 27 35 77.1 %
Date: 2014-04-11 Functions: 5 6 83.3 %
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             : 
      10             : #include "mtvelements.hxx"
      11             : #include "globalnames.hxx"
      12             : #include "document.hxx"
      13             : #include "cellvalue.hxx"
      14             : 
      15             : namespace sc {
      16             : 
      17       61981 : CellTextAttr::CellTextAttr() :
      18             :     mnTextWidth(TEXTWIDTH_DIRTY),
      19       61981 :     mnScriptType(SC_SCRIPTTYPE_UNKNOWN) {}
      20             : 
      21      148490 : CellTextAttr::CellTextAttr(const CellTextAttr& r) :
      22             :     mnTextWidth(r.mnTextWidth),
      23      148490 :     mnScriptType(r.mnScriptType) {}
      24             : 
      25        2384 : ColumnBlockPositionSet::ColumnBlockPositionSet(ScDocument& rDoc) : mrDoc(rDoc) {}
      26             : 
      27      156687 : ColumnBlockPosition* ColumnBlockPositionSet::getBlockPosition(SCTAB nTab, SCCOL nCol)
      28             : {
      29      156687 :     osl::MutexGuard aGuard(&maMtxTables);
      30             : 
      31      156687 :     TablesType::iterator itTab = maTables.find(nTab);
      32      156687 :     if (itTab == maTables.end())
      33             :     {
      34             :         std::pair<TablesType::iterator,bool> r =
      35         953 :             maTables.insert(TablesType::value_type(nTab, ColumnsType()));
      36         953 :         if (!r.second)
      37             :             // insertion failed.
      38           0 :             return NULL;
      39             : 
      40         953 :         itTab = r.first;
      41             :     }
      42             : 
      43      156687 :     ColumnsType& rCols = itTab->second;
      44             : 
      45      156687 :     ColumnsType::iterator it = rCols.find(nCol);
      46      156687 :     if (it != rCols.end())
      47             :         // Block position for this column has already been fetched.
      48       40825 :         return &it->second;
      49             : 
      50             :     std::pair<ColumnsType::iterator,bool> r =
      51             :         rCols.insert(
      52      115862 :             ColumnsType::value_type(nCol, ColumnBlockPosition()));
      53             : 
      54      115862 :     if (!r.second)
      55             :         // insertion failed.
      56           0 :         return NULL;
      57             : 
      58      115862 :     it = r.first;
      59             : 
      60      115862 :     if (!mrDoc.InitColumnBlockPosition(it->second, nTab, nCol))
      61           0 :         return NULL;
      62             : 
      63      115862 :     return &it->second;
      64             : }
      65             : 
      66           0 : void ColumnBlockPositionSet::clear()
      67             : {
      68           0 :     osl::MutexGuard aGuard(&maMtxTables);
      69           0 :     maTables.clear();
      70           0 : }
      71             : 
      72        5692 : ScRefCellValue toRefCell( const sc::CellStoreType::const_iterator& itPos, size_t nOffset )
      73             : {
      74        5692 :     switch (itPos->type)
      75             :     {
      76             :         case sc::element_type_numeric:
      77             :             // Numeric cell
      78        3060 :             return ScRefCellValue(sc::numeric_block::at(*itPos->data, nOffset));
      79             :         case sc::element_type_string:
      80             :             // String cell
      81        1782 :             return ScRefCellValue(&sc::string_block::at(*itPos->data, nOffset));
      82             :         case sc::element_type_edittext:
      83             :             // Edit cell
      84          19 :             return ScRefCellValue(sc::edittext_block::at(*itPos->data, nOffset));
      85             :         break;
      86             :         case sc::element_type_formula:
      87             :             // Formula cell
      88         831 :             return ScRefCellValue(sc::formula_block::at(*itPos->data, nOffset));
      89             :         default:
      90             :             ;
      91             :     }
      92             : 
      93           0 :     return ScRefCellValue();
      94             : }
      95             : 
      96             : }
      97             : 
      98             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10