Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Initial Developer of the Original Code is
16 : * [ Kohei Yoshida <kyoshida@novell.com> ]
17 : * Portions created by the Initial Developer are Copyright (C) 2010 the
18 : * Initial Developer. All Rights Reserved.
19 : *
20 : * Contributor(s):
21 : *
22 : * Alternatively, the contents of this file may be used under the terms of
23 : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 : * instead of those above.
27 : */
28 :
29 :
30 : #include "cellmergeoption.hxx"
31 : #include "address.hxx"
32 :
33 0 : ScCellMergeOption::ScCellMergeOption(const ScRange& rRange) :
34 0 : mnStartCol(rRange.aStart.Col()),
35 0 : mnStartRow(rRange.aStart.Row()),
36 0 : mnEndCol(rRange.aEnd.Col()),
37 0 : mnEndRow(rRange.aEnd.Row()),
38 0 : mbCenter(false)
39 : {
40 0 : SCTAB nTab1 = rRange.aStart.Tab();
41 0 : SCTAB nTab2 = rRange.aEnd.Tab();
42 0 : for (SCTAB i = nTab1; i <= nTab2; ++i)
43 0 : maTabs.insert(i);
44 0 : }
45 :
46 2 : ScCellMergeOption::ScCellMergeOption(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, bool bCenter) :
47 : mnStartCol(nStartCol),
48 : mnStartRow(nStartRow),
49 : mnEndCol(nEndCol),
50 : mnEndRow(nEndRow),
51 2 : mbCenter(bCenter)
52 : {
53 2 : }
54 :
55 2 : ScCellMergeOption::ScCellMergeOption(const ScCellMergeOption& r) :
56 : maTabs(r.maTabs),
57 : mnStartCol(r.mnStartCol),
58 : mnStartRow(r.mnStartRow),
59 : mnEndCol(r.mnEndCol),
60 : mnEndRow(r.mnEndRow),
61 2 : mbCenter(r.mbCenter)
62 : {
63 2 : }
64 :
65 2 : ScRange ScCellMergeOption::getSingleRange(SCTAB nTab) const
66 : {
67 2 : return ScRange(mnStartCol, mnStartRow, nTab, mnEndCol, mnEndRow, nTab);
68 : }
69 :
70 1 : ScRange ScCellMergeOption::getFirstSingleRange() const
71 : {
72 1 : SCTAB nTab = 0;
73 1 : if (!maTabs.empty())
74 1 : nTab = *maTabs.begin();
75 :
76 1 : return getSingleRange(nTab);
77 : }
78 :
79 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|