summaryrefslogtreecommitdiff
path: root/sc/inc/pivot/PivotTableFormats.hxx
blob: 2665c088625ccdc8dcaf9b5a5d554a2c215d1eb8 (plain)
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
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * 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 <memory>
#include <vector>
#include <rtl/ustring.hxx>
#include <patattr.hxx>
#include <memory>

namespace sc
{
/** Type of a pivot table cell format to which a selection can be made. */
enum class FormatType
{
    None,
    Data,
    Label
};

/** Information to make a selection in the pivot table. */
struct Selection
{
    sal_Int32 nField = 0;
    sal_uInt32 nDataIndex = 0;
};

/** Holds cell patter attributes and a selection information to which cells in the pivot table
 *  the pattern should be applied.
 */
struct PivotTableFormat
{
    FormatType eType = FormatType::None;
    std::vector<Selection> aSelections;
    std::shared_ptr<ScPatternAttr> pPattern;
};

/** A holder for a collection of PivotTableFormat */
class PivotTableFormats
{
    std::vector<PivotTableFormat> maFormats;

public:
    void add(PivotTableFormat const& rPivotTableFormat) { maFormats.push_back(rPivotTableFormat); }

    size_t size() { return maFormats.size(); }

    std::vector<PivotTableFormat> const& getVector() { return maFormats; }
};
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */