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

Generated by: LCOV version 1.10