Bump version to 4.3-4
[LibreOffice.git] / sc / inc / pivot.hxx
bloba3661a4c6708d34cc35870433cc4e6e5e24918db
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 <boost/ptr_container/ptr_vector.hpp>
47 #define PIVOT_DATA_FIELD (MAXCOLCOUNT)
48 #include <com/sun/star/uno/Sequence.hxx>
49 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
50 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
51 #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
52 #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
54 struct SC_DLLPUBLIC ScDPName
56 OUString maName; ///< Original name of the dimension.
57 OUString maLayoutName; ///< Layout name (display name)
58 sal_uInt8 mnDupCount;
60 ScDPName();
61 explicit ScDPName(const OUString& rName, const OUString& rLayoutName, sal_uInt8 nDupCount);
64 struct ScDPLabelData
66 OUString maName; ///< Original name of the dimension.
67 OUString maLayoutName; ///< Layout name (display name)
68 OUString maSubtotalName;
69 SCCOL mnCol; ///< 0-based field index (not the source column index)
70 long mnOriginalDim; ///< original dimension index (>= 0 for duplicated dimension)
71 sal_uInt16 mnFuncMask; ///< Page/Column/Row subtotal function.
72 sal_Int32 mnUsedHier; ///< Used hierarchy.
73 sal_Int32 mnFlags; ///< Flags from the DataPilotSource dimension
74 sal_uInt8 mnDupCount;
75 bool mbShowAll:1; ///< true = Show all (also empty) results.
76 bool mbIsValue:1; ///< true = Sum or count in data field.
77 bool mbDataLayout:1;
79 struct Member
81 OUString maName;
82 OUString maLayoutName;
83 bool mbVisible;
84 bool mbShowDetails;
86 Member();
88 /**
89 * @return the name that should be displayed in the dp dialogs i.e.
90 * when the layout name is present, use it, or else use the original
91 * name.
93 OUString SC_DLLPUBLIC getDisplayName() const;
95 std::vector<Member> maMembers;
96 css::uno::Sequence<OUString> maHiers; ///< Hierarchies.
97 css::sheet::DataPilotFieldSortInfo maSortInfo; ///< Sorting info.
98 css::sheet::DataPilotFieldLayoutInfo maLayoutInfo; ///< Layout info.
99 css::sheet::DataPilotFieldAutoShowInfo maShowInfo; ///< AutoShow info.
101 ScDPLabelData();
104 * @return the name that should be displayed in the dp dialogs i.e. when
105 * the layout name is present, use it, or else use the original name.
107 OUString SC_DLLPUBLIC getDisplayName() const;
110 typedef boost::ptr_vector<ScDPLabelData> ScDPLabelDataVector;
112 struct ScPivotField
114 SCCOL nCol; ///< 0-based dimension index (not source column index)
115 long mnOriginalDim; ///< >= 0 for duplicated field.
116 sal_uInt16 nFuncMask;
117 sal_uInt8 mnDupCount;
119 css::sheet::DataPilotFieldReference maFieldRef;
121 explicit ScPivotField( SCCOL nNewCol = 0, sal_uInt16 nNewFuncMask = PIVOT_FUNC_NONE );
122 ScPivotField( const ScPivotField& r );
124 long getOriginalDim() const;
125 bool operator==( const ScPivotField& r ) const;
128 typedef std::vector< ScPivotField > ScPivotFieldVector;
130 struct ScPivotParam
132 SCCOL nCol; ///< Cursor Position /
133 SCROW nRow; ///< or start of destination area
134 SCTAB nTab;
136 ScDPLabelDataVector maLabelArray;
137 ScPivotFieldVector maPageFields;
138 ScPivotFieldVector maColFields;
139 ScPivotFieldVector maRowFields;
140 ScPivotFieldVector maDataFields;
142 bool bIgnoreEmptyRows;
143 bool bDetectCategories;
144 bool bMakeTotalCol;
145 bool bMakeTotalRow;
147 ScPivotParam();
148 ScPivotParam( const ScPivotParam& r );
149 ~ScPivotParam();
151 ScPivotParam& operator= ( const ScPivotParam& r );
152 bool operator== ( const ScPivotParam& r ) const;
153 void SetLabelData(const ScDPLabelDataVector& r);
156 struct ScPivotFuncData
158 SCCOL mnCol;
159 long mnOriginalDim;
160 sal_uInt16 mnFuncMask;
161 sal_uInt8 mnDupCount;
163 css::sheet::DataPilotFieldReference maFieldRef;
165 explicit ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask );
167 bool operator== (const ScPivotFuncData& r) const;
169 #if DEBUG_PIVOT_TABLE
170 void Dump() const;
171 #endif
174 typedef std::vector<ScPivotFuncData> ScPivotFuncDataVector;
175 typedef std::vector<ScDPName> ScDPNameVec;
177 #endif
179 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */