xref: /aoo41x/main/sc/inc/pivot.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 /*
28 	WICHTIG:
29 	Folgende Reihenfolge beim Aufbau der Pivot-Tabelle unbedingt einzuhalten:
30 
31 	pPivot->SetColFields(aColArr, aColCount)
32 	pPivot->SetRowFields(aRowArr, aRowCount)
33 	pPivot->SetDataFields(aDataArr, aDataCount)
34 	if (pPivot->CreateData())
35 	{
36 		pPivotDrawData();
37 		pPivotReleaseData();
38 	}
39 
40 	ausserdem ist sicherzustellen, dass entweder das ColArr oder das RowArr
41 	einen PivotDataField Eintrag enthalten
42 
43 */
44 
45 
46 #ifndef SC_PIVOT_HXX
47 #define SC_PIVOT_HXX
48 
49 #include "global.hxx"
50 #include "address.hxx"
51 #include "dpglobal.hxx"
52 
53 #include <vector>
54 #include <boost/shared_ptr.hpp>
55 
56 class SubTotal;
57 #include "collect.hxx"
58 
59 #define PIVOT_DATA_FIELD		(MAXCOLCOUNT)
60 #define PIVOT_FUNC_REF			(MAXCOLCOUNT)
61 #include <com/sun/star/uno/Sequence.hxx>
62 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
63 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
64 #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
65 #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
66 
67 class SvStream;
68 class ScDocument;
69 class ScUserListData;
70 class ScProgress;
71 
72 // ============================================================================
73 
74 struct ScDPLabelData
75 {
76     ::rtl::OUString     maName;         /// Original name of the dimension.
77     ::rtl::OUString     maLayoutName;   /// Layout name (display name)
78     SCCOL               mnCol;
79     sal_uInt16          mnFuncMask;     /// Page/Column/Row subtotal function.
80     sal_Int32           mnUsedHier;     /// Used hierarchy.
81     sal_Int32           mnFlags;        /// Flags from the DataPilotSource dimension
82     bool                mbShowAll;      /// true = Show all (also empty) results.
83     bool                mbIsValue;      /// true = Sum or count in data field.
84 
85     struct Member
86     {
87         ::rtl::OUString maName;
88         ::rtl::OUString maLayoutName;
89         bool mbVisible;
90         bool mbShowDetails;
91 
92         Member();
93 
94         /**
95          * return the name that should be displayed in the dp dialogs i.e.
96          * when the layout name is present, use it, or else use the original
97          * name.
98          */
99         ::rtl::OUString SC_DLLPUBLIC getDisplayName() const;
100     };
101     ::std::vector<Member>                               maMembers;
102     ::com::sun::star::uno::Sequence< ::rtl::OUString >  maHiers;        /// Hierarchies.
103     ::com::sun::star::sheet::DataPilotFieldSortInfo     maSortInfo;     /// Sorting info.
104     ::com::sun::star::sheet::DataPilotFieldLayoutInfo   maLayoutInfo;   /// Layout info.
105     ::com::sun::star::sheet::DataPilotFieldAutoShowInfo maShowInfo;     /// AutoShow info.
106 
107     explicit            ScDPLabelData( const String& rName, SCCOL nCol, bool bIsValue );
108 
109     /**
110      * return the name that should be displayed in the dp dialogs i.e. when
111      * the layout name is present, use it, or else use the original name.
112      */
113     ::rtl::OUString SC_DLLPUBLIC getDisplayName() const;
114 };
115 
116 typedef std::vector< ScDPLabelData > ScDPLabelDataVector;
117 
118 // ============================================================================
119 
120 struct ScPivotField
121 {
122     SCCOL               nCol;
123     sal_uInt16          nFuncMask;
124     sal_uInt16          nFuncCount;
125     ::com::sun::star::sheet::DataPilotFieldReference maFieldRef;
126 
127     explicit            ScPivotField( SCCOL nNewCol = 0, sal_uInt16 nNewFuncMask = PIVOT_FUNC_NONE );
128 
129     bool                operator==( const ScPivotField& r ) const;
130 };
131 
132 typedef ::std::vector< ScPivotField > ScPivotFieldVector;
133 
134 // ============================================================================
135 
136 struct ScPivotParam
137 {
138     SCCOL           nCol;           // Cursor Position /
139     SCROW           nRow;           // bzw. Anfang des Zielbereiches
140     SCTAB           nTab;
141     ScDPLabelDataVector maLabelArray;
142     ScPivotFieldVector maPageArr;
143     ScPivotFieldVector maColArr;
144     ScPivotFieldVector maRowArr;
145     ScPivotFieldVector maDataArr;
146     bool            bIgnoreEmptyRows;
147     bool            bDetectCategories;
148     bool            bMakeTotalCol;
149     bool            bMakeTotalRow;
150 
151     ScPivotParam();
152 
153     bool            operator==( const ScPivotParam& r ) const;
154 };
155 
156 // ============================================================================
157 
158 struct ScPivotFuncData
159 {
160     SCCOL               mnCol;
161     sal_uInt16          mnFuncMask;
162     ::com::sun::star::sheet::DataPilotFieldReference maFieldRef;
163 
164     explicit            ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask );
165     explicit            ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask,
166                             const ::com::sun::star::sheet::DataPilotFieldReference& rFieldRef );
167 };
168 
169 typedef ::std::vector< ScPivotFuncData > ScPivotFuncDataVector;
170 
171 // ============================================================================
172 
173 typedef std::vector< String > ScDPNameVec;
174 
175 // ============================================================================
176 
177 #endif
178