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

Generated by: LCOV version 1.10