merge the formfield patch from ooo-build
[ooovba.git] / sc / inc / pivot.hxx
blob680da7dd974c857faa1a91ddc40a65b235d0c84a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pivot.hxx,v $
10 * $Revision: 1.8.32.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 WICHTIG:
32 Folgende Reihenfolge beim Aufbau der Pivot-Tabelle unbedingt einzuhalten:
34 pPivot->SetColFields(aColArr, aColCount)
35 pPivot->SetRowFields(aRowArr, aRowCount)
36 pPivot->SetDataFields(aDataArr, aDataCount)
37 if (pPivot->CreateData())
39 pPivotDrawData();
40 pPivotReleaseData();
43 ausserdem ist sicherzustellen, dass entweder das ColArr oder das RowArr
44 einen PivotDataField Eintrag enthalten
49 #ifndef SC_PIVOT_HXX
50 #define SC_PIVOT_HXX
52 #include "global.hxx"
53 #include "address.hxx"
55 #include <vector>
56 #include <boost/shared_ptr.hpp>
58 class SubTotal;
59 #include "collect.hxx"
61 #define PIVOT_DATA_FIELD (MAXCOLCOUNT)
62 #define PIVOT_FUNC_REF (MAXCOLCOUNT)
63 #include <com/sun/star/uno/Sequence.hxx>
64 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
65 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
66 #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
67 #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
69 class SvStream;
70 class ScDocument;
71 class ScUserListData;
72 class ScProgress;
73 struct ScDPLabelData;
75 typedef ::boost::shared_ptr<ScDPLabelData> ScDPLabelDataRef;
77 // -----------------------------------------------------------------------
79 struct PivotField
81 SCsCOL nCol;
82 USHORT nFuncMask;
83 USHORT nFuncCount;
84 ::com::sun::star::sheet::DataPilotFieldReference maFieldRef;
86 explicit PivotField( SCsCOL nNewCol = 0, USHORT nNewFuncMask = PIVOT_FUNC_NONE );
88 bool operator==( const PivotField& r ) const;
91 // -----------------------------------------------------------------------
93 // implementation still in global2.cxx
94 struct ScPivotParam
96 SCCOL nCol; // Cursor Position /
97 SCROW nRow; // bzw. Anfang des Zielbereiches
98 SCTAB nTab;
99 ::std::vector<ScDPLabelDataRef> maLabelArray;
100 PivotField aPageArr[PIVOT_MAXPAGEFIELD];
101 PivotField aColArr[PIVOT_MAXFIELD];
102 PivotField aRowArr[PIVOT_MAXFIELD];
103 PivotField aDataArr[PIVOT_MAXFIELD];
104 SCSIZE nPageCount;
105 SCSIZE nColCount;
106 SCSIZE nRowCount;
107 SCSIZE nDataCount;
108 BOOL bIgnoreEmptyRows;
109 BOOL bDetectCategories;
110 BOOL bMakeTotalCol;
111 BOOL bMakeTotalRow;
113 ScPivotParam();
114 ScPivotParam( const ScPivotParam& r );
115 ~ScPivotParam();
117 ScPivotParam& operator= ( const ScPivotParam& r );
118 BOOL operator== ( const ScPivotParam& r ) const;
119 //UNUSED2009-05 void Clear ();
120 void ClearPivotArrays();
121 void SetLabelData (const ::std::vector<ScDPLabelDataRef>& r);
122 void SetPivotArrays ( const PivotField* pPageArr,
123 const PivotField* pColArr,
124 const PivotField* pRowArr,
125 const PivotField* pDataArr,
126 SCSIZE nPageCnt,
127 SCSIZE nColCnt,
128 SCSIZE nRowCnt,
129 SCSIZE nDataCnt );
132 // -----------------------------------------------------------------------
134 typedef PivotField PivotFieldArr[PIVOT_MAXFIELD];
135 typedef PivotField PivotPageFieldArr[PIVOT_MAXPAGEFIELD];
137 //------------------------------------------------------------------------
139 struct ScDPLabelData
141 ::rtl::OUString maName; /// Original name of the dimension.
142 ::rtl::OUString maLayoutName; /// Layout name (display name)
143 SCsCOL mnCol;
144 USHORT mnFuncMask; /// Page/Column/Row subtotal function.
145 sal_Int32 mnUsedHier; /// Used hierarchy.
146 bool mbShowAll; /// true = Show all (also empty) results.
147 bool mbIsValue; /// true = Sum or count in data field.
149 struct Member
151 ::rtl::OUString maName;
152 ::rtl::OUString maLayoutName;
153 bool mbVisible;
154 bool mbShowDetails;
156 Member();
158 /**
159 * return the name that should be displayed in the dp dialogs i.e.
160 * when the layout name is present, use it, or else use the original
161 * name.
163 ::rtl::OUString SC_DLLPUBLIC getDisplayName() const;
165 ::std::vector<Member> maMembers;
166 ::com::sun::star::uno::Sequence< ::rtl::OUString > maHiers; /// Hierarchies.
167 ::com::sun::star::sheet::DataPilotFieldSortInfo maSortInfo; /// Sorting info.
168 ::com::sun::star::sheet::DataPilotFieldLayoutInfo maLayoutInfo; /// Layout info.
169 ::com::sun::star::sheet::DataPilotFieldAutoShowInfo maShowInfo; /// AutoShow info.
171 explicit ScDPLabelData( const String& rName, short nCol, bool bIsValue );
173 /**
174 * return the name that should be displayed in the dp dialogs i.e. when
175 * the layout name is present, use it, or else use the original name.
177 ::rtl::OUString SC_DLLPUBLIC getDisplayName() const;
180 // ============================================================================
182 struct ScDPFuncData
184 short mnCol;
185 USHORT mnFuncMask;
186 ::com::sun::star::sheet::DataPilotFieldReference maFieldRef;
188 explicit ScDPFuncData( short nNewCol, USHORT nNewFuncMask );
189 explicit ScDPFuncData( short nNewCol, USHORT nNewFuncMask,
190 const ::com::sun::star::sheet::DataPilotFieldReference& rFieldRef );
193 // ============================================================================
195 typedef std::vector< ScDPLabelData > ScDPLabelDataVec;
196 typedef std::vector< String > ScDPNameVec;
198 // ============================================================================
200 #endif