2015-12-25 06:10:02 +08:00
|
|
|
// Copyright (c) 2014-2016 Thomas Fussell
|
2015-12-25 04:51:11 +08:00
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
// of this software and associated documentation files (the "Software"), to deal
|
|
|
|
// in the Software without restriction, including without limitation the rights
|
|
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
// copies of the Software, and to permit persons to whom the Software is
|
|
|
|
// furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
|
|
|
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
// THE SOFTWARE
|
|
|
|
//
|
|
|
|
// @license: http://www.opensource.org/licenses/mit-license.php
|
|
|
|
// @author: see AUTHORS file
|
2014-05-30 08:52:14 +08:00
|
|
|
#include <string>
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <vector>
|
|
|
|
|
2015-11-01 22:43:01 +08:00
|
|
|
#include <xlnt/worksheet/column_properties.hpp>
|
|
|
|
#include <xlnt/worksheet/row_properties.hpp>
|
|
|
|
|
2014-06-06 04:19:31 +08:00
|
|
|
#include "cell_impl.hpp"
|
2014-05-30 08:52:14 +08:00
|
|
|
|
2014-05-31 06:42:25 +08:00
|
|
|
namespace xlnt {
|
|
|
|
|
2014-05-30 08:52:14 +08:00
|
|
|
class workbook;
|
|
|
|
|
2014-05-31 06:42:25 +08:00
|
|
|
namespace detail {
|
|
|
|
|
2014-05-30 08:52:14 +08:00
|
|
|
struct worksheet_impl
|
|
|
|
{
|
2015-11-11 07:58:54 +08:00
|
|
|
worksheet_impl(workbook *parent_workbook, const std::string &title)
|
2016-03-08 15:45:35 +08:00
|
|
|
: parent_(parent_workbook), title_(title), comment_count_(0)
|
2014-05-30 08:52:14 +08:00
|
|
|
{
|
2014-06-10 12:29:49 +08:00
|
|
|
page_margins_.set_left(0.75);
|
|
|
|
page_margins_.set_right(0.75);
|
|
|
|
page_margins_.set_top(1);
|
|
|
|
page_margins_.set_bottom(1);
|
|
|
|
page_margins_.set_header(0.5);
|
|
|
|
page_margins_.set_footer(0.5);
|
2014-05-30 08:52:14 +08:00
|
|
|
}
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2014-05-30 08:52:14 +08:00
|
|
|
worksheet_impl(const worksheet_impl &other)
|
|
|
|
{
|
|
|
|
*this = other;
|
|
|
|
}
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2014-05-30 08:52:14 +08:00
|
|
|
void operator=(const worksheet_impl &other)
|
|
|
|
{
|
|
|
|
parent_ = other.parent_;
|
2015-10-29 03:08:54 +08:00
|
|
|
column_properties_ = other.column_properties_;
|
|
|
|
row_properties_ = other.row_properties_;
|
2014-05-30 08:52:14 +08:00
|
|
|
title_ = other.title_;
|
|
|
|
cell_map_ = other.cell_map_;
|
2015-11-01 22:43:01 +08:00
|
|
|
for (auto &row : cell_map_)
|
2014-06-14 03:05:24 +08:00
|
|
|
{
|
2015-11-01 22:43:01 +08:00
|
|
|
for (auto &cell : row.second)
|
2014-06-14 03:05:24 +08:00
|
|
|
{
|
|
|
|
cell.second.parent_ = this;
|
|
|
|
}
|
|
|
|
}
|
2014-05-30 08:52:14 +08:00
|
|
|
relationships_ = other.relationships_;
|
|
|
|
page_setup_ = other.page_setup_;
|
|
|
|
auto_filter_ = other.auto_filter_;
|
|
|
|
page_margins_ = other.page_margins_;
|
|
|
|
merged_cells_ = other.merged_cells_;
|
|
|
|
named_ranges_ = other.named_ranges_;
|
2014-07-21 21:34:57 +08:00
|
|
|
comment_count_ = other.comment_count_;
|
|
|
|
header_footer_ = other.header_footer_;
|
2016-03-08 15:45:35 +08:00
|
|
|
print_title_cols_ = other.print_title_cols_;
|
|
|
|
print_title_rows_ = other.print_title_rows_;
|
|
|
|
print_area_ = other.print_area_;
|
|
|
|
view_ = other.view_;
|
2014-05-30 08:52:14 +08:00
|
|
|
}
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2014-05-30 08:52:14 +08:00
|
|
|
workbook *parent_;
|
2015-10-29 03:08:54 +08:00
|
|
|
std::unordered_map<column_t, column_properties> column_properties_;
|
2014-06-05 06:42:17 +08:00
|
|
|
std::unordered_map<row_t, row_properties> row_properties_;
|
2015-11-11 07:58:54 +08:00
|
|
|
std::string title_;
|
2014-07-21 21:34:57 +08:00
|
|
|
std::unordered_map<row_t, std::unordered_map<column_t, cell_impl>> cell_map_;
|
2014-05-30 08:52:14 +08:00
|
|
|
std::vector<relationship> relationships_;
|
|
|
|
page_setup page_setup_;
|
|
|
|
range_reference auto_filter_;
|
2015-11-20 11:54:54 +08:00
|
|
|
page_margins page_margins_;
|
2014-05-30 08:52:14 +08:00
|
|
|
std::vector<range_reference> merged_cells_;
|
2015-11-11 07:58:54 +08:00
|
|
|
std::unordered_map<std::string, named_range> named_ranges_;
|
2014-07-21 21:34:57 +08:00
|
|
|
std::size_t comment_count_;
|
2014-07-20 04:59:05 +08:00
|
|
|
header_footer header_footer_;
|
2016-03-08 15:45:35 +08:00
|
|
|
std::string print_title_cols_;
|
|
|
|
std::string print_title_rows_;
|
|
|
|
range_reference print_area_;
|
|
|
|
sheet_view view_;
|
2014-05-30 08:52:14 +08:00
|
|
|
};
|
|
|
|
|
2014-05-31 06:42:25 +08:00
|
|
|
} // namespace detail
|
|
|
|
} // namespace xlnt
|