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/.
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 .
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())
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 <rtl/ustring.hxx>
40 #include <tools/long.hxx>
43 #include "dpglobal.hxx"
44 #include "calcmacros.hxx"
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 #define PIVOT_DATA_FIELD (MAXCOLCOUNT)
57 struct SC_DLLPUBLIC ScDPName
59 OUString maName
; ///< Original name of the dimension.
60 OUString maLayoutName
; ///< Layout name (display name)
64 explicit ScDPName(const OUString
& rName
, const OUString
& rLayoutName
, sal_uInt8 nDupCount
);
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 tools::Long mnOriginalDim
; ///< original dimension index (>= 0 for duplicated dimension)
74 PivotFunc mnFuncMask
; ///< Page/Column/Row subtotal function.
75 sal_Int32 mnUsedHier
; ///< Used hierarchy.
76 sal_Int32 mnFlags
; ///< Flags from the DataPilotSource dimension
78 bool mbShowAll
:1; ///< true = Show all (also empty) results.
79 bool mbIsValue
:1; ///< true = Sum or count in data field.
81 bool mbRepeatItemLabels
:1;
86 OUString maLayoutName
;
93 * @return the name that should be displayed in the dp dialogs i.e.
94 * when the layout name is present, use it, or else use the original
97 SC_DLLPUBLIC OUString
const & getDisplayName() const;
99 std::vector
<Member
> maMembers
;
100 css::uno::Sequence
<OUString
> maHiers
; ///< Hierarchies.
101 css::sheet::DataPilotFieldSortInfo maSortInfo
; ///< Sorting info.
102 css::sheet::DataPilotFieldLayoutInfo maLayoutInfo
; ///< Layout info.
103 css::sheet::DataPilotFieldAutoShowInfo maShowInfo
; ///< AutoShow info.
108 * @return the name that should be displayed in the dp dialogs i.e. when
109 * the layout name is present, use it, or else use the original name.
111 SC_DLLPUBLIC OUString
const & getDisplayName() const;
114 typedef std::vector
< std::unique_ptr
<ScDPLabelData
> > ScDPLabelDataVector
;
118 css::sheet::DataPilotFieldReference maFieldRef
;
120 tools::Long mnOriginalDim
; ///< >= 0 for duplicated field.
122 SCCOL nCol
; ///< 0-based dimension index (not source column index)
123 sal_uInt8 mnDupCount
;
125 explicit ScPivotField( SCCOL nNewCol
= 0 );
127 tools::Long
getOriginalDim() const;
130 typedef std::vector
< ScPivotField
> ScPivotFieldVector
;
134 SCCOL nCol
; ///< Cursor Position /
135 SCROW nRow
; ///< or start of destination area
138 ScDPLabelDataVector maLabelArray
;
139 ScPivotFieldVector maPageFields
;
140 ScPivotFieldVector maColFields
;
141 ScPivotFieldVector maRowFields
;
142 ScPivotFieldVector maDataFields
;
144 bool bIgnoreEmptyRows
;
145 bool bDetectCategories
;
150 ScPivotParam( const ScPivotParam
& r
);
153 ScPivotParam
& operator= ( const ScPivotParam
& r
);
154 void SetLabelData(const ScDPLabelDataVector
& r
);
157 struct ScPivotFuncData
159 css::sheet::DataPilotFieldReference maFieldRef
;
161 tools::Long mnOriginalDim
;
162 PivotFunc mnFuncMask
;
164 sal_uInt8 mnDupCount
;
166 explicit ScPivotFuncData( SCCOL nCol
, PivotFunc nFuncMask
);
168 #if DEBUG_PIVOT_TABLE
173 typedef std::vector
<ScDPName
> ScDPNameVec
;
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */