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 : #include "mtvelements.hxx"
11 : #include "globalnames.hxx"
12 : #include "document.hxx"
13 :
14 : namespace sc {
15 :
16 81340 : CellTextAttr::CellTextAttr() :
17 : mnTextWidth(TEXTWIDTH_DIRTY),
18 81340 : mnScriptType(SC_SCRIPTTYPE_UNKNOWN) {}
19 :
20 136926 : CellTextAttr::CellTextAttr(const CellTextAttr& r) :
21 : mnTextWidth(r.mnTextWidth),
22 136926 : mnScriptType(r.mnScriptType) {}
23 :
24 0 : CellTextAttr::CellTextAttr(sal_uInt16 nTextWidth, sal_uInt8 nScriptType) :
25 : mnTextWidth(nTextWidth),
26 0 : mnScriptType(nScriptType) {}
27 :
28 160046 : ColumnBlockPosition& ColumnBlockPosition::operator= (const ColumnBlockPosition& r)
29 : {
30 160046 : miBroadcasterPos = r.miBroadcasterPos;
31 160046 : miCellTextAttrPos = r.miCellTextAttrPos;
32 160046 : miCellPos = r.miCellPos;
33 160046 : return *this;
34 : }
35 :
36 0 : ColumnBlockConstPosition& ColumnBlockConstPosition::operator= (const ColumnBlockConstPosition& r)
37 : {
38 0 : miBroadcasterPos = r.miBroadcasterPos;
39 0 : miCellTextAttrPos = r.miCellTextAttrPos;
40 0 : miCellPos = r.miCellPos;
41 0 : return *this;
42 : }
43 :
44 1047 : ColumnBlockPositionSet::ColumnBlockPositionSet(ScDocument& rDoc) : mrDoc(rDoc) {}
45 :
46 80118 : ColumnBlockPosition* ColumnBlockPositionSet::getBlockPosition(SCTAB nTab, SCCOL nCol)
47 : {
48 80118 : TablesType::iterator itTab = maTables.find(nTab);
49 80118 : if (itTab == maTables.end())
50 : {
51 : std::pair<TablesType::iterator,bool> r =
52 379 : maTables.insert(TablesType::value_type(nTab, ColumnsType()));
53 379 : if (!r.second)
54 : // insertion failed.
55 0 : return NULL;
56 :
57 379 : itTab = r.first;
58 : }
59 :
60 80118 : ColumnsType& rCols = itTab->second;
61 :
62 80118 : ColumnsType::iterator it = rCols.find(nCol);
63 80118 : if (it != rCols.end())
64 : // Block position for this column has already been fetched.
65 37 : return &it->second;
66 :
67 : std::pair<ColumnsType::iterator,bool> r =
68 : rCols.insert(
69 80081 : ColumnsType::value_type(nCol, ColumnBlockPosition()));
70 :
71 80081 : if (!r.second)
72 : // insertion failed.
73 0 : return NULL;
74 :
75 80081 : it = r.first;
76 :
77 80081 : if (!mrDoc.InitColumnBlockPosition(it->second, nTab, nCol))
78 0 : return NULL;
79 :
80 80081 : return &it->second;
81 : }
82 :
83 : }
84 :
85 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|