1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SC_INC_DPTABSRC_HXX
21 #define INCLUDED_SC_INC_DPTABSRC_HXX
24 #include <com/sun/star/sheet/XDimensionsSupplier.hpp>
25 #include <com/sun/star/sheet/XHierarchiesSupplier.hpp>
26 #include <com/sun/star/sheet/XLevelsSupplier.hpp>
27 #include <com/sun/star/sheet/XMembersSupplier.hpp>
28 #include <com/sun/star/sheet/XDataPilotResults.hpp>
29 #include <com/sun/star/sheet/XDataPilotMemberResults.hpp>
30 #include <com/sun/star/sheet/MemberResult.hpp>
31 #include <com/sun/star/sheet/GeneralFunction.hpp>
32 #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
33 #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
34 #include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
35 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
36 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
37 #include <com/sun/star/util/XRefreshable.hpp>
38 #include <com/sun/star/sheet/XDrillDownDataSupplier.hpp>
39 #include <com/sun/star/util/XCloneable.hpp>
40 #include <com/sun/star/beans/XPropertySet.hpp>
41 #include <com/sun/star/lang/XServiceInfo.hpp>
42 #include <com/sun/star/container/XNamed.hpp>
43 #include <cppuhelper/implbase2.hxx>
44 #include <cppuhelper/implbase3.hxx>
45 #include <cppuhelper/implbase5.hxx>
46 #include <cppuhelper/implbase6.hxx>
47 #include <rtl/ref.hxx>
49 #include "dptabdat.hxx"
50 #include "dpglobal.hxx"
51 #include "dpresfilter.hxx"
53 #include <boost/noncopyable.hpp>
54 #include <boost/scoped_ptr.hpp>
56 #include <unordered_map>
57 #include <unordered_set>
60 namespace com
{ namespace sun
{ namespace star
{
62 struct DataPilotFieldFilter
;
69 class ScDPResultMember
;
74 // implementation of DataPilotSource using ScDPTableData
78 class ScDPHierarchies
;
85 class ScDPSource
: public cppu::WeakImplHelper6
<
86 com::sun::star::sheet::XDimensionsSupplier
,
87 com::sun::star::sheet::XDataPilotResults
,
88 com::sun::star::util::XRefreshable
,
89 com::sun::star::sheet::XDrillDownDataSupplier
,
90 com::sun::star::beans::XPropertySet
,
91 com::sun::star::lang::XServiceInfo
>
94 ScDPTableData
* pData
; // data source (ScDPObject manages its life time)
95 ScDPDimensions
* pDimensions
; // api objects
98 std::vector
<long> maColDims
;
99 std::vector
<long> maRowDims
;
100 std::vector
<long> maDataDims
;
101 std::vector
<long> maPageDims
;
102 ScDPResultTree maResFilterSet
;
106 bool bIgnoreEmptyRows
;
112 ScDPResultData
* pResData
; // keep the rest in this!
113 ScDPResultMember
* pColResRoot
;
114 ScDPResultMember
* pRowResRoot
;
115 com::sun::star::uno::Sequence
<com::sun::star::sheet::MemberResult
>* pColResults
;
116 com::sun::star::uno::Sequence
<com::sun::star::sheet::MemberResult
>* pRowResults
;
117 std::vector
<ScDPLevel
*> aColLevelList
;
118 std::vector
<ScDPLevel
*> aRowLevelList
;
119 bool bResultOverflow
;
120 bool bPageFiltered
; // set if page field filters have been applied to cache table
122 ::std::unique_ptr
<OUString
> mpGrandTotalName
;
124 void CreateRes_Impl();
125 void FillMemberResults();
126 void FillLevelList( sal_uInt16 nOrientation
, std::vector
<ScDPLevel
*> &rList
);
127 void FillCalcInfo(bool bIsRow
, ScDPTableData::CalcInfo
& rInfo
, bool &bHasAutoShow
);
130 * Compile a list of dimension indices that are either, column, row or
131 * page dimensions (i.e. all but data dimensions).
133 void GetCategoryDimensionIndices(std::unordered_set
<sal_Int32
>& rCatDims
);
136 * Set visibilities of individual rows in the cache table based on the
139 void FilterCacheByPageDimensions();
141 void SetDupCount( long nNew
);
143 OUString
getDataDescription(); //! ???
145 void setIgnoreEmptyRows(bool bSet
);
146 void setRepeatIfEmpty(bool bSet
);
151 ScDPSource( ScDPTableData
* pD
);
152 virtual ~ScDPSource();
154 ScDPTableData
* GetData() { return pData
; }
155 const ScDPTableData
* GetData() const { return pData
; }
157 const OUString
* GetGrandTotalName() const;
159 sal_uInt16
GetOrientation(long nColumn
);
160 void SetOrientation(long nColumn
, sal_uInt16 nNew
);
161 long GetPosition(long nColumn
);
163 long GetDataDimensionCount();
164 ScDPDimension
* GetDataDimension(long nIndex
);
165 OUString
GetDataDimName(long nIndex
);
166 const ScDPCache
* GetCache();
167 const ScDPItemData
* GetItemDataById( long nDim
, long nId
);
168 long GetDataLayoutDim(){ return pData
->GetColumnCount(); }
169 SCROW
GetMemberId( long nDim
, const ScDPItemData
& rData
);
170 bool IsDataLayoutDimension(long nDim
);
171 sal_uInt16
GetDataLayoutOrientation();
173 bool IsDateDimension(long nDim
);
175 bool SubTotalAllowed(long nColumn
); //! move to ScDPResultData
177 ScDPDimension
* AddDuplicated(long nSource
, const OUString
& rNewName
);
178 long GetDupCount() const { return nDupCount
; }
180 long GetSourceDim(long nDim
);
182 const com::sun::star::uno::Sequence
<com::sun::star::sheet::MemberResult
>*
183 GetMemberResults( ScDPLevel
* pLevel
);
185 ScDPDimensions
* GetDimensionsObject();
187 // XDimensionsSupplier
188 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>
189 SAL_CALL
getDimensions( )
190 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
193 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
<
194 ::com::sun::star::sheet::DataResult
> > SAL_CALL
getResults( )
195 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
197 virtual com::sun::star::uno::Sequence
<double> SAL_CALL
199 const com::sun::star::uno::Sequence
<com::sun::star::sheet::DataPilotFieldFilter
>& aFilters
)
200 throw (com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
203 virtual void SAL_CALL
refresh() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
204 virtual void SAL_CALL
addRefreshListener( const ::com::sun::star::uno::Reference
<
205 ::com::sun::star::util::XRefreshListener
>& l
)
206 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
207 virtual void SAL_CALL
removeRefreshListener( const ::com::sun::star::uno::Reference
<
208 ::com::sun::star::util::XRefreshListener
>& l
)
209 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
211 // XDrillDownDataSupplier
212 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> >
213 SAL_CALL
getDrillDownData(const ::com::sun::star::uno::Sequence
<
214 ::com::sun::star::sheet::DataPilotFieldFilter
>& aFilters
)
215 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
218 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
219 SAL_CALL
getPropertySetInfo( )
220 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
221 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
222 const ::com::sun::star::uno::Any
& aValue
)
223 throw(::com::sun::star::beans::UnknownPropertyException
,
224 ::com::sun::star::beans::PropertyVetoException
,
225 ::com::sun::star::lang::IllegalArgumentException
,
226 ::com::sun::star::lang::WrappedTargetException
,
227 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
228 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
229 const OUString
& PropertyName
)
230 throw(::com::sun::star::beans::UnknownPropertyException
,
231 ::com::sun::star::lang::WrappedTargetException
,
232 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
233 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
234 const ::com::sun::star::uno::Reference
<
235 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
236 throw(::com::sun::star::beans::UnknownPropertyException
,
237 ::com::sun::star::lang::WrappedTargetException
,
238 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
239 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
240 const ::com::sun::star::uno::Reference
<
241 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
242 throw(::com::sun::star::beans::UnknownPropertyException
,
243 ::com::sun::star::lang::WrappedTargetException
,
244 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
245 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
246 const ::com::sun::star::uno::Reference
<
247 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
248 throw(::com::sun::star::beans::UnknownPropertyException
,
249 ::com::sun::star::lang::WrappedTargetException
,
250 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
251 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
252 const ::com::sun::star::uno::Reference
<
253 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
254 throw(::com::sun::star::beans::UnknownPropertyException
,
255 ::com::sun::star::lang::WrappedTargetException
,
256 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
259 virtual OUString SAL_CALL
getImplementationName( )
260 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
261 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
262 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
263 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
264 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
266 #if DEBUG_PIVOT_TABLE
267 void DumpResults() const;
271 class ScDPDimensions
: public cppu::WeakImplHelper2
<
272 com::sun::star::container::XNameAccess
,
273 com::sun::star::lang::XServiceInfo
>
278 ScDPDimension
** ppDims
;
281 ScDPDimensions( ScDPSource
* pSrc
);
282 virtual ~ScDPDimensions();
287 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
288 throw(::com::sun::star::container::NoSuchElementException
,
289 ::com::sun::star::lang::WrappedTargetException
,
290 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
291 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
292 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
293 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
294 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
297 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
298 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
299 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
302 virtual OUString SAL_CALL
getImplementationName( )
303 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
304 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
305 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
306 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
307 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
309 long getCount() const;
310 ScDPDimension
* getByIndex(long nIndex
) const;
313 class ScDPDimension
: boost::noncopyable
, public cppu::WeakImplHelper5
<
314 com::sun::star::sheet::XHierarchiesSupplier
,
315 com::sun::star::container::XNamed
,
316 com::sun::star::util::XCloneable
,
317 com::sun::star::beans::XPropertySet
,
318 com::sun::star::lang::XServiceInfo
>
321 long nDim
; // dimension index (== column ID)
322 ScDPHierarchies
* pHierarchies
;
324 sal_uInt16 nFunction
; // enum GeneralFunction
325 OUString aName
; // if empty, take from source
326 boost::scoped_ptr
<OUString
> mpLayoutName
;
327 boost::scoped_ptr
<OUString
> mpSubtotalName
;
328 long nSourceDim
; // >=0 if dup'ed
329 ::com::sun::star::sheet::DataPilotFieldReference
330 aReferenceValue
; // settings for "show data as" / "displayed value"
331 bool bHasSelectedPage
;
332 OUString aSelectedPage
;
333 ScDPItemData
* pSelectedData
; // internal, temporary, created from aSelectedPage
334 bool mbHasHiddenMember
;
337 ScDPDimension( ScDPSource
* pSrc
, long nD
);
338 virtual ~ScDPDimension();
340 long GetDimension() const { return nDim
; } // dimension index in source
341 long GetSourceDim() const { return nSourceDim
; } // >=0 if dup'ed
343 ScDPDimension
* CreateCloneObject();
344 ScDPHierarchies
* GetHierarchiesObject();
346 SC_DLLPUBLIC
const OUString
* GetLayoutName() const;
347 const OUString
* GetSubtotalName() const;
350 virtual OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
351 virtual void SAL_CALL
setName( const OUString
& aName
)
352 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
354 // XHierarchiesSupplier
355 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
356 getHierarchies() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
359 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::util::XCloneable
> SAL_CALL
360 createClone() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
363 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
364 SAL_CALL
getPropertySetInfo( )
365 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
366 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
367 const ::com::sun::star::uno::Any
& aValue
)
368 throw(::com::sun::star::beans::UnknownPropertyException
,
369 ::com::sun::star::beans::PropertyVetoException
,
370 ::com::sun::star::lang::IllegalArgumentException
,
371 ::com::sun::star::lang::WrappedTargetException
,
372 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
373 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
374 const OUString
& PropertyName
)
375 throw(::com::sun::star::beans::UnknownPropertyException
,
376 ::com::sun::star::lang::WrappedTargetException
,
377 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
378 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
379 const ::com::sun::star::uno::Reference
<
380 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
381 throw(::com::sun::star::beans::UnknownPropertyException
,
382 ::com::sun::star::lang::WrappedTargetException
,
383 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
384 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
385 const ::com::sun::star::uno::Reference
<
386 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
387 throw(::com::sun::star::beans::UnknownPropertyException
,
388 ::com::sun::star::lang::WrappedTargetException
,
389 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
390 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
391 const ::com::sun::star::uno::Reference
<
392 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
393 throw(::com::sun::star::beans::UnknownPropertyException
,
394 ::com::sun::star::lang::WrappedTargetException
,
395 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
396 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
397 const ::com::sun::star::uno::Reference
<
398 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
399 throw(::com::sun::star::beans::UnknownPropertyException
,
400 ::com::sun::star::lang::WrappedTargetException
,
401 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
404 virtual OUString SAL_CALL
getImplementationName( )
405 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
406 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
407 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
408 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
409 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
411 sal_uInt16
getOrientation() const;
412 void setOrientation(sal_uInt16 nNew
);
413 long getPosition() const;
414 bool getIsDataLayoutDimension() const;
415 sal_uInt16
getFunction() const { return nFunction
;}
416 void setFunction(sal_uInt16 nNew
); // for data dimension
417 long getUsedHierarchy() const { return nUsedHier
;}
419 bool HasSelectedPage() const { return bHasSelectedPage
; }
420 const ScDPItemData
& GetSelectedData();
422 const ::com::sun::star::sheet::DataPilotFieldReference
& GetReferenceValue() const { return aReferenceValue
;}
425 class ScDPHierarchies
: public cppu::WeakImplHelper2
<
426 com::sun::star::container::XNameAccess
,
427 com::sun::star::lang::XServiceInfo
>
433 ScDPHierarchy
** ppHiers
;
436 ScDPHierarchies( ScDPSource
* pSrc
, long nD
);
437 virtual ~ScDPHierarchies();
440 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
441 throw(::com::sun::star::container::NoSuchElementException
,
442 ::com::sun::star::lang::WrappedTargetException
,
443 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
444 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
445 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
446 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
447 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
450 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
451 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
452 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
455 virtual OUString SAL_CALL
getImplementationName( )
456 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
457 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
458 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
459 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
460 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
462 long getCount() const;
463 ScDPHierarchy
* getByIndex(long nIndex
) const;
466 class ScDPHierarchy
: public cppu::WeakImplHelper3
<
467 com::sun::star::sheet::XLevelsSupplier
,
468 com::sun::star::container::XNamed
,
469 com::sun::star::lang::XServiceInfo
>
478 ScDPHierarchy( ScDPSource
* pSrc
, long nD
, long nH
);
479 virtual ~ScDPHierarchy();
481 ScDPLevels
* GetLevelsObject();
484 virtual OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
485 virtual void SAL_CALL
setName( const OUString
& aName
)
486 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
489 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
490 getLevels() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
493 virtual OUString SAL_CALL
getImplementationName( )
494 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
495 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
496 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
497 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
498 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
501 class ScDPLevels
: public cppu::WeakImplHelper2
<
502 com::sun::star::container::XNameAccess
,
503 com::sun::star::lang::XServiceInfo
>
513 ScDPLevels( ScDPSource
* pSrc
, long nD
, long nH
);
514 virtual ~ScDPLevels();
517 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
518 throw(::com::sun::star::container::NoSuchElementException
,
519 ::com::sun::star::lang::WrappedTargetException
,
520 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
521 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
522 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
523 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
524 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
527 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
528 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
529 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
532 virtual OUString SAL_CALL
getImplementationName( )
533 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
534 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
535 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
536 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
537 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
539 long getCount() const;
540 ScDPLevel
* getByIndex(long nIndex
) const;
543 class ScDPLevel
: public cppu::WeakImplHelper5
<
544 com::sun::star::sheet::XMembersSupplier
,
545 com::sun::star::container::XNamed
,
546 com::sun::star::sheet::XDataPilotMemberResults
,
547 com::sun::star::beans::XPropertySet
,
548 com::sun::star::lang::XServiceInfo
>
555 ScDPMembers
* pMembers
;
556 com::sun::star::uno::Sequence
<com::sun::star::sheet::GeneralFunction
> aSubTotals
;
557 ::com::sun::star::sheet::DataPilotFieldSortInfo aSortInfo
; // stored user settings
558 ::com::sun::star::sheet::DataPilotFieldAutoShowInfo aAutoShowInfo
; // stored user settings
559 ::com::sun::star::sheet::DataPilotFieldLayoutInfo aLayoutInfo
; // stored user settings
560 // valid only from result calculation:
561 ::std::vector
<sal_Int32
> aGlobalOrder
; // result of sorting by name or position
562 long nSortMeasure
; // measure (index of data dimension) to sort by
563 long nAutoMeasure
; // measure (index of data dimension) for AutoShow
565 bool bEnableLayout
:1; // enabled only for row fields, not for the innermost one
566 bool bRepeatItemLabels
:1;
569 ScDPLevel( ScDPSource
* pSrc
, long nD
, long nH
, long nL
);
570 virtual ~ScDPLevel();
572 ScDPMembers
* GetMembersObject();
575 virtual OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
576 virtual void SAL_CALL
setName( const OUString
& aName
)
577 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
580 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
581 getMembers() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
583 // XDataPilotMemberResults
584 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::sheet::MemberResult
> SAL_CALL
585 getResults() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
588 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
589 SAL_CALL
getPropertySetInfo( )
590 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
591 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
592 const ::com::sun::star::uno::Any
& aValue
)
593 throw(::com::sun::star::beans::UnknownPropertyException
,
594 ::com::sun::star::beans::PropertyVetoException
,
595 ::com::sun::star::lang::IllegalArgumentException
,
596 ::com::sun::star::lang::WrappedTargetException
,
597 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
598 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
599 const OUString
& PropertyName
)
600 throw(::com::sun::star::beans::UnknownPropertyException
,
601 ::com::sun::star::lang::WrappedTargetException
,
602 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
603 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
604 const ::com::sun::star::uno::Reference
<
605 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
606 throw(::com::sun::star::beans::UnknownPropertyException
,
607 ::com::sun::star::lang::WrappedTargetException
,
608 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
609 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
610 const ::com::sun::star::uno::Reference
<
611 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
612 throw(::com::sun::star::beans::UnknownPropertyException
,
613 ::com::sun::star::lang::WrappedTargetException
,
614 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
615 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
616 const ::com::sun::star::uno::Reference
<
617 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
618 throw(::com::sun::star::beans::UnknownPropertyException
,
619 ::com::sun::star::lang::WrappedTargetException
,
620 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
621 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
622 const ::com::sun::star::uno::Reference
<
623 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
624 throw(::com::sun::star::beans::UnknownPropertyException
,
625 ::com::sun::star::lang::WrappedTargetException
,
626 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
629 virtual OUString SAL_CALL
getImplementationName( )
630 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
631 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
632 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
633 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
634 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
636 com::sun::star::uno::Sequence
<com::sun::star::sheet::GeneralFunction
> getSubTotals() const;
637 bool getShowEmpty() const { return bShowEmpty
;}
638 bool getRepeatItemLabels() const { return bRepeatItemLabels
; }
640 const ::com::sun::star::sheet::DataPilotFieldSortInfo
& GetSortInfo() const { return aSortInfo
; }
641 const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo
& GetAutoShow() const { return aAutoShowInfo
; }
643 void EvaluateSortOrder();
644 void SetEnableLayout(bool bSet
);
646 const ::std::vector
<sal_Int32
>& GetGlobalOrder() const { return aGlobalOrder
; }
647 ::std::vector
<sal_Int32
>& GetGlobalOrder() { return aGlobalOrder
; }
648 long GetSortMeasure() const { return nSortMeasure
; }
649 long GetAutoMeasure() const { return nAutoMeasure
; }
651 bool IsOutlineLayout() const
653 return bEnableLayout
&&
654 aLayoutInfo
.LayoutMode
!=
655 ::com::sun::star::sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT
;
658 bool IsSubtotalsAtTop() const
660 return bEnableLayout
&&
661 aLayoutInfo
.LayoutMode
==
662 ::com::sun::star::sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_TOP
;
665 bool IsAddEmpty() const
667 return bEnableLayout
&& aLayoutInfo
.AddEmptyLines
;
670 //! number format (for data fields and date fields)
673 // hash map from name to index in the member array, for fast name access
674 typedef std::unordered_map
< OUString
, sal_Int32
, OUStringHash
> ScDPMembersHashMap
;
676 class ScDPMembers
: public cppu::WeakImplHelper2
<
677 com::sun::star::container::XNameAccess
,
678 com::sun::star::lang::XServiceInfo
>
681 typedef std::vector
<rtl::Reference
<ScDPMember
> > MembersType
;
687 mutable MembersType maMembers
;
688 mutable ScDPMembersHashMap aHashMap
;
691 ScDPMembers( ScDPSource
* pSrc
, long nD
, long nH
, long nL
);
692 virtual ~ScDPMembers();
695 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
696 throw(::com::sun::star::container::NoSuchElementException
,
697 ::com::sun::star::lang::WrappedTargetException
,
698 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
699 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
700 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
701 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
702 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
705 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
706 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
707 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
710 virtual OUString SAL_CALL
getImplementationName( )
711 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
712 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
713 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
714 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
715 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
717 long getCount() const { return nMbrCount
;}
718 ScDPMember
* getByIndex(long nIndex
) const;
720 long getMinMembers() const;
722 sal_Int32
GetIndexFromName( const OUString
& rName
) const; // <0 if not found
723 const std::vector
<sal_Int32
>& GetGlobalOrder();
724 const ScDPItemData
* GetSrcItemDataByIndex( SCROW nIndex
);
725 SCROW
GetSrcItemsCount();
728 class ScDPMember
: boost::noncopyable
, public cppu::WeakImplHelper3
<
729 com::sun::star::container::XNamed
,
730 com::sun::star::beans::XPropertySet
,
731 com::sun::star::lang::XServiceInfo
>
740 boost::scoped_ptr
<OUString
> mpLayoutName
;
742 sal_Int32 nPosition
; // manual sorting
747 ScDPMember(ScDPSource
* pSrc
, long nD
, long nH
, long nL
, SCROW nIndex
);
748 virtual ~ScDPMember();
750 OUString
GetNameStr() const;
751 void FillItemData( ScDPItemData
& rData
) const;
752 const ScDPItemData
* GetItemData() const;
753 SCROW
GetItemDataId() const { return mnDataId
; }
754 bool IsNamedItem(SCROW nIndex
) const;
756 SC_DLLPUBLIC
const OUString
* GetLayoutName() const;
757 long GetDim() const { return nDim
;}
759 sal_Int32
Compare( const ScDPMember
& rOther
) const; // visible order
762 virtual OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
763 virtual void SAL_CALL
setName( const OUString
& aName
)
764 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
767 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
768 SAL_CALL
getPropertySetInfo( )
769 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
770 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
771 const ::com::sun::star::uno::Any
& aValue
)
772 throw(::com::sun::star::beans::UnknownPropertyException
,
773 ::com::sun::star::beans::PropertyVetoException
,
774 ::com::sun::star::lang::IllegalArgumentException
,
775 ::com::sun::star::lang::WrappedTargetException
,
776 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
777 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
778 const OUString
& PropertyName
)
779 throw(::com::sun::star::beans::UnknownPropertyException
,
780 ::com::sun::star::lang::WrappedTargetException
,
781 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
782 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
783 const ::com::sun::star::uno::Reference
<
784 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
785 throw(::com::sun::star::beans::UnknownPropertyException
,
786 ::com::sun::star::lang::WrappedTargetException
,
787 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
788 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
789 const ::com::sun::star::uno::Reference
<
790 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
791 throw(::com::sun::star::beans::UnknownPropertyException
,
792 ::com::sun::star::lang::WrappedTargetException
,
793 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
794 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
795 const ::com::sun::star::uno::Reference
<
796 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
797 throw(::com::sun::star::beans::UnknownPropertyException
,
798 ::com::sun::star::lang::WrappedTargetException
,
799 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
800 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
801 const ::com::sun::star::uno::Reference
<
802 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
803 throw(::com::sun::star::beans::UnknownPropertyException
,
804 ::com::sun::star::lang::WrappedTargetException
,
805 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
808 virtual OUString SAL_CALL
getImplementationName( )
809 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
810 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
811 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
812 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
813 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
815 bool isVisible() const { return bVisible
;}
816 bool getShowDetails() const { return bShowDet
;}
821 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */