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 #include "mtvelements.hxx"
11 #include "globalnames.hxx"
12 #include "document.hxx"
13 #include "cellvalue.hxx"
17 CellTextAttr::CellTextAttr() :
18 mnTextWidth(TEXTWIDTH_DIRTY
),
19 mnScriptType(SC_SCRIPTTYPE_UNKNOWN
) {}
21 CellTextAttr::CellTextAttr(const CellTextAttr
& r
) :
22 mnTextWidth(r
.mnTextWidth
),
23 mnScriptType(r
.mnScriptType
) {}
25 CellTextAttr::CellTextAttr(sal_uInt16 nTextWidth
, sal_uInt8 nScriptType
) :
26 mnTextWidth(nTextWidth
),
27 mnScriptType(nScriptType
) {}
29 ColumnBlockPositionSet::ColumnBlockPositionSet(ScDocument
& rDoc
) : mrDoc(rDoc
) {}
31 ColumnBlockPosition
* ColumnBlockPositionSet::getBlockPosition(SCTAB nTab
, SCCOL nCol
)
33 osl::MutexGuard
aGuard(&maMtxTables
);
35 TablesType::iterator itTab
= maTables
.find(nTab
);
36 if (itTab
== maTables
.end())
38 std::pair
<TablesType::iterator
,bool> r
=
39 maTables
.insert(TablesType::value_type(nTab
, ColumnsType()));
47 ColumnsType
& rCols
= itTab
->second
;
49 ColumnsType::iterator it
= rCols
.find(nCol
);
50 if (it
!= rCols
.end())
51 // Block position for this column has already been fetched.
54 std::pair
<ColumnsType::iterator
,bool> r
=
56 ColumnsType::value_type(nCol
, ColumnBlockPosition()));
64 if (!mrDoc
.InitColumnBlockPosition(it
->second
, nTab
, nCol
))
70 void ColumnBlockPositionSet::clear()
72 osl::MutexGuard
aGuard(&maMtxTables
);
76 ScRefCellValue
toRefCell( const sc::CellStoreType::const_iterator
& itPos
, size_t nOffset
)
80 case sc::element_type_numeric
:
82 return ScRefCellValue(sc::numeric_block::at(*itPos
->data
, nOffset
));
83 case sc::element_type_string
:
85 return ScRefCellValue(&sc::string_block::at(*itPos
->data
, nOffset
));
86 case sc::element_type_edittext
:
88 return ScRefCellValue(sc::edittext_block::at(*itPos
->data
, nOffset
));
90 case sc::element_type_formula
:
92 return ScRefCellValue(sc::formula_block::at(*itPos
->data
, nOffset
));
97 return ScRefCellValue();
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */