diff options
Diffstat (limited to 'core/src/Model/Template/TableTemplate.hpp')
-rw-r--r-- | core/src/Model/Template/TableTemplate.hpp | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/core/src/Model/Template/TableTemplate.hpp b/core/src/Model/Template/TableTemplate.hpp index d704b1f..6454ccd 100644 --- a/core/src/Model/Template/TableTemplate.hpp +++ b/core/src/Model/Template/TableTemplate.hpp @@ -1,8 +1,10 @@ -#pragma once +#pragma once #include "Utils/Vector.hpp" #include "Utils/VectorHash.hpp" +#include "cplt_fwd.hpp" +#include <tsl/robin_map.h> #include <string> #include <vector> @@ -42,6 +44,32 @@ public: bool IsMergedCell() const; }; +/// Parameter group information for a grouped array of cells, either horizontal or vertical. +/// These cells can have "expansion behavior", i.e. when instanciating, a list of cell values would be provided by +/// the caller: +/// \code +/// [["foo", "bar", "foobar"], +/// ["a", "b", c"], +/// ["1", "2", "3"], +/// ["x", "y", "z"]] +/// // ... may be more +/// \endcode +/// +/// For a array parameter group that vertically expands, this would create 4 rows of data in the place of the +/// original parameter group. If more than one array parameter groups are on the same row, they would share space +/// between each other : +/// +/// \code +/// | 2 elements was fed to it +/// | | 1 element was fed to it +/// V V +/// {~~~~~~~~~~~~~~~~}{~~~~~~~~~~~~~~} +/// +------+---------+---------------+ +/// | Foo | Example | Another group | +/// +------+---------+---------------+ +/// | Cool | Example | | +/// +------+---------+---------------+ +/// \endcode class TableArrayParameterGroup { public: @@ -57,6 +85,26 @@ public: ExpansionDirection ExpandDirection; }; +// Forward declaration of libxlsxwriter structs +struct lxw_workbook; +struct lxw_worksheet; + +/// An object containing the necessary information to instanciate a table template. +/// \see TableTemplate +class TableInstanciationParameters +{ +private: + TableTemplate* mTemplate; + tsl::robin_map<Vec2i, std::string> ParametricCells; + +public: + // TODO +}; + +/// A table template, where individual cells can be filled by workflows instanciating this template. Merged cells, +/// parametric rows/columns, and grids are also supported. +/// +/// This current supports exporting to xlsx files. class TableTemplate { private: @@ -86,4 +134,7 @@ public: BCR_Success, }; BreakCellsResult BreakCells(Vec2i topLeft); + + lxw_workbook* InstanciateToExcelWorkbook(const TableInstanciationParameters& params) const; + lxw_worksheet* InstanciateToExcelWorksheet(lxw_workbook* workbook, const TableInstanciationParameters& params) const; }; |