2015-10-02 06:14:42 +08:00
|
|
|
// Copyright (c) 2015 Thomas Fussell
|
|
|
|
// Copyright (c) 2010-2015 openpyxl
|
2014-06-06 04:19:31 +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-21 22:20:30 +08:00
|
|
|
#pragma once
|
|
|
|
|
2014-05-30 08:52:14 +08:00
|
|
|
#include <memory>
|
2014-05-21 22:20:30 +08:00
|
|
|
#include <unordered_map>
|
|
|
|
|
2015-11-03 21:38:09 +08:00
|
|
|
#include <xlnt/cell/types.hpp>
|
2015-11-05 07:45:03 +08:00
|
|
|
#include <xlnt/utils/string.hpp>
|
2014-05-22 05:48:51 +08:00
|
|
|
|
2015-11-08 07:37:23 +08:00
|
|
|
#include <xlnt/xlnt_config.hpp>
|
2015-11-04 13:36:14 +08:00
|
|
|
|
2014-05-21 22:20:30 +08:00
|
|
|
namespace xlnt {
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-19 03:30:46 +08:00
|
|
|
enum class calendar;
|
2015-10-30 01:46:56 +08:00
|
|
|
|
|
|
|
class alignment;
|
|
|
|
class border;
|
2014-05-21 22:20:30 +08:00
|
|
|
class cell_reference;
|
2014-07-26 04:39:25 +08:00
|
|
|
class comment;
|
2015-10-30 01:46:56 +08:00
|
|
|
class fill;
|
|
|
|
class font;
|
|
|
|
class number_format;
|
|
|
|
class protection;
|
2014-06-11 05:12:15 +08:00
|
|
|
class relationship;
|
2014-05-21 22:20:30 +08:00
|
|
|
class worksheet;
|
2014-05-31 06:42:25 +08:00
|
|
|
|
2014-06-07 23:49:19 +08:00
|
|
|
struct date;
|
|
|
|
struct datetime;
|
|
|
|
struct time;
|
2014-07-20 04:59:05 +08:00
|
|
|
struct timedelta;
|
2014-06-07 23:49:19 +08:00
|
|
|
|
2015-11-04 07:26:33 +08:00
|
|
|
namespace detail { struct cell_impl; }
|
2014-07-20 02:43:48 +08:00
|
|
|
|
2014-05-21 22:20:30 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Describes cell associated properties.
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// Properties of interest include style, type, value, and address.
|
|
|
|
/// The Cell class is required to know its value and type, display options,
|
|
|
|
/// and any other features of an Excel cell.Utilities for referencing
|
|
|
|
/// cells using Excel's 'A1' column/row nomenclature are also provided.
|
|
|
|
/// </remarks>
|
2015-11-04 13:36:14 +08:00
|
|
|
class XLNT_CLASS cell
|
2014-05-21 22:20:30 +08:00
|
|
|
{
|
2015-11-04 07:26:33 +08:00
|
|
|
public:
|
2015-10-30 01:46:56 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Enumerates the possible types a cell can be determined by it's current value.
|
|
|
|
/// </summary>
|
2015-10-14 01:56:07 +08:00
|
|
|
enum class type
|
|
|
|
{
|
2015-11-04 07:26:33 +08:00
|
|
|
/// no value. note: this is different from an empty string value or 0 numeric value
|
2015-10-14 01:56:07 +08:00
|
|
|
null,
|
2015-11-04 07:26:33 +08:00
|
|
|
/// number
|
2015-10-14 01:56:07 +08:00
|
|
|
numeric,
|
2015-11-04 07:26:33 +08:00
|
|
|
/// string
|
2015-10-14 01:56:07 +08:00
|
|
|
string,
|
2015-11-04 07:26:33 +08:00
|
|
|
/// value is a formula
|
2015-10-14 01:56:07 +08:00
|
|
|
formula,
|
2015-11-04 07:26:33 +08:00
|
|
|
/// value is a known error code such as \#VALUE!
|
2015-10-14 01:56:07 +08:00
|
|
|
error,
|
2015-11-04 07:26:33 +08:00
|
|
|
/// value is TRUE or FALSE
|
2015-10-14 01:56:07 +08:00
|
|
|
boolean
|
|
|
|
};
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-30 01:46:56 +08:00
|
|
|
/// <summary>
|
2015-11-04 07:26:33 +08:00
|
|
|
/// Return a map of error strings such as \#DIV/0! and their associated indices.
|
2015-10-30 01:46:56 +08:00
|
|
|
/// </summary>
|
2015-11-05 07:45:03 +08:00
|
|
|
static const std::unordered_map<string, int> &error_codes();
|
2015-11-01 22:43:01 +08:00
|
|
|
|
|
|
|
// TODO: Should it be possible to construct and use a cell without a parent worksheet?
|
2015-10-30 01:46:56 +08:00
|
|
|
//(cont'd) If so, it would need to be responsible for allocating and deleting its PIMPL.
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-30 01:46:56 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Construct a null cell without a parent.
|
|
|
|
/// Most methods will throw an exception if this cell is not further initialized.
|
|
|
|
/// </summary>
|
2014-05-21 22:20:30 +08:00
|
|
|
cell();
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-30 01:46:56 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Construct a cell in worksheet, sheet, at the given reference location (e.g. A1).
|
|
|
|
/// </summary>
|
|
|
|
cell(worksheet sheet, const cell_reference &reference);
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-30 01:46:56 +08:00
|
|
|
/// <summary>
|
|
|
|
/// This constructor, provided for convenience, is equivalent to calling:
|
|
|
|
/// cell c(sheet, reference);
|
|
|
|
/// c.set_value(initial_value);
|
|
|
|
/// </summary>
|
2015-11-01 22:43:01 +08:00
|
|
|
template <typename T>
|
2015-10-30 01:46:56 +08:00
|
|
|
cell(worksheet sheet, const cell_reference &reference, const T &initial_value);
|
2015-10-14 01:56:07 +08:00
|
|
|
|
|
|
|
// value
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-30 01:46:56 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Return true if value has been set and has not been cleared using cell::clear_value().
|
|
|
|
/// </summary>
|
2015-10-14 01:56:07 +08:00
|
|
|
bool has_value() const;
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-11-04 07:26:33 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Return the value of this cell as an instance of type T.
|
|
|
|
/// Overloads exist for most C++ fundamental types like bool, int, etc. as well
|
2015-11-05 07:45:03 +08:00
|
|
|
/// as for string and xlnt datetime types: date, time, datetime, and timedelta.
|
2015-11-04 07:26:33 +08:00
|
|
|
/// </summary>
|
2015-11-01 22:43:01 +08:00
|
|
|
template <typename T>
|
2015-10-14 02:19:46 +08:00
|
|
|
T get_value() const;
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-11-04 07:26:33 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Make this cell have a value of type null.
|
|
|
|
/// All other cell attributes are retained.
|
|
|
|
/// </summary>
|
2015-10-14 01:56:07 +08:00
|
|
|
void clear_value();
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-11-04 07:26:33 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Set the value of this cell to the given value.
|
|
|
|
/// Overloads exist for most C++ fundamental types like bool, int, etc. as well
|
2015-11-05 07:45:03 +08:00
|
|
|
/// as for string and xlnt datetime types: date, time, datetime, and timedelta.
|
|
|
|
/// </summary>
|
2015-11-01 22:43:01 +08:00
|
|
|
template <typename T>
|
2015-10-14 01:56:07 +08:00
|
|
|
void set_value(T value);
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-11-04 07:26:33 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Return the type of this cell.
|
|
|
|
/// </summary>
|
2015-10-14 01:56:07 +08:00
|
|
|
type get_data_type() const;
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Set the type of this cell.
|
|
|
|
/// </summary>
|
2015-10-14 01:56:07 +08:00
|
|
|
void set_data_type(type t);
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-30 01:46:56 +08:00
|
|
|
// properties
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-30 01:46:56 +08:00
|
|
|
/// <summary>
|
|
|
|
/// There's no reason to keep a cell which has no value and is not a placeholder.
|
|
|
|
/// Return true if this cell has no value, style, isn't merged, etc.
|
|
|
|
/// </summary>
|
2015-10-14 01:56:07 +08:00
|
|
|
bool garbage_collectible() const;
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-30 01:46:56 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Return true iff this cell's number format matches a date format.
|
|
|
|
/// </summary>
|
2015-10-14 01:56:07 +08:00
|
|
|
bool is_date() const;
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-14 01:56:07 +08:00
|
|
|
// position
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return a cell_reference that points to the location of this cell.
|
|
|
|
/// </summary>
|
2015-10-14 01:56:07 +08:00
|
|
|
cell_reference get_reference() const;
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return the column of this cell.
|
|
|
|
/// </summary>
|
2015-11-04 03:53:48 +08:00
|
|
|
column_t get_column() const;
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return the row of this cell.
|
|
|
|
/// </summary>
|
2015-10-14 01:56:07 +08:00
|
|
|
row_t get_row() const;
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return the location of this cell as an ordered pair.
|
|
|
|
/// </summary>
|
2015-10-14 01:56:07 +08:00
|
|
|
std::pair<int, int> get_anchor() const;
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-14 01:56:07 +08:00
|
|
|
// hyperlink
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return a relationship representing this cell's hyperlink.
|
|
|
|
/// </summary>
|
2014-06-11 05:12:15 +08:00
|
|
|
relationship get_hyperlink() const;
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Add a hyperlink to this cell pointing to the URI of the given value.
|
|
|
|
/// </summary>
|
2015-11-05 07:45:03 +08:00
|
|
|
void set_hyperlink(const string &value);
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return true if this cell has a hyperlink set.
|
|
|
|
/// </summary>
|
2014-06-11 05:12:15 +08:00
|
|
|
bool has_hyperlink() const;
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-14 01:56:07 +08:00
|
|
|
// style
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return true if this cell has had a style applied to it.
|
|
|
|
/// </summary>
|
2015-10-24 02:42:36 +08:00
|
|
|
bool has_style() const;
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return the index of this cell's style in its parent workbook.
|
|
|
|
/// This is also the index of the style in the stylesheet XML, xl/styles.xml.
|
|
|
|
/// </summary>
|
2015-10-19 03:30:46 +08:00
|
|
|
std::size_t get_style_id() const;
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Set the style index of this cell. This should be an existing style in
|
|
|
|
/// the parent workbook.
|
|
|
|
/// </summary>
|
2015-10-24 02:42:36 +08:00
|
|
|
void set_style_id(std::size_t style_id);
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return the number format of this cell.
|
|
|
|
/// </summary>
|
2015-10-19 03:30:46 +08:00
|
|
|
const number_format &get_number_format() const;
|
|
|
|
void set_number_format(const number_format &format);
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return the font applied to the text in this cell.
|
|
|
|
/// </summary>
|
2015-10-14 04:35:22 +08:00
|
|
|
const font &get_font() const;
|
2015-11-04 07:26:33 +08:00
|
|
|
|
2015-10-19 03:30:46 +08:00
|
|
|
void set_font(const font &font_);
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return the fill applied to this cell.
|
|
|
|
/// </summary>
|
2015-10-14 01:56:07 +08:00
|
|
|
const fill &get_fill() const;
|
2015-11-04 07:26:33 +08:00
|
|
|
|
2015-10-19 03:30:46 +08:00
|
|
|
void set_fill(const fill &fill_);
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return the border of this cell.
|
|
|
|
/// </summary>
|
2015-10-14 04:35:22 +08:00
|
|
|
const border &get_border() const;
|
2015-11-04 07:26:33 +08:00
|
|
|
|
2015-10-19 03:30:46 +08:00
|
|
|
void set_border(const border &border_);
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return the alignment of the text in this cell.
|
|
|
|
/// </summary>
|
2015-10-14 04:35:22 +08:00
|
|
|
const alignment &get_alignment() const;
|
2015-11-04 07:26:33 +08:00
|
|
|
|
2015-10-19 03:30:46 +08:00
|
|
|
void set_alignment(const alignment &alignment_);
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return the protection of this cell.
|
|
|
|
/// </summary>
|
2015-10-14 04:35:22 +08:00
|
|
|
const protection &get_protection() const;
|
2015-11-04 07:26:33 +08:00
|
|
|
|
2015-10-19 03:30:46 +08:00
|
|
|
void set_protection(const protection &protection_);
|
2015-11-04 07:26:33 +08:00
|
|
|
|
2015-10-19 03:30:46 +08:00
|
|
|
void set_pivot_button(bool b);
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return true iff pivot button?
|
|
|
|
/// </summary>
|
2015-10-14 01:56:07 +08:00
|
|
|
bool pivot_button() const;
|
2015-11-04 07:26:33 +08:00
|
|
|
|
2015-10-19 03:30:46 +08:00
|
|
|
void set_quote_prefix(bool b);
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return true iff quote prefix?
|
|
|
|
/// </summary>
|
2015-10-14 01:56:07 +08:00
|
|
|
bool quote_prefix() const;
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-14 01:56:07 +08:00
|
|
|
// comment
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return the comment of this cell.
|
|
|
|
/// </summary>
|
2015-10-14 01:56:07 +08:00
|
|
|
comment get_comment();
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return the comment of this cell.
|
|
|
|
/// </summary>
|
|
|
|
const comment get_comment() const;
|
|
|
|
|
2014-07-27 04:19:15 +08:00
|
|
|
void set_comment(const comment &comment);
|
2014-07-20 02:43:48 +08:00
|
|
|
void clear_comment();
|
2014-07-25 05:31:46 +08:00
|
|
|
bool has_comment() const;
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-14 01:56:07 +08:00
|
|
|
// formula
|
2015-11-05 07:45:03 +08:00
|
|
|
string get_formula() const;
|
|
|
|
void set_formula(const string &formula);
|
2014-07-25 05:31:46 +08:00
|
|
|
void clear_formula();
|
|
|
|
bool has_formula() const;
|
2014-05-31 06:42:25 +08:00
|
|
|
|
2015-10-14 01:56:07 +08:00
|
|
|
// printing
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-17 06:35:11 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Returns a string describing this cell like <Cell Sheet.A1>.
|
|
|
|
/// </summary>
|
2015-11-05 07:45:03 +08:00
|
|
|
string to_repr() const;
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-17 06:35:11 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Returns a string representing the value of this cell. If the data type is not a string,
|
|
|
|
/// it will be converted according to the number format.
|
|
|
|
/// </summary>
|
2015-11-05 07:45:03 +08:00
|
|
|
string to_string() const;
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-14 01:56:07 +08:00
|
|
|
// merging
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return true iff this cell has been merged with one or more
|
|
|
|
/// surrounding cells.
|
|
|
|
/// </summary>
|
2015-10-14 01:56:07 +08:00
|
|
|
bool is_merged() const;
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Make this a merged cell iff merged is true.
|
|
|
|
/// Generally, this shouldn't be called directly. Instead,
|
|
|
|
/// use worksheet::merge_cells on its parent worksheet.
|
|
|
|
/// </summary>
|
2015-10-14 01:56:07 +08:00
|
|
|
void set_merged(bool merged);
|
|
|
|
|
2015-11-04 07:26:33 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Return the error string that is stored in this cell.
|
|
|
|
/// </summary>
|
2015-11-05 07:45:03 +08:00
|
|
|
string get_error() const;
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Directly assign the value of this cell to be the given error.
|
|
|
|
/// </summary>
|
2015-11-05 07:45:03 +08:00
|
|
|
void set_error(const string &error);
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-11-04 07:26:33 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Return a cell from this cell's parent workbook at
|
|
|
|
/// a relative offset given by the parameters.
|
|
|
|
/// </summary>
|
2015-11-04 03:53:48 +08:00
|
|
|
cell offset(int column, int row);
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return the worksheet that owns this cell.
|
|
|
|
/// </summary>
|
2014-07-20 02:43:48 +08:00
|
|
|
worksheet get_parent();
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return the worksheet that owns this cell.
|
|
|
|
/// </summary>
|
2014-07-26 04:39:25 +08:00
|
|
|
const worksheet get_parent() const;
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-11-04 07:26:33 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Shortcut to return the base date of the parent workbook.
|
|
|
|
/// Equivalent to get_parent().get_parent().get_properties().excel_base_date
|
|
|
|
/// </summary>
|
2015-10-19 03:30:46 +08:00
|
|
|
calendar get_base_date() const;
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-10-14 01:56:07 +08:00
|
|
|
// operators
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Make this cell point to rhs.
|
|
|
|
/// The cell originally pointed to by this cell will be unchanged.
|
|
|
|
/// </summary>
|
2014-05-21 22:20:30 +08:00
|
|
|
cell &operator=(const cell &rhs);
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-11-04 07:26:33 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Return true if this cell the same cell as comparand (compare by reference).
|
|
|
|
/// </summary>
|
2014-06-14 03:05:24 +08:00
|
|
|
bool operator==(const cell &comparand) const;
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return true if this cell is uninitialized.
|
|
|
|
/// </summary>
|
2014-05-21 22:20:30 +08:00
|
|
|
bool operator==(std::nullptr_t) const;
|
2014-05-31 06:42:25 +08:00
|
|
|
|
2015-10-30 01:46:56 +08:00
|
|
|
// friend operators, so we can put cell on either side of comparisons with other types
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return true if this cell is uninitialized.
|
|
|
|
/// </summary>
|
2015-11-08 09:00:54 +08:00
|
|
|
friend XLNT_FUNCTION bool operator==(std::nullptr_t, const cell &cell);
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Return the result of left.get_reference() < right.get_reference().
|
|
|
|
/// What's the point of this?
|
|
|
|
/// </summary>
|
2015-11-08 09:00:54 +08:00
|
|
|
friend XLNT_FUNCTION bool operator<(const cell left, const cell right);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Convenience function for writing cell to an ostream.
|
|
|
|
/// Uses cell::to_string() internally.
|
|
|
|
/// </summary>
|
|
|
|
friend XLNT_FUNCTION std::ostream &operator<<(std::ostream &stream, const xlnt::cell &cell);
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-11-04 07:26:33 +08:00
|
|
|
private:
|
|
|
|
// make these friends so they can use the private constructor
|
2014-05-30 08:52:14 +08:00
|
|
|
friend class worksheet;
|
2015-10-19 03:30:46 +08:00
|
|
|
friend struct detail::cell_impl;
|
|
|
|
friend class style;
|
2015-11-01 22:43:01 +08:00
|
|
|
|
2015-11-04 07:26:33 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Private constructor to create a cell from its implementation.
|
|
|
|
/// </summary>
|
2014-05-31 06:42:25 +08:00
|
|
|
cell(detail::cell_impl *d);
|
2015-11-04 07:26:33 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// A pointer to this cell's implementation.
|
|
|
|
/// </summary>
|
2014-05-31 06:42:25 +08:00
|
|
|
detail::cell_impl *d_;
|
2014-05-21 22:20:30 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace xlnt
|