fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / core / data / columnset.cxx
blob84935e515e435081fc594f5ef37d1dfffccf80a2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #include "columnset.hxx"
11 #include <algorithm>
13 namespace sc {
15 void ColumnSet::set(SCTAB nTab, SCCOL nCol)
17 TabsType::iterator itTab = maTabs.find(nTab);
18 if (itTab == maTabs.end())
20 std::pair<TabsType::iterator,bool> r =
21 maTabs.insert(TabsType::value_type(nTab, ColsType()));
23 if (!r.second)
24 // insertion failed.
25 return;
27 itTab = r.first;
30 ColsType& rCols = itTab->second;
31 rCols.insert(nCol);
34 void ColumnSet::getColumns(SCTAB nTab, std::vector<SCCOL>& rCols) const
36 std::vector<SCCOL> aCols;
37 TabsType::const_iterator itTab = maTabs.find(nTab);
38 if (itTab == maTabs.end())
40 rCols.swap(aCols); // empty it.
41 return;
44 const ColsType& rTabCols = itTab->second;
45 aCols.assign(rTabCols.begin(), rTabCols.end());
47 // Sort and remove duplicates.
48 std::sort(aCols.begin(), aCols.end());
49 std::vector<SCCOL>::iterator itCol = std::unique(aCols.begin(), aCols.end());
50 aCols.erase(itCol, aCols.end());
52 rCols.swap(aCols);
57 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */