summaryrefslogtreecommitdiffstats
path: root/src/spreadsheet/sheet_impl.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:48:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:48:59 +0000
commitc484829272cd13a738e35412498e12f2c9a194ac (patch)
treea1f5ec09629ee895bd3963fa8820b45f2f4c574b /src/spreadsheet/sheet_impl.cpp
parentInitial commit. (diff)
downloadliborcus-f5bf3877c7cf3538ca1337452cf57cc99b0ace0e.tar.xz
liborcus-f5bf3877c7cf3538ca1337452cf57cc99b0ace0e.zip
Adding upstream version 0.19.2.upstream/0.19.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/spreadsheet/sheet_impl.cpp')
-rw-r--r--src/spreadsheet/sheet_impl.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/spreadsheet/sheet_impl.cpp b/src/spreadsheet/sheet_impl.cpp
new file mode 100644
index 0000000..1364e25
--- /dev/null
+++ b/src/spreadsheet/sheet_impl.cpp
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "sheet_impl.hpp"
+#include "orcus/spreadsheet/document.hpp"
+
+#include <ixion/model_context.hpp>
+
+namespace orcus { namespace spreadsheet { namespace detail {
+
+sheet_impl::sheet_impl(document& _doc, sheet& /*sh*/, sheet_t sheet_index) :
+ doc(_doc),
+ col_widths(0, doc.get_sheet_size().columns, get_default_column_width()),
+ row_heights(0, doc.get_sheet_size().rows, get_default_row_height()),
+ col_width_pos(col_widths.begin()),
+ row_height_pos(row_heights.begin()),
+ col_hidden(0, doc.get_sheet_size().columns, false),
+ row_hidden(0, doc.get_sheet_size().rows, false),
+ col_hidden_pos(col_hidden.begin()),
+ row_hidden_pos(row_hidden.begin()),
+ column_formats(0, doc.get_sheet_size().columns, 0),
+ row_formats(0, doc.get_sheet_size().rows, 0),
+ sheet_id(sheet_index) {}
+
+sheet_impl::~sheet_impl() {}
+
+const detail::merge_size* sheet_impl::get_merge_size(row_t row, col_t col) const
+{
+ detail::col_merge_size_type::const_iterator it_col = merge_ranges.find(col);
+ if (it_col == merge_ranges.end())
+ return nullptr;
+
+ detail::merge_size_type& col_merge_sizes = *it_col->second;
+ detail::merge_size_type::const_iterator it_row = col_merge_sizes.find(row);
+ if (it_row == col_merge_sizes.end())
+ return nullptr;
+
+ return &it_row->second;
+}
+
+ixion::abs_range_t sheet_impl::get_data_range() const
+{
+ const ixion::model_context& cxt = doc.get_model_context();
+ return cxt.get_data_range(sheet_id);
+}
+
+}}}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */