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 : * This file incorporates work covered by the following license notice:
10 : *
11 : */
12 :
13 :
14 : #include "cellmergeoption.hxx"
15 : #include "address.hxx"
16 :
17 0 : ScCellMergeOption::ScCellMergeOption(const ScRange& rRange) :
18 0 : mnStartCol(rRange.aStart.Col()),
19 0 : mnStartRow(rRange.aStart.Row()),
20 0 : mnEndCol(rRange.aEnd.Col()),
21 0 : mnEndRow(rRange.aEnd.Row()),
22 0 : mbCenter(false)
23 : {
24 0 : SCTAB nTab1 = rRange.aStart.Tab();
25 0 : SCTAB nTab2 = rRange.aEnd.Tab();
26 0 : for (SCTAB i = nTab1; i <= nTab2; ++i)
27 0 : maTabs.insert(i);
28 0 : }
29 :
30 12 : ScCellMergeOption::ScCellMergeOption(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, bool bCenter) :
31 : mnStartCol(nStartCol),
32 : mnStartRow(nStartRow),
33 : mnEndCol(nEndCol),
34 : mnEndRow(nEndRow),
35 12 : mbCenter(bCenter)
36 : {
37 12 : }
38 :
39 10 : ScCellMergeOption::ScCellMergeOption(const ScCellMergeOption& r) :
40 : maTabs(r.maTabs),
41 : mnStartCol(r.mnStartCol),
42 : mnStartRow(r.mnStartRow),
43 : mnEndCol(r.mnEndCol),
44 : mnEndRow(r.mnEndRow),
45 10 : mbCenter(r.mbCenter)
46 : {
47 10 : }
48 :
49 12 : ScRange ScCellMergeOption::getSingleRange(SCTAB nTab) const
50 : {
51 12 : return ScRange(mnStartCol, mnStartRow, nTab, mnEndCol, mnEndRow, nTab);
52 : }
53 :
54 6 : ScRange ScCellMergeOption::getFirstSingleRange() const
55 : {
56 6 : SCTAB nTab = 0;
57 6 : if (!maTabs.empty())
58 6 : nTab = *maTabs.begin();
59 :
60 6 : return getSingleRange(nTab);
61 : }
62 :
63 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|