1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
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
22 #define MDDS_MULTI_TYPE_VECTOR_DEBUG 1
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>
37 sal_uInt16 mnTextWidth
;
38 sal_uInt8 mnScriptType
;
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
)
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
;
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
;
91 ColumnBlockPositionSet(ScDocument
& rDoc
);
93 ColumnBlockPosition
* getBlockPosition(SCTAB nTab
, SCCOL nCol
);
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */