bump product version to 4.1.6.2
[LibreOffice.git] / sc / inc / pivot.hxx
bloba1e063f421a5fc068bae52dec67e164e6e736f22
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.
37 #ifndef SC_PIVOT_HXX
38 #define SC_PIVOT_HXX
40 #include "global.hxx"
41 #include "address.hxx"
42 #include "dpglobal.hxx"
43 #include "dpmacros.hxx"
45 #include <vector>
46 #include <boost/ptr_container/ptr_vector.hpp>
48 #define PIVOT_DATA_FIELD (MAXCOLCOUNT)
49 #include <com/sun/star/uno/Sequence.hxx>
50 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
51 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
52 #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
53 #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
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 // ============================================================================
67 struct ScDPLabelData
69 OUString maName; /// Original name of the dimension.
70 OUString maLayoutName; /// Layout name (display name)
71 OUString maSubtotalName;
72 SCCOL mnCol; ///< 0-based field index (not the source column index)
73 long mnOriginalDim; ///< original dimension index (>= 0 for duplicated dimension)
74 sal_uInt16 mnFuncMask; ///< Page/Column/Row subtotal function.
75 sal_Int32 mnUsedHier; ///< Used hierarchy.
76 sal_Int32 mnFlags; ///< Flags from the DataPilotSource dimension
77 sal_uInt8 mnDupCount;
78 bool mbShowAll:1; ///< true = Show all (also empty) results.
79 bool mbIsValue:1; ///< true = Sum or count in data field.
80 bool mbDataLayout:1;
82 struct Member
84 OUString maName;
85 OUString maLayoutName;
86 bool mbVisible;
87 bool mbShowDetails;
89 Member();
91 /**
92 * return the name that should be displayed in the dp dialogs i.e.
93 * when the layout name is present, use it, or else use the original
94 * name.
96 OUString SC_DLLPUBLIC getDisplayName() const;
98 ::std::vector<Member> maMembers;
99 ::com::sun::star::uno::Sequence< OUString > maHiers; /// Hierarchies.
100 ::com::sun::star::sheet::DataPilotFieldSortInfo maSortInfo; /// Sorting info.
101 ::com::sun::star::sheet::DataPilotFieldLayoutInfo maLayoutInfo; /// Layout info.
102 ::com::sun::star::sheet::DataPilotFieldAutoShowInfo maShowInfo; /// AutoShow info.
104 ScDPLabelData();
107 * return the name that should be displayed in the dp dialogs i.e. when
108 * the layout name is present, use it, or else use the original name.
110 OUString SC_DLLPUBLIC getDisplayName() const;
113 typedef boost::ptr_vector<ScDPLabelData> ScDPLabelDataVector;
115 struct ScPivotField
117 SCCOL nCol; /// 0-based dimension index (not source column index)
118 long mnOriginalDim; /// >= 0 for duplicated field.
119 sal_uInt16 nFuncMask;
120 sal_uInt8 mnDupCount;
121 ::com::sun::star::sheet::DataPilotFieldReference maFieldRef;
123 explicit ScPivotField( SCCOL nNewCol = 0, sal_uInt16 nNewFuncMask = PIVOT_FUNC_NONE );
124 ScPivotField( const ScPivotField& r );
126 long getOriginalDim() const;
127 bool operator==( const ScPivotField& r ) const;
130 typedef ::std::vector< ScPivotField > ScPivotFieldVector;
132 struct ScPivotParam
134 SCCOL nCol; // Cursor Position /
135 SCROW nRow; // or start of destination area
136 SCTAB nTab;
137 ScDPLabelDataVector maLabelArray;
138 ScPivotFieldVector maPageFields;
139 ScPivotFieldVector maColFields;
140 ScPivotFieldVector maRowFields;
141 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;
162 ::com::sun::star::sheet::DataPilotFieldReference maFieldRef;
164 explicit ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask );
165 explicit ScPivotFuncData(
166 SCCOL nCol, long nOriginalDim, sal_uInt16 nFuncMask, sal_uInt8 nDupCount,
167 const ::com::sun::star::sheet::DataPilotFieldReference& rFieldRef );
169 bool operator== (const ScPivotFuncData& r) const;
171 #if DEBUG_PIVOT_TABLE
172 void Dump() const;
173 #endif
176 typedef ::std::vector< ScPivotFuncData > ScPivotFuncDataVector;
177 typedef std::vector<ScDPName> ScDPNameVec;
179 #endif
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */