LOK: tilebench improvements
[LibreOffice.git] / sc / inc / pivot.hxx
bloba2fa951e070392f5f6c5d805a37c0b3f5ccdfd22
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 IMPORTANT:
22 Strictly adhere to the following sequence when creating a pivot table:
24 pPivot->SetColFields(aColArr, aColCount)
25 pPivot->SetRowFields(aRowArr, aRowCount)
26 pPivot->SetDataFields(aDataArr, aDataCount)
27 if (pPivot->CreateData())
29 pPivotDrawData();
30 pPivotReleaseData();
33 Make sure that either ColArr or RowArr contains a PivotDataField entry.
36 #ifndef INCLUDED_SC_INC_PIVOT_HXX
37 #define INCLUDED_SC_INC_PIVOT_HXX
39 #include "global.hxx"
40 #include "address.hxx"
41 #include "dpglobal.hxx"
42 #include "calcmacros.hxx"
44 #include <vector>
45 #include <memory>
47 #include <com/sun/star/uno/Sequence.hxx>
48 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
49 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
50 #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
51 #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
53 #define PIVOT_DATA_FIELD (MAXCOLCOUNT)
55 struct SC_DLLPUBLIC ScDPName
57 OUString maName; ///< Original name of the dimension.
58 OUString maLayoutName; ///< Layout name (display name)
59 sal_uInt8 mnDupCount;
61 ScDPName();
62 explicit ScDPName(const OUString& rName, const OUString& rLayoutName, sal_uInt8 nDupCount);
65 struct ScDPLabelData
67 OUString maName; ///< Original name of the dimension.
68 OUString maLayoutName; ///< Layout name (display name)
69 OUString maSubtotalName;
70 SCCOL mnCol; ///< 0-based field index (not the source column index)
71 long mnOriginalDim; ///< original dimension index (>= 0 for duplicated dimension)
72 PivotFunc mnFuncMask; ///< Page/Column/Row subtotal function.
73 sal_Int32 mnUsedHier; ///< Used hierarchy.
74 sal_Int32 mnFlags; ///< Flags from the DataPilotSource dimension
75 sal_uInt8 mnDupCount;
76 bool mbShowAll:1; ///< true = Show all (also empty) results.
77 bool mbIsValue:1; ///< true = Sum or count in data field.
78 bool mbDataLayout:1;
79 bool mbRepeatItemLabels:1;
81 struct Member
83 OUString maName;
84 OUString maLayoutName;
85 bool mbVisible;
86 bool mbShowDetails;
88 Member();
90 /**
91 * @return the name that should be displayed in the dp dialogs i.e.
92 * when the layout name is present, use it, or else use the original
93 * name.
95 SC_DLLPUBLIC OUString const & getDisplayName() const;
97 std::vector<Member> maMembers;
98 css::uno::Sequence<OUString> maHiers; ///< Hierarchies.
99 css::sheet::DataPilotFieldSortInfo maSortInfo; ///< Sorting info.
100 css::sheet::DataPilotFieldLayoutInfo maLayoutInfo; ///< Layout info.
101 css::sheet::DataPilotFieldAutoShowInfo maShowInfo; ///< AutoShow info.
103 ScDPLabelData();
106 * @return the name that should be displayed in the dp dialogs i.e. when
107 * the layout name is present, use it, or else use the original name.
109 SC_DLLPUBLIC OUString const & getDisplayName() const;
112 typedef std::vector< std::unique_ptr<ScDPLabelData> > ScDPLabelDataVector;
114 struct ScPivotField
116 SCCOL nCol; ///< 0-based dimension index (not source column index)
117 long mnOriginalDim; ///< >= 0 for duplicated field.
118 PivotFunc nFuncMask;
119 sal_uInt8 mnDupCount;
121 css::sheet::DataPilotFieldReference maFieldRef;
123 explicit ScPivotField( SCCOL nNewCol = 0 );
124 ScPivotField( const ScPivotField& r );
126 long getOriginalDim() const;
129 typedef std::vector< ScPivotField > ScPivotFieldVector;
131 struct ScPivotParam
133 SCCOL nCol; ///< Cursor Position /
134 SCROW nRow; ///< or start of destination area
135 SCTAB nTab;
137 ScDPLabelDataVector maLabelArray;
138 ScPivotFieldVector maPageFields;
139 ScPivotFieldVector maColFields;
140 ScPivotFieldVector maRowFields;
141 ScPivotFieldVector maDataFields;
143 bool bIgnoreEmptyRows;
144 bool bDetectCategories;
145 bool bMakeTotalCol;
146 bool bMakeTotalRow;
148 ScPivotParam();
149 ScPivotParam( const ScPivotParam& r );
150 ~ScPivotParam();
152 ScPivotParam& operator= ( const ScPivotParam& r );
153 void SetLabelData(const ScDPLabelDataVector& r);
156 struct ScPivotFuncData
158 SCCOL mnCol;
159 long mnOriginalDim;
160 PivotFunc mnFuncMask;
161 sal_uInt8 mnDupCount;
163 css::sheet::DataPilotFieldReference maFieldRef;
165 explicit ScPivotFuncData( SCCOL nCol, PivotFunc nFuncMask );
167 #if DEBUG_PIVOT_TABLE
168 void Dump() const;
169 #endif
172 typedef std::vector<ScDPName> ScDPNameVec;
174 #endif
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */