1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "types.hpp"
#include "../types.hpp"
#include "../env.hpp"
// NB: This header must not depend on ixion, as it needs to be usable for
// those clients that provide their own formula engine. Other headers in
// the orcus::spreadsheet namespace may depend on ixion.
namespace orcus { namespace spreadsheet { namespace iface {
/**
* Interface for importing a pivot field as part of a pivot table.
*
* A pivot field is a single field that can be added to row, column or page
* axes.
*/
class ORCUS_DLLPUBLIC import_pivot_field
{
public:
virtual ~import_pivot_field();
virtual void set_item_count(std::size_t count) = 0;
virtual void set_axis(pivot_axis_t axis) = 0;
/**
* Append a pivot field item with an index.
*
* @param index Index into the corresponding cache field in the pivot cache.
* @param hidden Whether or not this item is hidden.
*/
virtual void append_item(std::size_t index, bool hidden) = 0;
virtual void append_item(pivot_field_item_t type) = 0;
virtual void commit() = 0;
};
class ORCUS_DLLPUBLIC import_pivot_fields
{
public:
virtual ~import_pivot_fields();
virtual void set_count(std::size_t count) = 0;
virtual import_pivot_field* start_pivot_field() = 0;
virtual void commit() = 0;
};
/**
* Interface for importing either row or column fields.
*/
class ORCUS_DLLPUBLIC import_pivot_rc_fields
{
public:
virtual ~import_pivot_rc_fields();
virtual void set_count(std::size_t count) = 0;
virtual void append_field(std::size_t index) = 0;
/**
* Append a special field that displays a list of data fields when the pivot
* table contains more than one data field.
*/
virtual void append_data_field() = 0;
virtual void commit() = 0;
};
class ORCUS_DLLPUBLIC import_pivot_page_field
{
public:
virtual ~import_pivot_page_field();
virtual void set_field(std::size_t index) = 0;
virtual void set_item(std::size_t index) = 0;
virtual void commit() = 0;
};
class ORCUS_DLLPUBLIC import_pivot_page_fields
{
public:
virtual ~import_pivot_page_fields();
virtual void set_count(std::size_t count) = 0;
virtual import_pivot_page_field* start_page_field() = 0;
virtual void commit() = 0;
};
class ORCUS_DLLPUBLIC import_pivot_data_field
{
public:
virtual ~import_pivot_data_field();
virtual void set_field(std::size_t index) = 0;
virtual void set_name(std::string_view name) = 0;
virtual void set_subtotal_function(pivot_data_subtotal_t func) = 0;
virtual void set_show_data_as(
pivot_data_show_data_as_t type, std::size_t base_field, std::size_t base_item) = 0;
virtual void commit() = 0;
};
class ORCUS_DLLPUBLIC import_pivot_data_fields
{
public:
virtual ~import_pivot_data_fields();
virtual void set_count(std::size_t count) = 0;
virtual import_pivot_data_field* start_data_field() = 0;
virtual void commit() = 0;
};
/**
* Interface for importing a single row or column item.
*
* A single row or column item consists of a series of labels displayed in a
* pivot table output. The labels are represented by their respective indexes
* into the corresponding shared items in pivot cache definition. The number
* of indexes stored in one item is equal to the number of the corresponding
* row or column fields.
*/
class ORCUS_DLLPUBLIC import_pivot_rc_item
{
public:
virtual ~import_pivot_rc_item();
/**
* Set the number of items to be repeated from the previous row or column of
* items. This typically corresponds with the number of empty cells to fill
* before the first non-empty item label to appear.
*
* @param repeat Number of items to repeat from the previous row or column,
* which typically is the number of empty cells to fill.
*/
virtual void set_repeat_items(std::size_t repeat) = 0;
/**
* Set the type of items in the current row or column of items.
*
* @param type Item type in the current row or column of items.
*/
virtual void set_item_type(pivot_field_item_t type) = 0;
/**
* Set the index of a data item in a data field with multiple data items.
*
* @param index Index of a referenced data item.
*/
virtual void set_data_item(std::size_t index) = 0;
/**
* Append the index of an item of a field.
*
* @param index Index of a label.
*/
virtual void append_index(std::size_t index) = 0;
virtual void commit() = 0;
};
/**
* Interface for importing a series of row or column items.
*/
class ORCUS_DLLPUBLIC import_pivot_rc_items
{
public:
virtual ~import_pivot_rc_items();
virtual void set_count(std::size_t count) = 0;
virtual import_pivot_rc_item* start_item() = 0;
virtual void commit() = 0;
};
/**
* Interface for importing pivot table definitions.
*/
class ORCUS_DLLPUBLIC import_pivot_table_definition
{
public:
virtual ~import_pivot_table_definition();
virtual void set_name(std::string_view name) = 0;
virtual void set_cache_id(pivot_cache_id_t cache_id) = 0;
/**
* Set the range of a pivot table.
*
* @param ref Range of a pivot table.
*/
virtual void set_range(const range_t& ref) = 0;
virtual import_pivot_fields* start_pivot_fields() = 0;
virtual import_pivot_rc_fields* start_row_fields() = 0;
virtual import_pivot_rc_fields* start_column_fields() = 0;
virtual import_pivot_page_fields* start_page_fields() = 0;
virtual import_pivot_data_fields* start_data_fields() = 0;
virtual import_pivot_rc_items* start_row_items() = 0;
virtual import_pivot_rc_items* start_col_items() = 0;
virtual void commit() = 0;
};
}}}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|