xref: /aoo4110/main/sc/inc/pivot.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 /*
24 	WICHTIG:
25 	Folgende Reihenfolge beim Aufbau der Pivot-Tabelle unbedingt einzuhalten:
26 
27 	pPivot->SetColFields(aColArr, aColCount)
28 	pPivot->SetRowFields(aRowArr, aRowCount)
29 	pPivot->SetDataFields(aDataArr, aDataCount)
30 	if (pPivot->CreateData())
31 	{
32 		pPivotDrawData();
33 		pPivotReleaseData();
34 	}
35 
36 	ausserdem ist sicherzustellen, dass entweder das ColArr oder das RowArr
37 	einen PivotDataField Eintrag enthalten
38 
39 */
40 
41 
42 #ifndef SC_PIVOT_HXX
43 #define SC_PIVOT_HXX
44 
45 #include "global.hxx"
46 #include "address.hxx"
47 #include "dpglobal.hxx"
48 
49 #include <vector>
50 #include <boost/shared_ptr.hpp>
51 
52 class SubTotal;
53 #include "collect.hxx"
54 
55 #define PIVOT_DATA_FIELD		(MAXCOLCOUNT)
56 #define PIVOT_FUNC_REF			(MAXCOLCOUNT)
57 #include <com/sun/star/uno/Sequence.hxx>
58 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
59 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
60 #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
61 #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
62 
63 class SvStream;
64 class ScDocument;
65 class ScUserListData;
66 class ScProgress;
67 
68 // ============================================================================
69 
70 struct ScDPLabelData
71 {
72     ::rtl::OUString     maName;         /// Original name of the dimension.
73     ::rtl::OUString     maLayoutName;   /// Layout name (display name)
74     SCCOL               mnCol;
75     sal_uInt16          mnFuncMask;     /// Page/Column/Row subtotal function.
76     sal_Int32           mnUsedHier;     /// Used hierarchy.
77     sal_Int32           mnFlags;        /// Flags from the DataPilotSource dimension
78     bool                mbShowAll;      /// true = Show all (also empty) results.
79     bool                mbIsValue;      /// true = Sum or count in data field.
80 
81     struct Member
82     {
83         ::rtl::OUString maName;
84         ::rtl::OUString maLayoutName;
85         bool mbVisible;
86         bool mbShowDetails;
87 
88         Member();
89 
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.
94          */
95         ::rtl::OUString SC_DLLPUBLIC getDisplayName() const;
96     };
97     ::std::vector<Member>                               maMembers;
98     ::com::sun::star::uno::Sequence< ::rtl::OUString >  maHiers;        /// Hierarchies.
99     ::com::sun::star::sheet::DataPilotFieldSortInfo     maSortInfo;     /// Sorting info.
100     ::com::sun::star::sheet::DataPilotFieldLayoutInfo   maLayoutInfo;   /// Layout info.
101     ::com::sun::star::sheet::DataPilotFieldAutoShowInfo maShowInfo;     /// AutoShow info.
102 
103     explicit            ScDPLabelData( const String& rName, SCCOL nCol, bool bIsValue );
104 
105     /**
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.
108      */
109     ::rtl::OUString SC_DLLPUBLIC getDisplayName() const;
110 };
111 
112 typedef std::vector< ScDPLabelData > ScDPLabelDataVector;
113 
114 // ============================================================================
115 
116 struct ScPivotField
117 {
118     SCCOL               nCol;
119     sal_uInt16          nFuncMask;
120     sal_uInt16          nFuncCount;
121     ::com::sun::star::sheet::DataPilotFieldReference maFieldRef;
122 
123     explicit            ScPivotField( SCCOL nNewCol = 0, sal_uInt16 nNewFuncMask = PIVOT_FUNC_NONE );
124 
125     bool                operator==( const ScPivotField& r ) const;
126 };
127 
128 typedef ::std::vector< ScPivotField > ScPivotFieldVector;
129 
130 // ============================================================================
131 
132 struct ScPivotParam
133 {
134     SCCOL           nCol;           // Cursor Position /
135     SCROW           nRow;           // bzw. Anfang des Zielbereiches
136     SCTAB           nTab;
137     ScDPLabelDataVector maLabelArray;
138     ScPivotFieldVector maPageArr;
139     ScPivotFieldVector maColArr;
140     ScPivotFieldVector maRowArr;
141     ScPivotFieldVector maDataArr;
142     bool            bIgnoreEmptyRows;
143     bool            bDetectCategories;
144     bool            bMakeTotalCol;
145     bool            bMakeTotalRow;
146 
147     ScPivotParam();
148 
149     bool            operator==( const ScPivotParam& r ) const;
150 };
151 
152 // ============================================================================
153 
154 struct ScPivotFuncData
155 {
156     SCCOL               mnCol;
157     sal_uInt16          mnFuncMask;
158     ::com::sun::star::sheet::DataPilotFieldReference maFieldRef;
159 
160     explicit            ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask );
161     explicit            ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask,
162                             const ::com::sun::star::sheet::DataPilotFieldReference& rFieldRef );
163 };
164 
165 typedef ::std::vector< ScPivotFuncData > ScPivotFuncDataVector;
166 
167 // ============================================================================
168 
169 typedef std::vector< String > ScDPNameVec;
170 
171 // ============================================================================
172 
173 #endif
174