namespace orcus::spreadsheet::iface

Classes

export_factory

class export_factory

Entry-point interface for exporting document contents.

Subclassed by orcus::spreadsheet::export_factory

Public Functions

virtual ~export_factory() = 0
virtual const export_sheet *get_sheet(std::string_view sheet_name) const = 0

Obtain an interface for exporting sheet content.

Parameters:

sheet_name – name of the sheet to export.

Returns:

pointer to an interface for exporting sheet content.

export_sheet

class export_sheet

Interface for exporting sheet contents.

Public Functions

virtual ~export_sheet() = 0
virtual void write_string(std::ostream &os, orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col) const = 0

Write the content of a cell to an output stream.

Parameters:
  • os – output stream to write the cell content to.

  • row – 0-based row position of a cell.

  • col – 0-based column position of a cell.

import_array_formula

class import_array_formula

Interface for importing the properties of an array formula which occupies a range of cells. Cells that are part of an array formula share the same formula expression but may have different calculation results.

Public Functions

virtual ~import_array_formula()
virtual void set_range(const range_t &range) = 0

Set the range of an array formula.

Parameters:

range – range of an array formula.

virtual void set_formula(formula_grammar_t grammar, std::string_view formula) = 0

Set the formula expression of an array formula.

Parameters:
  • grammar – grammar to use to compile the formula string into tokens.

  • formula – formula expression of an array formula.

virtual void set_result_string(row_t row, col_t col, std::string_view value) = 0

Set a cached string result of a cell within the array formula range.

Parameters:
  • row – 0-based row position of a cell.

  • col – 0-based column position of a cell.

  • value – cached string value to set.

virtual void set_result_value(row_t row, col_t col, double value) = 0

Set a cached numeric result of a cell within the array formula range.

Parameters:
  • row – 0-based row position of a cell.

  • col – 0-based column position of a cell.

  • value – cached numeric value to set.

virtual void set_result_bool(row_t row, col_t col, bool value) = 0

Set a cached boolean result of a cell within the array formula range.

Parameters:
  • row – 0-based row position of a cell.

  • col – 0-based column position of a cell.

  • value – cached boolean value to set.

virtual void set_result_empty(row_t row, col_t col) = 0

Set an empty value as a cached result to a cell within the array formula range.

Parameters:
  • row – 0-based row position of a cell.

  • col – 0-based column position of a cell.

virtual void commit() = 0

Push the properties of an array formula currently stored in the buffer to the sheet store.

import_auto_filter

class import_auto_filter

Interface for importing auto filters.

Public Functions

virtual ~import_auto_filter()
virtual iface::import_auto_filter_node *start_node(auto_filter_node_op_t op) = 0

Signal the start of the import of a set of auto-filter rules associated with a single column.

Note

Note that the import_auto_filter implementer must return a non-null pointer.

Parameters:
  • col_offset – 0-based offset position of the field relative to the left-most column of the filtered range.

  • op – Boolean operator connecting the multiple filter rules at the root level of the filter rules tree.

Returns:

Interface for importing the root node of the auto-filter rules for a column.

virtual void commit() = 0

Commit all the auto filter data stored in the buffer so far to the destination store.

import_auto_filter_multi_values

class import_auto_filter_multi_values

Interface for importing a set of multiple filter values.

Public Functions

virtual ~import_auto_filter_multi_values()
virtual void add_value(std::string_view value) = 0

Add a single filter value to the current buffer.

Parameters:

value – Filter value to add to the current buffer.

virtual void commit() = 0

Commit the values stored in the current buffer to the destination store.

import_auto_filter_node

class import_auto_filter_node

Interface for importing a single node in a larger auto-filter structure.

Note that one auto-filter structure may consist of nested filter nodes.

Public Functions

virtual ~import_auto_filter_node()
virtual void append_item(col_t field, auto_filter_op_t op, double value) = 0

Append to this node a new filter item with a numeric value.

Parameters:
  • field – 0-based field index which is the offset from the left-most column of the filtered range.

  • op – Operator for the filter item.

  • value – Numeric value associated with the operator for the filter item. Note that some operators may not require a value.

virtual void append_item(col_t field, auto_filter_op_t op, std::string_view value, bool regex) = 0

Append to this node a new filter item with a string value.

Note that the the life cycle of the string value passed to this call is only guaranteed to persist during the call.

Parameters:
  • field – 0-based field index which is the offset from the left-most column of the filtered range.

  • op – Operator for the filter item.

  • value – String value associated with the operator for the filter item. Note that some operators may not require a value.

  • regex – Whether or not the string value should be interpreted as a regular expression.

virtual void append_item(col_t field, auto_filter_op_t op) = 0

Append to this node a new filter item with no associated value.

Parameters:
  • field – 0-based field index which is the offset from the left-most column of the filtered range.

  • op – Operator for the filter item.

virtual import_auto_filter_node *start_node(auto_filter_node_op_t op) = 0

Start a new node of filter rules as a filter item to this node. The new node should be appended to this node as new filter item when it is committed.

Note

Note that the import_auto_filter_node implementer must return a non-null pointer.

Parameters:

op – Operator to use to link the items stored in the new node.

Returns:

Interface for importing the filter rules for the new node.

virtual import_auto_filter_multi_values *start_multi_values(col_t field) = 0

Start importing a set of multiple filter values. Note that a set of multiple filter values and individual filter items cannot co-exist in the same filter node.

Note

Note that the import_auto_filter_node implementer must return a non-null pointer.

Returns:

Interface for importing a set of multiple filter values for the current filter node.

virtual void commit() = 0

Commit the filter node data stored in the buffer to the destination store.

import_border_style

class import_border_style

Interface for importing border style items.

Public Functions

virtual ~import_border_style()
virtual void set_style(border_direction_t dir, border_style_t style) = 0

Set the border style to a specified border position.

Parameters:
  • dir – position of a border to set the style to.

  • style – border style to set.

virtual void set_color(border_direction_t dir, color_elem_t alpha, color_elem_t red, color_elem_t green, color_elem_t blue) = 0

Set the color of a border.

Parameters:
  • dir – position of a border to set the color to.

  • alpha – alpha element of the color.

  • red – red element of the color.

  • green – green element of the color.

  • blue – blue element of the color.

virtual void set_width(border_direction_t dir, double width, orcus::length_unit_t unit) = 0

Set the width of a border.

Parameters:
  • dir – position of a border.

  • width – width of a border.

  • unit – unit of measurement to use in the border width.

virtual size_t commit() = 0

Commit the border style in the current buffer.

Returns:

index of the committed border style, to be passed on to the import_xf::set_border() method as its argument.

import_cell_protection

class import_cell_protection

Interface for importing cell protection items.

Public Functions

virtual ~import_cell_protection()
virtual void set_hidden(bool b) = 0

Hide the entire cell content when the sheet is protected.

Parameters:

b – whether to hide the entire cell content when the sheet is protected.

virtual void set_locked(bool b) = 0

Lock the cell when the sheet is protected.

Parameters:

b – whether or not to lock the cell when the sheet is protected.

virtual void set_print_content(bool b) = 0

Specify whether or not to print the cell content when the sheet is protected.

Parameters:

b – whether or not to print the cell content when the sheet is protected.

virtual void set_formula_hidden(bool b) = 0

Hide the formula when the sheet is protected and the cell contains formula.

Parameters:

b – whether or not to hide the formula when the sheet is protected and the cell contains formula.

virtual std::size_t commit() = 0

Commit the cell protection data in the current buffer.

Returns:

index of the committed cell protection data, to be passed on to the import_xf::set_protection() method as its argument.

import_cell_style

class import_cell_style

This interface is used to import named cell style records.

Note

The actual cell format data for named cell styles are imported through import_xf, and this interface references its index through the import_cell_style::set_xf() method.

Public Functions

virtual ~import_cell_style()
virtual void set_name(std::string_view s) = 0

Set the name associated with the named cell style.

Parameters:

s – name of the named cell style.

virtual void set_display_name(std::string_view s) = 0

Set the name associated with the named cell style intended for display purposes.

Note

Not all supported formats make use of this property. Also, the style may not always have this property even if the format supports it. ODF uses this property when the original name contains characters that cannot be used in internal symbols.

Parameters:

s – name to use for display purposes.

virtual void set_xf(size_t index) = 0

Set the index into the cell format record. The named cell style applies the format referenced by this index.

Parameters:

index – index into the cell format record.

virtual void set_builtin(size_t index) = 0

Set the index into the built-in cell style record.

Note

This is Excel-specific, and unclear whether it’s useful outside of Excel’s implementation. Built-in styles are not stored in file, and Excel likely has its own internal styles stored in the application itself.

Parameters:

index – index into the built-in cell style record.

virtual void set_parent_name(std::string_view s) = 0

Set the name of the parent cell style it uses as its basis.

Note

ODF uses this but Excel does not use this value.

Parameters:

s – name of the parent cell style.

virtual void commit() = 0

Commit the cell style format in the current buffer to the storage.

Note

This method does not return an index.

import_conditional_format

class import_conditional_format

This is an optional interface to import conditional formatting.

In general, a single conditional format consists of:

  • a cell range the format is applied to, and

  • one or more rule entries.

Each rule entry consists of:

  • a type of rule,

  • zero or more rule properties, and

  • zero or more conditions depending on the rule type.

Lastly, each condition consists of:

  • a formula, value, or string,

  • an optional color.

The flow of the import process varies depending on the type of the conditional formatting being imported. The following is an example of importing a conditional formatting that consists of a rule that applies a format when the cell value is greather than 2:

import_conditional_format* iface = ... ;

iface->set_range("A2:A13");
iface->set_xf_id(14); // apply differential format (dxf) whose ID is 14
iface->set_type(conditional_format_t::condition); // rule entry type
iface->set_operator(condition_operator_t::expression);
iface->set_operator(condition_operator_t::greater);

iface->set_formula("2");
iface->commit_condition();

iface->commit_entry();

iface->commit_format();

Todo:

Revise this API for simplification.

Public Functions

virtual ~import_conditional_format()
virtual void set_color(color_elem_t alpha, color_elem_t red, color_elem_t green, color_elem_t blue) = 0

Sets the color of the current condition. only valid for type == databar or type == colorscale.

virtual void set_formula(std::string_view formula) = 0

Sets the formula, value or string of the current condition.

virtual void set_condition_type(condition_type_t type) = 0

Sets the type for the formula, value or string of the current condition. Only valid for type = iconset, databar or colorscale.

virtual void set_date(condition_date_t date) = 0

Only valid for type = date.

virtual void commit_condition() = 0

commits the current condition to the current entry.

virtual void set_icon_name(std::string_view name) = 0

Name of the icons to use in the current entry. only valid for type = iconset

virtual void set_databar_gradient(bool gradient) = 0

Use a gradient for the current entry. only valid for type == databar

virtual void set_databar_axis(databar_axis_t axis) = 0

Position of the 0 axis in the current entry. only valid for type == databar.

virtual void set_databar_color_positive(color_elem_t alpha, color_elem_t red, color_elem_t green, color_elem_t blue) = 0

Databar color for positive values. only valid for type == databar.

virtual void set_databar_color_negative(color_elem_t alpha, color_elem_t red, color_elem_t green, color_elem_t blue) = 0

Databar color for negative values. only valid for type == databar.

virtual void set_min_databar_length(double length) = 0

Sets the minimum length for a databar. only valid for type == databar.

virtual void set_max_databar_length(double length) = 0

Sets the maximum length for a databar. only valid for type == databar.

virtual void set_show_value(bool show) = 0

Don’t show the value in the cell. only valid for type = databar, iconset, colorscale.

virtual void set_iconset_reverse(bool reverse) = 0

Use the icons in reverse order. only valid for type == iconset.

virtual void set_xf_id(size_t xf) = 0

TODO: In OOXML the style is stored as dxf and in ODF as named style.

virtual void set_operator(condition_operator_t condition_type) = 0

Sets the current operation used for the current entry. only valid for type == condition

virtual void set_type(conditional_format_t type) = 0
virtual void commit_entry() = 0
virtual void set_range(std::string_view range) = 0
virtual void set_range(row_t row_start, col_t col_start, row_t row_end, col_t col_end) = 0
virtual void commit_format() = 0

import_data_table

class import_data_table

Interface for importing data tables.

Public Functions

virtual ~import_data_table()
virtual void set_type(data_table_type_t type) = 0

Set the type of a data table. A data table can either:

  • be a single-variable column-oriented,

  • be a single-variable row-oriented, or

  • use two variables that use both column and row.

Parameters:

type – type of a data table.

virtual void set_range(const range_t &range) = 0

Set the range of a data table.

Parameters:

range – range of a data table.

virtual void set_first_reference(std::string_view ref, bool deleted) = 0

Set the reference of the first input cell.

Parameters:
  • ref – reference of the first input cell.

  • deleted – whether or not this input cell has been deleted.

virtual void set_second_reference(std::string_view ref, bool deleted) = 0

Set the reference of the second input cell but only if the data table uses two variables.

Note

This method gets called only if the data table uses two variables.

Parameters:
  • ref – reference of the second input cell.

  • deleted – whether or not this input cell has been deleted.

virtual void commit() = 0

Store the current data table data in the buffer to the backend sheet storage.

import_factory

class import_factory

This interface is the entry point for the import filter code to instantiate other, more specialized interfaces. The life cycles of any specialized interfaces returned from this interface shall be managed by the implementor of this interface.

The implementer of this interface may wrap a backend document store that needs to be populated.

Subclassed by orcus::spreadsheet::import_factory

Public Functions

virtual ~import_factory()
virtual import_global_settings *get_global_settings()

Obtain an optional interface for global settings, which the import filter uses to specify global filter settings that may affect how certain values and properties should be processed. The implementor can use this interface to decide how to process relevant values and properties.

Returns:

pointer to the global settings interface, or a nullptr if the implementor doesn’t support it.

virtual import_shared_strings *get_shared_strings()

Obtain an optional interface for importing shared strings for string cells. Implementing this interface is required in order to import string cell values.

Returns:

pointer to the shared strings interface, or a nullptr if the implementor doesn’t support it.

virtual import_named_expression *get_named_expression()

Obtain an optional interface for importing global named expressions.

Note that import_sheet also provides the same interface, but its interface is for importing sheet-local named expressions.

Returns:

pointer to the global named expression interface, or a nullptr if the implementor doesn’t support it.

virtual import_styles *get_styles()

Obtain an optional interface for importing styles used to add formatting properties to cell values.

Returns:

pointer to the styles interface, or a nullptr if the implementor doesn’t support it.

virtual import_reference_resolver *get_reference_resolver(formula_ref_context_t cxt)

Obtain an optional interface for resolving cell and cell-range references from string values.

Parameters:

cxt – context in which the formula expression containing the references to be resolved occurs.

Returns:

pointer to the reference resolve interfance, or a nullptr if the implementor doesn’t support it.

virtual import_pivot_cache_definition *create_pivot_cache_definition(pivot_cache_id_t cache_id)

Obtain an optional interface for pivot cache definition import for a specified cache ID. In case a pivot cache alrady exists for the passed ID, the implementor should overwrite the existing cache with a brand-new cache instance.

Parameters:

cache_id – numeric ID associated with the pivot cache.

Returns:

pointer to the pivot cache interface, or a nullptr if the implementor doesn’t support pivot cache import.

virtual import_pivot_cache_records *create_pivot_cache_records(pivot_cache_id_t cache_id)

Obtain an optional interface for pivot cache records import for a specified cache ID.

Parameters:

cache_id – numeric ID associated with the pivot cache.

Returns:

pointer to the pivot cache records interface, or a nullptr if the implementor doesn’t support pivot cache import.

virtual import_sheet *append_sheet(sheet_t sheet_index, std::string_view name) = 0

Append a sheet with a specified sheet position index and name and return an interface for importing its content. The implementor can use a call to this method as a signal to create and append a new sheet instance to the document store.

Parameters:
  • sheet_index – position index of the sheet to be appended. It is 0-based i.e. the first sheet to be appended will have an index value of 0.

  • name – sheet name.

Returns:

pointer to the sheet instance, or a nullptr if the implementor doesn’t support it. Note, however, that if the implementor doesn’t support this interface, no cell values will get imported.

virtual import_sheet *get_sheet(std::string_view name) = 0

Get a sheet instance by name. The import filter may use this method to get access to an existing sheet after it has been created.

Parameters:

name – sheet name.

Returns:

pointer to the sheet instance whose name matches the name passed to this method. It returns a nullptr if no sheet instance exists by the specified name.

virtual import_sheet *get_sheet(sheet_t sheet_index) = 0

Retrieve a sheet instance by a specified numerical sheet index.

Parameters:

sheet_index – sheet index.

Returns:

pointer to the sheet instance, or a nullptr if no sheet instance exists at the specified sheet index.

virtual void finalize() = 0

The import filter calls this method after completing its import, to give the implementor a chance to perform post-processing.

import_fill_style

class import_fill_style

Interface for importing fill style items.

Public Functions

virtual ~import_fill_style()
virtual void set_pattern_type(fill_pattern_t fp) = 0

Set the type of fill pattern.

Parameters:

fp – fill pattern type.

virtual void set_fg_color(color_elem_t alpha, color_elem_t red, color_elem_t green, color_elem_t blue) = 0

Set the foreground color of a fill. Note that for a solid fill type, the foreground color will be used.

Parameters:
  • alpha – alpha component ranging from 0 (fully transparent) to 255 (fully opaque).

  • red – red component ranging from 0 to 255.

  • green – green component ranging from 0 to 255.

  • blue – blue component ranging from 0 to 255.

virtual void set_bg_color(color_elem_t alpha, color_elem_t red, color_elem_t green, color_elem_t blue) = 0

Set the background color of a fill. Note that this color will be ignored for a solid fill type.

Parameters:
  • alpha – alpha component ranging from 0 (fully transparent) to 255 (fully opaque).

  • red – red component ranging from 0 to 255.

  • green – green component ranging from 0 to 255.

  • blue – blue component ranging from 0 to 255.

virtual size_t commit() = 0

Commit the fill style in the current buffer.

Returns:

index of the committed fill style, to be passed on to the import_xf::set_fill() method as its argument.

import_font_style

class import_font_style

Interface for importing font style items. The following font style properties store different values for western, asian and complex scripts:

  • font name

  • font size

  • font weight (normal or bold)

  • font style (normal or italic)

Public Functions

virtual ~import_font_style()
virtual void set_bold(bool b) = 0

Set the font weight to either normal or bold, for western script.

Parameters:

b – whether the font has normal (false) or bold weight (true).

virtual void set_bold_asian(bool b) = 0

Set the font weight to either normal or bold, for asian script.

Parameters:

b – whether the font has normal (false) or bold weight (true).

virtual void set_bold_complex(bool b) = 0

Set the font weight to either normal or bold, for complex script.

Parameters:

b – whether the font has normal (false) or bold weight (true).

virtual void set_italic(bool b) = 0

Set the font style to either normal or italic, for western script.

Parameters:

b – whether the font has normal (false) or italic style (true).

virtual void set_italic_asian(bool b) = 0

Set the font style to either normal or italic, for asian script.

Parameters:

b – whether the font has normal (false) or italic style (true).

virtual void set_italic_complex(bool b) = 0

Set the font style to either normal or italic, for complex script.

Parameters:

b – whether the font has normal (false) or italic style (true).

virtual void set_name(std::string_view s) = 0

Set the name of a font, for western script.

Parameters:

s – font name.

virtual void set_name_asian(std::string_view s) = 0

Set the name of a font, for asian script.

Parameters:

s – font name.

virtual void set_name_complex(std::string_view s) = 0

Set the name of a font, for complex script.

Parameters:

s – font name.

virtual void set_size(double point) = 0

Set the size of a font in points, for western script.

Parameters:

point – font size in points.

virtual void set_size_asian(double point) = 0

Set the size of a font in points, for asian script.

Parameters:

point – font size in points.

virtual void set_size_complex(double point) = 0

Set the size of a font in points, for complex script.

Parameters:

point – font size in points.

virtual void set_color(color_elem_t alpha, color_elem_t red, color_elem_t green, color_elem_t blue) = 0

Specify the color of font in ARGB format.

Parameters:
  • alpha – alpha component of the color.

  • red – red component of the color.

  • green – green component of the color.

  • blue – blue component of the color.

virtual import_underline *start_underline()

Get an interface for importing the underline attributes and applying them to the font style.

Returns:

Pointer to an interface for applying the underline-related attributes to the font style. The implementer may return nullptr if the implementation does not support it.

virtual import_strikethrough *start_strikethrough()

Get an interface for importing the strikethrough attributes and applying them to the font style.

Returns:

Pointer to an interface for applying the strikethrough-related attributes to the font style. The implementer may return nullptr if the implementation does not support it.

virtual std::size_t commit() = 0

Commit the font style in the current buffer.

Returns:

index of the committed font style, to be passed on to the import_xf::set_font() method as its argument.

import_formula

class import_formula

Interface for importing the properties of a single formula cell. A formula cell contains a formula expression that can be computed, and optionally a cached result of the last computation performed on the expression.

Public Functions

virtual ~import_formula()
virtual void set_position(row_t row, col_t col) = 0

Set the position of a cell.

Parameters:
  • row – row position.

  • col – column position.

virtual void set_formula(formula_grammar_t grammar, std::string_view formula) = 0

Set formula string to a cell.

Parameters:
  • grammar – grammar to use to compile the formula string into tokens.

  • formula – formula expression to store.

virtual void set_shared_formula_index(size_t index) = 0

Register the formula stored in a cell as a shared formula to be shared with other cells, if the cell contains a formula string.

If a cell references a shared formula stored in another cell, only specify the index of that shared formula without specifying a formula string of its own. In that case, it is expected that another formula cell registers its formula string for that index.

Parameters:

index – shared string index to register the formula with.

virtual void set_result_string(std::string_view value) = 0

Set cached result of string type.

Parameters:

value – string result value.

virtual void set_result_value(double value) = 0

Set cached result of numeric type.

Parameters:

value – numeric value to set as a cached result.

virtual void set_result_bool(bool value) = 0

Set cached result of boolean type.

Parameters:

value – boolean value to set as a cached result.

virtual void set_result_empty() = 0

Set empty value as a cached result.

virtual void commit() = 0

Commit all the formula data to the specified cell.

import_global_settings

class import_global_settings

Interface for specifying global settings that may affect how the implementor should process certain values and properties.

Public Functions

virtual ~import_global_settings()
virtual void set_origin_date(int year, int month, int day) = 0

Set the date that is to be represented by a value of 0. All date values should be represented relative to this date. This may affect, for instance, values imported via import_sheet::set_date_time().

Parameters:
  • year – 1-based value representing year

  • month – 1-based value representing month, varying from 1 through 12.

  • day – 1-based value representing day, varying from 1 through 31.

virtual void set_default_formula_grammar(formula_grammar_t grammar) = 0

Set the formula grammar to be used globally when parsing formulas if the grammar is not specified. This grammar should also be used when parsing range strings associated with shared formula ranges, array formula ranges, autofilter ranges etc.

Note that the import filter may specify what formula grammar to use locally when importing formula expressions for cells via import_formula::set_formula(), in which case the implementor should honor that one instead.

Parameters:

grammar – default formula grammar to use globally unless otherwise specified.

virtual formula_grammar_t get_default_formula_grammar() const = 0

Get current global formula grammar. The import filter may use this method to query the current global formula grammar.

Returns:

current default formula grammar.

virtual void set_character_set(character_set_t charset) = 0

Set the character set to use when parsing encoded string values.

Parameters:

charset – character set to use when parsing encoded string values.

import_named_expression

class import_named_expression

Interface for importing named expressions or ranges.

This interface has two different methods for defining named expressions:

Generally speaking, set_named_expression() can be used to define both named expression and named range. However, the implementor may choose to apply a different syntax rule to parse an expression passed to set_named_range(), depending on the formula grammar defined via import_global_settings::set_default_formula_grammar(). For instance, the OpenDocument Spreadsheet format is known to use different syntax rules between named expressions and named ranges.

A named range is a special case of a named expression where the expression consists of only one single cell range token.

Here is a code example of how a named expression is defined:

import_named_expression* iface = ...;

// set the A1 on the first sheet as its origin (optional).
src_address_t origin{0, 0, 0};
iface->set_base_position(origin);
iface->set_named_expression("MyExpression", "SUM(A1:B10)+SUM(D1:D4)");
iface->commit();

Replace the above set_named_expression() call with set_named_range() if you wish to define a named range instead.

Public Functions

virtual ~import_named_expression()
virtual void set_base_position(const src_address_t &pos) = 0

Specify an optional base position, or origin, from which to evaluate a named expression. If not specified, the implementor should use the top-left corner cell on the first sheet as its origin.

Parameters:

pos – cell position to be used as the origin.

virtual void set_named_expression(std::string_view name, std::string_view expression) = 0

Set a named expression to the buffer.

Parameters:
  • name – name of the expression to be defined.

  • expression – expression to be associated with the name.

virtual void set_named_range(std::string_view name, std::string_view range) = 0

Set a named range to the buffer.

Parameters:
  • name – name of the expression to be defined.

  • range – range to be associated with the name.

virtual void commit() = 0

Commit the named expression or range currently in the buffer to the document.

import_number_format

class import_number_format

Interface for importing number format items.

Public Functions

virtual ~import_number_format()
virtual void set_identifier(std::size_t id) = 0

Set the integral identifier of a number format.

Todo:

Perhaps when this method is called, the commit() method of the corresponding item should return the value set in this method instead.

Note

This is specific to xlsx format. In xlsx, this identifier gets used to reference number formats instead of the identifier returned by the commit() method.

Parameters:

id – integral indentifier of a number format.

virtual void set_code(std::string_view s) = 0

Set the number format code.

Parameters:

s – number format code.

virtual size_t commit() = 0

Commit the number format item in the current buffer.

Todo:

Look into returning the identifier set through the set_identifier() method.

Returns:

index of the committed number format item, to be passed on to the import_xf::set_number_format() method as its argument.

import_pivot_cache_definition

class import_pivot_cache_definition

Interface for importing pivot cache definitions.

Public Functions

virtual ~import_pivot_cache_definition()
virtual void set_worksheet_source(std::string_view ref, std::string_view sheet_name) = 0

Specify that the source data of this pivot cache is located on a local worksheet.

Todo:

use the ref resolver to resolve the range.

Parameters:
  • ref – range string specifying the source range.

  • sheet_name – name of the worksheet where the source data is located.

virtual void set_worksheet_source(std::string_view table_name) = 0

Specify that the source data of this pivot cache is associated with a table.

Parameters:

table_name – name of the table.

virtual void set_field_count(size_t n) = 0

Set the total number of fields present in this pivot cache.

Parameters:

n – total number of fields in this pivot cache.

virtual void set_field_name(std::string_view name) = 0

Set the name of the field in the current field buffer.

Parameters:

name – field name.

virtual void set_field_min_value(double v) = 0

Set the lowest value of the field in the current field buffer.

Parameters:

v – lowest value of the field.

virtual void set_field_max_value(double v) = 0

Set the highest value of the field in the current field buffer.

Parameters:

v – highest value of the field.

virtual void set_field_min_date(const date_time_t &dt) = 0

Set the lowest date value of the field in the current field buffer.

Parameters:

dt – lowest date value of the field.

virtual void set_field_max_date(const date_time_t &dt) = 0

Set the highest date value of the field in the current field buffer.

Parameters:

dt – highest date value of the field.

virtual import_pivot_cache_field_group *start_field_group(size_t base_index) = 0

Mark the current field as a group field and initiate its import.

The implementor should create an internal storage to prepare for the importing of field group data when this method gets called.

Parameters:

base_index – 0-based index of the field this group field uses as its base.

Returns:

interface for importing group field data, or a nullptr if the implementor doesn’t support it.

virtual void commit_field() = 0

Commit the field in the current field buffer to the pivot cache model.

virtual void set_field_item_string(std::string_view value) = 0

Set a string value to the current field item buffer.

Parameters:

value – string value.

virtual void set_field_item_numeric(double v) = 0

Set a numeric value to the current field item buffer.

Parameters:

v – numeric value.

virtual void set_field_item_date_time(const date_time_t &dt) = 0

Set a date-time value to the current field item buffer.

Parameters:

dt – date-time value.

virtual void set_field_item_error(error_value_t ev) = 0

Set an error value to the current field item buffer,

Parameters:

ev – error value.

virtual void commit_field_item() = 0

Commit the field item in current field item buffer to the current field model.

virtual void commit() = 0

Commit the current pivot cache model to the document model.

import_pivot_cache_field_group

class import_pivot_cache_field_group

Interface for importing group field settings in a pivot cache definition.

Public Functions

virtual ~import_pivot_cache_field_group()

Establish a linkage between a base item to a group item.

The index to corresponding base item is inferred from the order of this method being called; the first call to this method implies a base item index of 0, the second call implies an index of 1, and so on.

This method is called only for a non-range group field; a group field where parent-to-child item relationships are manually defined.

Parameters:

group_item_index – 0-based index for the group item.

virtual void set_field_item_string(std::string_view value) = 0

Set an individual field item value that is of string type to the current internal buffer.

This method can be called either for a range group field or a non-range one.

Parameters:

value – field item value.

virtual void set_field_item_numeric(double v) = 0

Set an individual field item value that is of numeric type to the current internal buffer.

This method can be called either for a range group field or a non-range one.

Parameters:

v – field item value.

virtual void commit_field_item() = 0

Commit the current internal field item buffer to the group.

virtual void set_range_grouping_type(pivot_cache_group_by_t group_by) = 0

Set the range grouping type.

The current group field implicitly becomes a range group field when this method is called.

Parameters:

group_by – type of range grouping.

virtual void set_range_auto_start(bool b) = 0

Set whether the current range group field has an automatic start position.

The current group field implicitly becomes a range group field when this method is called.

Parameters:

b – whether or not the current range group field has an automatic start position.

virtual void set_range_auto_end(bool b) = 0

Set whether the current range group field has an automatic end position.

The current group field implicitly becomes a range group field when this method is called.

Parameters:

b – whether or not the current range group field has an automatic end position.

virtual void set_range_start_number(double v) = 0

Set the start number of the current range group field.

The current group field implicitly becomes a range group field when this method is called.

Parameters:

v – start number of the current range group field.

virtual void set_range_end_number(double v) = 0

Set the end number of the current range group field.

The current group field implicitly becomes a range group field when this method is called.

Parameters:

v – end number of the current range group field.

virtual void set_range_start_date(const date_time_t &dt) = 0

Set the start date of the current range group field.

The current group field implicitly becomes a range group field when this method is called.

Parameters:

dt – start date of the current range group field.

virtual void set_range_end_date(const date_time_t &dt) = 0

Set the end date of the current range group field.

The current group field implicitly becomes a range group field when this method is called.

Parameters:

dt – end date of the current range group field.

virtual void set_range_interval(double v) = 0

Set the interval of the current range group field. If the current range is a date range, the value represents the number of days.

Parameters:

v – interval of the current range group field.

virtual void commit() = 0

Commit the current field group data to the parent field.

import_pivot_cache_records

class import_pivot_cache_records

Interface for importing pivot cache records.

Public Functions

virtual ~import_pivot_cache_records()
virtual void set_record_count(size_t n) = 0

Set the number of records included in pivot cache records.

Note

This method gets called before the very first record gets imported. The implementor can use this call as an opportunity to initialize any internal buffers used to store the imported records.

Parameters:

n – number of records included in pivot cache records.

virtual void append_record_value_numeric(double v) = 0

Append to the current record buffer a numeric value as a column value.

Parameters:

v – numeric value to append to the current record buffer as a column value.

virtual void append_record_value_character(std::string_view s) = 0

Append to the current record buffer a character value as a column value.

Parameters:

s – character value to append to the current record buffer as a column value.

virtual void append_record_value_shared_item(size_t index) = 0

Append to the current record buffer a column value referenced by an index into the shared items table of a pivot cache field. The corresponding field in the pivot cache definition should provide the shared items table that this index references.

Parameters:

index – index into the shared items table of a pivot cache field.

virtual void commit_record() = 0

Commit the record in the current record buffer.

The implementor can clear the buffer afterward.

virtual void commit() = 0

Commit the entire records set to the document store.

import_reference_resolver

class import_reference_resolver

This is an interface to allow the implementor to provide its own reference address parsers, for both single cell references and cell range references. The implementor may choose to provide a different parser depending of the type of formula_ref_context_t argument given to the import_factory::get_reference_resolver() call.

Public Functions

virtual ~import_reference_resolver()
virtual src_address_t resolve_address(std::string_view address) = 0

Resolve a textural representation of a single cell address.

Parameters:

address – single cell address string.

Throws:

orcus::invalid_arg_error – the string is not a valid single cell addreess.

Returns:

structure containing the column and row positions of the address.

virtual src_range_t resolve_range(std::string_view range) = 0

Resolve a textural representation of a range address. Note that a string representing a valid single cell address should be considered a valid range address.

Parameters:

range – range address string.

Throws:

invalid_arg_error – the string is not a valid range addreess.

Returns:

structure containing the start and end positions of the range address.

import_shared_strings

class import_shared_strings

Interface for importing raw string values shared in string cells. String values may be either with or without formatted segments.

To insert an unformatted string, simply use either append() or add() method. The string will then be immediately pushed to the pool.

To insert a string with mixed formatted segments, you need to first use one or more of:

to define the format attribute(s) of a string segment followed by a call to append_segment(). This may be repeated as many times as necessary. Then as the final step, call commit_segments() to insert the entire series of formatted segments to the pool as a single string entry. The following example demonstrates how the code may look like:

import_shared_strings* iface = ...;

// store a segment with specific font, size and boldness.
iface->set_segment_font_name("FreeMono");
iface->set_segment_font_size(14);
iface->set_segment_font_bold(true);
iface->append_segment("a bold and big segment");

// store an unformatted segment.
iface->append_segment(" followed by ");

// store a segment with smaller, italic font.
iface->set_segment_font_size(7);
iface->set_segment_font_italic(true);
iface->append_segment("a small and italic segment");

iface->commit_segments(); // commit the whole formatted string to the pool.

Public Functions

virtual ~import_shared_strings()
virtual size_t append(std::string_view s) = 0

Append a new string to the sequence of strings. Order of insertion determines the numerical ID value of an inserted string. Note that this method assumes that the caller knows the string being appended is not yet in the pool; it does not check on duplicated strings.

Parameters:

s – string to append to the pool.

Returns:

ID of the inserted string.

virtual size_t add(std::string_view s) = 0

Similar to the append() method, it adds a new string to the string pool; however, this method checks if the string being added is already in the pool before each insertion, to avoid duplicated strings.

Parameters:

s – string to add to the pool.

Returns:

ID of the inserted string.

virtual void set_segment_font(size_t font_index) = 0

Set the index of a font to apply to the current format attributes. Refer to the import_font_style interface on how to obtain a font index. Note that a single font index is associated with multiple font-related formatting attributes, such as font name, font color, boldness and italics.

Parameters:

font_index – positive integer representing the font to use.

virtual void set_segment_bold(bool b) = 0

Set whether or not to make the current segment bold.

Parameters:

b – true if it’s bold, false otherwise.

virtual void set_segment_italic(bool b) = 0

Set whether or not to make the current segment italic.

Parameters:

b – true if it’s italic, false otherwise.

virtual void set_segment_superscript(bool b) = 0

Set whether or not to apply superscript to the current segment.

Parameters:

b – True if superscript needs to be applied, false otherwise.

virtual void set_segment_subscript(bool b) = 0

Set whether or not to apply subscript to the current segment.

Parameters:

b – True if subscript needs to be applied, false otherwise.

virtual void set_segment_font_name(std::string_view s) = 0

Set the name of a font to the current segment.

Parameters:

s – font name.

virtual void set_segment_font_size(double point) = 0

Set a font size to the current segment.

Parameters:

point – font size in points.

virtual void set_segment_font_color(color_elem_t alpha, color_elem_t red, color_elem_t green, color_elem_t blue) = 0

Set the color of a font in ARGB format to the current segment.

Parameters:
  • alpha – alpha component value (0-255).

  • red – red component value (0-255).

  • green – green component value (0-255).

  • blue – blue component value (0-255).

virtual import_underline *start_underline()

Get an interface for importing the underline attributes and applying them to the current segment.

Returns:

Pointer to an interface for applying the underline-related attributes to the current segment. The implementer may return nullptr if the implementation does not support it.

virtual import_strikethrough *start_strikethrough()

Get an interface for importing the strikethrough attributes and applying them to the current segment.

Returns:

Pointer to an interface for applying the strikethrough-related attributes to the current segment. The implementer may return nullptr if the implementation does not support it.

virtual void append_segment(std::string_view s) = 0

Push the current string segment to the buffer. Any formatting attributes set so far will be applied to this segment.

Parameters:

s – string value for the segment.

virtual size_t commit_segments() = 0

Store the entire formatted string in the current buffer to the shared strings pool. The implementor may choose to unconditionally append the string to the pool, or choose to find an existing duplicate and reuse it instead.

Returns:

ID of the string just inserted, or the ID of an existing string with identical formatting.

import_sheet

class import_sheet

Interface for importing the content and properties of a sheet.

Public Functions

virtual ~import_sheet()
virtual import_sheet_view *get_sheet_view()

Get an optional interface for importing properties that are specific to a view of a sheet.

Returns:

pointer to the interface for importing view properties, or a nullptr if the implementor doesn’t support it.

virtual import_sheet_properties *get_sheet_properties()

Get an optional interface for importing sheet properties.

Returns:

pointer to the interface for importing sheet properties, or a nullptr if the implementor doesn’t support it.

virtual import_data_table *get_data_table()

Get an optional interface for importing data tables. Note that the implementer may decide not to support this feature in which case this method should return a nullptr.

The implementor should initialize the internal state of the temporary data table object when this method is called.

Returns:

pointer to the data table interface object, or a nullptr if the implementor doesn’t support it.

virtual import_auto_filter *start_auto_filter(const range_t &range)

Get an optional interface for importing auto filter data.

The implementor should initialize the internal buffer to store the auto filter data when this method is called.

Parameters:

range – Filtered range.

Returns:

Pointer to an auto filter interface object, or a nullptr if the implementor doesn’t support it.

virtual import_table *start_table()

Get an interface for importing tables.

The implementor should initialize the internal state of the temporary table object when this method is called.

Returns:

pointer to a table interface object, or nullptr if the implementer doesn’t support importing of tables.

virtual import_conditional_format *get_conditional_format()

Get an optional interface for importing conditional formats.

Returns:

pointer to the conditional format interface object, or nullptr if the implementer doesn’t support importing conditional formats.

virtual import_named_expression *get_named_expression()

Get an optional interface for importing sheet-local named expressions.

Returns:

pointer to the sheet-local named expression interface, or a nullptr if the implementor doesn’t support it.

virtual import_array_formula *get_array_formula()

Get an optional interface for importing array formulas. An array formula is a formula expression applied to a range of cells where each cell may have a different result value.

Returns:

pointer to the array formula import interface, or a nullptr if the implementor doesn’t support it.

virtual import_formula *get_formula()

Get an optional interface for importing formula cells.

Returns:

pointer to the formula interface object, or a nullptr if the implementer doesn’t support importing of formula cells.

virtual void set_auto(row_t row, col_t col, std::string_view s) = 0

Set raw string value to a cell and have the implementation auto-recognize its data type.

Parameters:
  • row – row ID

  • col – column ID

  • s – raw string value.

virtual void set_string(row_t row, col_t col, string_id_t sindex) = 0

Set string value to a cell.

Parameters:
  • row – row ID

  • col – column ID

  • sindex – 0-based string index in the shared string table.

virtual void set_value(row_t row, col_t col, double value) = 0

Set numerical value to a cell.

Parameters:
  • row – row ID

  • col – column ID

  • value – value being assigned to the cell.

virtual void set_bool(row_t row, col_t col, bool value) = 0

Set a boolean value to a cell.

Parameters:
  • row – row ID

  • col – col ID

  • value – boolean value being assigned to the cell

virtual void set_date_time(row_t row, col_t col, int year, int month, int day, int hour, int minute, double second) = 0

Set date and time value to a cell.

Parameters:
  • row – row ID

  • col – column ID

  • year – 1-based value representing year

  • month – 1-based value representing month, varying from 1 through 12.

  • day – 1-based value representing day, varying from 1 through 31.

  • hour – the hour of a day, ranging from 0 through 23.

  • minute – the minute of an hour, ranging from 0 through 59.

  • second – the second of a minute, ranging from 0 through 59.

virtual void set_format(row_t row, col_t col, size_t xf_index) = 0

Set cell format to specified cell. The cell format is referred to by the xf (cell format) index in the styles table.

Note

This method gets called after both set_column_format() and set_row_format().

Parameters:
  • row – row ID

  • col – column ID

  • xf_index – 0-based xf (cell format) index

virtual void set_format(row_t row_start, col_t col_start, row_t row_end, col_t col_end, size_t xf_index) = 0

Set cell format to specified cell range. The cell format is referred to by the xf (cell format) index in the styles table.

Parameters:
  • row_start – start row ID

  • col_start – start column ID

  • row_end – end row ID

  • col_end – end column ID

  • xf_index – 0-based xf (cell format) index

virtual void set_column_format(col_t col, col_t col_span, std::size_t xf_index) = 0

Set cell format to a specified column. The cell format is referred to by the xf (cell format) index in the styles table.

Note

This method gets called first before set_row_format() or set_format() variants.

Parameters:
  • col – column ID

  • col_span – number of contiguous columns to apply the format to. It must be at least one.

  • xf_index – 0-based xf (cell format) index

virtual void set_row_format(row_t row, std::size_t xf_index) = 0

Set cell format to a specified row. The cell format is referred to by the xf (cell format) index in the styles table.

Note

This method gets called after set_column_format() but before set_format().

Parameters:
  • row – row ID

  • xf_index – 0-based xf (cell format) index

virtual void fill_down_cells(row_t src_row, col_t src_col, row_t range_size) = 0

Duplicate the value of the source cell to one or more cells located immediately below it.

Parameters:
  • src_row – row ID of the source cell

  • src_col – column ID of the source cell

  • range_size – number of cells below the source cell to copy the source cell value to. It must be at least one.

virtual range_size_t get_sheet_size() const = 0

Get the size of the sheet.

Returns:

structure containing the numbers of rows and columns of the sheet.

import_sheet_properties

class import_sheet_properties

Interface for importing sheet properties. Sheet properties include:

  • column widths and row heights,

  • hidden flags for columns and rows, and

  • merged cell ranges.

These properties are independent of the cell contents of a sheet.

Public Functions

virtual ~import_sheet_properties()
virtual void set_column_width(col_t col, col_t col_span, double width, orcus::length_unit_t unit) = 0

Set a column width to one or more columns.

Parameters:
  • col – 0-based position of the first column.

  • col_span – number of contiguous columns to apply the width to.

  • width – column width to apply.

  • unit – unit of measurement to use for the width value.

virtual void set_column_hidden(col_t col, col_t col_span, bool hidden) = 0

Set a column hidden flag to one or more columns.

Parameters:
  • col – 0-based position of the first column.

  • col_span – number of contiguous columns to apply the flag to.

  • hidden – flag indicating whether or not the columns are hidden.

virtual void set_row_height(row_t row, row_t row_span, double height, orcus::length_unit_t unit) = 0

Set a row height to specified row.

Todo:

Convert this to take a raw span.

Parameters:
  • row – 0-based position of a row.

  • row_span – number of contiguous rows to apply the height to.

  • height – new row height value to set.

  • unit – unit of the new row height value.

virtual void set_row_hidden(row_t row, row_t row_span, bool hidden) = 0

Set a row hidden flag to a specified row.

Todo:

Convert this to take a raw span.

Parameters:
  • row – 0-based position of a row.

  • row_span – number of contiguous rows to apply the flag to.

  • hidden – flag indicating whether or not the row is hidden.

virtual void set_merge_cell_range(const range_t &range) = 0

Set a merged cell range.

Parameters:

range – structure containing the top-left and bottom-right positions of a merged cell range.

import_sheet_view

class import_sheet_view

Interface for importing view properties. This interface may be obtained from the import_sheet interface.

Public Functions

virtual ~import_sheet_view()
virtual void set_sheet_active() = 0

Set the current sheet as the active sheet.

virtual void set_split_pane(double hor_split, double ver_split, const address_t &top_left_cell, sheet_pane_t active_pane) = 0

Set the information about split view in the current sheet.

Parameters:
  • hor_split – horizontal position of the split in 1/20th of a point, or 0 if none. “Horizontal” in this case indicates the column direction.

  • ver_split – vertical position of the split in 1/20th of a point, or 0 if none. “Vertical” in this case indicates the row direction.

  • top_left_cell – the top left visible cell in the bottom right pane.

  • active_pane – active pane in this sheet.

virtual void set_frozen_pane(col_t visible_columns, row_t visible_rows, const address_t &top_left_cell, sheet_pane_t active_pane) = 0

Set the state of frozen view in the current sheet.

Parameters:
  • visible_columns – number of visible columns in the left pane.

  • visible_rows – number of visible rows in the top pane.

  • top_left_cell – the top left visible cell in the bottom right pane.

  • active_pane – active pane in this sheet.

virtual void set_selected_range(sheet_pane_t pane, range_t range) = 0

Set the selected cursor range in a specified sheet pane.

Parameters:
  • pane – sheet pane associated with the selection. The top-left pane is used for a non-split sheet view.

  • range – selected cursor range. The range will be 1 column by 1 row when the cursor is on a single cell only.

import_strikethrough

class import_strikethrough

Interface for importing strikethrough attributes of a text.

Public Functions

virtual ~import_strikethrough()
virtual void set_style(strikethrough_style_t s) = 0

Set the strikethrough style of a font.

Parameters:

s – strikethrough style of a font.

virtual void set_type(strikethrough_type_t s) = 0

Set whether the strikethrough of a font consists of a single line or a double line.

Parameters:

s – whether the strikethrough of a font consists of a single line or a double line.

virtual void set_width(strikethrough_width_t s) = 0

Set the width of the strikethrough of a font.

Parameters:

s – the width of the strikethrough of a font.

virtual void set_text(strikethrough_text_t s) = 0

Set the text to use as a strikethrough.

Parameters:

s – text to use as a strikethrough.

virtual void commit() = 0

Commit the strikethrough attributes in the current buffer.

import_styles

class import_styles

Interface for importing styles. This one acts as an entry point and provides other interfaces for the style categories.

The styles are to be stored in a flyweight fashion where each style category maintains an array of stored style items, which are referenced by their indices. Each time a style item is pushed through the interface, it returns an index representing the item. The indices are to be assigned sequentially starting with 0 in each style category, and the default style must get an index of 0. Because of this, the import filter imports the default styles first before importing other non-default styles.

The appreviation xf stands for cell format, and is used throughout the styles API. Similarly, the dxf stands for differential cell format, and stores partial format properties that are to be applied on top of the base format properties.

Note

The implementor of this interface must implement all interfaces for all the style categories that this interface returns.

Subclassed by orcus::spreadsheet::import_styles

Public Functions

virtual ~import_styles()
virtual import_font_style *start_font_style() = 0

Signal the start of the import of font style attributes, and return a pointer to the interface instance for importing the attributes.

Note

Note that the import_styles implementer must return a non-null pointer.

Returns:

pointer to the interface instance for importing font style attributes.

virtual import_fill_style *start_fill_style() = 0

Signal the start of the import of fill style attributes, and return a pointer to the interface instance for importing the attributes.

Note

Note that the import_styles implementer must return a non-null pointer.

Returns:

pointer to the interface instance for importing fill style attributes.

virtual import_border_style *start_border_style() = 0

Signal the start of the import of border style attributes, and return a pointer to the interface instance for importing the attributes.

Note

Note that the import_styles implementer must return a non-null pointer.

Returns:

pointer to the interface instance for importing border style attributes.

virtual import_cell_protection *start_cell_protection() = 0

Signal the start of the import of cell protection attributes, and return a pointer to the interface instance for importing the attributes.

Note

Note that the import_styles implementer must return a non-null pointer.

Returns:

pointer to the interface instance for importing cell protection attributes.

virtual import_number_format *start_number_format() = 0

Signal the start of the import of number format attributes and return a pointer to the interface instance for importing the attributes.

Note

Note that the import_styles implementer must return a non-null pointer.

Returns:

pointer to the interface instance for importing number format attributes.

virtual import_xf *start_xf(xf_category_t cat) = 0

Signal the start of the import of cell format (xf) indices that each reference different format attributes in their respective pools, and return a pointer to the interface instance for importing the indices.

Note

Note that the import_styles implementer must return a non-null pointer.

Returns:

pointer to the interface instance for importing cell format (xf) indices.

virtual import_cell_style *start_cell_style() = 0

Signal the start of the import of named cell style information, and return a pointer to the interface instance for importing the information.

Note

Note that the import_styles implementer must return a non-null pointer.

Returns:

pointer to the interface instance for importing named cell style information.

virtual void set_font_count(size_t n) = 0

Set the total number of font styles. This may be called before importing any of the font styles. This will give the implementer a chance to allocate storage. Note that it may not always be called.

Parameters:

n – number of font styles.

virtual void set_fill_count(size_t n) = 0

Set the total number of fill styles. This may be called before importing any of the fill styles. This will give the implementer a chance to allocate storage. Note that it may not always be called.

Parameters:

n – number of fill styles.

virtual void set_border_count(size_t n) = 0

Set the total number of border styles. This may be called before importing any of the border styles. This will give the implementer a chance to allocate storage. Note that it may not always be called.

Parameters:

n – number of border styles.

virtual void set_number_format_count(size_t n) = 0

Set the total number of number format styles. This may be called before importing any of the number format styles. This will give the implementer a chance to allocate storage. Note that it may not always be called.

Parameters:

n – number of number format styles.

virtual void set_xf_count(xf_category_t cat, size_t n) = 0

Set the total number of cell format styles for a specified cell format category. This may be called before importing any of the cell format styles for the specified category. This will give the implementer a chance to allocate storage. Note that it may not always be called.

Parameters:
  • cat – cell format category.

  • n – number of cell formats styles for the specified cell format category.

virtual void set_cell_style_count(size_t n) = 0

Set the total number of named cell styles. This may be called before importing any cell styles to give the implementer a chance to allocate storage. Note that it may not always be called.

Parameters:

n – number of named cell styles.

import_table

class import_table

Interface for table. A table is a range of cells within a sheet that consists of one or more data columns with a header row that contains their labels.

Public Functions

virtual ~import_table()
virtual import_auto_filter *start_auto_filter(const range_t &range)

Get an optional interface for importing auto filter data stored as part of a table.

The implementor should initialize the internal buffer to store the auto filter data when this method is called.

Parameters:

range – Filtered range.

Returns:

Pointer to an auto filter interface object, or a nullptr if the implementor doesn’t support it.

virtual void set_identifier(size_t id) = 0

Set an integral identifier unique to the table.

Parameters:

id – identifier associated with the table.

virtual void set_range(const range_t &range) = 0

Set a 2-dimensional cell range associated with the table.

Parameters:

range – cell range associated with the table.

virtual void set_totals_row_count(size_t row_count) = 0

Set the number of totals rows.

Parameters:

row_count – number of totals rows.

virtual void set_name(std::string_view name) = 0

Set the internal name of the table.

Parameters:

name – name of the table.

virtual void set_display_name(std::string_view name) = 0

Set the displayed name of the table.

Parameters:

name – displayed name of the table.

virtual void set_column_count(size_t n) = 0

Set the number of columns the table contains.

Note

This method gets called before the column data gets imported. The implementor can use this call to initialize the buffer for storing the column data.

Parameters:

n – number of columns in the table.

virtual void set_column_identifier(size_t id) = 0

Set an integral identifier for a column.

Parameters:

id – integral identifier for a column.

virtual void set_column_name(std::string_view name) = 0

Set a name of a column.

Parameters:

name – name of a column.

virtual void set_column_totals_row_label(std::string_view label) = 0

Set the totals row label for a column.

Parameters:

label – row label for a column.

virtual void set_column_totals_row_function(totals_row_function_t func) = 0

Set the totals row function for a column.

Parameters:

func – totals row function for a column.

virtual void commit_column() = 0

Push and append the column data stored in the current column data buffer into the table buffer.

virtual void set_style_name(std::string_view name) = 0

Set the name of a style to apply to the table.

Parameters:

name – name of a style to apply to the table.

virtual void set_style_show_first_column(bool b) = 0

Specify whether or not the first column in the table should have the style applied.

Parameters:

b – whether or not the first column in the table should have the style applied.

virtual void set_style_show_last_column(bool b) = 0

Specify whether or not the last column in the table should have the style applied.

Parameters:

b – whether or not the last column in the table should have the style applied.

virtual void set_style_show_row_stripes(bool b) = 0

Specify whether or not row stripe formatting is applied.

Parameters:

b – whether or not row stripe formatting is applied.

virtual void set_style_show_column_stripes(bool b) = 0

Specify whether or not column stripe formatting is applied.

Parameters:

b – whether or not column stripe formatting is applied.

virtual void commit() = 0

Push the data stored in the table buffer into the document store.

import_underline

class import_underline

Interface for importing underline attributes of a text.

Public Functions

~import_underline()
virtual void set_style(underline_style_t e) = 0

Set the style of an underline.

Parameters:

e – underline style of a font.

virtual void set_thickness(underline_thickness_t e) = 0

Set the thickness of an underline.

Parameters:

e – Thickness of the underline.

virtual void set_spacing(underline_spacing_t e) = 0

Set the spacing of an underline with respect to the text it is applied to.

Parameters:

e – Spacing of an underline.

virtual void set_count(underline_count_t e) = 0

Set the number of vertically-stacked lines in an underline.

Parameters:

e – Number of vertically-stacked lines in an underline.

virtual void set_color(color_elem_t alpha, color_elem_t red, color_elem_t green, color_elem_t blue) = 0

Specify the color of an underline in ARGB format.

Note

If this value is not explicitly set, the font color should be used.

Parameters:
  • alpha – alpha component of the color.

  • red – red component of the color.

  • green – green component of the color.

  • blue – blue component of the color.

virtual void commit() = 0

Commit the underline attributes in the current buffer.

import_xf

class import_xf

This interface is used to import cell format records for direct cell formats, named cell style formats, and differential cell formats.

The following cell format types:

  • font

  • fill

  • border

  • protection

  • number format

use indices to reference their records in their respective record pools.

The horizontal and vertical alignments are specified directly.

Public Functions

virtual ~import_xf()
virtual void set_font(size_t index) = 0

Set the index of the font record, as returned from the import_font_style::commit() method.

Parameters:

index – index of the font record to reference.

virtual void set_fill(size_t index) = 0

Set the index of the fill record, as returned from the import_fill_style::commit() method.

Parameters:

index – index of the fill record to reference.

virtual void set_border(size_t index) = 0

Set the index of the border record, as returned from the import_border_style::commit() method.

Parameters:

index – index of the border record to reference.

virtual void set_protection(size_t index) = 0

Set the index of the cell protection record, as returned from the import_cell_protection::commit() method.

Parameters:

index – index of the cell protection record to reference.

virtual void set_number_format(size_t index) = 0

Set the index of the number format record, as returned from the import_number_format::commit() method.

Parameters:

index – index of the number format record to reference.

virtual void set_style_xf(size_t index) = 0

Set the index into the cell style record to specify a named cell style it uses as its base format in case the cell has an underlying style applied. This can be used for a direct cell format i.e. when the xf category is xf_category_t::cell or for a cell style format i.e. the xf category is xf_category_t::cell_style. In a cell style format, this can be used to reference a parent style.

Parameters:

index – index into the cell style record it uses as its basis.

virtual void set_apply_alignment(bool b) = 0

Set the flag indicating whether or not to apply the alignment attribute.

Note

This is specific to Excel format.

Parameters:

b – flag indicating whether or not to apply the alignment attribute.

virtual void set_horizontal_alignment(hor_alignment_t align) = 0

Set the horizontal alignment of a style.

Parameters:

align – horizontal alignment of a style.

virtual void set_vertical_alignment(ver_alignment_t align) = 0

Set the vertical alignment of a style.

Parameters:

align – vertical alignment of a style.

virtual void set_wrap_text(bool b) = 0

Specify whether or not to wrap text when the text spills over the cell region.

Parameters:

b – whether or not to wrap text when the text spills over the cell region.

virtual void set_shrink_to_fit(bool b) = 0

Specify whether or not to shrink the text within cell until it fits inside the cell.

Parameters:

b – whether or not to shrink the text.

virtual size_t commit() = 0

Commit the cell format in the current buffer to the storage.

Returns:

index of the cell format data in the storage. This index may be passed to the import_cell_style::set_xf() method.