LCOV - code coverage report
Current view: top level - sc/inc - mtvelements.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 10 10 100.0 %
Date: 2015-06-13 12:38:46 Functions: 53 75 70.7 %
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             : #ifndef INCLUDED_SC_INC_MTVELEMENTS_HXX
      11             : #define INCLUDED_SC_INC_MTVELEMENTS_HXX
      12             : 
      13             : #include "address.hxx"
      14             : #include "formulacell.hxx"
      15             : #include <svl/broadcast.hxx>
      16             : #include <svl/sharedstring.hxx>
      17             : #include <editeng/editobj.hxx>
      18             : #include "calcmacros.hxx"
      19             : #include "postit.hxx"
      20             : #include <celltextattr.hxx>
      21             : #include <osl/mutex.hxx>
      22             : 
      23             : #if DEBUG_COLUMN_STORAGE
      24             : #ifdef NDEBUG
      25             : #undef NDEBUG
      26             : #endif
      27             : #define MDDS_MULTI_TYPE_VECTOR_DEBUG 1
      28             : #endif
      29             : 
      30             : #include <mdds/multi_type_vector_macro.hpp>
      31             : #include <mdds/multi_type_vector.hpp>
      32             : #include <mdds/multi_type_vector_custom_func1.hpp>
      33             : #include <mdds/multi_type_vector_custom_func3.hpp>
      34             : 
      35             : #include <unordered_map>
      36             : 
      37             : class ScDocument;
      38             : struct ScRefCellValue;
      39             : 
      40             : namespace sc {
      41             : 
      42             : /// Custom element type IDs for multi_type_vector.
      43             : 
      44             : const mdds::mtv::element_t element_type_broadcaster = mdds::mtv::element_type_user_start;
      45             : const mdds::mtv::element_t element_type_celltextattr = mdds::mtv::element_type_user_start + 1;
      46             : 
      47             : const mdds::mtv::element_t element_type_string = mdds::mtv::element_type_user_start + 2;
      48             : const mdds::mtv::element_t element_type_edittext = mdds::mtv::element_type_user_start + 3;
      49             : const mdds::mtv::element_t element_type_formula = mdds::mtv::element_type_user_start + 4;
      50             : 
      51             : const mdds::mtv::element_t element_type_cellnote = mdds::mtv::element_type_user_start + 5;
      52             : 
      53             : /// Mapped standard element types (for convenience).
      54             : const mdds::mtv::element_t element_type_numeric = mdds::mtv::element_type_numeric;
      55             : const mdds::mtv::element_t element_type_empty = mdds::mtv::element_type_empty;
      56             : 
      57             : /// Custom element blocks.
      58             : 
      59             : typedef mdds::mtv::noncopyable_managed_element_block<element_type_cellnote, ScPostIt> cellnote_block;
      60             : typedef mdds::mtv::noncopyable_managed_element_block<element_type_broadcaster, SvtBroadcaster> broadcaster_block;
      61             : typedef mdds::mtv::default_element_block<element_type_celltextattr, CellTextAttr> celltextattr_block;
      62             : typedef mdds::mtv::default_element_block<element_type_string, svl::SharedString> string_block;
      63             : typedef mdds::mtv::noncopyable_managed_element_block<element_type_edittext, EditTextObject> edittext_block;
      64             : typedef mdds::mtv::noncopyable_managed_element_block<element_type_formula, ScFormulaCell> formula_block;
      65             : 
      66             : /// Mapped standard element blocks (for convenience).
      67             : typedef mdds::mtv::numeric_element_block numeric_block;
      68             : 
      69             : /// This needs to be in the same namespace as CellTextAttr.
      70      155717 : MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(CellTextAttr, element_type_celltextattr, CellTextAttr(), celltextattr_block)
      71             : }
      72             : 
      73             : /// These need to be in global namespace just like their respective types are.
      74      207458 : MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(ScPostIt, sc::element_type_cellnote, NULL, sc::cellnote_block)
      75       81533 : MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(SvtBroadcaster, sc::element_type_broadcaster, NULL, sc::broadcaster_block)
      76       26764 : MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(ScFormulaCell, sc::element_type_formula, NULL, sc::formula_block)
      77        1689 : MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(EditTextObject, sc::element_type_edittext, NULL, sc::edittext_block)
      78             : 
      79             : namespace svl {
      80             : 
      81      256803 : MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(SharedString, sc::element_type_string, SharedString(), sc::string_block)
      82             : 
      83             : }
      84             : 
      85             : namespace sc {
      86             : 
      87             : /// Cell note container
      88             : typedef mdds::mtv::custom_block_func1<sc::cellnote_block> CNoteFunc;
      89             : typedef mdds::multi_type_vector<CNoteFunc> CellNoteStoreType;
      90             : 
      91             : /// Broadcaster storage container
      92             : typedef mdds::mtv::custom_block_func1<sc::broadcaster_block> BCBlkFunc;
      93             : typedef mdds::multi_type_vector<BCBlkFunc> BroadcasterStoreType;
      94             : 
      95             : /// Cell text attribute container.
      96             : typedef mdds::mtv::custom_block_func1<sc::celltextattr_block> CTAttrFunc;
      97             : typedef mdds::multi_type_vector<CTAttrFunc> CellTextAttrStoreType;
      98             : 
      99             : /// Cell container
     100             : typedef mdds::mtv::custom_block_func3<sc::string_block, sc::edittext_block, sc::formula_block> CellFunc;
     101             : typedef mdds::multi_type_vector<CellFunc> CellStoreType;
     102             : 
     103             : /**
     104             :  * Store position data for column array storage.
     105             :  */
     106      779076 : struct ColumnBlockPosition
     107             : {
     108             :     CellNoteStoreType::iterator miCellNotePos;
     109             :     BroadcasterStoreType::iterator miBroadcasterPos;
     110             :     CellTextAttrStoreType::iterator miCellTextAttrPos;
     111             :     CellStoreType::iterator miCellPos;
     112             : 
     113      440894 :     ColumnBlockPosition(): miCellPos() {}
     114             : };
     115             : 
     116             : struct ColumnBlockConstPosition
     117             : {
     118             :     CellNoteStoreType::const_iterator miCellNotePos;
     119             :     BroadcasterStoreType::const_iterator miBroadcasterPos;
     120             :     CellTextAttrStoreType::const_iterator miCellTextAttrPos;
     121             :     CellStoreType::const_iterator miCellPos;
     122             : 
     123        1226 :     ColumnBlockConstPosition(): miCellPos() {}
     124             : };
     125             : 
     126        5878 : class ColumnBlockPositionSet
     127             : {
     128             :     typedef std::unordered_map<SCCOL, ColumnBlockPosition> ColumnsType;
     129             :     typedef std::unordered_map<SCTAB, ColumnsType> TablesType;
     130             : 
     131             :     ScDocument& mrDoc;
     132             :     TablesType maTables;
     133             :     osl::Mutex maMtxTables;
     134             : 
     135             : public:
     136             :     ColumnBlockPositionSet(ScDocument& rDoc);
     137             : 
     138             :     ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
     139             : 
     140             :     void clear();
     141             : };
     142             : 
     143             : ScRefCellValue toRefCell( const sc::CellStoreType::const_iterator& itPos, size_t nOffset );
     144             : 
     145             : }
     146             : 
     147             : #endif
     148             : 
     149             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11