LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sc/inc - mtvelements.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 8 8 100.0 %
Date: 2013-07-09 Functions: 38 65 58.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             : #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 "editeng/editobj.hxx"
      17             : #include "calcmacros.hxx"
      18             : 
      19             : #if DEBUG_COLUMN_STORAGE
      20             : #ifdef NDEBUG
      21             : #undef NDEBUG
      22             : #endif
      23             : #define MDDS_MULTI_TYPE_VECTOR_DEBUG 1
      24             : #endif
      25             : 
      26             : #include <mdds/multi_type_vector_macro.hpp>
      27             : #include <mdds/multi_type_vector.hpp>
      28             : #include <mdds/multi_type_vector_custom_func1.hpp>
      29             : #include <mdds/multi_type_vector_custom_func3.hpp>
      30             : 
      31             : #include <boost/unordered_map.hpp>
      32             : 
      33             : class ScDocument;
      34             : 
      35             : namespace sc {
      36             : 
      37             : struct CellTextAttr
      38             : {
      39             :     sal_uInt16 mnTextWidth;
      40             :     sal_uInt8 mnScriptType;
      41             : 
      42             :     CellTextAttr();
      43             :     CellTextAttr(const CellTextAttr& r);
      44             :     CellTextAttr(sal_uInt16 nTextWidth, sal_uInt8 nScriptType);
      45             : };
      46             : 
      47             : // Custom element type IDs for multi_type_vector.
      48             : 
      49             : const mdds::mtv::element_t element_type_broadcaster = mdds::mtv::element_type_user_start;
      50             : const mdds::mtv::element_t element_type_celltextattr = mdds::mtv::element_type_user_start + 1;
      51             : 
      52             : const mdds::mtv::element_t element_type_string = mdds::mtv::element_type_user_start + 2;
      53             : const mdds::mtv::element_t element_type_edittext = mdds::mtv::element_type_user_start + 3;
      54             : const mdds::mtv::element_t element_type_formula = mdds::mtv::element_type_user_start + 4;
      55             : 
      56             : // Mapped standard element types (for convenience).
      57             : const mdds::mtv::element_t element_type_numeric = mdds::mtv::element_type_numeric;
      58             : const mdds::mtv::element_t element_type_empty = mdds::mtv::element_type_empty;
      59             : 
      60             : // Custom element blocks.
      61             : 
      62             : typedef mdds::mtv::noncopyable_managed_element_block<element_type_broadcaster, SvtBroadcaster> broadcaster_block;
      63             : typedef mdds::mtv::default_element_block<element_type_celltextattr, CellTextAttr> celltextattr_block;
      64             : typedef mdds::mtv::default_element_block<element_type_string, rtl::OUString> string_block;
      65             : typedef mdds::mtv::noncopyable_managed_element_block<element_type_edittext, EditTextObject> edittext_block;
      66             : typedef mdds::mtv::noncopyable_managed_element_block<element_type_formula, ScFormulaCell> formula_block;
      67             : 
      68             : // Mapped standard element blocks (for convenience).
      69             : typedef mdds::mtv::numeric_element_block numeric_block;
      70             : 
      71             : // This needs to be in the same namespace as CellTextAttr.
      72      203689 : MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(CellTextAttr, element_type_celltextattr, CellTextAttr(), celltextattr_block)
      73             : 
      74             : }
      75             : 
      76             : // These need to be in global namespace just like their respective types are.
      77       43533 : MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(SvtBroadcaster, sc::element_type_broadcaster, NULL, sc::broadcaster_block)
      78       10858 : MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(ScFormulaCell, sc::element_type_formula, NULL, sc::formula_block)
      79         956 : MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(EditTextObject, sc::element_type_edittext, NULL, sc::edittext_block)
      80             : 
      81             : namespace rtl {
      82             : 
      83       45808 : MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(OUString, sc::element_type_string, OUString(), sc::string_block)
      84             : 
      85             : }
      86             : 
      87             : namespace sc {
      88             : 
      89             : // Broadcaster storage container
      90             : typedef mdds::mtv::custom_block_func1<sc::broadcaster_block> BCBlkFunc;
      91             : typedef mdds::multi_type_vector<BCBlkFunc> BroadcasterStoreType;
      92             : 
      93             : // Cell text attribute container.
      94             : typedef mdds::mtv::custom_block_func1<sc::celltextattr_block> CTAttrFunc;
      95             : typedef mdds::multi_type_vector<CTAttrFunc> CellTextAttrStoreType;
      96             : 
      97             : // Cell container
      98             : typedef mdds::mtv::custom_block_func3<sc::string_block, sc::edittext_block, sc::formula_block> CellFunc;
      99             : typedef mdds::multi_type_vector<CellFunc> CellStoreType;
     100             : 
     101             : /**
     102             :  * Store position data for column array storage.
     103             :  */
     104      324577 : struct ColumnBlockPosition
     105             : {
     106             :     BroadcasterStoreType::iterator miBroadcasterPos;
     107             :     CellTextAttrStoreType::iterator miCellTextAttrPos;
     108             :     CellStoreType::iterator miCellPos;
     109             : 
     110             :     ColumnBlockPosition& operator= (const ColumnBlockPosition& r);
     111             : };
     112             : 
     113         734 : struct ColumnBlockConstPosition
     114             : {
     115             :     BroadcasterStoreType::const_iterator miBroadcasterPos;
     116             :     CellTextAttrStoreType::const_iterator miCellTextAttrPos;
     117             :     CellStoreType::const_iterator miCellPos;
     118             : 
     119             :     ColumnBlockConstPosition& operator= (const ColumnBlockConstPosition& r);
     120             : };
     121             : 
     122        1047 : class ColumnBlockPositionSet
     123             : {
     124             :     typedef boost::unordered_map<SCCOL, ColumnBlockPosition> ColumnsType;
     125             :     typedef boost::unordered_map<SCTAB, ColumnsType> TablesType;
     126             : 
     127             :     ScDocument& mrDoc;
     128             :     TablesType maTables;
     129             : 
     130             : public:
     131             :     ColumnBlockPositionSet(ScDocument& rDoc);
     132             : 
     133             :     ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
     134             : };
     135             : 
     136             : }
     137             : 
     138             : #endif
     139             : 
     140             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
     141             : 

Generated by: LCOV version 1.10