xref: /trunk/main/sc/inc/dptabsrc.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 #ifndef SC_DPTABSRC_HXX
25cdf0e10cSrcweir #define SC_DPTABSRC_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vector>
28cdf0e10cSrcweir #include <hash_map>
29cdf0e10cSrcweir // Wang Xu Ming -- 2009-8-17
30cdf0e10cSrcweir // DataPilot Migration - Cache&&Performance
31cdf0e10cSrcweir #include <list>
32cdf0e10cSrcweir // End Comments
33cdf0e10cSrcweir #include <memory>
34cdf0e10cSrcweir #include <tools/string.hxx>
35cdf0e10cSrcweir #include <tools/list.hxx>
36cdf0e10cSrcweir #include "global.hxx"		// enum ScSubTotalFunc
37cdf0e10cSrcweir #include <com/sun/star/sheet/XDimensionsSupplier.hpp>
38cdf0e10cSrcweir #include <com/sun/star/sheet/XHierarchiesSupplier.hpp>
39cdf0e10cSrcweir #include <com/sun/star/sheet/XLevelsSupplier.hpp>
40cdf0e10cSrcweir #include <com/sun/star/sheet/XMembersSupplier.hpp>
41cdf0e10cSrcweir #include <com/sun/star/sheet/XDataPilotResults.hpp>
42cdf0e10cSrcweir #include <com/sun/star/sheet/XDataPilotMemberResults.hpp>
43cdf0e10cSrcweir #include <com/sun/star/sheet/MemberResult.hpp>
44cdf0e10cSrcweir #include <com/sun/star/sheet/GeneralFunction.hpp>
45cdf0e10cSrcweir #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
46cdf0e10cSrcweir #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
47cdf0e10cSrcweir #include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
48cdf0e10cSrcweir #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
49cdf0e10cSrcweir #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
50cdf0e10cSrcweir #include <com/sun/star/util/XRefreshable.hpp>
51cdf0e10cSrcweir #include <com/sun/star/sheet/XDrillDownDataSupplier.hpp>
52cdf0e10cSrcweir #include <com/sun/star/util/XCloneable.hpp>
53cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
54cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
55cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp>
56cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
57cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx>
58cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx>
59cdf0e10cSrcweir #include <cppuhelper/implbase6.hxx>
60cdf0e10cSrcweir // Wang Xu Ming -- 2009-8-17
61cdf0e10cSrcweir // DataPilot Migration - Cache&&Performance
62cdf0e10cSrcweir #include "dpglobal.hxx"
63cdf0e10cSrcweir // End Comments
64cdf0e10cSrcweir #include "dptabdat.hxx"
65cdf0e10cSrcweir 
66cdf0e10cSrcweir namespace com { namespace sun { namespace star {
67cdf0e10cSrcweir     namespace sheet {
68cdf0e10cSrcweir         struct DataPilotFieldFilter;
69cdf0e10cSrcweir     }
70cdf0e10cSrcweir     namespace table {
71cdf0e10cSrcweir         struct CellAddress;
72cdf0e10cSrcweir     }
73cdf0e10cSrcweir }}}
74cdf0e10cSrcweir 
75cdf0e10cSrcweir class ScDPResultMember;
76cdf0e10cSrcweir class ScDPResultData;
77cdf0e10cSrcweir // Wang Xu Ming -- 2009-8-17
78cdf0e10cSrcweir // DataPilot Migration - Cache&&Performance
79cdf0e10cSrcweir class ScDPItemData;
80cdf0e10cSrcweir // End Comments
81cdf0e10cSrcweir class ScDPTableData;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir // ------------------------------------------------------------------------
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 
86cdf0e10cSrcweir //	should be dynamic!
87cdf0e10cSrcweir #define SC_DAPI_MAXFIELDS 	256
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 
90cdf0e10cSrcweir // --------------------------------------------------------------------
91cdf0e10cSrcweir //
92cdf0e10cSrcweir //	implementation of DataPilotSource using ScDPTableData
93cdf0e10cSrcweir //
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 
96cdf0e10cSrcweir class ScDPDimensions;
97cdf0e10cSrcweir class ScDPDimension;
98cdf0e10cSrcweir class ScDPHierarchies;
99cdf0e10cSrcweir class ScDPHierarchy;
100cdf0e10cSrcweir class ScDPLevels;
101cdf0e10cSrcweir class ScDPLevel;
102cdf0e10cSrcweir class ScDPMembers;
103cdf0e10cSrcweir class ScDPMember;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 
106cdf0e10cSrcweir class ScDPSource : public cppu::WeakImplHelper6<
107cdf0e10cSrcweir 							com::sun::star::sheet::XDimensionsSupplier,
108cdf0e10cSrcweir 							com::sun::star::sheet::XDataPilotResults,
109cdf0e10cSrcweir 							com::sun::star::util::XRefreshable,
110cdf0e10cSrcweir                             com::sun::star::sheet::XDrillDownDataSupplier,
111cdf0e10cSrcweir 							com::sun::star::beans::XPropertySet,
112cdf0e10cSrcweir 							com::sun::star::lang::XServiceInfo >
113cdf0e10cSrcweir {
114cdf0e10cSrcweir private:
115cdf0e10cSrcweir 	ScDPTableData*			pData;				// data source (ScDPObject manages its life time)
116cdf0e10cSrcweir 	ScDPDimensions*			pDimensions;		// api objects
117cdf0e10cSrcweir 												// settings:
118cdf0e10cSrcweir 	long					nColDims[SC_DAPI_MAXFIELDS];
119cdf0e10cSrcweir 	long					nRowDims[SC_DAPI_MAXFIELDS];
120cdf0e10cSrcweir 	long					nDataDims[SC_DAPI_MAXFIELDS];
121cdf0e10cSrcweir 	long					nPageDims[SC_DAPI_MAXFIELDS];
122cdf0e10cSrcweir 	long					nColDimCount;
123cdf0e10cSrcweir 	long					nRowDimCount;
124cdf0e10cSrcweir 	long					nDataDimCount;
125cdf0e10cSrcweir 	long					nPageDimCount;
126cdf0e10cSrcweir 	sal_Bool					bColumnGrand;
127cdf0e10cSrcweir 	sal_Bool					bRowGrand;
128cdf0e10cSrcweir 	sal_Bool					bIgnoreEmptyRows;
129cdf0e10cSrcweir 	sal_Bool					bRepeatIfEmpty;
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 	long					nDupCount;
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 												// results:
134cdf0e10cSrcweir 	ScDPResultData*			pResData;			// keep the rest in this!
135cdf0e10cSrcweir 	ScDPResultMember*		pColResRoot;
136cdf0e10cSrcweir 	ScDPResultMember*		pRowResRoot;
137cdf0e10cSrcweir 	com::sun::star::uno::Sequence<com::sun::star::sheet::MemberResult>* pColResults;
138cdf0e10cSrcweir 	com::sun::star::uno::Sequence<com::sun::star::sheet::MemberResult>* pRowResults;
139cdf0e10cSrcweir 	List					aColLevelList;
140cdf0e10cSrcweir 	List					aRowLevelList;
141cdf0e10cSrcweir 	sal_Bool					bResultOverflow;
142bfbd599dSEike Rathke     bool                    bPageFiltered;      // set if page field filters have been applied to cache table
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     ::std::auto_ptr<rtl::OUString> mpGrandTotalName;
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 	void					CreateRes_Impl();
147cdf0e10cSrcweir 	void					FillMemberResults();
148cdf0e10cSrcweir 	void					FillLevelList( sal_uInt16 nOrientation, List& rList );
149cdf0e10cSrcweir     void                    FillCalcInfo(bool bIsRow, ScDPTableData::CalcInfo& rInfo, bool &bHasAutoShow);
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     /**
152cdf0e10cSrcweir      * Compile a list of dimension indices that are either, column, row or
153cdf0e10cSrcweir      * page dimensions (i.e. all but data dimensions).
154cdf0e10cSrcweir      */
155cdf0e10cSrcweir     void                    GetCategoryDimensionIndices(::std::hash_set<sal_Int32>& rCatDims);
156cdf0e10cSrcweir 
157cdf0e10cSrcweir     /**
158cdf0e10cSrcweir      * Set visibilities of individual rows in the cache table based on the
159cdf0e10cSrcweir      * page field data.
160cdf0e10cSrcweir      */
161cdf0e10cSrcweir     void                    FilterCacheTableByPageDimensions();
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 	void					SetDupCount( long nNew );
164cdf0e10cSrcweir 
165cdf0e10cSrcweir public:
166cdf0e10cSrcweir 								ScDPSource( ScDPTableData* pD );	// TableData is deleted by Source
167cdf0e10cSrcweir 	virtual 					~ScDPSource();
168cdf0e10cSrcweir 
GetData()169cdf0e10cSrcweir 	ScDPTableData*			GetData()		{ return pData; }
GetData() const170cdf0e10cSrcweir 	const ScDPTableData*	GetData() const	{ return pData; }
171cdf0e10cSrcweir 
172cdf0e10cSrcweir     void                    SetGrandTotalName(const ::rtl::OUString& rName);
173cdf0e10cSrcweir     const ::rtl::OUString*  GetGrandTotalName() const;
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	sal_uInt16					GetOrientation(long nColumn);
176cdf0e10cSrcweir 	void					SetOrientation(long nColumn, sal_uInt16 nNew);
177cdf0e10cSrcweir 	long					GetPosition(long nColumn);
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 	long					GetDataDimensionCount();
180cdf0e10cSrcweir     ScDPDimension*          GetDataDimension(long nIndex);
181cdf0e10cSrcweir 	String					GetDataDimName(long nIndex);
182cdf0e10cSrcweir     // Wang Xu Ming -- 2009-8-17
183cdf0e10cSrcweir     // DataPilot Migration - Cache&&Performance
184cdf0e10cSrcweir     ScDPTableDataCache*         GetCache();
185cdf0e10cSrcweir     const ScDPItemData*            GetItemDataById( long nDim, long nId );
GetDataLayoutDim()186cdf0e10cSrcweir     long                                       GetDataLayoutDim(){ return pData->GetColumnCount(); }
187cdf0e10cSrcweir     SCROW                                GetMemberId(  long  nDim, const ScDPItemData& rData );
188cdf0e10cSrcweir     // End Comments
189cdf0e10cSrcweir 	sal_Bool					IsDataLayoutDimension(long nDim);
190cdf0e10cSrcweir 	sal_uInt16					GetDataLayoutOrientation();
191cdf0e10cSrcweir 
192cdf0e10cSrcweir 	sal_Bool					IsDateDimension(long nDim);
193cdf0e10cSrcweir 	sal_uInt32					GetNumberFormat(long nDim);
194cdf0e10cSrcweir 
195cdf0e10cSrcweir 	sal_Bool					SubTotalAllowed(long nColumn);		//! move to ScDPResultData
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 	ScDPDimension*			AddDuplicated(long nSource, const String& rNewName);
GetDupCount() const198cdf0e10cSrcweir 	long					GetDupCount() const	{ return nDupCount; }
199cdf0e10cSrcweir 
200cdf0e10cSrcweir 	long					GetSourceDim(long nDim);
201cdf0e10cSrcweir 
202cdf0e10cSrcweir 	const com::sun::star::uno::Sequence<com::sun::star::sheet::MemberResult>*
203cdf0e10cSrcweir 							GetMemberResults( ScDPLevel* pLevel );
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 	ScDPDimensions*			GetDimensionsObject();
206cdf0e10cSrcweir 
207cdf0e10cSrcweir //UNUSED2009-05 void					DumpState( ScDocument* pDoc, const ScAddress& rPos );
208cdf0e10cSrcweir 
209cdf0e10cSrcweir 							// XDimensionsSupplier
210cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
211cdf0e10cSrcweir 							SAL_CALL getDimensions(  )
212cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 							// XDataPilotResults
215cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence<
216cdf0e10cSrcweir 							::com::sun::star::sheet::DataResult > > SAL_CALL getResults(  )
217cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 							// XRefreshable
220cdf0e10cSrcweir 	virtual void SAL_CALL	refresh() throw(::com::sun::star::uno::RuntimeException);
221cdf0e10cSrcweir 	virtual void SAL_CALL	addRefreshListener( const ::com::sun::star::uno::Reference<
222cdf0e10cSrcweir 									::com::sun::star::util::XRefreshListener >& l )
223cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
224cdf0e10cSrcweir 	virtual void SAL_CALL	removeRefreshListener( const ::com::sun::star::uno::Reference<
225cdf0e10cSrcweir 									::com::sun::star::util::XRefreshListener >& l )
226cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
227cdf0e10cSrcweir 
228cdf0e10cSrcweir                             // XDrillDownDataSupplier
229cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >
230cdf0e10cSrcweir         SAL_CALL getDrillDownData(const ::com::sun::star::uno::Sequence<
231cdf0e10cSrcweir                                       ::com::sun::star::sheet::DataPilotFieldFilter >& aFilters )
232cdf0e10cSrcweir                                 throw(::com::sun::star::uno::RuntimeException);
233cdf0e10cSrcweir 
234cdf0e10cSrcweir 							// XPropertySet
235cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
236cdf0e10cSrcweir 							SAL_CALL getPropertySetInfo(  )
237cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
238cdf0e10cSrcweir 	virtual void SAL_CALL	setPropertyValue( const ::rtl::OUString& aPropertyName,
239cdf0e10cSrcweir 									const ::com::sun::star::uno::Any& aValue )
240cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
241cdf0e10cSrcweir 									::com::sun::star::beans::PropertyVetoException,
242cdf0e10cSrcweir 									::com::sun::star::lang::IllegalArgumentException,
243cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
244cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
245cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
246cdf0e10cSrcweir 									const ::rtl::OUString& PropertyName )
247cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
248cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
249cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
250cdf0e10cSrcweir 	virtual void SAL_CALL	addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
251cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference<
252cdf0e10cSrcweir 										::com::sun::star::beans::XPropertyChangeListener >& xListener )
253cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
254cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
255cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
256cdf0e10cSrcweir 	virtual void SAL_CALL	removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
257cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference<
258cdf0e10cSrcweir 										::com::sun::star::beans::XPropertyChangeListener >& aListener )
259cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
260cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
261cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
262cdf0e10cSrcweir 	virtual void SAL_CALL	addVetoableChangeListener( const ::rtl::OUString& PropertyName,
263cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference<
264cdf0e10cSrcweir 										::com::sun::star::beans::XVetoableChangeListener >& aListener )
265cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
266cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
267cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
268cdf0e10cSrcweir 	virtual void SAL_CALL	removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
269cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference<
270cdf0e10cSrcweir 										::com::sun::star::beans::XVetoableChangeListener >& aListener )
271cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
272cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
273cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
274cdf0e10cSrcweir 
275cdf0e10cSrcweir 							// XServiceInfo
276cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName(  )
277cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
278cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
279cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
280cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
281cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 	virtual String				getDataDescription();		//! ???
284cdf0e10cSrcweir 
285cdf0e10cSrcweir 	virtual sal_Bool				getColumnGrand() const;
286cdf0e10cSrcweir 	virtual void				setColumnGrand(sal_Bool bSet);
287cdf0e10cSrcweir 	virtual sal_Bool				getRowGrand() const;
288cdf0e10cSrcweir 	virtual void				setRowGrand(sal_Bool bSet);
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 	virtual sal_Bool				getIgnoreEmptyRows() const;
291cdf0e10cSrcweir 	virtual void				setIgnoreEmptyRows(sal_Bool bSet);
292cdf0e10cSrcweir 	virtual sal_Bool				getRepeatIfEmpty() const;
293cdf0e10cSrcweir 	virtual void				setRepeatIfEmpty(sal_Bool bSet);
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 	virtual void				validate();		//! ???
296cdf0e10cSrcweir 	virtual void				disposeData();
297cdf0e10cSrcweir };
298cdf0e10cSrcweir 
299cdf0e10cSrcweir class ScDPDimensions : public cppu::WeakImplHelper2<
300cdf0e10cSrcweir 							com::sun::star::container::XNameAccess,
301cdf0e10cSrcweir 							com::sun::star::lang::XServiceInfo >
302cdf0e10cSrcweir {
303cdf0e10cSrcweir private:
304cdf0e10cSrcweir 	ScDPSource*			pSource;
305cdf0e10cSrcweir 	long				nDimCount;
306cdf0e10cSrcweir 	ScDPDimension**		ppDims;
307cdf0e10cSrcweir 
308cdf0e10cSrcweir public:
309cdf0e10cSrcweir 							ScDPDimensions( ScDPSource* pSrc );
310cdf0e10cSrcweir 	virtual 				~ScDPDimensions();
311cdf0e10cSrcweir 
312cdf0e10cSrcweir 	void					CountChanged();
313cdf0e10cSrcweir 
314cdf0e10cSrcweir 							// XNameAccess
315cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
316cdf0e10cSrcweir 								throw(::com::sun::star::container::NoSuchElementException,
317cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
318cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
319cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
320cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
321cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
322cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 							// XElementAccess
325cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
326cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
327cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
328cdf0e10cSrcweir 
329cdf0e10cSrcweir 							// XServiceInfo
330cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName(  )
331cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
332cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
333cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
334cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
335cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
336cdf0e10cSrcweir 
337cdf0e10cSrcweir 	virtual	long			getCount() const;
338cdf0e10cSrcweir 	virtual ScDPDimension*	getByIndex(long nIndex) const;
339cdf0e10cSrcweir };
340cdf0e10cSrcweir 
341cdf0e10cSrcweir class ScDPDimension : public cppu::WeakImplHelper5<
342cdf0e10cSrcweir 							com::sun::star::sheet::XHierarchiesSupplier,
343cdf0e10cSrcweir 							com::sun::star::container::XNamed,
344cdf0e10cSrcweir 							com::sun::star::util::XCloneable,
345cdf0e10cSrcweir 							com::sun::star::beans::XPropertySet,
346cdf0e10cSrcweir 							com::sun::star::lang::XServiceInfo >
347cdf0e10cSrcweir {
348cdf0e10cSrcweir private:
349cdf0e10cSrcweir 	ScDPSource*			pSource;
350cdf0e10cSrcweir 	long				nDim;               // dimension index (== column ID)
351cdf0e10cSrcweir 	ScDPHierarchies*	pHierarchies;
352cdf0e10cSrcweir 	long				nUsedHier;
353cdf0e10cSrcweir 	sal_uInt16				nFunction;			// enum GeneralFunction
354cdf0e10cSrcweir 	String				aName;				// if empty, take from source
355cdf0e10cSrcweir     ::std::auto_ptr<rtl::OUString> mpLayoutName;
356cdf0e10cSrcweir     ::std::auto_ptr<rtl::OUString> mpSubtotalName;
357cdf0e10cSrcweir 	long				nSourceDim;			// >=0 if dup'ed
358cdf0e10cSrcweir     ::com::sun::star::sheet::DataPilotFieldReference
359cdf0e10cSrcweir                         aReferenceValue;    // settings for "show data as" / "displayed value"
360cdf0e10cSrcweir 	sal_Bool				bHasSelectedPage;
361cdf0e10cSrcweir 	String				aSelectedPage;
362cdf0e10cSrcweir 	ScDPItemData*		pSelectedData;		// internal, temporary, created from aSelectedPage
363cdf0e10cSrcweir     sal_Bool            mbHasHiddenMember;
364cdf0e10cSrcweir 
365cdf0e10cSrcweir public:
366cdf0e10cSrcweir 							ScDPDimension( ScDPSource* pSrc, long nD );
367cdf0e10cSrcweir 	virtual 				~ScDPDimension();
368cdf0e10cSrcweir 
GetDimension() const369cdf0e10cSrcweir     long                    GetDimension() const    { return nDim; }        // dimension index in source
GetSourceDim() const370cdf0e10cSrcweir 	long					GetSourceDim() const	{ return nSourceDim; }  // >=0 if dup'ed
371cdf0e10cSrcweir 
372cdf0e10cSrcweir 	ScDPDimension*			CreateCloneObject();
373cdf0e10cSrcweir 	ScDPHierarchies*		GetHierarchiesObject();
374cdf0e10cSrcweir 
375cdf0e10cSrcweir     SC_DLLPUBLIC const ::rtl::OUString*  GetLayoutName() const;
376cdf0e10cSrcweir     const ::rtl::OUString*  GetSubtotalName() const;
377cdf0e10cSrcweir 
378cdf0e10cSrcweir 							// XNamed
379cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
380cdf0e10cSrcweir 	virtual void SAL_CALL	setName( const ::rtl::OUString& aName )
381cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
382cdf0e10cSrcweir 
383cdf0e10cSrcweir 							// XHierarchiesSupplier
384cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL
385cdf0e10cSrcweir 							getHierarchies() throw(::com::sun::star::uno::RuntimeException);
386cdf0e10cSrcweir 
387cdf0e10cSrcweir 							// XCloneable
388cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL
389cdf0e10cSrcweir 							createClone() throw(::com::sun::star::uno::RuntimeException);
390cdf0e10cSrcweir 
391cdf0e10cSrcweir 							// XPropertySet
392cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
393cdf0e10cSrcweir 							SAL_CALL getPropertySetInfo(  )
394cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
395cdf0e10cSrcweir 	virtual void SAL_CALL	setPropertyValue( const ::rtl::OUString& aPropertyName,
396cdf0e10cSrcweir 									const ::com::sun::star::uno::Any& aValue )
397cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
398cdf0e10cSrcweir 									::com::sun::star::beans::PropertyVetoException,
399cdf0e10cSrcweir 									::com::sun::star::lang::IllegalArgumentException,
400cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
401cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
402cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
403cdf0e10cSrcweir 									const ::rtl::OUString& PropertyName )
404cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
405cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
406cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
407cdf0e10cSrcweir 	virtual void SAL_CALL	addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
408cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference<
409cdf0e10cSrcweir 										::com::sun::star::beans::XPropertyChangeListener >& xListener )
410cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
411cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
412cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
413cdf0e10cSrcweir 	virtual void SAL_CALL	removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
414cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference<
415cdf0e10cSrcweir 										::com::sun::star::beans::XPropertyChangeListener >& aListener )
416cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
417cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
418cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
419cdf0e10cSrcweir 	virtual void SAL_CALL	addVetoableChangeListener( const ::rtl::OUString& PropertyName,
420cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference<
421cdf0e10cSrcweir 										::com::sun::star::beans::XVetoableChangeListener >& aListener )
422cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
423cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
424cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
425cdf0e10cSrcweir 	virtual void SAL_CALL	removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
426cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference<
427cdf0e10cSrcweir 										::com::sun::star::beans::XVetoableChangeListener >& aListener )
428cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
429cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
430cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
431cdf0e10cSrcweir 
432cdf0e10cSrcweir 							// XServiceInfo
433cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName(  )
434cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
435cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
436cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
437cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
438cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
439cdf0e10cSrcweir 
440cdf0e10cSrcweir 	virtual sal_uInt16				getOrientation() const;
441cdf0e10cSrcweir 	virtual void				setOrientation(sal_uInt16 nNew);
442cdf0e10cSrcweir 	virtual long				getPosition() const;
443cdf0e10cSrcweir 	virtual void				setPosition(long nNew);
444cdf0e10cSrcweir 	virtual	sal_Bool				getIsDataLayoutDimension() const;
445cdf0e10cSrcweir 	virtual sal_uInt16				getFunction() const;
446cdf0e10cSrcweir 	virtual void				setFunction(sal_uInt16 nNew);		// for data dimension
447cdf0e10cSrcweir 	virtual long				getUsedHierarchy() const;
448cdf0e10cSrcweir 	virtual void				setUsedHierarchy(long nNew);
449cdf0e10cSrcweir 	virtual sal_Bool				isDuplicated() const;
450cdf0e10cSrcweir 
HasSelectedPage() const451cdf0e10cSrcweir     sal_Bool                        HasSelectedPage() const     { return bHasSelectedPage; }
452cdf0e10cSrcweir     const ScDPItemData&         GetSelectedData();
453cdf0e10cSrcweir 
454cdf0e10cSrcweir 	const ::com::sun::star::sheet::DataPilotFieldReference& GetReferenceValue() const;
455cdf0e10cSrcweir 
456cdf0e10cSrcweir //UNUSED2009-05 sal_Bool						IsValidPage( const ScDPItemData& rData );
457cdf0e10cSrcweir // Wang Xu Ming -- 2009-8-17
458cdf0e10cSrcweir // DataPilot Migration - Cache&&Performance
459cdf0e10cSrcweir     sal_Bool                      IsVisible( const ScDPItemData& rData );
460cdf0e10cSrcweir // End Comments
461cdf0e10cSrcweir };
462cdf0e10cSrcweir 
463cdf0e10cSrcweir class ScDPHierarchies : public cppu::WeakImplHelper2<
464cdf0e10cSrcweir 							com::sun::star::container::XNameAccess,
465cdf0e10cSrcweir 							com::sun::star::lang::XServiceInfo >
466cdf0e10cSrcweir {
467cdf0e10cSrcweir private:
468cdf0e10cSrcweir 	ScDPSource*			pSource;
469cdf0e10cSrcweir 	long				nDim;
470cdf0e10cSrcweir 	long				nHierCount;
471cdf0e10cSrcweir 	ScDPHierarchy**		ppHiers;
472cdf0e10cSrcweir 
473cdf0e10cSrcweir public:
474cdf0e10cSrcweir 							ScDPHierarchies( ScDPSource* pSrc, long nD );
475cdf0e10cSrcweir 	virtual 				~ScDPHierarchies();
476cdf0e10cSrcweir 
477cdf0e10cSrcweir 							// XNameAccess
478cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
479cdf0e10cSrcweir 								throw(::com::sun::star::container::NoSuchElementException,
480cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
481cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
482cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
483cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
484cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
485cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
486cdf0e10cSrcweir 
487cdf0e10cSrcweir 							// XElementAccess
488cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
489cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
490cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
491cdf0e10cSrcweir 
492cdf0e10cSrcweir 							// XServiceInfo
493cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName(  )
494cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
495cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
496cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
497cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
498cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
499cdf0e10cSrcweir 
500cdf0e10cSrcweir 	virtual	long			getCount() const;
501cdf0e10cSrcweir 	virtual ScDPHierarchy*	getByIndex(long nIndex) const;
502cdf0e10cSrcweir };
503cdf0e10cSrcweir 
504cdf0e10cSrcweir class ScDPHierarchy : public cppu::WeakImplHelper3<
505cdf0e10cSrcweir 							com::sun::star::sheet::XLevelsSupplier,
506cdf0e10cSrcweir 							com::sun::star::container::XNamed,
507cdf0e10cSrcweir 							com::sun::star::lang::XServiceInfo >
508cdf0e10cSrcweir {
509cdf0e10cSrcweir private:
510cdf0e10cSrcweir 	ScDPSource*		pSource;
511cdf0e10cSrcweir 	long			nDim;
512cdf0e10cSrcweir 	long			nHier;
513cdf0e10cSrcweir 	ScDPLevels*		pLevels;
514cdf0e10cSrcweir 
515cdf0e10cSrcweir public:
516cdf0e10cSrcweir 							ScDPHierarchy( ScDPSource* pSrc, long nD, long nH );
517cdf0e10cSrcweir 	virtual 				~ScDPHierarchy();
518cdf0e10cSrcweir 
519cdf0e10cSrcweir 	ScDPLevels*				GetLevelsObject();
520cdf0e10cSrcweir 
521cdf0e10cSrcweir 							// XNamed
522cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
523cdf0e10cSrcweir 	virtual void SAL_CALL	setName( const ::rtl::OUString& aName )
524cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
525cdf0e10cSrcweir 
526cdf0e10cSrcweir 							// XLevelsSupplier
527cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL
528cdf0e10cSrcweir 							getLevels() throw(::com::sun::star::uno::RuntimeException);
529cdf0e10cSrcweir 
530cdf0e10cSrcweir 							// XServiceInfo
531cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName(  )
532cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
533cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
534cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
535cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
536cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
537cdf0e10cSrcweir };
538cdf0e10cSrcweir 
539cdf0e10cSrcweir class ScDPLevels : public cppu::WeakImplHelper2<
540cdf0e10cSrcweir 							com::sun::star::container::XNameAccess,
541cdf0e10cSrcweir 							com::sun::star::lang::XServiceInfo >
542cdf0e10cSrcweir {
543cdf0e10cSrcweir private:
544cdf0e10cSrcweir 	ScDPSource*		pSource;
545cdf0e10cSrcweir 	long			nDim;
546cdf0e10cSrcweir 	long			nHier;
547cdf0e10cSrcweir 	long			nLevCount;
548cdf0e10cSrcweir 	ScDPLevel**		ppLevs;
549cdf0e10cSrcweir 
550cdf0e10cSrcweir public:
551cdf0e10cSrcweir 							ScDPLevels( ScDPSource* pSrc, long nD, long nH );
552cdf0e10cSrcweir 	virtual 				~ScDPLevels();
553cdf0e10cSrcweir 
554cdf0e10cSrcweir 							// XNameAccess
555cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
556cdf0e10cSrcweir 								throw(::com::sun::star::container::NoSuchElementException,
557cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
558cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
559cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
560cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
561cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
562cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
563cdf0e10cSrcweir 
564cdf0e10cSrcweir 							// XElementAccess
565cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
566cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
567cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
568cdf0e10cSrcweir 
569cdf0e10cSrcweir 							// XServiceInfo
570cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName(  )
571cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
572cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
573cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
574cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
575cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
576cdf0e10cSrcweir 
577cdf0e10cSrcweir 	virtual	long			getCount() const;
578cdf0e10cSrcweir 	virtual ScDPLevel*		getByIndex(long nIndex) const;
579cdf0e10cSrcweir };
580cdf0e10cSrcweir 
581cdf0e10cSrcweir class ScDPLevel : public cppu::WeakImplHelper5<
582cdf0e10cSrcweir 							com::sun::star::sheet::XMembersSupplier,
583cdf0e10cSrcweir 							com::sun::star::container::XNamed,
584cdf0e10cSrcweir 							com::sun::star::sheet::XDataPilotMemberResults,
585cdf0e10cSrcweir 							com::sun::star::beans::XPropertySet,
586cdf0e10cSrcweir 							com::sun::star::lang::XServiceInfo >
587cdf0e10cSrcweir {
588cdf0e10cSrcweir private:
589cdf0e10cSrcweir 	ScDPSource*					pSource;
590cdf0e10cSrcweir 	long						nDim;
591cdf0e10cSrcweir 	long						nHier;
592cdf0e10cSrcweir 	long						nLev;
593cdf0e10cSrcweir 	ScDPMembers*				pMembers;
594cdf0e10cSrcweir 	com::sun::star::uno::Sequence<com::sun::star::sheet::GeneralFunction> aSubTotals;
595cdf0e10cSrcweir 	sal_Bool						bShowEmpty;
596cdf0e10cSrcweir     ::com::sun::star::sheet::DataPilotFieldSortInfo     aSortInfo;      // stored user settings
597cdf0e10cSrcweir     ::com::sun::star::sheet::DataPilotFieldAutoShowInfo aAutoShowInfo;  // stored user settings
598cdf0e10cSrcweir 	::com::sun::star::sheet::DataPilotFieldLayoutInfo   aLayoutInfo;    // stored user settings
599cdf0e10cSrcweir 	                                                // valid only from result calculation:
600cdf0e10cSrcweir 	::std::vector<sal_Int32>    aGlobalOrder;       // result of sorting by name or position
601cdf0e10cSrcweir 	long                        nSortMeasure;       // measure (index of data dimension) to sort by
602cdf0e10cSrcweir 	long                        nAutoMeasure;       // measure (index of data dimension) for AutoShow
603cdf0e10cSrcweir 	sal_Bool                        bEnableLayout;      // enabled only for row fields, not for the innermost one
604cdf0e10cSrcweir 
605cdf0e10cSrcweir public:
606cdf0e10cSrcweir 							ScDPLevel( ScDPSource* pSrc, long nD, long nH, long nL );
607cdf0e10cSrcweir 	virtual 				~ScDPLevel();
608cdf0e10cSrcweir 
609cdf0e10cSrcweir 	ScDPMembers*			GetMembersObject();
610cdf0e10cSrcweir 
611cdf0e10cSrcweir 							// XNamed
612cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
613cdf0e10cSrcweir 	virtual void SAL_CALL	setName( const ::rtl::OUString& aName )
614cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
615cdf0e10cSrcweir 
616cdf0e10cSrcweir 							// XMembersSupplier
617cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL
618cdf0e10cSrcweir 							getMembers() throw(::com::sun::star::uno::RuntimeException);
619cdf0e10cSrcweir 
620cdf0e10cSrcweir 							// XDataPilotMemberResults
621cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::MemberResult > SAL_CALL
622cdf0e10cSrcweir 							getResults() throw(::com::sun::star::uno::RuntimeException);
623cdf0e10cSrcweir 
624cdf0e10cSrcweir 							// XPropertySet
625cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
626cdf0e10cSrcweir 							SAL_CALL getPropertySetInfo(  )
627cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
628cdf0e10cSrcweir 	virtual void SAL_CALL	setPropertyValue( const ::rtl::OUString& aPropertyName,
629cdf0e10cSrcweir 									const ::com::sun::star::uno::Any& aValue )
630cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
631cdf0e10cSrcweir 									::com::sun::star::beans::PropertyVetoException,
632cdf0e10cSrcweir 									::com::sun::star::lang::IllegalArgumentException,
633cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
634cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
635cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
636cdf0e10cSrcweir 									const ::rtl::OUString& PropertyName )
637cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
638cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
639cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
640cdf0e10cSrcweir 	virtual void SAL_CALL	addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
641cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference<
642cdf0e10cSrcweir 										::com::sun::star::beans::XPropertyChangeListener >& xListener )
643cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
644cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
645cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
646cdf0e10cSrcweir 	virtual void SAL_CALL	removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
647cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference<
648cdf0e10cSrcweir 										::com::sun::star::beans::XPropertyChangeListener >& aListener )
649cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
650cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
651cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
652cdf0e10cSrcweir 	virtual void SAL_CALL	addVetoableChangeListener( const ::rtl::OUString& PropertyName,
653cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference<
654cdf0e10cSrcweir 										::com::sun::star::beans::XVetoableChangeListener >& aListener )
655cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
656cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
657cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
658cdf0e10cSrcweir 	virtual void SAL_CALL	removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
659cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference<
660cdf0e10cSrcweir 										::com::sun::star::beans::XVetoableChangeListener >& aListener )
661cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
662cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
663cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
664cdf0e10cSrcweir 
665cdf0e10cSrcweir 							// XServiceInfo
666cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName(  )
667cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
668cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
669cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
670cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
671cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
672cdf0e10cSrcweir 
673cdf0e10cSrcweir 	virtual com::sun::star::uno::Sequence<com::sun::star::sheet::GeneralFunction> getSubTotals() const;
674cdf0e10cSrcweir 	virtual void			setSubTotals(const com::sun::star::uno::Sequence<
675cdf0e10cSrcweir 											com::sun::star::sheet::GeneralFunction>& rNew);
676cdf0e10cSrcweir 	virtual sal_Bool			getShowEmpty() const;
677cdf0e10cSrcweir 	virtual void			setShowEmpty(sal_Bool bSet);
678cdf0e10cSrcweir 
GetSortInfo() const679cdf0e10cSrcweir     const ::com::sun::star::sheet::DataPilotFieldSortInfo& GetSortInfo() const      { return aSortInfo; }
GetAutoShow() const680cdf0e10cSrcweir 	const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo& GetAutoShow() const  { return aAutoShowInfo; }
681cdf0e10cSrcweir 
682cdf0e10cSrcweir     void                    EvaluateSortOrder();
683cdf0e10cSrcweir     void                    SetEnableLayout( sal_Bool bSet );
684cdf0e10cSrcweir 
GetGlobalOrder() const685cdf0e10cSrcweir 	const ::std::vector<sal_Int32>& GetGlobalOrder() const      { return aGlobalOrder; }
GetGlobalOrder()686cdf0e10cSrcweir 	::std::vector<sal_Int32>&  GetGlobalOrder()                 { return aGlobalOrder; }
GetSortMeasure() const687cdf0e10cSrcweir     long                    GetSortMeasure() const              { return nSortMeasure; }
GetAutoMeasure() const688cdf0e10cSrcweir     long                    GetAutoMeasure() const              { return nAutoMeasure; }
689cdf0e10cSrcweir 
IsOutlineLayout() const690cdf0e10cSrcweir 	sal_Bool                    IsOutlineLayout() const
691cdf0e10cSrcweir 	                        { return bEnableLayout &&
692cdf0e10cSrcweir 	                           aLayoutInfo.LayoutMode !=
693cdf0e10cSrcweir 	                            ::com::sun::star::sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT; }
694cdf0e10cSrcweir 
IsSubtotalsAtTop() const695cdf0e10cSrcweir 	sal_Bool                    IsSubtotalsAtTop() const
696cdf0e10cSrcweir 	                        { return bEnableLayout &&
697cdf0e10cSrcweir 	                           aLayoutInfo.LayoutMode ==
698cdf0e10cSrcweir 	                            ::com::sun::star::sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_TOP; }
699cdf0e10cSrcweir 
IsAddEmpty() const700cdf0e10cSrcweir 	sal_Bool                    IsAddEmpty() const          { return bEnableLayout && aLayoutInfo.AddEmptyLines; }
701cdf0e10cSrcweir 
702cdf0e10cSrcweir 	//!	number format (for data fields and date fields)
703cdf0e10cSrcweir };
704cdf0e10cSrcweir 
705cdf0e10cSrcweir // hash map from name to index in the member array, for fast name access
706cdf0e10cSrcweir typedef ::std::hash_map< ::rtl::OUString, sal_Int32, ::rtl::OUStringHash > ScDPMembersHashMap;
707cdf0e10cSrcweir 
708cdf0e10cSrcweir class ScDPMembers : public cppu::WeakImplHelper2<
709cdf0e10cSrcweir 							com::sun::star::container::XNameAccess,
710cdf0e10cSrcweir 							com::sun::star::lang::XServiceInfo >
711cdf0e10cSrcweir {
712cdf0e10cSrcweir private:
713cdf0e10cSrcweir 	ScDPSource*		pSource;
714cdf0e10cSrcweir 	long			nDim;
715cdf0e10cSrcweir 	long			nHier;
716cdf0e10cSrcweir 	long			nLev;
717cdf0e10cSrcweir 	long			nMbrCount;
718cdf0e10cSrcweir 	ScDPMember**	ppMbrs;
719cdf0e10cSrcweir     mutable ScDPMembersHashMap aHashMap;
720cdf0e10cSrcweir 
721cdf0e10cSrcweir public:
722cdf0e10cSrcweir 							ScDPMembers( ScDPSource* pSrc, long nD, long nH, long nL );
723cdf0e10cSrcweir 	virtual 				~ScDPMembers();
724cdf0e10cSrcweir 
725cdf0e10cSrcweir 							// XNameAccess
726cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
727cdf0e10cSrcweir 								throw(::com::sun::star::container::NoSuchElementException,
728cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
729cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
730cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
731cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
732cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
733cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
734cdf0e10cSrcweir 
735cdf0e10cSrcweir 							// XElementAccess
736cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
737cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
738cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
739cdf0e10cSrcweir 
740cdf0e10cSrcweir 							// XServiceInfo
741cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName(  )
742cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
743cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
744cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
745cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
746cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
747cdf0e10cSrcweir 
748cdf0e10cSrcweir 	virtual	long			getCount() const;
749cdf0e10cSrcweir 	virtual ScDPMember*		getByIndex(long nIndex) const;
750cdf0e10cSrcweir 
751cdf0e10cSrcweir 	long					getMinMembers() const;
752cdf0e10cSrcweir 
753cdf0e10cSrcweir     sal_Int32               GetIndexFromName( const ::rtl::OUString& rName ) const;     // <0 if not found
754cdf0e10cSrcweir     // Wang Xu Ming -- 2009-8-17
755cdf0e10cSrcweir     // DataPilot Migration - Cache&&Performance
756cdf0e10cSrcweir     const std::vector<sal_Int32>&    GetGlobalOrder();
757cdf0e10cSrcweir     const ScDPItemData*               GetSrcItemDataByIndex(  SCROW nIndex);
758cdf0e10cSrcweir     SCROW                                   GetSrcItemsCount();
759cdf0e10cSrcweir     // End Comments
760cdf0e10cSrcweir };
761cdf0e10cSrcweir 
762cdf0e10cSrcweir class ScDPMember : public cppu::WeakImplHelper3<
763cdf0e10cSrcweir 							com::sun::star::container::XNamed,
764cdf0e10cSrcweir 							com::sun::star::beans::XPropertySet,
765cdf0e10cSrcweir 							com::sun::star::lang::XServiceInfo >
766cdf0e10cSrcweir {
767cdf0e10cSrcweir private:
768cdf0e10cSrcweir 	ScDPSource*		pSource;
769cdf0e10cSrcweir 	long			nDim;
770cdf0e10cSrcweir 	long			nHier;
771cdf0e10cSrcweir 	long			nLev;
772cdf0e10cSrcweir 
773cdf0e10cSrcweir     // Wang Xu Ming -- 2009-8-17
774cdf0e10cSrcweir     // DataPilot Migration - Cache&&Performance
775cdf0e10cSrcweir     SCROW       mnDataId;
776cdf0e10cSrcweir     // End Comments
777cdf0e10cSrcweir //	String			aCaption;			// visible name (changeable by user)
778cdf0e10cSrcweir     ::std::auto_ptr<rtl::OUString> mpLayoutName;
779cdf0e10cSrcweir 
780cdf0e10cSrcweir     sal_Int32       nPosition;          // manual sorting
781cdf0e10cSrcweir 	sal_Bool			bVisible;
782cdf0e10cSrcweir 	sal_Bool			bShowDet;
783cdf0e10cSrcweir 
784cdf0e10cSrcweir public:
785cdf0e10cSrcweir     // Wang Xu Ming -- 2009-8-17
786cdf0e10cSrcweir     // DataPilot Migration - Cache&&Performance
787cdf0e10cSrcweir     ScDPMember( ScDPSource* pSrc, long nD, long nH, long nL,
788cdf0e10cSrcweir         SCROW nIndex /*const String& rN, double fV, sal_Bool bHV */);
789cdf0e10cSrcweir     // End Comments
790cdf0e10cSrcweir     virtual 				~ScDPMember();
791cdf0e10cSrcweir 
792cdf0e10cSrcweir 	sal_Bool					IsNamedItem( const ScDPItemData& r ) const;
793cdf0e10cSrcweir 	String					GetNameStr() const;
794cdf0e10cSrcweir 	void					FillItemData( ScDPItemData& rData ) const;
795cdf0e10cSrcweir     // Wang Xu Ming -- 2009-8-17
796cdf0e10cSrcweir     // DataPilot Migration - Cache&&Performance
797cdf0e10cSrcweir     //  const ScDPItemData&  GetItemData() const{ return maData; }
798cdf0e10cSrcweir     const ScDPItemData&  GetItemData() const;
GetItemDataId() const799cdf0e10cSrcweir     inline SCROW               GetItemDataId() const { return mnDataId; }
800cdf0e10cSrcweir     sal_Bool                           IsNamedItem( SCROW    nIndex  ) const;
801cdf0e10cSrcweir     // End Comments
802cdf0e10cSrcweir 
803cdf0e10cSrcweir     SC_DLLPUBLIC const ::rtl::OUString*  GetLayoutName() const;
804cdf0e10cSrcweir 
805cdf0e10cSrcweir     sal_Int32               Compare( const ScDPMember& rOther ) const;      // visible order
806cdf0e10cSrcweir 
807cdf0e10cSrcweir 							// XNamed
808cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
809cdf0e10cSrcweir 	virtual void SAL_CALL	setName( const ::rtl::OUString& aName )
810cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
811cdf0e10cSrcweir 
812cdf0e10cSrcweir 							// XPropertySet
813cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
814cdf0e10cSrcweir 							SAL_CALL getPropertySetInfo(  )
815cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
816cdf0e10cSrcweir 	virtual void SAL_CALL	setPropertyValue( const ::rtl::OUString& aPropertyName,
817cdf0e10cSrcweir 									const ::com::sun::star::uno::Any& aValue )
818cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
819cdf0e10cSrcweir 									::com::sun::star::beans::PropertyVetoException,
820cdf0e10cSrcweir 									::com::sun::star::lang::IllegalArgumentException,
821cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
822cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
823cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
824cdf0e10cSrcweir 									const ::rtl::OUString& PropertyName )
825cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
826cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
827cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
828cdf0e10cSrcweir 	virtual void SAL_CALL	addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
829cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference<
830cdf0e10cSrcweir 										::com::sun::star::beans::XPropertyChangeListener >& xListener )
831cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
832cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
833cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
834cdf0e10cSrcweir 	virtual void SAL_CALL	removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
835cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference<
836cdf0e10cSrcweir 										::com::sun::star::beans::XPropertyChangeListener >& aListener )
837cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
838cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
839cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
840cdf0e10cSrcweir 	virtual void SAL_CALL	addVetoableChangeListener( const ::rtl::OUString& PropertyName,
841cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference<
842cdf0e10cSrcweir 										::com::sun::star::beans::XVetoableChangeListener >& aListener )
843cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
844cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
845cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
846cdf0e10cSrcweir 	virtual void SAL_CALL	removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
847cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference<
848cdf0e10cSrcweir 										::com::sun::star::beans::XVetoableChangeListener >& aListener )
849cdf0e10cSrcweir 								throw(::com::sun::star::beans::UnknownPropertyException,
850cdf0e10cSrcweir 									::com::sun::star::lang::WrappedTargetException,
851cdf0e10cSrcweir 									::com::sun::star::uno::RuntimeException);
852cdf0e10cSrcweir 
853cdf0e10cSrcweir 							// XServiceInfo
854cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName(  )
855cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
856cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
857cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
858cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
859cdf0e10cSrcweir 								throw(::com::sun::star::uno::RuntimeException);
860cdf0e10cSrcweir 
861cdf0e10cSrcweir 	virtual sal_Bool			getIsVisible() const;
862cdf0e10cSrcweir 	virtual void			setIsVisible(sal_Bool bSet);
863cdf0e10cSrcweir 	virtual sal_Bool			getShowDetails() const;
864cdf0e10cSrcweir 	virtual void			setShowDetails(sal_Bool bSet);
865cdf0e10cSrcweir 
866cdf0e10cSrcweir     sal_Int32               getPosition() const;
867cdf0e10cSrcweir     void                    setPosition(sal_Int32 nNew);
868cdf0e10cSrcweir };
869cdf0e10cSrcweir 
870cdf0e10cSrcweir 
871cdf0e10cSrcweir #endif
872cdf0e10cSrcweir 
873