update credits
[LibreOffice.git] / sc / inc / mtvelements.hxx
blob162838115da9086e04ce09af9e73b49458c9921d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #ifndef SC_MTVELEMENTS_HXX
11 #define SC_MTVELEMENTS_HXX
13 #include "address.hxx"
14 #include "svl/broadcast.hxx"
16 #define DEBUG_COLUMN_STORAGE 0
18 #if DEBUG_COLUMN_STORAGE
19 #ifdef NDEBUG
20 #undef NDEBUG
21 #endif
22 #define MDDS_MULTI_TYPE_VECTOR_DEBUG 1
23 #endif
25 #include <mdds/multi_type_vector_macro.hpp>
26 #include <mdds/multi_type_vector.hpp>
27 #include <mdds/multi_type_vector_custom_func1.hpp>
29 #include <boost/unordered_map.hpp>
31 class ScDocument;
33 namespace sc {
35 struct CellTextAttr
37 sal_uInt16 mnTextWidth;
38 sal_uInt8 mnScriptType;
40 CellTextAttr();
41 CellTextAttr(const CellTextAttr& r);
42 CellTextAttr(sal_uInt16 nTextWidth, sal_uInt8 nScriptType);
45 // Custom element type IDs for multi_type_vector.
47 const mdds::mtv::element_t element_type_broadcaster = mdds::mtv::element_type_user_start;
48 const mdds::mtv::element_t element_type_celltextattr = mdds::mtv::element_type_user_start + 1;
50 // Custom element blocks.
52 typedef mdds::mtv::noncopyable_managed_element_block<element_type_broadcaster, SvtBroadcaster> custom_broadcaster_block;
53 typedef mdds::mtv::default_element_block<element_type_celltextattr, CellTextAttr> custom_celltextattr_block;
55 // This needs to be in the same namespace as CellTextAttr.
56 MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(CellTextAttr, element_type_celltextattr, CellTextAttr(), custom_celltextattr_block)
60 // This needs to be in global namespace just like SvtBroacaster is.
61 MDDS_MTV_DEFINE_ELEMENT_CALLBACKS_PTR(SvtBroadcaster, sc::element_type_broadcaster, NULL, sc::custom_broadcaster_block)
63 namespace sc {
65 // Broadcaster storage container
66 typedef mdds::mtv::custom_block_func1<sc::element_type_broadcaster, sc::custom_broadcaster_block> BCBlkFunc;
67 typedef mdds::multi_type_vector<BCBlkFunc> BroadcasterStoreType;
69 // Cell text attribute container.
70 typedef mdds::mtv::custom_block_func1<sc::element_type_celltextattr, sc::custom_celltextattr_block> CTAttrFunc;
71 typedef mdds::multi_type_vector<CTAttrFunc> CellTextAttrStoreType;
73 /**
74 * Store position data for column array storage.
76 struct ColumnBlockPosition
78 BroadcasterStoreType::iterator miBroadcasterPos;
79 CellTextAttrStoreType::iterator miCellTextAttrPos;
82 class ColumnBlockPositionSet
84 typedef boost::unordered_map<SCCOL, ColumnBlockPosition> ColumnsType;
85 typedef boost::unordered_map<SCTAB, ColumnsType> TablesType;
87 ScDocument& mrDoc;
88 TablesType maTables;
90 public:
91 ColumnBlockPositionSet(ScDocument& rDoc);
93 ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
98 #endif
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */