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