28 #include <xlnt/xlnt_config.hpp> 29 #include <xlnt/utils/optional.hpp> 30 #include <xlnt/worksheet/pane.hpp> 31 #include <xlnt/worksheet/selection.hpp> 55 void id(std::size_t new_id)
63 std::size_t
id()
const 73 return pane_.is_set();
125 return !selections_.empty();
133 selections_.push_back(new_selection);
158 if (index >= selections_.size())
160 throw xlnt::invalid_parameter(
"sheet view selection at index " + std::to_string(index) +
" does not exist (" + std::to_string(selections_.size()) +
" selections available)");
163 return selections_.at(index);
171 show_grid_lines_ = show;
179 return show_grid_lines_;
187 default_grid_color_ = is_default;
195 return default_grid_color_;
219 return top_left_cell_.is_set();
227 top_left_cell_.set(ref);
237 if (!top_left_cell_.is_set())
241 return top_left_cell_.get();
266 return id_ == rhs.id_
267 && show_grid_lines_ == rhs.show_grid_lines_
268 && default_grid_color_ == rhs.default_grid_color_
269 && pane_ == rhs.pane_
270 && selections_ == rhs.selections_
271 && top_left_cell_ == rhs.top_left_cell_
272 && zoom_scale_ == rhs.zoom_scale_;
280 return !(*
this == rhs);
292 bool show_grid_lines_ =
true;
297 bool default_grid_color_ =
true;
317 std::vector<xlnt::selection> selections_;
322 int zoom_scale_ = 100;
void clear_selections()
Removes all selections.
Definition: sheet_view.hpp:139
void top_left_cell(const cell_reference &ref)
Sets the top left cell of this view.
Definition: sheet_view.hpp:225
void zoom_scale(int scale)
Sets the zoom scale (percentage) for this view.
Definition: sheet_view.hpp:247
bool show_grid_lines() const
Returns true if grid lines will be shown for sheets using this view.
Definition: sheet_view.hpp:177
class xlnt::selection & selection(std::size_t index)
Returns the selection at the given index (please call selections().size() if the number of selections...
Definition: sheet_view.hpp:156
struct pane & pane()
Returns a reference to this view's pane. Assumes that this view has a pane (please call has_pane() to...
Definition: sheet_view.hpp:81
std::size_t id() const
Returns the ID of this view.
Definition: sheet_view.hpp:63
void add_selection(const class selection &new_selection)
Adds the given selection to the collection of selections.
Definition: sheet_view.hpp:131
bool has_top_left_cell() const
has a top left cell?
Definition: sheet_view.hpp:217
void pane(const struct pane &new_pane)
Sets the pane of this view to new_pane.
Definition: sheet_view.hpp:115
cell_reference top_left_cell() const
Returns the top left cell of this view. Assumes that this view has a top left (please call has_top_le...
Definition: sheet_view.hpp:235
sheet_view_type type() const
Returns the type of this view.
Definition: sheet_view.hpp:209
The selected area of a worksheet.
Definition: selection.hpp:41
Enumerates the possible types a cell can be determined by it's current value.
Definition: cell.hpp:36
bool operator!=(const sheet_view &rhs) const
Returns the negation of the equality operator.
Definition: sheet_view.hpp:278
void show_grid_lines(bool show)
If show is true, grid lines will be shown for sheets using this view.
Definition: sheet_view.hpp:169
sheet_view_type
Enumeration of possible types of sheet views
Definition: sheet_view.hpp:38
Exception for a bad parameter value
Definition: exceptions.hpp:69
bool has_selections() const
Returns true if this view has any selections.
Definition: sheet_view.hpp:123
bool operator==(const sheet_view &rhs) const
Returns true if this view is equal to rhs based on its id, grid lines setting, default grid color...
Definition: sheet_view.hpp:264
An object used to refer to a cell. References have two parts, the column and the row. In Excel, the reference string A1 refers to the top-left-most cell. A cell_reference can be initialized from a string of this form or a 1-indexed ordered pair of the form column, row. By default, cell references range from column A1–A1048576 (column A:A) to column XFD1–XFD1048576 (column XFD:XFD, column index 16384). The OOXML specification allows to extend this range, and XLNT allows both rows and columns between 1 and 4294967295. Please note that not all applications might support these extended ranges.
Definition: cell_reference.hpp:62
std::vector< xlnt::selection > selections() const
Returns the collection of selections as a vector.
Definition: sheet_view.hpp:147
Exception when getting a class's attribute before being set/initialized, or when setting a class's at...
Definition: exceptions.hpp:171
Describes a view of a worksheet. Worksheets can have multiple views which show the data differently...
Definition: sheet_view.hpp:49
void default_grid_color(bool is_default)
If is_default is true, the default grid color will be used.
Definition: sheet_view.hpp:185
bool has_pane() const
Returns true if this view has a pane defined.
Definition: sheet_view.hpp:71
void type(sheet_view_type new_type)
Sets the type of this view.
Definition: sheet_view.hpp:201
A fixed portion of a worksheet.
Definition: pane.hpp:59
void clear_pane()
Removes the defined pane from this view.
Definition: sheet_view.hpp:107
int zoom_scale() const
Returns the zoom scale (percentage).
Definition: sheet_view.hpp:255
void id(std::size_t new_id)
Sets the ID of this view to new_id.
Definition: sheet_view.hpp:55
const struct pane & pane() const
Returns a reference to this view's pane. Assumes that this view has a pane (please call has_pane() to...
Definition: sheet_view.hpp:95
bool default_grid_color() const
Returns true if the default grid color will be used.
Definition: sheet_view.hpp:193