1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
16 namespace com::sun::star::sheet
{ struct SubTotalColumn
; }
17 namespace com::sun::star::uno
{ template <class E
> class Sequence
; }
19 struct SC_DLLPUBLIC ScSubTotalParam
21 SCCOL nCol1
= 0; ///< selected area
25 sal_uInt16 nUserIndex
= 0; ///< index into list
26 bool bRemoveOnly
:1 = false;
27 bool bReplace
:1 = true; ///< replace existing results
28 bool bPagebreak
:1 = false; ///< page break at change of group
29 bool bCaseSens
:1 = false;
30 bool bDoSort
:1 = true; ///< presort
31 bool bSummaryBelow
:1 = true; ///< Summary below or above (default: below)
32 bool bAscending
:1 = true; ///< sort ascending
33 bool bUserDef
:1 = false; ///< sort user defined
34 bool bIncludePattern
:1 = false; ///< sort formats
38 bool bActive
= false; ///< active groups
39 SCCOL nField
= 0; ///< associated field
40 SCCOL nSubTotals
= 0; ///< number of SubTotals
42 using Pair
= std::pair
<SCCOL
, ScSubTotalFunc
>;
43 // array of columns to be calculated, and associated functions
44 std::unique_ptr
<Pair
[]> pSubTotals
;
46 SubtotalGroup() = default;
47 SubtotalGroup(const SubtotalGroup
& r
);
49 SubtotalGroup
& operator=(const SubtotalGroup
& r
);
50 bool operator==(const SubtotalGroup
& r
) const;
52 void AllocSubTotals(SCCOL n
);
53 void SetSubtotals(const css::uno::Sequence
<css::sheet::SubTotalColumn
>& seq
);
55 std::span
<Pair
> subtotals() { return std::span(pSubTotals
.get(), nSubTotals
); }
56 std::span
<const Pair
> subtotals() const { return std::span(pSubTotals
.get(), nSubTotals
); }
57 SCCOL
& col(SCCOL n
) { return subtotals()[n
].first
; }
58 SCCOL
col(SCCOL n
) const { return subtotals()[n
].first
; }
59 ScSubTotalFunc
func(SCCOL n
) const { return subtotals()[n
].second
; }
61 SubtotalGroup aGroups
[MAXSUBTOTAL
];
63 ScSubTotalParam() = default;
64 ScSubTotalParam(const ScSubTotalParam
&) = default;
66 ScSubTotalParam
& operator=(const ScSubTotalParam
&) = default;
67 inline bool operator==(const ScSubTotalParam
&) const = default;
68 void SetSubTotals( sal_uInt16 nGroup
,
69 const SCCOL
* ptrSubTotals
,
70 const ScSubTotalFunc
* ptrFunctions
,
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */