mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
finish documenting all headers (well enough). closes #28
This commit is contained in:
parent
c3d9b85530
commit
83d2d18d1f
File diff suppressed because it is too large
Load Diff
|
@ -42,7 +42,7 @@ class range_reference;
|
||||||
struct XLNT_API cell_reference_hash
|
struct XLNT_API cell_reference_hash
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a hash representing a particular cell_reference.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::size_t operator()(const cell_reference &k) const;
|
std::size_t operator()(const cell_reference &k) const;
|
||||||
};
|
};
|
||||||
|
@ -58,12 +58,12 @@ class XLNT_API cell_reference
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Split a coordinate string like "A1" into an equivalent pair like {"A", 1}.
|
/// Splits a coordinate string like "A1" into an equivalent pair like {"A", 1}.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static std::pair<std::string, row_t> split_reference(const std::string &reference_string);
|
static std::pair<std::string, row_t> split_reference(const std::string &reference_string);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Split a coordinate string like "A1" into an equivalent pair like {"A", 1}.
|
/// Splits a coordinate string like "A1" into an equivalent pair like {"A", 1}.
|
||||||
/// Reference parameters absolute_column and absolute_row will be set to true
|
/// Reference parameters absolute_column and absolute_row will be set to true
|
||||||
/// if column part or row part are prefixed by a dollar-sign indicating they
|
/// if column part or row part are prefixed by a dollar-sign indicating they
|
||||||
/// are absolute, otherwise false.
|
/// are absolute, otherwise false.
|
||||||
|
@ -98,7 +98,7 @@ public:
|
||||||
// absoluteness
|
// absoluteness
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Convert a coordinate to an absolute coordinate string (e.g. B12 -> $B$12)
|
/// Converts a coordinate to an absolute coordinate string (e.g. B12 -> $B$12)
|
||||||
/// Defaulting to true, absolute_column and absolute_row can optionally control
|
/// Defaulting to true, absolute_column and absolute_row can optionally control
|
||||||
/// whether the resulting cell_reference has an absolute column (e.g. B12 -> $B12)
|
/// whether the resulting cell_reference has an absolute column (e.g. B12 -> $B12)
|
||||||
/// and absolute row (e.g. B12 -> B$12) respectively.
|
/// and absolute row (e.g. B12 -> B$12) respectively.
|
||||||
|
@ -113,23 +113,23 @@ public:
|
||||||
cell_reference &make_absolute(bool absolute_column = true, bool absolute_row = true);
|
cell_reference &make_absolute(bool absolute_column = true, bool absolute_row = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if the reference refers to an absolute column, otherwise false.
|
/// Returns true if the reference refers to an absolute column, otherwise false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool column_absolute() const;
|
bool column_absolute() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Make this reference have an absolute column if absolute_column is true,
|
/// Makes this reference have an absolute column if absolute_column is true,
|
||||||
/// otherwise not absolute.
|
/// otherwise not absolute.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void column_absolute(bool absolute_column);
|
void column_absolute(bool absolute_column);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if the reference refers to an absolute row, otherwise false.
|
/// Returns true if the reference refers to an absolute row, otherwise false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool row_absolute() const;
|
bool row_absolute() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Make this reference have an absolute row if absolute_row is true,
|
/// Makes this reference have an absolute row if absolute_row is true,
|
||||||
/// otherwise not absolute.
|
/// otherwise not absolute.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void row_absolute(bool absolute_row);
|
void row_absolute(bool absolute_row);
|
||||||
|
@ -137,38 +137,38 @@ public:
|
||||||
// getters/setters
|
// getters/setters
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return a string that identifies the column of this reference
|
/// Returns a string that identifies the column of this reference
|
||||||
/// (e.g. second column from left is "B")
|
/// (e.g. second column from left is "B")
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t column() const;
|
column_t column() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the column of this reference from a string that identifies a particular column.
|
/// Sets the column of this reference from a string that identifies a particular column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void column(const std::string &column_string);
|
void column(const std::string &column_string);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return a 1-indexed numeric index of the column of this reference.
|
/// Returns a 1-indexed numeric index of the column of this reference.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t::index_t column_index() const;
|
column_t::index_t column_index() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the column of this reference from a 1-indexed number that identifies a particular column.
|
/// Sets the column of this reference from a 1-indexed number that identifies a particular column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void column_index(column_t column);
|
void column_index(column_t column);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return a 1-indexed numeric index of the row of this reference.
|
/// Returns a 1-indexed numeric index of the row of this reference.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
row_t row() const;
|
row_t row() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the row of this reference from a 1-indexed number that identifies a particular row.
|
/// Sets the row of this reference from a 1-indexed number that identifies a particular row.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void row(row_t row);
|
void row(row_t row);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return a cell_reference offset from this cell_reference by
|
/// Returns a cell_reference offset from this cell_reference by
|
||||||
/// the number of columns and rows specified by the parameters.
|
/// the number of columns and rows specified by the parameters.
|
||||||
/// A negative value for column_offset or row_offset results
|
/// A negative value for column_offset or row_offset results
|
||||||
/// in a reference above or left of this cell_reference, respectively.
|
/// in a reference above or left of this cell_reference, respectively.
|
||||||
|
@ -176,12 +176,12 @@ public:
|
||||||
cell_reference make_offset(int column_offset, int row_offset) const;
|
cell_reference make_offset(int column_offset, int row_offset) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return a string like "A1" for cell_reference(1, 1).
|
/// Returns a string like "A1" for cell_reference(1, 1).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string to_string() const;
|
std::string to_string() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return a 1x1 range_reference containing only this cell_reference.
|
/// Returns a 1x1 range_reference containing only this cell_reference.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_reference to_range() const;
|
range_reference to_range() const;
|
||||||
|
|
||||||
|
@ -195,37 +195,37 @@ public:
|
||||||
range_reference operator,(const cell_reference &other) const;
|
range_reference operator,(const cell_reference &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if this reference is identical to comparand including
|
/// Returns true if this reference is identical to comparand including
|
||||||
/// in absoluteness of column and row.
|
/// in absoluteness of column and row.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(const cell_reference &comparand) const;
|
bool operator==(const cell_reference &comparand) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Construct a cell_reference from reference_string and return the result
|
/// Constructs a cell_reference from reference_string and return the result
|
||||||
/// of their comparison.
|
/// of their comparison.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(const std::string &reference_string) const;
|
bool operator==(const std::string &reference_string) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Construct a cell_reference from reference_string and return the result
|
/// Constructs a cell_reference from reference_string and return the result
|
||||||
/// of their comparison.
|
/// of their comparison.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(const char *reference_string) const;
|
bool operator==(const char *reference_string) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if this reference is not identical to comparand including
|
/// Returns true if this reference is not identical to comparand including
|
||||||
/// in absoluteness of column and row.
|
/// in absoluteness of column and row.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(const cell_reference &comparand) const;
|
bool operator!=(const cell_reference &comparand) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Construct a cell_reference from reference_string and return the result
|
/// Constructs a cell_reference from reference_string and return the result
|
||||||
/// of their comparison.
|
/// of their comparison.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(const std::string &reference_string) const;
|
bool operator!=(const std::string &reference_string) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Construct a cell_reference from reference_string and return the result
|
/// Constructs a cell_reference from reference_string and return the result
|
||||||
/// of their comparison.
|
/// of their comparison.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(const char *reference_string) const;
|
bool operator!=(const char *reference_string) const;
|
||||||
|
|
|
@ -52,27 +52,27 @@ public:
|
||||||
comment(const std::string &text, const std::string &author);
|
comment(const std::string &text, const std::string &author);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return the text that will be displayed for this comment.
|
/// Returns the text that will be displayed for this comment.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
rich_text text() const;
|
rich_text text() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return the plain text that will be displayed for this comment without formatting information.
|
/// Returns the plain text that will be displayed for this comment without formatting information.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string plain_text() const;
|
std::string plain_text() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return the author of this comment.
|
/// Returns the author of this comment.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string author() const;
|
std::string author() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Make this comment only visible when the associated cell is hovered.
|
/// Makes this comment only visible when the associated cell is hovered.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void hide();
|
void hide();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Make this comment always visible.
|
/// Makes this comment always visible.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void show();
|
void show();
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ public:
|
||||||
bool visible() const;
|
bool visible() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the absolute position of this cell to the given coordinates.
|
/// Sets the absolute position of this cell to the given coordinates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void position(int left, int top);
|
void position(int left, int top);
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ public:
|
||||||
int top() const;
|
int top() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the size of the comment.
|
/// Sets the size of the comment.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void size(int width, int height);
|
void size(int width, int height);
|
||||||
|
|
||||||
|
@ -112,9 +112,14 @@ public:
|
||||||
int height() const;
|
int height() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if both comments are equivalent.
|
/// Return true if this comment is equivalent to other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
friend XLNT_API bool operator==(const comment &left, const comment &right);
|
bool operator==(const comment &other) const;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if this comment is not equivalent to other.
|
||||||
|
/// </summary>
|
||||||
|
bool operator!=(const comment &other) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -48,7 +48,7 @@ class XLNT_API column_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Alias declaration for the internal numeric type of this column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
using index_t = std::uint32_t;
|
using index_t = std::uint32_t;
|
||||||
|
|
||||||
|
@ -73,237 +73,207 @@ public:
|
||||||
static std::string column_string_from_index(index_t column_index);
|
static std::string column_string_from_index(index_t column_index);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default column_t is the first (left-most) column.
|
/// Default constructor. The column points to the "A" column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t();
|
column_t();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Construct a column from a number.
|
/// Constructs a column from a number.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t(index_t column_index);
|
column_t(index_t column_index);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Construct a column from a string.
|
/// Constructs a column from a string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t(const std::string &column_string);
|
column_t(const std::string &column_string);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Construct a column from a string.
|
/// Constructs a column from a string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t(const char *column_string);
|
column_t(const char *column_string);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Copy constructor
|
/// Copy constructor. Constructs a column by copying it from other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t(const column_t &other);
|
column_t(const column_t &other);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Move constructor
|
/// Move constructor. Constructs a column by moving it from other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t(column_t &&other);
|
column_t(column_t &&other);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return a string representation of this column index.
|
/// Returns a string representation of this column index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string column_string() const;
|
std::string column_string() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set this column to be the same as rhs's and return reference to self.
|
/// Sets this column to be the same as rhs's and return reference to self.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t &operator=(column_t rhs);
|
column_t &operator=(column_t rhs);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set this column to be equal to rhs and return reference to self.
|
/// Sets this column to be equal to rhs and return reference to self.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t &operator=(const std::string &rhs);
|
column_t &operator=(const std::string &rhs);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set this column to be equal to rhs and return reference to self.
|
/// Sets this column to be equal to rhs and return reference to self.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t &operator=(const char *rhs);
|
column_t &operator=(const char *rhs);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if this column refers to the same column as other.
|
/// Returns true if this column refers to the same column as other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(const column_t &other) const;
|
bool operator==(const column_t &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if this column doesn't refer to the same column as other.
|
/// Returns true if this column doesn't refer to the same column as other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(const column_t &other) const;
|
bool operator!=(const column_t &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if this column refers to the same column as other.
|
/// Returns true if this column refers to the same column as other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(int other) const;
|
bool operator==(int other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if this column refers to the same column as other.
|
/// Returns true if this column refers to the same column as other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(index_t other) const;
|
bool operator==(index_t other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if this column refers to the same column as other.
|
/// Returns true if this column refers to the same column as other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(const std::string &other) const;
|
bool operator==(const std::string &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if this column refers to the same column as other.
|
/// Returns true if this column refers to the same column as other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(const char *other) const;
|
bool operator==(const char *other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if this column doesn't refer to the same column as other.
|
/// Returns true if this column doesn't refer to the same column as other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(int other) const;
|
bool operator!=(int other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if this column doesn't refer to the same column as other.
|
/// Returns true if this column doesn't refer to the same column as other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(index_t other) const;
|
bool operator!=(index_t other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if this column doesn't refer to the same column as other.
|
/// Returns true if this column doesn't refer to the same column as other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(const std::string &other) const;
|
bool operator!=(const std::string &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if this column doesn't refer to the same column as other.
|
/// Returns true if this column doesn't refer to the same column as other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(const char *other) const;
|
bool operator!=(const char *other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if other is to the right of this column.
|
/// Returns true if other is to the right of this column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator>(const column_t &other) const;
|
bool operator>(const column_t &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if other is to the right of or equal to this column.
|
/// Returns true if other is to the right of or equal to this column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator>=(const column_t &other) const;
|
bool operator>=(const column_t &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if other is to the left of this column.
|
/// Returns true if other is to the left of this column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator<(const column_t &other) const;
|
bool operator<(const column_t &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if other is to the left of or equal to this column.
|
/// Returns true if other is to the left of or equal to this column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator<=(const column_t &other) const;
|
bool operator<=(const column_t &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if other is to the right of this column.
|
/// Returns true if other is to the right of this column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator>(const column_t::index_t &other) const;
|
bool operator>(const column_t::index_t &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if other is to the right of or equal to this column.
|
/// Returns true if other is to the right of or equal to this column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator>=(const column_t::index_t &other) const;
|
bool operator>=(const column_t::index_t &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if other is to the left of this column.
|
/// Returns true if other is to the left of this column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator<(const column_t::index_t &other) const;
|
bool operator<(const column_t::index_t &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if other is to the left of or equal to this column.
|
/// Returns true if other is to the left of or equal to this column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator<=(const column_t::index_t &other) const;
|
bool operator<=(const column_t::index_t &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Pre-increment this column, making it point to the column one to the right.
|
/// Pre-increments this column, making it point to the column one to the right and returning a reference to it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t &operator++();
|
column_t &operator++();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Pre-deccrement this column, making it point to the column one to the left.
|
/// Pre-deccrements this column, making it point to the column one to the left and returning a reference to it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t &operator--();
|
column_t &operator--();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Post-increment this column, making it point to the column one to the right and returning the old column.
|
/// Post-increments this column, making it point to the column one to the right and returning the old column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t operator++(int);
|
column_t operator++(int);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Post-decrement this column, making it point to the column one to the left and returning the old column.
|
/// Post-decrements this column, making it point to the column one to the left and returning the old column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t operator--(int);
|
column_t operator--(int);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return the result of adding rhs to this column.
|
/// Returns the result of adding rhs to this column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
friend XLNT_API column_t operator+(column_t lhs, const column_t &rhs);
|
friend XLNT_API column_t operator+(column_t lhs, const column_t &rhs);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return the result of subtracing lhs by rhs column.
|
/// Returns the result of subtracing lhs by rhs column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
friend XLNT_API column_t operator-(column_t lhs, const column_t &rhs);
|
friend XLNT_API column_t operator-(column_t lhs, const column_t &rhs);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return the result of multiply lhs by rhs column.
|
/// Adds rhs to this column and returns a reference to this column.
|
||||||
/// </summary>
|
|
||||||
friend XLNT_API column_t operator*(column_t lhs, const column_t &rhs);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return the result of divide lhs by rhs column.
|
|
||||||
/// </summary>
|
|
||||||
friend XLNT_API column_t operator/(column_t lhs, const column_t &rhs);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return the result of mod lhs by rhs column.
|
|
||||||
/// </summary>
|
|
||||||
friend XLNT_API column_t operator%(column_t lhs, const column_t &rhs);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add rhs to this column and return a reference to this column.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t &operator+=(const column_t &rhs);
|
column_t &operator+=(const column_t &rhs);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Subtrac rhs from this column and return a reference to this column.
|
/// Subtracts rhs from this column and returns a reference to this column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t &operator-=(const column_t &rhs);
|
column_t &operator-=(const column_t &rhs);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Multiply this column by rhs and return a reference to this column.
|
/// Returns true if other is to the right of this column.
|
||||||
/// </summary>
|
|
||||||
column_t &operator*=(const column_t &rhs);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Divide this column by rhs and return a reference to this column.
|
|
||||||
/// </summary>
|
|
||||||
column_t &operator/=(const column_t &rhs);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Mod this column by rhs and return a reference to this column.
|
|
||||||
/// </summary>
|
|
||||||
column_t &operator%=(const column_t &rhs);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return true if other is to the right of this column.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
friend XLNT_API bool operator>(const column_t::index_t &left, const column_t &right);
|
friend XLNT_API bool operator>(const column_t::index_t &left, const column_t &right);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if other is to the right of or equal to this column.
|
/// Returns true if other is to the right of or equal to this column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
friend XLNT_API bool operator>=(const column_t::index_t &left, const column_t &right);
|
friend XLNT_API bool operator>=(const column_t::index_t &left, const column_t &right);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if other is to the left of this column.
|
/// Returns true if other is to the left of this column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
friend XLNT_API bool operator<(const column_t::index_t &left, const column_t &right);
|
friend XLNT_API bool operator<(const column_t::index_t &left, const column_t &right);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return true if other is to the left of or equal to this column.
|
/// Returns true if other is to the left of or equal to this column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
friend XLNT_API bool operator<=(const column_t::index_t &left, const column_t &right);
|
friend XLNT_API bool operator<=(const column_t::index_t &left, const column_t &right);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Swap the columns that left and right refer to.
|
/// Swaps the columns that left and right refer to.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
friend XLNT_API void swap(column_t &left, column_t &right);
|
friend XLNT_API void swap(column_t &left, column_t &right);
|
||||||
|
|
||||||
|
@ -315,12 +285,12 @@ public:
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Functor for hashing a column.
|
/// Functor for hashing a column.
|
||||||
/// Allows for use of std::unordered_set<column, column_hash> and similar.
|
/// Allows for use of std::unordered_set<column_t, column_hash> and similar.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
struct XLNT_API column_hash
|
struct XLNT_API column_hash
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the result of hashing column k.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::size_t operator()(const column_t &k) const;
|
std::size_t operator()(const column_t &k) const;
|
||||||
};
|
};
|
||||||
|
@ -336,7 +306,7 @@ template <>
|
||||||
struct hash<xlnt::column_t>
|
struct hash<xlnt::column_t>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the result of hashing column k.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
size_t operator()(const xlnt::column_t &k) const
|
size_t operator()(const xlnt::column_t &k) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,38 +39,38 @@ class XLNT_API rich_text
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs an empty rich text object with no font and empty text.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
rich_text() = default;
|
rich_text() = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a rich text object with the given text and no font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
rich_text(const std::string &plain_text);
|
rich_text(const std::string &plain_text);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a rich text object with the given text and font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
rich_text(const std::string &plain_text, const class font &text_font);
|
rich_text(const std::string &plain_text, const class font &text_font);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
rich_text(const rich_text_run &single_run);
|
rich_text(const rich_text_run &single_run);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove all text runs from this text.
|
/// Removes all text runs from this text.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clear any runs in this text and add a single run with default formatting and
|
/// Clears any runs in this text and adds a single run with default formatting and
|
||||||
/// the given string as its textual content.
|
/// the given string as its textual content.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void plain_text(const std::string &s);
|
void plain_text(const std::string &s);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Combine the textual content of each text run in order and return the result.
|
/// Combines the textual content of each text run in order and returns the result.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string plain_text() const;
|
std::string plain_text() const;
|
||||||
|
|
||||||
|
@ -80,12 +80,12 @@ public:
|
||||||
std::vector<rich_text_run> runs() const;
|
std::vector<rich_text_run> runs() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the runs of this text all at once.
|
/// Sets the runs of this text all at once.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void runs(const std::vector<rich_text_run> &new_runs);
|
void runs(const std::vector<rich_text_run> &new_runs);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a new run to the end of the set of runs.
|
/// Adds a new run to the end of the set of runs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void add_run(const rich_text_run &t);
|
void add_run(const rich_text_run &t);
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The runs that make up this rich text.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::vector<rich_text_run> runs_;
|
std::vector<rich_text_run> runs_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -143,7 +143,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A vector to the all of the border sides for iteration.
|
/// Returns a vector containing all of the border sides to be used for iteration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const std::vector<border_side> &all_sides();
|
static const std::vector<border_side> &all_sides();
|
||||||
|
|
||||||
|
|
|
@ -37,24 +37,25 @@ namespace xlnt {
|
||||||
class XLNT_API indexed_color
|
class XLNT_API indexed_color
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
//TODO: should this be explicit?
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs an indexed_color from an index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
indexed_color(std::size_t index);
|
indexed_color(std::size_t index);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the index this color points to.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::size_t index() const;
|
std::size_t index() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the index to index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void index(std::size_t index);
|
void index(std::size_t index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The index of this color
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::size_t index_;
|
std::size_t index_;
|
||||||
};
|
};
|
||||||
|
@ -66,23 +67,23 @@ class XLNT_API theme_color
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a theme_color from an index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
theme_color(std::size_t index);
|
theme_color(std::size_t index);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the index of the color in the theme this points to.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::size_t index() const;
|
std::size_t index() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the index of this color to index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void index(std::size_t index);
|
void index(std::size_t index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The index of the color
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::size_t index_;
|
std::size_t index_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -59,7 +59,7 @@ enum class XLNT_API pattern_fill_type
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a fill which colors the cell based on a foreground and
|
/// Represents a fill which colors the cell based on a foreground and
|
||||||
/// background color and a pattern.
|
/// background color and a pattern.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class XLNT_API pattern_fill
|
class XLNT_API pattern_fill
|
||||||
|
@ -112,23 +112,23 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The type of this pattern_fill
|
||||||
/// </summary>
|
/// </summary>
|
||||||
pattern_fill_type type_ = pattern_fill_type::none;
|
pattern_fill_type type_ = pattern_fill_type::none;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The optional foreground color
|
||||||
/// </summary>
|
/// </summary>
|
||||||
optional<color> foreground_;
|
optional<color> foreground_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// THe optional background color
|
||||||
/// </summary>
|
/// </summary>
|
||||||
optional<color> background_;
|
optional<color> background_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Enumerates the types of gradient fills
|
||||||
/// </summary>
|
/// </summary>
|
||||||
enum class XLNT_API gradient_fill_type
|
enum class XLNT_API gradient_fill_type
|
||||||
{
|
{
|
||||||
|
@ -174,117 +174,117 @@ public:
|
||||||
// Left
|
// Left
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the distance from the left where the gradient starts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double left() const;
|
double left() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the distance from the left where the gradient starts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
gradient_fill &left(double value);
|
gradient_fill &left(double value);
|
||||||
|
|
||||||
// Right
|
// Right
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the distance from the right where the gradient starts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double right() const;
|
double right() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the distance from the right where the gradient starts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
gradient_fill &right(double value);
|
gradient_fill &right(double value);
|
||||||
|
|
||||||
// Top
|
// Top
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the distance from the top where the gradient starts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double top() const;
|
double top() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the distance from the top where the gradient starts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
gradient_fill &top(double value);
|
gradient_fill &top(double value);
|
||||||
|
|
||||||
// Bottom
|
// Bottom
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the distance from the bottom where the gradient starts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double bottom() const;
|
double bottom() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the distance from the bottom where the gradient starts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
gradient_fill &bottom(double value);
|
gradient_fill &bottom(double value);
|
||||||
|
|
||||||
// Stops
|
// Stops
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Adds a gradient stop at position with the given color.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
gradient_fill &add_stop(double position, color stop_color);
|
gradient_fill &add_stop(double position, color stop_color);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Deletes all stops from the gradient.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
gradient_fill &clear_stops();
|
gradient_fill &clear_stops();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns all of the gradient stops.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::unordered_map<double, color> stops() const;
|
std::unordered_map<double, color> stops() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if left is exactly equal to right.
|
/// Returns true if the gradient is equivalent to other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(const gradient_fill &other) const;
|
bool operator==(const gradient_fill &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if left is not exactly equal to right.
|
/// Returns true if the gradient is not equivalent to other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(const gradient_fill &right) const;
|
bool operator!=(const gradient_fill &right) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The type of gradient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
gradient_fill_type type_ = gradient_fill_type::linear;
|
gradient_fill_type type_ = gradient_fill_type::linear;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The angle of the gradient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double degree_ = 0;
|
double degree_ = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// THe left distance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double left_ = 0;
|
double left_ = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// THe right distance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double right_ = 0;
|
double right_ = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The top distance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double top_ = 0;
|
double top_ = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The bottom distance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double bottom_ = 0;
|
double bottom_ = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The gradient stops and colors
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::unordered_map<double, color> stops_;
|
std::unordered_map<double, color> stops_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Enumerates the possible fill types
|
||||||
/// </summary>
|
/// </summary>
|
||||||
enum class XLNT_API fill_type
|
enum class XLNT_API fill_type
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,7 +41,7 @@ class XLNT_API font
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Text can be underlined in the enumerated ways
|
||||||
/// </summary>
|
/// </summary>
|
||||||
enum class underline_style
|
enum class underline_style
|
||||||
{
|
{
|
||||||
|
@ -53,258 +53,257 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a default font. Calibri, size 12
|
||||||
/// </summary>
|
/// </summary>
|
||||||
font();
|
font();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the bold state of the font to bold and returns a reference to the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
font &bold(bool bold);
|
font &bold(bool bold);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the bold state of the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool bold() const;
|
bool bold() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the bold state of the font to bold and returns a reference to the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
font &superscript(bool superscript);
|
font &superscript(bool superscript);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this font has a superscript applied.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool superscript() const;
|
bool superscript() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the bold state of the font to bold and returns a reference to the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
font &italic(bool italic);
|
font &italic(bool italic);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this font has italics applied.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool italic() const;
|
bool italic() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the bold state of the font to bold and returns a reference to the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
font &strikethrough(bool strikethrough);
|
font &strikethrough(bool strikethrough);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this font has a strikethrough applied.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool strikethrough() const;
|
bool strikethrough() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the bold state of the font to bold and returns a reference to the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
font &outline(bool outline);
|
font &outline(bool outline);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this font has an outline applied.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool outline() const;
|
bool outline() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the shadow state of the font to shadow and returns a reference to the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
font &shadow(bool shadow);
|
font &shadow(bool shadow);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this font has a shadow applied.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool shadow() const;
|
bool shadow() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the underline state of the font to new_underline and returns a reference to the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
font &underline(underline_style new_underline);
|
font &underline(underline_style new_underline);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this font has any type of underline applied.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool underlined() const;
|
bool underlined() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the particular style of underline this font has applied.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
underline_style underline() const;
|
underline_style underline() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this font has a defined size.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool has_size() const;
|
bool has_size() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the size of the font to size and returns a reference to the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
font &size(double size);
|
font &size(double size);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the size of the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double size() const;
|
double size() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this font has a particular face applied (e.g. "Comic Sans").
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool has_name() const;
|
bool has_name() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the font face to name and returns a reference to the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
font &name(const std::string &name);
|
font &name(const std::string &name);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the name of the font face.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string name() const;
|
std::string name() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this font has a color applied.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool has_color() const;
|
bool has_color() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the color of the font to c and returns a reference to the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
font &color(const color &c);
|
font &color(const color &c);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the color that this font is using.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
xlnt::color color() const;
|
xlnt::color color() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this font has a family defined.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool has_family() const;
|
bool has_family() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the family index of the font to family and returns a reference to the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
font &family(std::size_t family);
|
font &family(std::size_t family);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the family index for the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::size_t family() const;
|
std::size_t family() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this font has a charset defined.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool has_charset() const;
|
bool has_charset() const;
|
||||||
|
|
||||||
|
// TODO: charset should be an enum, not a number
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the charset of the font to charset and returns a reference to the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
font &charset(std::size_t charset);
|
font &charset(std::size_t charset);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the charset of the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::size_t charset() const;
|
std::size_t charset() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this font has a scheme.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool has_scheme() const;
|
bool has_scheme() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the scheme of the font to scheme and returns a reference to the font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
font &scheme(const std::string &scheme);
|
font &scheme(const std::string &scheme);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the scheme of this font.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string scheme() const;
|
std::string scheme() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if left is exactly equal to right.
|
/// Returns true if left is exactly equal to right.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
XLNT_API friend bool operator==(const font &left, const font &right);
|
bool operator==(const font &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if left is not exactly equal to right.
|
/// Returns true if left is not exactly equal to right.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
XLNT_API friend bool operator!=(const font &left, const font &right)
|
bool operator!=(const font &other) const;
|
||||||
{
|
|
||||||
return !(left == right);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class style;
|
friend class style;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The name of the font
|
||||||
/// </summary>
|
/// </summary>
|
||||||
optional<std::string> name_;
|
optional<std::string> name_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// size
|
||||||
/// </summary>
|
/// </summary>
|
||||||
optional<double> size_;
|
optional<double> size_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// bold
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool bold_ = false;
|
bool bold_ = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// italic
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool italic_ = false;
|
bool italic_ = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// superscript
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool superscript_ = false;
|
bool superscript_ = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// subscript
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool subscript_ = false;
|
bool subscript_ = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// strikethrough
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool strikethrough_ = false;
|
bool strikethrough_ = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// outline
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool outline_ = false;
|
bool outline_ = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// shadow
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool shadow_ = false;
|
bool shadow_ = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// underline style
|
||||||
/// </summary>
|
/// </summary>
|
||||||
underline_style underline_ = underline_style::none;
|
underline_style underline_ = underline_style::none;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// color
|
||||||
/// </summary>
|
/// </summary>
|
||||||
optional<xlnt::color> color_;
|
optional<xlnt::color> color_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// family
|
||||||
/// </summary>
|
/// </summary>
|
||||||
optional<std::size_t> family_;
|
optional<std::size_t> family_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// charset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
optional<std::size_t> charset_;
|
optional<std::size_t> charset_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// scheme
|
||||||
/// </summary>
|
/// </summary>
|
||||||
optional<std::string> scheme_;
|
optional<std::string> scheme_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -53,207 +53,176 @@ class xlsx_producer;
|
||||||
class XLNT_API format
|
class XLNT_API format
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Alignment
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the alignment of this format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class alignment &alignment();
|
class alignment alignment() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the alignment of this format to new_alignment. Applied, which defaults
|
||||||
|
/// to true, determines whether the alignment should be enabled for cells using
|
||||||
|
/// this format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const class alignment &alignment() const;
|
format alignment(const xlnt::alignment &new_alignment, bool applied = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the alignment of this format should be applied to cells
|
||||||
/// </summary>
|
/// using it.
|
||||||
format alignment(const xlnt::alignment &new_alignment, bool applied);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool alignment_applied() const;
|
bool alignment_applied() const;
|
||||||
|
|
||||||
// Border
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the border of this format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class border &border();
|
class border border() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the border of this format to new_border. Applied, which defaults
|
||||||
|
/// to true, determines whether the border should be enabled for cells using
|
||||||
|
/// this format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const class border &border() const;
|
format border(const xlnt::border &new_border, bool applied = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the border set for this format should be applied to cells using the format.
|
||||||
/// </summary>
|
|
||||||
format border(const xlnt::border &new_border, bool applied);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool border_applied() const;
|
bool border_applied() const;
|
||||||
|
|
||||||
// Fill
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the fill of this format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class fill &fill();
|
class fill fill() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the fill of this format to new_fill. Applied, which defaults
|
||||||
|
/// to true, determines whether the border should be enabled for cells using
|
||||||
|
/// this format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const class fill &fill() const;
|
format fill(const xlnt::fill &new_fill, bool applied = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the fill set for this format should be applied to cells using the format.
|
||||||
/// </summary>
|
|
||||||
format fill(const xlnt::fill &new_fill, bool applied);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool fill_applied() const;
|
bool fill_applied() const;
|
||||||
|
|
||||||
// Font
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the font of this format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class font &font();
|
class font font() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the font of this format to new_font. Applied, which defaults
|
||||||
|
/// to true, determines whether the font should be enabled for cells using
|
||||||
|
/// this format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const class font &font() const;
|
format font(const xlnt::font &new_font, bool applied = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the font set for this format should be applied to cells using the format.
|
||||||
/// </summary>
|
|
||||||
format font(const xlnt::font &new_font, bool applied);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool font_applied() const;
|
bool font_applied() const;
|
||||||
|
|
||||||
// Number Format
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the number format of this format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class number_format &number_format();
|
class number_format number_format() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the number format of this format to new_number_format. Applied, which defaults
|
||||||
|
/// to true, determines whether the number format should be enabled for cells using
|
||||||
|
/// this format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const class number_format &number_format() const;
|
format number_format(const xlnt::number_format &new_number_format, bool applied = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the number_format set for this format should be applied to cells using the format.
|
||||||
/// </summary>
|
|
||||||
format number_format(const xlnt::number_format &new_number_format, bool applied);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool number_format_applied() const;
|
bool number_format_applied() const;
|
||||||
|
|
||||||
// Protection
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the protection of this format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class protection &protection();
|
class protection protection() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the protection set for this format should be applied to cells using the format.
|
||||||
/// </summary>
|
|
||||||
const class protection &protection() const;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
format protection(const xlnt::protection &new_protection, bool applied);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool protection_applied() const;
|
bool protection_applied() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the protection of this format to new_protection. Applied, which defaults
|
||||||
|
/// to true, determines whether the protection should be enabled for cells using
|
||||||
|
/// this format.
|
||||||
|
/// </summary>
|
||||||
|
format protection(const xlnt::protection &new_protection, bool applied = true);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if the pivot table interface is enabled for this format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool pivot_button() const;
|
bool pivot_button() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// If show is true, a pivot table interface will be displayed for cells using
|
||||||
|
/// this format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void pivot_button(bool show);
|
void pivot_button(bool show);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this format should add a single-quote prefix for all text values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool quote_prefix() const;
|
bool quote_prefix() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// If quote is true, enables a single-quote prefix for all text values in cells
|
||||||
|
/// using this format (e.g. "abc" will appear as "'abc"). The text will also not
|
||||||
|
/// be stored in sharedStrings when this is enabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void quote_prefix(bool quote);
|
void quote_prefix(bool quote);
|
||||||
|
|
||||||
// Style
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this format has a corresponding style applied.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool has_style() const;
|
bool has_style() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Removes the style from this format if it exists.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void clear_style();
|
void clear_style();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the style of this format to a style with the given name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
format style(const std::string &name);
|
format style(const std::string &name);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the style of this format to new_style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
format style(const class style &new_style);
|
format style(const class style &new_style);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the style of this format. If it has no style, an invalid_parameter
|
||||||
|
/// exception will be thrown.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class style style();
|
class style style();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the style of this format. If it has no style, an invalid_parameters
|
||||||
/// </summary>
|
/// exception will be thrown.
|
||||||
const class style style() const;
|
/// </summary>
|
||||||
|
const class style style() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend struct detail::stylesheet;
|
friend struct detail::stylesheet;
|
||||||
friend class detail::xlsx_producer;
|
friend class detail::xlsx_producer;
|
||||||
friend class cell;
|
friend class cell;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a format from an impl pointer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
format(detail::format_impl *d);
|
format(detail::format_impl *d);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
std::size_t id() const;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The internal implementation of this format
|
||||||
/// </summary>
|
/// </summary>
|
||||||
detail::format_impl *d_;
|
detail::format_impl *d_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <xlnt/xlnt_config.hpp>
|
#include <xlnt/xlnt_config.hpp>
|
||||||
|
#include <xlnt/utils/optional.hpp>
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
|
@ -40,236 +41,232 @@ class XLNT_API number_format
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "General"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format general();
|
static const number_format general();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "@"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format text();
|
static const number_format text();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "0"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format number();
|
static const number_format number();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "00"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format number_00();
|
static const number_format number_00();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "#,##0.00"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format number_comma_separated1();
|
static const number_format number_comma_separated1();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "0%"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format percentage();
|
static const number_format percentage();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "0.00%"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format percentage_00();
|
static const number_format percentage_00();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "yyyy-mm-dd"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_yyyymmdd2();
|
static const number_format date_yyyymmdd2();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "yy-mm-dd"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_yymmdd();
|
static const number_format date_yymmdd();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "dd/mm/yy"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_ddmmyyyy();
|
static const number_format date_ddmmyyyy();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "d/m/yy"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_dmyslash();
|
static const number_format date_dmyslash();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "d-m-yy"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_dmyminus();
|
static const number_format date_dmyminus();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "d-m"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_dmminus();
|
static const number_format date_dmminus();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "m-yy"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_myminus();
|
static const number_format date_myminus();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "mm-dd-yy"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_xlsx14();
|
static const number_format date_xlsx14();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "d-mmm-yy"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_xlsx15();
|
static const number_format date_xlsx15();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "d-mmm"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_xlsx16();
|
static const number_format date_xlsx16();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "mmm-yy"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_xlsx17();
|
static const number_format date_xlsx17();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "m/d/yy h:mm"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_xlsx22();
|
static const number_format date_xlsx22();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "yyyy-mm-dd h:mm:ss"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_datetime();
|
static const number_format date_datetime();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "h:mm AM/PM"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_time1();
|
static const number_format date_time1();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "h:mm:ss AM/PM"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_time2();
|
static const number_format date_time2();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "h:mm"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_time3();
|
static const number_format date_time3();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "h:mm:ss"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_time4();
|
static const number_format date_time4();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "mm:ss"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_time5();
|
static const number_format date_time5();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Number format "h:mm:ss"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format date_time6();
|
static const number_format date_time6();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the given format ID corresponds to a known builtin format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static bool is_builtin_format(std::size_t builtin_id);
|
static bool is_builtin_format(std::size_t builtin_id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the format with the given ID. Thows an invalid_parameter exception
|
||||||
|
/// if builtin_id is not a valid ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static const number_format &from_builtin_id(std::size_t builtin_id);
|
static const number_format &from_builtin_id(std::size_t builtin_id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a default number_format equivalent to "General"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
number_format();
|
number_format();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a number format equivalent to that returned from number_format::from_builtin_id(builtin_id).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
number_format(std::size_t builtin_id);
|
number_format(std::size_t builtin_id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a number format from a code string. If the string matches a builtin ID,
|
||||||
|
/// its ID will also be set to match the builtin ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
number_format(const std::string &code);
|
number_format(const std::string &code);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a number format from a code string and custom ID. Custom ID should generally
|
||||||
|
/// be >= 164.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
number_format(const std::string &code, std::size_t custom_id);
|
number_format(const std::string &code, std::size_t custom_id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the format code of this number format to format_code.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void format_string(const std::string &format_code);
|
void format_string(const std::string &format_code);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the format code of this number format to format_code and the ID to custom_id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void format_string(const std::string &format_code, std::size_t custom_id);
|
void format_string(const std::string &format_code, std::size_t custom_id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the format code this number format uses.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string format_string() const;
|
std::string format_string() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this number format has an ID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool has_id() const;
|
bool has_id() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the ID of this number format to id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void id(std::size_t id);
|
void id(std::size_t id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the ID of this format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::size_t id() const;
|
std::size_t id() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns text formatted according to this number format's format code.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string format(const std::string &text) const;
|
std::string format(const std::string &text) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns number formatted according to this number format's format code
|
||||||
|
/// with the given base date.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string format(long double number, calendar base_date) const;
|
std::string format(long double number, calendar base_date) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this format code returns a number formatted as a date.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool is_date_format() const;
|
bool is_date_format() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if left is exactly equal to right.
|
/// Returns true if this format is equivalent to other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
XLNT_API friend bool operator==(const number_format &left, const number_format &right);
|
bool operator==(const number_format &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if left is not exactly equal to right.
|
/// Returns true if this format is not equivalent to other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
XLNT_API friend bool operator!=(const number_format &left, const number_format &right)
|
bool operator!=(const number_format &other) const;
|
||||||
{
|
|
||||||
return !(left == right);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The optional ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool id_set_;
|
optional<std::size_t> id_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The format code
|
||||||
/// </summary>
|
|
||||||
std::size_t id_;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string format_string_;
|
std::string format_string_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,71 +38,68 @@ class XLNT_API protection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns an unlocked and unhidden protection object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static protection unlocked_and_visible();
|
static protection unlocked_and_visible();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a locked and unhidden protection object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static protection locked_and_visible();
|
static protection locked_and_visible();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns an unlocked and hidden protection object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static protection unlocked_and_hidden();
|
static protection unlocked_and_hidden();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a locked and hidden protection object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static protection locked_and_hidden();
|
static protection locked_and_hidden();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a default unlocked unhidden protection object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protection();
|
protection();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if cells using this protection should be locked.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool locked() const;
|
bool locked() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the locked state of the protection to locked and returns a reference to the protection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protection &locked(bool locked);
|
protection &locked(bool locked);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if cells using this protection should be hidden.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool hidden() const;
|
bool hidden() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the hidden state of the protection to hidden and returns a reference to the protection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protection &hidden(bool hidden);
|
protection &hidden(bool hidden);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if left is exactly equal to right.
|
/// Returns true if this protections is equivalent to right.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
XLNT_API friend bool operator==(const protection &left, const protection &right);
|
bool operator==(const protection &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if left is not exactly equal to right.
|
/// Returns true if this protection is not equivalent to right.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
XLNT_API friend bool operator!=(const protection &left, const protection &right)
|
bool operator!=(const protection &other) const;
|
||||||
{
|
|
||||||
return !(left == right);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Whether the cell using this protection is locked or not
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool locked_;
|
bool locked_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Whether the cell using this protection is hidden or not
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool hidden_;
|
bool hidden_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -112,91 +112,101 @@ public:
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class alignment alignment() const;
|
class alignment alignment() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if the alignment of this style should be applied to cells
|
/// Returns true if the alignment of this style should be applied to cells
|
||||||
/// using it.
|
/// using it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool alignment_applied() const;
|
bool alignment_applied() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the alignment of this style to new_alignment. Applied, which defaults
|
/// Sets the alignment of this style to new_alignment. Applied, which defaults
|
||||||
/// to true, determines whether the alignment should be enabled for cells using
|
/// to true, determines whether the alignment should be enabled for cells using
|
||||||
/// this style.
|
/// this style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
style alignment(const xlnt::alignment &new_alignment, bool applied = true);
|
style alignment(const xlnt::alignment &new_alignment, bool applied = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the border of this style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class border border() const;
|
class border border() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the border set for this style should be applied to cells using the style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool border_applied() const;
|
bool border_applied() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the border of this style to new_border. Applied, which defaults
|
||||||
|
/// to true, determines whether the border should be enabled for cells using
|
||||||
|
/// this style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
style border(const xlnt::border &new_border, bool applied = true);
|
style border(const xlnt::border &new_border, bool applied = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the fill of this style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class fill fill() const;
|
class fill fill() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the fill set for this style should be applied to cells using the style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool fill_applied() const;
|
bool fill_applied() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the fill of this style to new_fill. Applied, which defaults
|
||||||
|
/// to true, determines whether the border should be enabled for cells using
|
||||||
|
/// this style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
style fill(const xlnt::fill &new_fill, bool applied = true);
|
style fill(const xlnt::fill &new_fill, bool applied = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the font of this style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class font font() const;
|
class font font() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the font set for this style should be applied to cells using the style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool font_applied() const;
|
bool font_applied() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the font of this style to new_font. Applied, which defaults
|
||||||
|
/// to true, determines whether the font should be enabled for cells using
|
||||||
|
/// this style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
style font(const xlnt::font &new_font, bool applied = true);
|
style font(const xlnt::font &new_font, bool applied = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the number_format of this style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class number_format number_format() const;
|
class number_format number_format() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the number_format set for this style should be applied to cells using the style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool number_format_applied() const;
|
bool number_format_applied() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the number format of this style to new_number_format. Applied, which defaults
|
||||||
|
/// to true, determines whether the number format should be enabled for cells using
|
||||||
|
/// this style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
style number_format(const xlnt::number_format &new_number_format, bool applied = true);
|
style number_format(const xlnt::number_format &new_number_format, bool applied = true);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the protection of this style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class protection protection() const;
|
class protection protection() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the protection set for this style should be applied to cells using the style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool protection_applied() const;
|
bool protection_applied() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the border of this style to new_protection. Applied, which defaults
|
||||||
|
/// to true, determines whether the protection should be enabled for cells using
|
||||||
|
/// this style.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
style protection(const xlnt::protection &new_protection, bool applied = true);
|
style protection(const xlnt::protection &new_protection, bool applied = true);
|
||||||
|
|
||||||
|
@ -238,12 +248,12 @@ private:
|
||||||
friend class detail::xlsx_consumer;
|
friend class detail::xlsx_consumer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a style from an impl pointer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
style(detail::style_impl *d);
|
style(detail::style_impl *d);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The internal implementation of this style
|
||||||
/// </summary>
|
/// </summary>
|
||||||
detail::style_impl *d_;
|
detail::style_impl *d_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,7 +49,7 @@ struct XLNT_API date
|
||||||
static date from_number(int days_since_base_year, calendar base_date);
|
static date from_number(int days_since_base_year, calendar base_date);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a data from a given year, month, and day.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
date(int year_, int month_, int day_);
|
date(int year_, int month_, int day_);
|
||||||
|
|
||||||
|
@ -59,7 +59,8 @@ struct XLNT_API date
|
||||||
int to_number(calendar base_date) const;
|
int to_number(calendar base_date) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Calculates and returns the day of the week that this date represents in the range
|
||||||
|
/// 0 to 6 where 0 represents Sunday.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int weekday() const;
|
int weekday() const;
|
||||||
|
|
||||||
|
@ -69,17 +70,17 @@ struct XLNT_API date
|
||||||
bool operator==(const date &comparand) const;
|
bool operator==(const date &comparand) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The year
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int year;
|
int year;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The month
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int month;
|
int month;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The day
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int day;
|
int day;
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,95 +39,96 @@ struct time;
|
||||||
struct XLNT_API datetime
|
struct XLNT_API datetime
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return the current date and time according to the system time.
|
/// Returns the current date and time according to the system time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static datetime now();
|
static datetime now();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return the current date and time according to the system time.
|
/// Returns the current date and time according to the system time.
|
||||||
/// This is equivalent to datetime::now().
|
/// This is equivalent to datetime::now().
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static datetime today();
|
static datetime today();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return a datetime from number by converting the integer part into
|
/// Returns a datetime from number by converting the integer part into
|
||||||
/// a date and the fractional part into a time according to date::from_number
|
/// a date and the fractional part into a time according to date::from_number
|
||||||
/// and time::from_number.
|
/// and time::from_number.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static datetime from_number(long double number, calendar base_date);
|
static datetime from_number(long double number, calendar base_date);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a datetime equivalent to the ISO-formatted string iso_string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static datetime from_iso_string(const std::string &iso_string);
|
static datetime from_iso_string(const std::string &iso_string);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a datetime from a date and a time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
datetime(const date &d, const time &t);
|
datetime(const date &d, const time &t);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a datetime from a year, month, and day plus optional hour, minute, second, and microsecond.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
datetime(int year_, int month_, int day_, int hour_ = 0, int minute_ = 0, int second_ = 0, int microsecond_ = 0);
|
datetime(int year_, int month_, int day_, int hour_ = 0, int minute_ = 0, int second_ = 0, int microsecond_ = 0);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a string represenation of this date and time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string to_string() const;
|
std::string to_string() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns an ISO-formatted string representation of this date and time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string to_iso_string() const;
|
std::string to_iso_string() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns this datetime as a number of seconds since 1900 or 1904 (depending on base_date provided).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
long double to_number(calendar base_date) const;
|
long double to_number(calendar base_date) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this datetime is equivalent to comparand.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(const datetime &comparand) const;
|
bool operator==(const datetime &comparand) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Calculates and returns the day of the week that this date represents in the range
|
||||||
|
/// 0 to 6 where 0 represents Sunday.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int weekday() const;
|
int weekday() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The year
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int year;
|
int year;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The month
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int month;
|
int month;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The day
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int day;
|
int day;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The hour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int hour;
|
int hour;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The minute
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int minute;
|
int minute;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The second
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int second;
|
int second;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The microsecond
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int microsecond;
|
int microsecond;
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,28 +39,30 @@ class XLNT_API exception : public std::runtime_error
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs an exception with a message. This message will be
|
||||||
|
/// returned by std::exception::what(), an inherited member of this class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
exception(const std::string &message);
|
exception(const std::string &message);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
exception(const exception &) = default;
|
exception(const exception &) = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Destructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
virtual ~exception();
|
virtual ~exception();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the message after the xlnt::exception is constructed. This can show
|
||||||
|
/// more specific information than std::exception::what().
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void message(const std::string &message);
|
void message(const std::string &message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The exception message
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string message_;
|
std::string message_;
|
||||||
};
|
};
|
||||||
|
@ -72,17 +74,17 @@ class XLNT_API invalid_parameter : public exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
invalid_parameter();
|
invalid_parameter();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
invalid_parameter(const invalid_parameter &) = default;
|
invalid_parameter(const invalid_parameter &) = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Destructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
virtual ~invalid_parameter();
|
virtual ~invalid_parameter();
|
||||||
};
|
};
|
||||||
|
@ -94,17 +96,17 @@ class XLNT_API invalid_sheet_title : public exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
invalid_sheet_title(const std::string &title);
|
invalid_sheet_title(const std::string &title);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
invalid_sheet_title(const invalid_sheet_title &) = default;
|
invalid_sheet_title(const invalid_sheet_title &) = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Destructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
virtual ~invalid_sheet_title();
|
virtual ~invalid_sheet_title();
|
||||||
};
|
};
|
||||||
|
@ -116,12 +118,17 @@ class XLNT_API missing_number_format : public exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
missing_number_format();
|
missing_number_format();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default copy constructor.
|
||||||
|
/// </summary>
|
||||||
|
missing_number_format(const missing_number_format &) = default;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Destructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
virtual ~missing_number_format();
|
virtual ~missing_number_format();
|
||||||
};
|
};
|
||||||
|
@ -133,17 +140,18 @@ class XLNT_API invalid_file : public exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs an invalid_file exception thrown when attempt to access
|
||||||
|
/// the given filename.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
invalid_file(const std::string &filename);
|
invalid_file(const std::string &filename);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
invalid_file(const invalid_file &) = default;
|
invalid_file(const invalid_file &) = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Destructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
virtual ~invalid_file();
|
virtual ~invalid_file();
|
||||||
};
|
};
|
||||||
|
@ -156,17 +164,17 @@ class XLNT_API illegal_character : public exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs an illegal_character exception thrown as a result of the given character.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
illegal_character(char c);
|
illegal_character(char c);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
illegal_character(const illegal_character &) = default;
|
illegal_character(const illegal_character &) = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Destructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
virtual ~illegal_character();
|
virtual ~illegal_character();
|
||||||
};
|
};
|
||||||
|
@ -178,41 +186,41 @@ class XLNT_API invalid_data_type : public exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
invalid_data_type();
|
invalid_data_type();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
invalid_data_type(const invalid_data_type &) = default;
|
invalid_data_type(const invalid_data_type &) = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Destructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
virtual ~invalid_data_type();
|
virtual ~invalid_data_type();
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Exception for bad column names in A1-style cell references.
|
/// Exception for bad column indices in A1-style cell references.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class XLNT_API invalid_column_string_index : public exception
|
class XLNT_API invalid_column_index : public exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
invalid_column_string_index();
|
invalid_column_index();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
invalid_column_string_index(const invalid_column_string_index &) = default;
|
invalid_column_index(const invalid_column_index &) = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Destructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
virtual ~invalid_column_string_index();
|
virtual ~invalid_column_index();
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -222,22 +230,22 @@ class XLNT_API invalid_cell_reference : public exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs an invalid_cell_reference exception for the given column and row.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
invalid_cell_reference(column_t column, row_t row);
|
invalid_cell_reference(column_t column, row_t row);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs an invalid_cell_reference exception for the given string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
invalid_cell_reference(const std::string &reference_string);
|
invalid_cell_reference(const std::string &reference_string);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
invalid_cell_reference(const invalid_cell_reference &) = default;
|
invalid_cell_reference(const invalid_cell_reference &) = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Destructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
virtual ~invalid_cell_reference();
|
virtual ~invalid_cell_reference();
|
||||||
};
|
};
|
||||||
|
@ -249,17 +257,17 @@ class XLNT_API invalid_attribute : public exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
invalid_attribute();
|
invalid_attribute();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
invalid_attribute(const invalid_attribute &) = default;
|
invalid_attribute(const invalid_attribute &) = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Destructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
virtual ~invalid_attribute();
|
virtual ~invalid_attribute();
|
||||||
};
|
};
|
||||||
|
@ -271,17 +279,17 @@ class XLNT_API key_not_found : public exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
key_not_found();
|
key_not_found();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
key_not_found(const key_not_found &) = default;
|
key_not_found(const key_not_found &) = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Destructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
virtual ~key_not_found();
|
virtual ~key_not_found();
|
||||||
};
|
};
|
||||||
|
@ -293,17 +301,17 @@ class XLNT_API no_visible_worksheets : public exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
no_visible_worksheets();
|
no_visible_worksheets();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
no_visible_worksheets(const no_visible_worksheets &) = default;
|
no_visible_worksheets(const no_visible_worksheets &) = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Destructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
virtual ~no_visible_worksheets();
|
virtual ~no_visible_worksheets();
|
||||||
};
|
};
|
||||||
|
@ -315,17 +323,17 @@ class XLNT_API unhandled_switch_case : public exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
unhandled_switch_case();
|
unhandled_switch_case();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
unhandled_switch_case(const unhandled_switch_case &) = default;
|
unhandled_switch_case(const unhandled_switch_case &) = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Destructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
virtual ~unhandled_switch_case();
|
virtual ~unhandled_switch_case();
|
||||||
};
|
};
|
||||||
|
@ -337,17 +345,18 @@ class XLNT_API unsupported : public exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs an unsupported exception with a message describing the unsupported
|
||||||
|
/// feature.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
unsupported(const std::string &message);
|
unsupported(const std::string &message);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
unsupported(const unsupported &) = default;
|
unsupported(const unsupported &) = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Destructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
virtual ~unsupported();
|
virtual ~unsupported();
|
||||||
};
|
};
|
||||||
|
|
|
@ -166,7 +166,7 @@ public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if left path is equal to right path.
|
/// Returns true if left path is equal to right path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
friend XLNT_API bool operator==(const path &left, const path &right);
|
bool operator==(const path &other) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -196,7 +196,7 @@ template <>
|
||||||
struct hash<xlnt::path>
|
struct hash<xlnt::path>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a hashed represenation of the given path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
size_t operator()(const xlnt::path &p) const
|
size_t operator()(const xlnt::path &p) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,42 +49,43 @@ struct XLNT_API time
|
||||||
static time from_number(long double number);
|
static time from_number(long double number);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a time object from an optional hour, minute, second, and microsecond.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
explicit time(int hour_ = 0, int minute_ = 0, int second_ = 0, int microsecond_ = 0);
|
explicit time(int hour_ = 0, int minute_ = 0, int second_ = 0, int microsecond_ = 0);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a time object from a string representing the time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
explicit time(const std::string &time_string);
|
explicit time(const std::string &time_string);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a numeric representation of the time in the range 0-1 where the value
|
||||||
|
/// is equal to the fraction of the day elapsed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
long double to_number() const;
|
long double to_number() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this time is equivalent to comparand.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(const time &comparand) const;
|
bool operator==(const time &comparand) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The hour
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int hour;
|
int hour;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The minute
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int minute;
|
int minute;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The second
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int second;
|
int second;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The microsecond
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int microsecond;
|
int microsecond;
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,52 +31,52 @@ namespace xlnt {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a span of time between two datetimes. This is
|
/// Represents a span of time between two datetimes. This is
|
||||||
/// not fully supported yet.
|
/// not fully supported yet throughout the library.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
struct XLNT_API timedelta
|
struct XLNT_API timedelta
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a timedelta from a number representing the factional number of days elapsed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static timedelta from_number(long double number);
|
static timedelta from_number(long double number);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a timedelta equal to zero.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
timedelta();
|
timedelta();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a timedelta from a number of days, hours, minutes, seconds, and microseconds.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
timedelta(int days_, int hours_, int minutes_, int seconds_, int microseconds_);
|
timedelta(int days_, int hours_, int minutes_, int seconds_, int microseconds_);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a numeric representation of this timedelta as a fractional number of days.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
long double to_number() const;
|
long double to_number() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The days
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int days;
|
int days;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The hours
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int hours;
|
int hours;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The minutes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int minutes;
|
int minutes;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The seconds
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int seconds;
|
int seconds;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The microseconds
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int microseconds;
|
int microseconds;
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,22 +43,23 @@ public:
|
||||||
struct lock_verifier
|
struct lock_verifier
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The algorithm used to create and verify this lock.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string hash_algorithm;
|
std::string hash_algorithm;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The initial salt combined with the password used to prevent rainbow table attacks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string salt;
|
std::string salt;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The actual hash value represented as a string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string hash;
|
std::string hash;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The number of times the hash should be applied to the password combined with the salt.
|
||||||
|
/// This allows the difficulty of the hash to be increased as computing power increases.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::size_t spin_count;
|
std::size_t spin_count;
|
||||||
};
|
};
|
||||||
|
|
|
@ -83,158 +83,160 @@ struct XLNT_API page_setup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
page_setup();
|
page_setup();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the page break.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
xlnt::page_break page_break() const;
|
xlnt::page_break page_break() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the page break to b.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void page_break(xlnt::page_break b);
|
void page_break(xlnt::page_break b);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the current sheet state of this page setup.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
xlnt::sheet_state sheet_state() const;
|
xlnt::sheet_state sheet_state() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the sheet state to sheet_state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void sheet_state(xlnt::sheet_state sheet_state);
|
void sheet_state(xlnt::sheet_state sheet_state);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the paper size which should be used to print the worksheet using this page setup.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
xlnt::paper_size paper_size() const;
|
xlnt::paper_size paper_size() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the paper size of this page setup.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void paper_size(xlnt::paper_size paper_size);
|
void paper_size(xlnt::paper_size paper_size);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the orientation of the worksheet using this page setup.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
xlnt::orientation orientation() const;
|
xlnt::orientation orientation() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the orientation of the page.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void orientation(xlnt::orientation orientation);
|
void orientation(xlnt::orientation orientation);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this worksheet should be scaled to fit on a single page during printing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool fit_to_page() const;
|
bool fit_to_page() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// If true, forces the worksheet to be scaled to fit on a single page during printing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void fit_to_page(bool fit_to_page);
|
void fit_to_page(bool fit_to_page);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the height of this worksheet should be scaled to fit on a printed page.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool fit_to_height() const;
|
bool fit_to_height() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets whether the height of the page should be scaled to fit on a printed page.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void fit_to_height(bool fit_to_height);
|
void fit_to_height(bool fit_to_height);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the width of this worksheet should be scaled to fit on a printed page.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool fit_to_width() const;
|
bool fit_to_width() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets whether the width of the page should be scaled to fit on a printed page.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void fit_to_width(bool fit_to_width);
|
void fit_to_width(bool fit_to_width);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets whether the worksheet should be centered horizontall on the page if it takes
|
||||||
|
/// up less than a full page.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void horizontal_centered(bool horizontal_centered);
|
void horizontal_centered(bool horizontal_centered);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns whether horizontal centering has been enabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool horizontal_centered() const;
|
bool horizontal_centered() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets whether the worksheet should be vertically centered on the page if it takes
|
||||||
|
/// up less than a full page.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void vertical_centered(bool vertical_centered);
|
void vertical_centered(bool vertical_centered);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns whether vertical centering has been enabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool vertical_centered() const;
|
bool vertical_centered() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the factor by which the page should be scaled during printing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void scale(double scale);
|
void scale(double scale);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the factor by which the page should be scaled during printing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double scale() const;
|
double scale() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The break
|
||||||
/// </summary>
|
/// </summary>
|
||||||
xlnt::page_break break_;
|
xlnt::page_break break_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The sheet state
|
||||||
/// </summary>
|
/// </summary>
|
||||||
xlnt::sheet_state sheet_state_;
|
xlnt::sheet_state sheet_state_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The paper size
|
||||||
/// </summary>
|
/// </summary>
|
||||||
xlnt::paper_size paper_size_;
|
xlnt::paper_size paper_size_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The orientation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
xlnt::orientation orientation_;
|
xlnt::orientation orientation_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Whether or not to fit to page
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool fit_to_page_;
|
bool fit_to_page_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Whether or not to fit to height
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool fit_to_height_;
|
bool fit_to_height_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Whether or not to fit to width
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool fit_to_width_;
|
bool fit_to_width_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Whether or not to center the content horizontally
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool horizontal_centered_;
|
bool horizontal_centered_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Whether or not to center the conent vertically
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool vertical_centered_;
|
bool vertical_centered_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The amount to scale the worksheet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double scale_;
|
double scale_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Enumeration of possible states of a pane
|
||||||
/// </summary>
|
/// </summary>
|
||||||
enum class XLNT_API pane_state
|
enum class XLNT_API pane_state
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ enum class XLNT_API pane_state
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Enumeration of the four quadrants of a worksheet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
enum class XLNT_API pane_corner
|
enum class XLNT_API pane_corner
|
||||||
{
|
{
|
||||||
|
@ -57,27 +57,27 @@ enum class XLNT_API pane_corner
|
||||||
struct XLNT_API pane
|
struct XLNT_API pane
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The optional top left cell
|
||||||
/// </summary>
|
/// </summary>
|
||||||
optional<cell_reference> top_left_cell;
|
optional<cell_reference> top_left_cell;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The state of the pane
|
||||||
/// </summary>
|
/// </summary>
|
||||||
pane_state state = pane_state::split;
|
pane_state state = pane_state::split;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The pane which contains the active cell
|
||||||
/// </summary>
|
/// </summary>
|
||||||
pane_corner active_pane = pane_corner::top_left;
|
pane_corner active_pane = pane_corner::top_left;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The row where the split should take place
|
||||||
/// </summary>
|
/// </summary>
|
||||||
row_t y_split = 1;
|
row_t y_split = 1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The column where the split should take place
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t x_split = 1;
|
column_t x_split = 1;
|
||||||
|
|
||||||
|
|
|
@ -48,122 +48,106 @@ class XLNT_API range
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Alias for the iterator type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
using iterator = range_iterator;
|
using iterator = range_iterator;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Alias for the const iterator type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
using const_iterator = const_range_iterator;
|
using const_iterator = const_range_iterator;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Alias for the reverse iterator type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
using reverse_iterator = std::reverse_iterator<iterator>;
|
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Alias for the const reverse iterator type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a range on the given worksheet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range(worksheet ws, const range_reference &reference, major_order order = major_order::row, bool skip_null = false);
|
range(worksheet ws, const range_reference &reference,
|
||||||
|
major_order order = major_order::row, bool skip_null = false);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Desctructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
~range();
|
~range();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range(const range &) = default;
|
range(const range &) = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a vector pointing to the n-th row or column in this range (depending
|
||||||
|
/// on major order).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
cell_vector operator[](std::size_t vector_index);
|
cell_vector vector(std::size_t n);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a vector pointing to the n-th row or column in this range (depending
|
||||||
|
/// on major order).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const cell_vector operator[](std::size_t vector_index) const;
|
const cell_vector vector(std::size_t n) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a cell in the range relative to its top left cell.
|
||||||
/// </summary>
|
|
||||||
bool operator==(const range &comparand) const;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
bool operator!=(const range &comparand) const;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
cell_vector vector(std::size_t vector_index);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
const cell_vector vector(std::size_t vector_index) const;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class cell cell(const cell_reference &ref);
|
class cell cell(const cell_reference &ref);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a cell in the range relative to its top left cell.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const class cell cell(const cell_reference &ref) const;
|
const class cell cell(const cell_reference &ref) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the reference defining the bounds of this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_reference reference() const;
|
range_reference reference() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the number of rows or columns in this range (depending on major order).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::size_t length() const;
|
std::size_t length() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the given cell exists in the parent worksheet of this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool contains(const cell_reference &ref);
|
bool contains(const cell_reference &ref);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the alignment of all cells in the range to new_alignment and returns the range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range alignment(const xlnt::alignment &new_alignment);
|
range alignment(const xlnt::alignment &new_alignment);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the border of all cells in the range to new_border and returns the range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range border(const xlnt::border &new_border);
|
range border(const xlnt::border &new_border);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the fill of all cells in the range to new_fill and returns the range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range fill(const xlnt::fill &new_fill);
|
range fill(const xlnt::fill &new_fill);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the font of all cells in the range to new_font and returns the range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range font(const xlnt::font &new_font);
|
range font(const xlnt::font &new_font);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the number format of all cells in the range to new_number_format and
|
||||||
|
/// returns the range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range number_format(const xlnt::number_format &new_number_format);
|
range number_format(const xlnt::number_format &new_number_format);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the protection of all cells in the range to new_protection and returns the range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range protection(const xlnt::protection &new_protection);
|
range protection(const xlnt::protection &new_protection);
|
||||||
|
|
||||||
|
@ -180,108 +164,128 @@ public:
|
||||||
range style(const std::string &style_name);
|
range style(const std::string &style_name);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the first row or column in this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
cell_vector front();
|
cell_vector front();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the first row or column in this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const cell_vector front() const;
|
const cell_vector front() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the last row or column in this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
cell_vector back();
|
cell_vector back();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the last row or column in this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const cell_vector back() const;
|
const cell_vector back() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns an iterator to the first row or column in this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
iterator begin();
|
iterator begin();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns an iterator to one past the last row or column in this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
iterator end();
|
iterator end();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns an iterator to the first row or column in this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const_iterator begin() const;
|
const_iterator begin() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns an iterator to one past the last row or column in this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const_iterator end() const;
|
const_iterator end() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns an iterator to the first row or column in this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const_iterator cbegin() const;
|
const_iterator cbegin() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns an iterator to one past the last row or column in this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const_iterator cend() const;
|
const_iterator cend() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a reverse iterator to the first row or column in this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
reverse_iterator rbegin();
|
reverse_iterator rbegin();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a reverse iterator to one past the last row or column in this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
reverse_iterator rend();
|
reverse_iterator rend();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a reverse iterator to the first row or column in this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const_reverse_iterator rbegin() const;
|
const_reverse_iterator rbegin() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a reverse iterator to one past the last row or column in this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const_reverse_iterator rend() const;
|
const_reverse_iterator rend() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a reverse iterator to the first row or column in this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const_reverse_iterator crbegin() const;
|
const_reverse_iterator crbegin() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a reverse iterator to one past the last row or column in this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const_reverse_iterator crend() const;
|
const_reverse_iterator crend() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Applies function f to all cells in the range
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void apply(std::function<void(class cell)> f);
|
void apply(std::function<void(class cell)> f);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the n-th row or column in this range.
|
||||||
|
/// </summary>
|
||||||
|
cell_vector operator[](std::size_t n);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the n-th row or column in this range.
|
||||||
|
/// </summary>
|
||||||
|
const cell_vector operator[](std::size_t n) const;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if this range is equivalent to comparand.
|
||||||
|
/// </summary>
|
||||||
|
bool operator==(const range &comparand) const;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if this range is not equivalent to comparand.
|
||||||
|
/// </summary>
|
||||||
|
bool operator!=(const range &comparand) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The worksheet this range is within
|
||||||
/// </summary>
|
/// </summary>
|
||||||
worksheet ws_;
|
worksheet ws_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The reference of this range
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_reference ref_;
|
range_reference ref_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Whether this range should be iterated by columns or rows first
|
||||||
/// </summary>
|
/// </summary>
|
||||||
major_order order_;
|
major_order order_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Whether null rows/columns and cells should be skipped during iteration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool skip_null_;
|
bool skip_null_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,74 +49,75 @@ class XLNT_API range_iterator : public r_iter_type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a range iterator on a worksheet, cell pointing to the current
|
||||||
|
/// row or column, range bounds, an order, and whether or not to skip null column/rows.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_iterator(worksheet &ws, const cell_reference &cursor,
|
range_iterator(worksheet &ws, const cell_reference &cursor,
|
||||||
const range_reference &bounds, major_order order, bool skip_null);
|
const range_reference &bounds, major_order order, bool skip_null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_iterator(const range_iterator &other);
|
range_iterator(const range_iterator &other);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Dereference the iterator to return a column or row.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
cell_vector operator*() const;
|
cell_vector operator*() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default assignment operator.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_iterator &operator=(const range_iterator &) = default;
|
range_iterator &operator=(const range_iterator &) = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this iterator is equivalent to other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(const range_iterator &other) const;
|
bool operator==(const range_iterator &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this iterator is not equivalent to other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(const range_iterator &other) const;
|
bool operator!=(const range_iterator &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Pre-decrement the iterator to point to the previous row/column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_iterator &operator--();
|
range_iterator &operator--();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Post-decrement the iterator to point to the previous row/column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_iterator operator--(int);
|
range_iterator operator--(int);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Pre-increment the iterator to point to the next row/column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_iterator &operator++();
|
range_iterator &operator++();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Post-increment the iterator to point to the next row/column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_iterator operator++(int);
|
range_iterator operator++(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The worksheet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
worksheet ws_;
|
worksheet ws_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The first cell in the current row/column
|
||||||
/// </summary>
|
/// </summary>
|
||||||
cell_reference cursor_;
|
cell_reference cursor_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The bounds of the range
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_reference bounds_;
|
range_reference bounds_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Whether rows or columns should be iterated over first
|
||||||
/// </summary>
|
/// </summary>
|
||||||
major_order order_;
|
major_order order_;
|
||||||
|
|
||||||
|
@ -140,74 +141,75 @@ class XLNT_API const_range_iterator : public cr_iter_type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a range iterator on a worksheet, cell pointing to the current
|
||||||
|
/// row or column, range bounds, an order, and whether or not to skip null column/rows.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const_range_iterator(const worksheet &ws, const cell_reference &cursor,
|
const_range_iterator(const worksheet &ws, const cell_reference &cursor,
|
||||||
const range_reference &bounds, major_order order, bool skip_null);
|
const range_reference &bounds, major_order order, bool skip_null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Copy constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const_range_iterator(const const_range_iterator &other);
|
const_range_iterator(const const_range_iterator &other);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Dereferennce the iterator to return the current column/row.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const cell_vector operator*() const;
|
const cell_vector operator*() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Default assignment operator.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const_range_iterator &operator=(const const_range_iterator &) = default;
|
const_range_iterator &operator=(const const_range_iterator &) = default;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this iterator is equivalent to other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(const const_range_iterator &other) const;
|
bool operator==(const const_range_iterator &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this iterator is not equivalent to other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(const const_range_iterator &other) const;
|
bool operator!=(const const_range_iterator &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Pre-decrement the iterator to point to the next row/column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const_range_iterator &operator--();
|
const_range_iterator &operator--();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Post-decrement the iterator to point to the next row/column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const_range_iterator operator--(int);
|
const_range_iterator operator--(int);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Pre-increment the iterator to point to the next row/column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const_range_iterator &operator++();
|
const_range_iterator &operator++();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Post-increment the iterator to point to the next row/column.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const_range_iterator operator++(int);
|
const_range_iterator operator++(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The implementation of the worksheet this iterator points to
|
||||||
/// </summary>
|
/// </summary>
|
||||||
detail::worksheet_impl *ws_;
|
detail::worksheet_impl *ws_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The first cell in the current row or column this iterator points to
|
||||||
/// </summary>
|
/// </summary>
|
||||||
cell_reference cursor_;
|
cell_reference cursor_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The range this iterator starts and ends in
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_reference bounds_;
|
range_reference bounds_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Determines whether iteration should move through rows or columns first
|
||||||
/// </summary>
|
/// </summary>
|
||||||
major_order order_;
|
major_order order_;
|
||||||
|
|
||||||
|
|
|
@ -36,165 +36,155 @@ class XLNT_API range_reference
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Convert a coordinate to an absolute coordinate string (B12 -> $B$12)
|
/// Converts relative reference coordinates to absolute coordinates (B12 -> $B$12)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static range_reference make_absolute(const range_reference &relative_reference);
|
static range_reference make_absolute(const range_reference &relative_reference);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a range reference equal to A1:A1
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_reference();
|
range_reference();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a range reference equivalent to the provided range_string in the form
|
||||||
|
/// <top_left>:<bottom_right>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
explicit range_reference(const std::string &range_string);
|
explicit range_reference(const std::string &range_string);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a range reference equivalent to the provided range_string in the form
|
||||||
|
/// <top_left>:<bottom_right>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
explicit range_reference(const char *range_string);
|
explicit range_reference(const char *range_string);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a range reference from a pair of cell references.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
explicit range_reference(const std::pair<cell_reference, cell_reference> &reference_pair);
|
explicit range_reference(const std::pair<cell_reference, cell_reference> &reference_pair);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a range reference from cell references indicating top
|
||||||
|
/// left and bottom right coordinates of the range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_reference(const cell_reference &start, const cell_reference &end);
|
range_reference(const cell_reference &start, const cell_reference &end);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Constructs a range reference from column and row indices.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_reference(column_t column_index_start, row_t row_index_start, column_t column_index_end, row_t row_index_end);
|
range_reference(column_t column_index_start, row_t row_index_start,
|
||||||
|
column_t column_index_end, row_t row_index_end);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the range has a width and height of 1 cell.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool is_single_cell() const;
|
bool is_single_cell() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the number of columns encompassed by this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::size_t width() const;
|
std::size_t width() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the number of rows encompassed by this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::size_t height() const;
|
std::size_t height() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the coordinate of the top left cell of this range.
|
||||||
/// </summary>
|
|
||||||
cell_reference top_left();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
cell_reference top_left() const;
|
cell_reference top_left() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the coordinate of the top right cell of this range.
|
||||||
/// </summary>
|
|
||||||
cell_reference top_right();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
cell_reference top_right() const;
|
cell_reference top_right() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the coordinate of the bottom left cell of this range.
|
||||||
/// </summary>
|
|
||||||
cell_reference bottom_left();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
cell_reference bottom_left() const;
|
cell_reference bottom_left() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the coordinate of the bottom right cell of this range.
|
||||||
/// </summary>
|
|
||||||
cell_reference bottom_right();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
cell_reference bottom_right() const;
|
cell_reference bottom_right() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a new range reference with the same width and height as this
|
||||||
|
/// range but shifted by the given number of columns and rows.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_reference make_offset(int column_offset, int row_offset) const;
|
range_reference make_offset(int column_offset, int row_offset) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a string representation of this range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string to_string() const;
|
std::string to_string() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this range is equivalent to the other range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(const range_reference &comparand) const;
|
bool operator==(const range_reference &comparand) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this range is equivalent to the string representation
|
||||||
|
/// of the other range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(const std::string &reference_string) const;
|
bool operator==(const std::string &reference_string) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this range is equivalent to the string representation
|
||||||
|
/// of the other range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(const char *reference_string) const;
|
bool operator==(const char *reference_string) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this range is not equivalent to the other range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(const range_reference &comparand) const;
|
bool operator!=(const range_reference &comparand) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this range is not equivalent to the string representation
|
||||||
|
/// of the other range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(const std::string &reference_string) const;
|
bool operator!=(const std::string &reference_string) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this range is not equivalent to the string representation
|
||||||
|
/// of the other range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(const char *reference_string) const;
|
bool operator!=(const char *reference_string) const;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
XLNT_API friend bool operator==(const std::string &reference_string, const range_reference &ref);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
XLNT_API friend bool operator==(const char *reference_string, const range_reference &ref);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
XLNT_API friend bool operator!=(const std::string &reference_string, const range_reference &ref);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
XLNT_API friend bool operator!=(const char *reference_string, const range_reference &ref);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The top left cell in the range
|
||||||
/// </summary>
|
/// </summary>
|
||||||
cell_reference top_left_;
|
cell_reference top_left_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The bottom right cell in the range
|
||||||
/// </summary>
|
/// </summary>
|
||||||
cell_reference bottom_right_;
|
cell_reference bottom_right_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if the string representation of the range is equivalent to ref.
|
||||||
|
/// </summary>
|
||||||
|
XLNT_API bool operator==(const std::string &reference_string, const range_reference &ref);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if the string representation of the range is equivalent to ref.
|
||||||
|
/// </summary>
|
||||||
|
XLNT_API bool operator==(const char *reference_string, const range_reference &ref);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if the string representation of the range is not equivalent to ref.
|
||||||
|
/// </summary>
|
||||||
|
XLNT_API bool operator!=(const std::string &reference_string, const range_reference &ref);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if the string representation of the range is not equivalent to ref.
|
||||||
|
/// </summary>
|
||||||
|
XLNT_API bool operator!=(const char *reference_string, const range_reference &ref);
|
||||||
|
|
||||||
|
|
||||||
} // namespace xlnt
|
} // namespace xlnt
|
||||||
|
|
|
@ -35,22 +35,22 @@ class XLNT_API row_properties
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Optional height
|
||||||
/// </summary>
|
/// </summary>
|
||||||
optional<double> height;
|
optional<double> height;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Whether or not the height is different from the default
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool custom_height = false;
|
bool custom_height = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Whether or not the row should be hidden
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool hidden = false;
|
bool hidden = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The index to the style used by all cells in this row
|
||||||
/// </summary>
|
/// </summary>
|
||||||
optional<std::size_t> style;
|
optional<std::size_t> style;
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,7 +37,7 @@ class XLNT_API selection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this selection has a defined active cell.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool has_active_cell() const
|
bool has_active_cell() const
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the cell reference of the active cell.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
cell_reference active_cell() const
|
cell_reference active_cell() const
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the active cell to that pointed to by ref.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void active_cell(const cell_reference &ref)
|
void active_cell(const cell_reference &ref)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the range encompassed by this selection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_reference sqref() const
|
range_reference sqref() const
|
||||||
{
|
{
|
||||||
|
@ -69,7 +69,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the sheet quadrant of this selection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
pane_corner pane() const
|
pane_corner pane() const
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the sheet quadrant of this selection to corner.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void pane(pane_corner corner)
|
void pane(pane_corner corner)
|
||||||
{
|
{
|
||||||
|
@ -91,22 +91,23 @@ public:
|
||||||
bool operator==(const selection &rhs) const
|
bool operator==(const selection &rhs) const
|
||||||
{
|
{
|
||||||
return active_cell_ == rhs.active_cell_
|
return active_cell_ == rhs.active_cell_
|
||||||
&& sqref_ == rhs.sqref_ && pane_ == rhs.pane_;
|
&& sqref_ == rhs.sqref_
|
||||||
|
&& pane_ == rhs.pane_;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The active cell
|
||||||
/// </summary>
|
/// </summary>
|
||||||
optional<cell_reference> active_cell_;
|
optional<cell_reference> active_cell_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The range
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_reference sqref_;
|
range_reference sqref_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The quadrant
|
||||||
/// </summary>
|
/// </summary>
|
||||||
pane_corner pane_;
|
pane_corner pane_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
|
// TOOD: does this really need its own class?
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Protection applied to a particular worksheet to prevent it from being modified.
|
/// Protection applied to a particular worksheet to prevent it from being modified.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -37,23 +39,23 @@ class XLNT_API sheet_protection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Calculates and returns the hash of the given protection password.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static std::string hash_password(const std::string &password);
|
static std::string hash_password(const std::string &password);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the protection password to password.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void password(const std::string &password);
|
void password(const std::string &password);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the hash of the password set for this sheet protection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string hashed_password() const;
|
std::string hashed_password() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The hash of the password.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::string hashed_password_;
|
std::string hashed_password_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Enumeration of possible types of sheet views
|
||||||
/// </summary>
|
/// </summary>
|
||||||
enum class sheet_view_type
|
enum class sheet_view_type
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ class XLNT_API sheet_view
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the ID of this view to new_id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void id(std::size_t new_id)
|
void id(std::size_t new_id)
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the ID of this view.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::size_t id() const
|
std::size_t id() const
|
||||||
{
|
{
|
||||||
|
@ -65,7 +65,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this view has a pane defined.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool has_pane() const
|
bool has_pane() const
|
||||||
{
|
{
|
||||||
|
@ -73,7 +73,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a reference to this view's pane.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
struct pane &pane()
|
struct pane &pane()
|
||||||
{
|
{
|
||||||
|
@ -81,7 +81,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a reference to this view's pane.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const struct pane &pane() const
|
const struct pane &pane() const
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Removes the defined pane from this view.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void clear_pane()
|
void clear_pane()
|
||||||
{
|
{
|
||||||
|
@ -97,7 +97,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the pane of this view to new_pane.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void pane(const struct pane &new_pane)
|
void pane(const struct pane &new_pane)
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this view has any selections.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool has_selections() const
|
bool has_selections() const
|
||||||
{
|
{
|
||||||
|
@ -113,7 +113,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Adds the given selection to the collection of selections.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void add_selection(const class selection &new_selection)
|
void add_selection(const class selection &new_selection)
|
||||||
{
|
{
|
||||||
|
@ -121,7 +121,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Removes all selections.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void clear_selections()
|
void clear_selections()
|
||||||
{
|
{
|
||||||
|
@ -129,7 +129,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the collection of selections as a vector.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::vector<xlnt::selection> selections() const
|
std::vector<xlnt::selection> selections() const
|
||||||
{
|
{
|
||||||
|
@ -137,7 +137,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the selection at the given index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class xlnt::selection &selection(std::size_t index)
|
class xlnt::selection &selection(std::size_t index)
|
||||||
{
|
{
|
||||||
|
@ -145,7 +145,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// If show is true, grid lines will be shown for sheets using this view.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void show_grid_lines(bool show)
|
void show_grid_lines(bool show)
|
||||||
{
|
{
|
||||||
|
@ -153,7 +153,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if grid lines will be shown for sheets using this view.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool show_grid_lines() const
|
bool show_grid_lines() const
|
||||||
{
|
{
|
||||||
|
@ -161,7 +161,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// If is_default is true, the default grid color will be used.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void default_grid_color(bool is_default)
|
void default_grid_color(bool is_default)
|
||||||
{
|
{
|
||||||
|
@ -169,7 +169,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if the default grid color will be used.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool default_grid_color() const
|
bool default_grid_color() const
|
||||||
{
|
{
|
||||||
|
@ -205,32 +205,32 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::size_t id_ = 0;
|
std::size_t id_ = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Whether or not to show grid lines
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool show_grid_lines_ = true;
|
bool show_grid_lines_ = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Whether or not to use the default grid color
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool default_grid_color_ = true;
|
bool default_grid_color_ = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The type of this view
|
||||||
/// </summary>
|
/// </summary>
|
||||||
sheet_view_type type_ = sheet_view_type::normal;
|
sheet_view_type type_ = sheet_view_type::normal;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The optional pane
|
||||||
/// </summary>
|
/// </summary>
|
||||||
optional<xlnt::pane> pane_;
|
optional<xlnt::pane> pane_;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The collection of selections
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::vector<xlnt::selection> selections_;
|
std::vector<xlnt::selection> selections_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -320,17 +320,17 @@ public:
|
||||||
// named range
|
// named range
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Creates a new named range with the given name encompassing the string representing a range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void create_named_range(const std::string &name, const std::string &reference_string);
|
void create_named_range(const std::string &name, const std::string &reference_string);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Creates a new named range with the given name encompassing the given range reference.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void create_named_range(const std::string &name, const range_reference &reference);
|
void create_named_range(const std::string &name, const range_reference &reference);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this worksheet contains a named range with the given name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool has_named_range(const std::string &name) const;
|
bool has_named_range(const std::string &name) const;
|
||||||
|
|
||||||
|
@ -354,96 +354,86 @@ public:
|
||||||
// extents
|
// extents
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the row of the first non-empty cell in the worksheet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
row_t lowest_row() const;
|
row_t lowest_row() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the row of the last non-empty cell in the worksheet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
row_t highest_row() const;
|
row_t highest_row() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the row directly below the last non-empty cell in the worksheet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
row_t next_row() const;
|
row_t next_row() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the column of the first non-empty cell in the worksheet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t lowest_column() const;
|
column_t lowest_column() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns the column of the last non-empty cell in the worksheet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
column_t highest_column() const;
|
column_t highest_column() const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a range_reference pointing to the full range of non-empty cells in the worksheet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
range_reference calculate_dimension() const;
|
range_reference calculate_dimension() const;
|
||||||
|
|
||||||
// cell merge
|
// cell merge
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Merges the cells within the range represented by the given string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void merge_cells(const std::string &reference_string);
|
void merge_cells(const std::string &reference_string);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Merges the cells within the given range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void merge_cells(const range_reference &reference);
|
void merge_cells(const range_reference &reference);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Removes the merging of the cells in the range represented by the given string.
|
||||||
/// </summary>
|
|
||||||
void merge_cells(column_t start_column, row_t start_row, column_t end_column, row_t end_row);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void unmerge_cells(const std::string &reference_string);
|
void unmerge_cells(const std::string &reference_string);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Removes the merging of the cells in the given range.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void unmerge_cells(const range_reference &reference);
|
void unmerge_cells(const range_reference &reference);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns a vector of references of all merged ranges in the worksheet.
|
||||||
/// </summary>
|
|
||||||
void unmerge_cells(column_t start_column, row_t start_row, column_t end_column, row_t end_row);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
std::vector<range_reference> merged_ranges() const;
|
std::vector<range_reference> merged_ranges() const;
|
||||||
|
|
||||||
// operators
|
// operators
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this worksheet refers to the same worksheet as other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(const worksheet &other) const;
|
bool operator==(const worksheet &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this worksheet doesn't refer to the same worksheet as other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(const worksheet &other) const;
|
bool operator!=(const worksheet &other) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this worksheet is null.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator==(std::nullptr_t) const;
|
bool operator==(std::nullptr_t) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Returns true if this worksheet is not null.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool operator!=(std::nullptr_t) const;
|
bool operator!=(std::nullptr_t) const;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Sets the internal pointer of this worksheet object to point to other.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void operator=(const worksheet &other);
|
void operator=(const worksheet &other);
|
||||||
|
|
||||||
|
|
|
@ -103,9 +103,14 @@ int comment::height() const
|
||||||
return height_;
|
return height_;
|
||||||
}
|
}
|
||||||
|
|
||||||
XLNT_API bool operator==(const comment &left, const comment &right)
|
bool comment::operator==(const comment &other) const
|
||||||
{
|
{
|
||||||
return left.text_ == right.text_ && left.author_ == right.author_;
|
return text_ == other.text_ && author_ == other.author_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool comment::operator!=(const comment &other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xlnt
|
} // namespace xlnt
|
||||||
|
|
|
@ -33,7 +33,7 @@ column_t::index_t column_t::column_index_from_string(const std::string &column_s
|
||||||
{
|
{
|
||||||
if (column_string.length() > 3 || column_string.empty())
|
if (column_string.length() > 3 || column_string.empty())
|
||||||
{
|
{
|
||||||
throw invalid_column_string_index();
|
throw invalid_column_index();
|
||||||
}
|
}
|
||||||
|
|
||||||
column_t::index_t column_index = 0;
|
column_t::index_t column_index = 0;
|
||||||
|
@ -43,7 +43,7 @@ column_t::index_t column_t::column_index_from_string(const std::string &column_s
|
||||||
{
|
{
|
||||||
if (!std::isalpha(column_string[static_cast<std::size_t>(i)], std::locale::classic()))
|
if (!std::isalpha(column_string[static_cast<std::size_t>(i)], std::locale::classic()))
|
||||||
{
|
{
|
||||||
throw invalid_column_string_index();
|
throw invalid_column_index();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto char_index = std::toupper(column_string[static_cast<std::size_t>(i)], std::locale::classic()) - 'A';
|
auto char_index = std::toupper(column_string[static_cast<std::size_t>(i)], std::locale::classic()) - 'A';
|
||||||
|
@ -65,7 +65,7 @@ std::string column_t::column_string_from_index(column_t::index_t column_index)
|
||||||
// columns
|
// columns
|
||||||
if (column_index < constants::min_column() || column_index > constants::max_column())
|
if (column_index < constants::min_column() || column_index > constants::max_column())
|
||||||
{
|
{
|
||||||
throw invalid_column_string_index();
|
throw invalid_column_index();
|
||||||
}
|
}
|
||||||
|
|
||||||
int temp = static_cast<int>(column_index);
|
int temp = static_cast<int>(column_index);
|
||||||
|
@ -268,24 +268,6 @@ column_t operator-(column_t lhs, const column_t &rhs)
|
||||||
return lhs;
|
return lhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
column_t operator*(column_t lhs, const column_t &rhs)
|
|
||||||
{
|
|
||||||
lhs *= rhs;
|
|
||||||
return lhs;
|
|
||||||
}
|
|
||||||
|
|
||||||
column_t operator/(column_t lhs, const column_t &rhs)
|
|
||||||
{
|
|
||||||
lhs /= rhs;
|
|
||||||
return lhs;
|
|
||||||
}
|
|
||||||
|
|
||||||
column_t operator%(column_t lhs, const column_t &rhs)
|
|
||||||
{
|
|
||||||
lhs %= rhs;
|
|
||||||
return lhs;
|
|
||||||
}
|
|
||||||
|
|
||||||
column_t &column_t::operator+=(const column_t &rhs)
|
column_t &column_t::operator+=(const column_t &rhs)
|
||||||
{
|
{
|
||||||
index += rhs.index;
|
index += rhs.index;
|
||||||
|
@ -298,24 +280,6 @@ column_t &column_t::operator-=(const column_t &rhs)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
column_t &column_t::operator*=(const column_t &rhs)
|
|
||||||
{
|
|
||||||
index *= rhs.index;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
column_t &column_t::operator/=(const column_t &rhs)
|
|
||||||
{
|
|
||||||
index /= rhs.index;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
column_t &column_t::operator%=(const column_t &rhs)
|
|
||||||
{
|
|
||||||
index %= rhs.index;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator>(const column_t::index_t &left, const column_t &right)
|
bool operator>(const column_t::index_t &left, const column_t &right)
|
||||||
{
|
{
|
||||||
return column_t(left) > right;
|
return column_t(left) > right;
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
TS_ASSERT(cell.value<xlnt::time>() == xlnt::time(0, 30, 33, 865633));
|
TS_ASSERT(cell.value<xlnt::time>() == xlnt::time(0, 30, 33, 865633));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_ctor()
|
void test_constructor()
|
||||||
{
|
{
|
||||||
xlnt::workbook wb;
|
xlnt::workbook wb;
|
||||||
auto ws = wb.active_sheet();
|
auto ws = wb.active_sheet();
|
||||||
|
@ -195,6 +195,7 @@ public:
|
||||||
auto cell = ws.cell(xlnt::cell_reference(1, 1));
|
auto cell = ws.cell(xlnt::cell_reference(1, 1));
|
||||||
|
|
||||||
cell.value(xlnt::datetime(2010, 7, 13, 6, 37, 41));
|
cell.value(xlnt::datetime(2010, 7, 13, 6, 37, 41));
|
||||||
|
|
||||||
TS_ASSERT(cell.data_type() == xlnt::cell::type::numeric);
|
TS_ASSERT(cell.data_type() == xlnt::cell::type::numeric);
|
||||||
TS_ASSERT(cell.value<long double>() == 40372.27616898148L);
|
TS_ASSERT(cell.value<long double>() == 40372.27616898148L);
|
||||||
TS_ASSERT(cell.is_date());
|
TS_ASSERT(cell.is_date());
|
||||||
|
@ -270,7 +271,8 @@ public:
|
||||||
auto cell = ws.cell(xlnt::cell_reference(1, 1));
|
auto cell = ws.cell(xlnt::cell_reference(1, 1));
|
||||||
|
|
||||||
// The bytes 0x00 through 0x1F inclusive must be manually escaped in values.
|
// The bytes 0x00 through 0x1F inclusive must be manually escaped in values.
|
||||||
auto illegal_chrs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
|
auto illegal_chrs = {0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 15, 16, 17, 18,
|
||||||
|
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
|
||||||
|
|
||||||
for(auto i : illegal_chrs)
|
for(auto i : illegal_chrs)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,25 +8,39 @@
|
||||||
class test_index_types : public CxxTest::TestSuite
|
class test_index_types : public CxxTest::TestSuite
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void test_bad_string()
|
void test_bad_string_empty()
|
||||||
{
|
{
|
||||||
TS_ASSERT_THROWS(xlnt::column_t::column_index_from_string(""), xlnt::invalid_column_string_index);
|
TS_ASSERT_THROWS(xlnt::column_t::column_index_from_string(""),
|
||||||
TS_ASSERT_THROWS(xlnt::column_t::column_index_from_string("ABCD"), xlnt::invalid_column_string_index);
|
xlnt::invalid_column_index);
|
||||||
TS_ASSERT_THROWS(xlnt::column_t::column_index_from_string("123"), xlnt::invalid_column_string_index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_bad_column()
|
void test_bad_string_too_long()
|
||||||
{
|
{
|
||||||
TS_ASSERT_THROWS(xlnt::column_t::column_string_from_index(0), xlnt::invalid_column_string_index);
|
TS_ASSERT_THROWS(xlnt::column_t::column_index_from_string("ABCD"),
|
||||||
|
xlnt::invalid_column_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_bad_string_numbers()
|
||||||
|
{
|
||||||
|
TS_ASSERT_THROWS(xlnt::column_t::column_index_from_string("123"),
|
||||||
|
xlnt::invalid_column_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_bad_index_zero()
|
||||||
|
{
|
||||||
|
TS_ASSERT_THROWS(xlnt::column_t::column_string_from_index(0),
|
||||||
|
xlnt::invalid_column_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_column_operators()
|
void test_column_operators()
|
||||||
{
|
{
|
||||||
xlnt::column_t c1;
|
auto c1 = xlnt::column_t();
|
||||||
c1 = "B";
|
c1 = "B";
|
||||||
xlnt::column_t c2;
|
|
||||||
std::string d = "D";
|
auto c2 = xlnt::column_t();
|
||||||
|
const auto d = std::string("D");
|
||||||
c2 = d;
|
c2 = d;
|
||||||
|
|
||||||
TS_ASSERT(c1 != c2);
|
TS_ASSERT(c1 != c2);
|
||||||
TS_ASSERT(c1 == static_cast<xlnt::column_t::index_t>(2));
|
TS_ASSERT(c1 == static_cast<xlnt::column_t::index_t>(2));
|
||||||
TS_ASSERT(c2 == d);
|
TS_ASSERT(c2 == d);
|
||||||
|
@ -44,18 +58,7 @@ public:
|
||||||
TS_ASSERT_EQUALS(c2, 2);
|
TS_ASSERT_EQUALS(c2, 2);
|
||||||
|
|
||||||
c2 = 4;
|
c2 = 4;
|
||||||
|
|
||||||
TS_ASSERT_EQUALS(c1 * c2, 8);
|
|
||||||
TS_ASSERT_EQUALS(c2 / c1, 2);
|
|
||||||
TS_ASSERT_EQUALS(c2 % c1, 0);
|
|
||||||
|
|
||||||
c1 *= c2;
|
|
||||||
TS_ASSERT_EQUALS(c1, 8);
|
|
||||||
c1 /= c2;
|
|
||||||
TS_ASSERT_EQUALS(c1, 2);
|
|
||||||
c1 = 3;
|
c1 = 3;
|
||||||
c1 %= c2;
|
|
||||||
TS_ASSERT_EQUALS(c1, 3);
|
|
||||||
|
|
||||||
TS_ASSERT(c2 <= 4);
|
TS_ASSERT(c2 <= 4);
|
||||||
TS_ASSERT(!(c2 < 3));
|
TS_ASSERT(!(c2 < 3));
|
||||||
|
|
|
@ -58,11 +58,19 @@ struct format_impl
|
||||||
{
|
{
|
||||||
return left.parent == right.parent
|
return left.parent == right.parent
|
||||||
&& left.alignment_id == right.alignment_id
|
&& left.alignment_id == right.alignment_id
|
||||||
|
&& left.alignment_applied == right.alignment_applied
|
||||||
&& left.border_id == right.border_id
|
&& left.border_id == right.border_id
|
||||||
|
&& left.border_applied == right.border_applied
|
||||||
&& left.fill_id == right.fill_id
|
&& left.fill_id == right.fill_id
|
||||||
|
&& left.fill_applied == right.fill_applied
|
||||||
&& left.font_id == right.font_id
|
&& left.font_id == right.font_id
|
||||||
|
&& left.font_applied == right.font_applied
|
||||||
&& left.number_format_id == right.number_format_id
|
&& left.number_format_id == right.number_format_id
|
||||||
|
&& left.number_format_applied == right.number_format_applied
|
||||||
&& left.protection_id == right.protection_id
|
&& left.protection_id == right.protection_id
|
||||||
|
&& left.protection_applied == right.protection_applied
|
||||||
|
&& left.pivot_button_ == right.pivot_button_
|
||||||
|
&& left.quote_prefix_ == right.quote_prefix_
|
||||||
&& left.style == right.style;
|
&& left.style == right.style;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2181,7 +2181,7 @@ void xlsx_producer::write_worksheet(const relationship &rel)
|
||||||
|
|
||||||
if (cell.has_format())
|
if (cell.has_format())
|
||||||
{
|
{
|
||||||
write_attribute("s", cell.format().id());
|
write_attribute("s", cell.format().d_->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cell.has_hyperlink())
|
if (cell.has_hyperlink())
|
||||||
|
|
|
@ -120,7 +120,7 @@ std::uint8_t rgb_color::alpha() const
|
||||||
|
|
||||||
std::array<std::uint8_t, 3> rgb_color::rgb() const
|
std::array<std::uint8_t, 3> rgb_color::rgb() const
|
||||||
{
|
{
|
||||||
return { red(), green(), blue() };
|
return {{red(), green(), blue()}};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<std::uint8_t, 4> rgb_color::rgba() const
|
std::array<std::uint8_t, 4> rgb_color::rgba() const
|
||||||
|
|
|
@ -207,78 +207,78 @@ std::string font::scheme() const
|
||||||
return scheme_.get();
|
return scheme_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
XLNT_API bool operator==(const font &left, const font &right)
|
bool font::operator==(const font &other) const
|
||||||
{
|
{
|
||||||
if (left.bold() != right.bold())
|
if (bold() != other.bold())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left.has_color() != right.has_color())
|
if (has_color() != other.has_color())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left.has_color())
|
if (has_color())
|
||||||
{
|
{
|
||||||
if (left.color() != right.color())
|
if (color() != other.color())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left.has_family() != right.has_family())
|
if (has_family() != other.has_family())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left.has_family())
|
if (has_family())
|
||||||
{
|
{
|
||||||
if (left.family() != right.family())
|
if (family() != other.family())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left.italic() != right.italic())
|
if (italic() != other.italic())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left.name() != right.name())
|
if (name() != other.name())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left.has_scheme() != right.has_scheme())
|
if (has_scheme() != other.has_scheme())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left.has_scheme())
|
if (has_scheme())
|
||||||
{
|
{
|
||||||
if (left.scheme() != right.scheme())
|
if (scheme() != other.scheme())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::fabs(left.size() - right.size()) != 0.0)
|
if (std::fabs(size() - other.size()) != 0.0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left.strikethrough() != right.strikethrough())
|
if (strikethrough() != other.strikethrough())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left.superscript() != right.superscript())
|
if (superscript() != other.superscript())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (left.underline() != right.underline())
|
if (underline() != other.underline())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,6 @@ format::format(detail::format_impl *d)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t format::id() const
|
|
||||||
{
|
|
||||||
return d_->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void format::clear_style()
|
void format::clear_style()
|
||||||
{
|
{
|
||||||
d_->style.clear();
|
d_->style.clear();
|
||||||
|
@ -81,12 +76,7 @@ const style format::style() const
|
||||||
return d_->parent->style(d_->style.get());
|
return d_->parent->style(d_->style.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
xlnt::alignment &format::alignment()
|
xlnt::alignment format::alignment() const
|
||||||
{
|
|
||||||
return d_->parent->alignments.at(d_->alignment_id.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
const xlnt::alignment &format::alignment() const
|
|
||||||
{
|
{
|
||||||
return d_->parent->alignments.at(d_->alignment_id.get());
|
return d_->parent->alignments.at(d_->alignment_id.get());
|
||||||
}
|
}
|
||||||
|
@ -97,12 +87,7 @@ format format::alignment(const xlnt::alignment &new_alignment, bool applied)
|
||||||
return format(d_);
|
return format(d_);
|
||||||
}
|
}
|
||||||
|
|
||||||
xlnt::border &format::border()
|
xlnt::border format::border() const
|
||||||
{
|
|
||||||
return d_->parent->borders.at(d_->border_id.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
const xlnt::border &format::border() const
|
|
||||||
{
|
{
|
||||||
return d_->parent->borders.at(d_->border_id.get());
|
return d_->parent->borders.at(d_->border_id.get());
|
||||||
}
|
}
|
||||||
|
@ -113,12 +98,7 @@ format format::border(const xlnt::border &new_border, bool applied)
|
||||||
return format(d_);
|
return format(d_);
|
||||||
}
|
}
|
||||||
|
|
||||||
xlnt::fill &format::fill()
|
xlnt::fill format::fill() const
|
||||||
{
|
|
||||||
return d_->parent->fills.at(d_->fill_id.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
const xlnt::fill &format::fill() const
|
|
||||||
{
|
{
|
||||||
return d_->parent->fills.at(d_->fill_id.get());
|
return d_->parent->fills.at(d_->fill_id.get());
|
||||||
}
|
}
|
||||||
|
@ -129,12 +109,7 @@ format format::fill(const xlnt::fill &new_fill, bool applied)
|
||||||
return format(d_);
|
return format(d_);
|
||||||
}
|
}
|
||||||
|
|
||||||
xlnt::font &format::font()
|
xlnt::font format::font() const
|
||||||
{
|
|
||||||
return d_->parent->fonts.at(d_->font_id.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
const xlnt::font &format::font() const
|
|
||||||
{
|
{
|
||||||
return d_->parent->fonts.at(d_->font_id.get());
|
return d_->parent->fonts.at(d_->font_id.get());
|
||||||
}
|
}
|
||||||
|
@ -145,12 +120,7 @@ format format::font(const xlnt::font &new_font, bool applied)
|
||||||
return format(d_);
|
return format(d_);
|
||||||
}
|
}
|
||||||
|
|
||||||
xlnt::number_format &format::number_format()
|
xlnt::number_format format::number_format() const
|
||||||
{
|
|
||||||
return d_->parent->number_formats.at(d_->number_format_id.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
const xlnt::number_format &format::number_format() const
|
|
||||||
{
|
{
|
||||||
if (number_format::is_builtin_format(d_->number_format_id.get()))
|
if (number_format::is_builtin_format(d_->number_format_id.get()))
|
||||||
{
|
{
|
||||||
|
@ -175,12 +145,7 @@ format format::number_format(const xlnt::number_format &new_number_format, bool
|
||||||
return format(d_);
|
return format(d_);
|
||||||
}
|
}
|
||||||
|
|
||||||
xlnt::protection &format::protection()
|
xlnt::protection format::protection() const
|
||||||
{
|
|
||||||
return d_->parent->protections.at(d_->protection_id.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
const xlnt::protection &format::protection() const
|
|
||||||
{
|
{
|
||||||
return d_->parent->protections.at(d_->protection_id.get());
|
return d_->parent->protections.at(d_->protection_id.get());
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,15 +244,13 @@ number_format::number_format(std::size_t id)
|
||||||
}
|
}
|
||||||
|
|
||||||
number_format::number_format(const std::string &format_string)
|
number_format::number_format(const std::string &format_string)
|
||||||
: id_set_(false), id_(0)
|
: format_string_(format_string)
|
||||||
{
|
{
|
||||||
this->format_string(format_string);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
number_format::number_format(const std::string &format_string, std::size_t id)
|
number_format::number_format(const std::string &format, std::size_t id)
|
||||||
: id_set_(false), id_(0)
|
|
||||||
{
|
{
|
||||||
this->format_string(format_string, id);
|
format_string(format, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool number_format::is_builtin_format(std::size_t builtin_id)
|
bool number_format::is_builtin_format(std::size_t builtin_id)
|
||||||
|
@ -279,14 +277,12 @@ void number_format::format_string(const std::string &format_string)
|
||||||
{
|
{
|
||||||
format_string_ = format_string;
|
format_string_ = format_string;
|
||||||
id_ = 0;
|
id_ = 0;
|
||||||
id_set_ = false;
|
|
||||||
|
|
||||||
for (const auto &pair : builtin_formats())
|
for (const auto &pair : builtin_formats())
|
||||||
{
|
{
|
||||||
if (pair.second.format_string() == format_string)
|
if (pair.second.format_string() == format_string)
|
||||||
{
|
{
|
||||||
id_ = pair.first;
|
id_ = pair.first;
|
||||||
id_set_ = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,28 +292,26 @@ void number_format::format_string(const std::string &format_string, std::size_t
|
||||||
{
|
{
|
||||||
format_string_ = format_string;
|
format_string_ = format_string;
|
||||||
id_ = id;
|
id_ = id;
|
||||||
id_set_ = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool number_format::has_id() const
|
bool number_format::has_id() const
|
||||||
{
|
{
|
||||||
return id_set_;
|
return id_.is_set();
|
||||||
}
|
}
|
||||||
|
|
||||||
void number_format::id(std::size_t id)
|
void number_format::id(std::size_t id)
|
||||||
{
|
{
|
||||||
id_ = id;
|
id_ = id;
|
||||||
id_set_ = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t number_format::id() const
|
std::size_t number_format::id() const
|
||||||
{
|
{
|
||||||
if (!id_set_)
|
if (!has_id())
|
||||||
{
|
{
|
||||||
throw invalid_attribute();
|
throw invalid_attribute();
|
||||||
}
|
}
|
||||||
|
|
||||||
return id_;
|
return id_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool number_format::is_date_format() const
|
bool number_format::is_date_format() const
|
||||||
|
@ -355,9 +349,14 @@ std::string number_format::format(long double number, calendar base_date) const
|
||||||
return detail::number_formatter(format_string_, base_date).format_number(number);
|
return detail::number_formatter(format_string_, base_date).format_number(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
XLNT_API bool operator==(const number_format &left, const number_format &right)
|
bool number_format::operator==(const number_format &other) const
|
||||||
{
|
{
|
||||||
return left.format_string_ == right.format_string_;
|
return format_string_ == other.format_string_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool number_format::operator!=(const number_format &other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xlnt
|
} // namespace xlnt
|
||||||
|
|
|
@ -53,9 +53,14 @@ protection &protection::hidden(bool hidden)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
XLNT_API bool operator==(const protection &left, const protection &right)
|
bool protection::operator==(const protection &other) const
|
||||||
{
|
{
|
||||||
return left.locked_ == right.locked_ && left.hidden_ == right.hidden_;
|
return locked_ == other.locked_ && hidden_ == other.hidden_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool protection::operator!=(const protection &other) const
|
||||||
|
{
|
||||||
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xlnt
|
} // namespace xlnt
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
exception::exception(const std::string &message)
|
exception::exception(const std::string &message)
|
||||||
: std::runtime_error("xlnt::error : " + message)
|
: std::runtime_error("xlnt::exception : " + message)
|
||||||
{
|
{
|
||||||
this->message(message);
|
this->message(message);
|
||||||
}
|
}
|
||||||
|
@ -63,12 +63,12 @@ invalid_sheet_title::~invalid_sheet_title()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid_column_string_index::invalid_column_string_index()
|
invalid_column_index::invalid_column_index()
|
||||||
: exception("column string index error")
|
: exception("column string index error")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid_column_string_index::~invalid_column_string_index()
|
invalid_column_index::~invalid_column_index()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -315,9 +315,9 @@ path path::relative_to(const path &base_path) const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const path &left, const path &right)
|
bool path::operator==(const path &other) const
|
||||||
{
|
{
|
||||||
return left.internal_ == right.internal_;
|
return internal_ == other.internal_;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xlnt
|
} // namespace xlnt
|
||||||
|
|
|
@ -118,41 +118,21 @@ bool range_reference::operator!=(const range_reference &comparand) const
|
||||||
return comparand.top_left_ != top_left_ || comparand.bottom_right_ != bottom_right_;
|
return comparand.top_left_ != top_left_ || comparand.bottom_right_ != bottom_right_;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell_reference range_reference::top_left()
|
|
||||||
{
|
|
||||||
return top_left_;
|
|
||||||
}
|
|
||||||
|
|
||||||
cell_reference range_reference::top_left() const
|
cell_reference range_reference::top_left() const
|
||||||
{
|
{
|
||||||
return top_left_;
|
return top_left_;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell_reference range_reference::top_right()
|
|
||||||
{
|
|
||||||
return cell_reference(bottom_right_.column(), top_left_.row());
|
|
||||||
}
|
|
||||||
|
|
||||||
cell_reference range_reference::top_right() const
|
cell_reference range_reference::top_right() const
|
||||||
{
|
{
|
||||||
return cell_reference(bottom_right_.column(), top_left_.row());
|
return cell_reference(bottom_right_.column(), top_left_.row());
|
||||||
}
|
}
|
||||||
|
|
||||||
cell_reference range_reference::bottom_left()
|
|
||||||
{
|
|
||||||
return cell_reference(top_left_.column(), bottom_right_.row());
|
|
||||||
}
|
|
||||||
|
|
||||||
cell_reference range_reference::bottom_left() const
|
cell_reference range_reference::bottom_left() const
|
||||||
{
|
{
|
||||||
return cell_reference(top_left_.column(), bottom_right_.row());
|
return cell_reference(top_left_.column(), bottom_right_.row());
|
||||||
}
|
}
|
||||||
|
|
||||||
cell_reference range_reference::bottom_right()
|
|
||||||
{
|
|
||||||
return bottom_right_;
|
|
||||||
}
|
|
||||||
|
|
||||||
cell_reference range_reference::bottom_right() const
|
cell_reference range_reference::bottom_right() const
|
||||||
{
|
{
|
||||||
return bottom_right_;
|
return bottom_right_;
|
||||||
|
|
|
@ -303,15 +303,6 @@ public:
|
||||||
TS_ASSERT(!ws.cell("D4").has_value());
|
TS_ASSERT(!ws.cell("D4").has_value());
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_merge_coordinate()
|
|
||||||
{
|
|
||||||
xlnt::workbook wb;
|
|
||||||
auto ws = wb.active_sheet();
|
|
||||||
ws.merge_cells(1, 1, 4, 4);
|
|
||||||
std::vector<xlnt::range_reference> expected = { xlnt::range_reference("A1:D4") };
|
|
||||||
TS_ASSERT_EQUALS(ws.merged_ranges(), expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_unmerge_bad()
|
void test_unmerge_bad()
|
||||||
{
|
{
|
||||||
xlnt::workbook wb;
|
xlnt::workbook wb;
|
||||||
|
@ -330,16 +321,6 @@ public:
|
||||||
TS_ASSERT_EQUALS(ws.merged_ranges().size(), 0);
|
TS_ASSERT_EQUALS(ws.merged_ranges().size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_unmerge_coordinate()
|
|
||||||
{
|
|
||||||
xlnt::workbook wb;
|
|
||||||
auto ws = wb.active_sheet();
|
|
||||||
ws.merge_cells("A1:D4");
|
|
||||||
TS_ASSERT_EQUALS(ws.merged_ranges().size(), 1);
|
|
||||||
ws.unmerge_cells(1, 1, 4, 4);
|
|
||||||
TS_ASSERT_EQUALS(ws.merged_ranges().size(), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_print_titles_old()
|
void test_print_titles_old()
|
||||||
{
|
{
|
||||||
xlnt::workbook wb;
|
xlnt::workbook wb;
|
||||||
|
|
|
@ -568,11 +568,6 @@ void worksheet::merge_cells(const range_reference &reference)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void worksheet::merge_cells(column_t start_column, row_t start_row, column_t end_column, row_t end_row)
|
|
||||||
{
|
|
||||||
merge_cells(xlnt::range_reference(start_column, start_row, end_column, end_row));
|
|
||||||
}
|
|
||||||
|
|
||||||
void worksheet::unmerge_cells(const range_reference &reference)
|
void worksheet::unmerge_cells(const range_reference &reference)
|
||||||
{
|
{
|
||||||
auto match = std::find(d_->merged_cells_.begin(), d_->merged_cells_.end(), reference);
|
auto match = std::find(d_->merged_cells_.begin(), d_->merged_cells_.end(), reference);
|
||||||
|
@ -593,11 +588,6 @@ void worksheet::unmerge_cells(const range_reference &reference)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void worksheet::unmerge_cells(column_t start_column, row_t start_row, column_t end_column, row_t end_row)
|
|
||||||
{
|
|
||||||
unmerge_cells(xlnt::range_reference(start_column, start_row, end_column, end_row));
|
|
||||||
}
|
|
||||||
|
|
||||||
row_t worksheet::next_row() const
|
row_t worksheet::next_row() const
|
||||||
{
|
{
|
||||||
auto row = highest_row() + 1;
|
auto row = highest_row() + 1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user