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/unordered_map.hpp>
54 #include <boost/unordered_set.hpp>
55 #include <boost/noncopyable.hpp>
56 #include <boost/scoped_ptr.hpp>
60 namespace com
{ namespace sun
{ namespace star
{
62 struct DataPilotFieldFilter
;
69 class ScDPResultMember
;
75 // implementation of DataPilotSource using ScDPTableData
79 class ScDPHierarchies
;
87 class ScDPSource
: public cppu::WeakImplHelper6
<
88 com::sun::star::sheet::XDimensionsSupplier
,
89 com::sun::star::sheet::XDataPilotResults
,
90 com::sun::star::util::XRefreshable
,
91 com::sun::star::sheet::XDrillDownDataSupplier
,
92 com::sun::star::beans::XPropertySet
,
93 com::sun::star::lang::XServiceInfo
>
96 ScDPTableData
* pData
; // data source (ScDPObject manages its life time)
97 ScDPDimensions
* pDimensions
; // api objects
100 std::vector
<long> maColDims
;
101 std::vector
<long> maRowDims
;
102 std::vector
<long> maDataDims
;
103 std::vector
<long> maPageDims
;
104 ScDPResultTree maResFilterSet
;
108 bool bIgnoreEmptyRows
;
114 ScDPResultData
* pResData
; // keep the rest in this!
115 ScDPResultMember
* pColResRoot
;
116 ScDPResultMember
* pRowResRoot
;
117 com::sun::star::uno::Sequence
<com::sun::star::sheet::MemberResult
>* pColResults
;
118 com::sun::star::uno::Sequence
<com::sun::star::sheet::MemberResult
>* pRowResults
;
119 std::vector
<ScDPLevel
*> aColLevelList
;
120 std::vector
<ScDPLevel
*> aRowLevelList
;
121 bool bResultOverflow
;
122 bool bPageFiltered
; // set if page field filters have been applied to cache table
124 SAL_WNODEPRECATED_DECLARATIONS_PUSH
125 ::std::auto_ptr
<OUString
> mpGrandTotalName
;
126 SAL_WNODEPRECATED_DECLARATIONS_POP
128 void CreateRes_Impl();
129 void FillMemberResults();
130 void FillLevelList( sal_uInt16 nOrientation
, std::vector
<ScDPLevel
*> &rList
);
131 void FillCalcInfo(bool bIsRow
, ScDPTableData::CalcInfo
& rInfo
, bool &bHasAutoShow
);
134 * Compile a list of dimension indices that are either, column, row or
135 * page dimensions (i.e. all but data dimensions).
137 void GetCategoryDimensionIndices(::boost::unordered_set
<sal_Int32
>& rCatDims
);
140 * Set visibilities of individual rows in the cache table based on the
143 void FilterCacheByPageDimensions();
145 void SetDupCount( long nNew
);
147 OUString
getDataDescription(); //! ???
149 void setIgnoreEmptyRows(bool bSet
);
150 void setRepeatIfEmpty(bool bSet
);
155 ScDPSource( ScDPTableData
* pD
);
156 virtual ~ScDPSource();
158 ScDPTableData
* GetData() { return pData
; }
159 const ScDPTableData
* GetData() const { return pData
; }
161 const OUString
* GetGrandTotalName() const;
163 sal_uInt16
GetOrientation(long nColumn
);
164 void SetOrientation(long nColumn
, sal_uInt16 nNew
);
165 long GetPosition(long nColumn
);
167 long GetDataDimensionCount();
168 ScDPDimension
* GetDataDimension(long nIndex
);
169 OUString
GetDataDimName(long nIndex
);
170 const ScDPCache
* GetCache();
171 const ScDPItemData
* GetItemDataById( long nDim
, long nId
);
172 long GetDataLayoutDim(){ return pData
->GetColumnCount(); }
173 SCROW
GetMemberId( long nDim
, const ScDPItemData
& rData
);
174 bool IsDataLayoutDimension(long nDim
);
175 sal_uInt16
GetDataLayoutOrientation();
177 bool IsDateDimension(long nDim
);
179 bool SubTotalAllowed(long nColumn
); //! move to ScDPResultData
181 ScDPDimension
* AddDuplicated(long nSource
, const OUString
& rNewName
);
182 long GetDupCount() const { return nDupCount
; }
184 long GetSourceDim(long nDim
);
186 const com::sun::star::uno::Sequence
<com::sun::star::sheet::MemberResult
>*
187 GetMemberResults( ScDPLevel
* pLevel
);
189 ScDPDimensions
* GetDimensionsObject();
191 // XDimensionsSupplier
192 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>
193 SAL_CALL
getDimensions( )
194 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
197 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
<
198 ::com::sun::star::sheet::DataResult
> > SAL_CALL
getResults( )
199 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
201 virtual com::sun::star::uno::Sequence
<double> SAL_CALL
203 const com::sun::star::uno::Sequence
<com::sun::star::sheet::DataPilotFieldFilter
>& aFilters
)
204 throw (com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
207 virtual void SAL_CALL
refresh() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
208 virtual void SAL_CALL
addRefreshListener( const ::com::sun::star::uno::Reference
<
209 ::com::sun::star::util::XRefreshListener
>& l
)
210 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
211 virtual void SAL_CALL
removeRefreshListener( const ::com::sun::star::uno::Reference
<
212 ::com::sun::star::util::XRefreshListener
>& l
)
213 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
215 // XDrillDownDataSupplier
216 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> >
217 SAL_CALL
getDrillDownData(const ::com::sun::star::uno::Sequence
<
218 ::com::sun::star::sheet::DataPilotFieldFilter
>& aFilters
)
219 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
222 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
223 SAL_CALL
getPropertySetInfo( )
224 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
225 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
226 const ::com::sun::star::uno::Any
& aValue
)
227 throw(::com::sun::star::beans::UnknownPropertyException
,
228 ::com::sun::star::beans::PropertyVetoException
,
229 ::com::sun::star::lang::IllegalArgumentException
,
230 ::com::sun::star::lang::WrappedTargetException
,
231 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
232 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
233 const OUString
& PropertyName
)
234 throw(::com::sun::star::beans::UnknownPropertyException
,
235 ::com::sun::star::lang::WrappedTargetException
,
236 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
237 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
238 const ::com::sun::star::uno::Reference
<
239 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
240 throw(::com::sun::star::beans::UnknownPropertyException
,
241 ::com::sun::star::lang::WrappedTargetException
,
242 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
243 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
244 const ::com::sun::star::uno::Reference
<
245 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
246 throw(::com::sun::star::beans::UnknownPropertyException
,
247 ::com::sun::star::lang::WrappedTargetException
,
248 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
249 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
250 const ::com::sun::star::uno::Reference
<
251 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
252 throw(::com::sun::star::beans::UnknownPropertyException
,
253 ::com::sun::star::lang::WrappedTargetException
,
254 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
255 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
256 const ::com::sun::star::uno::Reference
<
257 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
258 throw(::com::sun::star::beans::UnknownPropertyException
,
259 ::com::sun::star::lang::WrappedTargetException
,
260 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
263 virtual OUString SAL_CALL
getImplementationName( )
264 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
265 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
266 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
267 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
268 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
270 #if DEBUG_PIVOT_TABLE
271 void DumpResults() const;
275 class ScDPDimensions
: public cppu::WeakImplHelper2
<
276 com::sun::star::container::XNameAccess
,
277 com::sun::star::lang::XServiceInfo
>
282 ScDPDimension
** ppDims
;
285 ScDPDimensions( ScDPSource
* pSrc
);
286 virtual ~ScDPDimensions();
291 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
292 throw(::com::sun::star::container::NoSuchElementException
,
293 ::com::sun::star::lang::WrappedTargetException
,
294 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
295 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
296 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
297 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
298 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
301 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
302 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
303 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
306 virtual OUString SAL_CALL
getImplementationName( )
307 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
308 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
309 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
310 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
311 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
313 virtual long getCount() const;
314 virtual ScDPDimension
* getByIndex(long nIndex
) const;
317 class ScDPDimension
: boost::noncopyable
, public cppu::WeakImplHelper5
<
318 com::sun::star::sheet::XHierarchiesSupplier
,
319 com::sun::star::container::XNamed
,
320 com::sun::star::util::XCloneable
,
321 com::sun::star::beans::XPropertySet
,
322 com::sun::star::lang::XServiceInfo
>
325 long nDim
; // dimension index (== column ID)
326 ScDPHierarchies
* pHierarchies
;
328 sal_uInt16 nFunction
; // enum GeneralFunction
329 OUString aName
; // if empty, take from source
330 boost::scoped_ptr
<OUString
> mpLayoutName
;
331 boost::scoped_ptr
<OUString
> mpSubtotalName
;
332 long nSourceDim
; // >=0 if dup'ed
333 ::com::sun::star::sheet::DataPilotFieldReference
334 aReferenceValue
; // settings for "show data as" / "displayed value"
335 bool bHasSelectedPage
;
336 OUString aSelectedPage
;
337 ScDPItemData
* pSelectedData
; // internal, temporary, created from aSelectedPage
338 bool mbHasHiddenMember
;
341 ScDPDimension( ScDPSource
* pSrc
, long nD
);
342 virtual ~ScDPDimension();
344 long GetDimension() const { return nDim
; } // dimension index in source
345 long GetSourceDim() const { return nSourceDim
; } // >=0 if dup'ed
347 ScDPDimension
* CreateCloneObject();
348 ScDPHierarchies
* GetHierarchiesObject();
350 SC_DLLPUBLIC
const OUString
* GetLayoutName() const;
351 const OUString
* GetSubtotalName() const;
354 virtual OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
355 virtual void SAL_CALL
setName( const OUString
& aName
)
356 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
358 // XHierarchiesSupplier
359 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
360 getHierarchies() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
363 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::util::XCloneable
> SAL_CALL
364 createClone() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
367 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
368 SAL_CALL
getPropertySetInfo( )
369 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
370 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
371 const ::com::sun::star::uno::Any
& aValue
)
372 throw(::com::sun::star::beans::UnknownPropertyException
,
373 ::com::sun::star::beans::PropertyVetoException
,
374 ::com::sun::star::lang::IllegalArgumentException
,
375 ::com::sun::star::lang::WrappedTargetException
,
376 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
377 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
378 const OUString
& PropertyName
)
379 throw(::com::sun::star::beans::UnknownPropertyException
,
380 ::com::sun::star::lang::WrappedTargetException
,
381 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
382 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
383 const ::com::sun::star::uno::Reference
<
384 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
385 throw(::com::sun::star::beans::UnknownPropertyException
,
386 ::com::sun::star::lang::WrappedTargetException
,
387 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
388 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
389 const ::com::sun::star::uno::Reference
<
390 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
391 throw(::com::sun::star::beans::UnknownPropertyException
,
392 ::com::sun::star::lang::WrappedTargetException
,
393 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
394 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
395 const ::com::sun::star::uno::Reference
<
396 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
397 throw(::com::sun::star::beans::UnknownPropertyException
,
398 ::com::sun::star::lang::WrappedTargetException
,
399 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
400 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
401 const ::com::sun::star::uno::Reference
<
402 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
403 throw(::com::sun::star::beans::UnknownPropertyException
,
404 ::com::sun::star::lang::WrappedTargetException
,
405 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
408 virtual OUString SAL_CALL
getImplementationName( )
409 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
410 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
411 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
412 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
413 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
415 sal_uInt16
getOrientation() const;
416 void setOrientation(sal_uInt16 nNew
);
417 long getPosition() const;
418 bool getIsDataLayoutDimension() const;
419 sal_uInt16
getFunction() const;
420 void setFunction(sal_uInt16 nNew
); // for data dimension
421 long getUsedHierarchy() const;
422 void setUsedHierarchy(long nNew
);
424 bool HasSelectedPage() const { return bHasSelectedPage
; }
425 const ScDPItemData
& GetSelectedData();
427 const ::com::sun::star::sheet::DataPilotFieldReference
& GetReferenceValue() const;
430 class ScDPHierarchies
: public cppu::WeakImplHelper2
<
431 com::sun::star::container::XNameAccess
,
432 com::sun::star::lang::XServiceInfo
>
438 ScDPHierarchy
** ppHiers
;
441 ScDPHierarchies( ScDPSource
* pSrc
, long nD
);
442 virtual ~ScDPHierarchies();
445 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
446 throw(::com::sun::star::container::NoSuchElementException
,
447 ::com::sun::star::lang::WrappedTargetException
,
448 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
449 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
450 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
451 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
452 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
455 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
456 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
457 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
460 virtual OUString SAL_CALL
getImplementationName( )
461 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
462 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
463 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
464 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
465 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
467 virtual long getCount() const;
468 virtual ScDPHierarchy
* getByIndex(long nIndex
) const;
471 class ScDPHierarchy
: public cppu::WeakImplHelper3
<
472 com::sun::star::sheet::XLevelsSupplier
,
473 com::sun::star::container::XNamed
,
474 com::sun::star::lang::XServiceInfo
>
483 ScDPHierarchy( ScDPSource
* pSrc
, long nD
, long nH
);
484 virtual ~ScDPHierarchy();
486 ScDPLevels
* GetLevelsObject();
489 virtual OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
490 virtual void SAL_CALL
setName( const OUString
& aName
)
491 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
494 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
495 getLevels() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
498 virtual OUString SAL_CALL
getImplementationName( )
499 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
500 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
501 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
502 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
503 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
506 class ScDPLevels
: public cppu::WeakImplHelper2
<
507 com::sun::star::container::XNameAccess
,
508 com::sun::star::lang::XServiceInfo
>
518 ScDPLevels( ScDPSource
* pSrc
, long nD
, long nH
);
519 virtual ~ScDPLevels();
522 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
523 throw(::com::sun::star::container::NoSuchElementException
,
524 ::com::sun::star::lang::WrappedTargetException
,
525 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
526 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
527 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
528 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
529 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
532 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
533 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
534 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
537 virtual OUString SAL_CALL
getImplementationName( )
538 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
539 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
540 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
541 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
542 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
544 virtual long getCount() const;
545 virtual ScDPLevel
* getByIndex(long nIndex
) const;
548 class ScDPLevel
: public cppu::WeakImplHelper5
<
549 com::sun::star::sheet::XMembersSupplier
,
550 com::sun::star::container::XNamed
,
551 com::sun::star::sheet::XDataPilotMemberResults
,
552 com::sun::star::beans::XPropertySet
,
553 com::sun::star::lang::XServiceInfo
>
560 ScDPMembers
* pMembers
;
561 com::sun::star::uno::Sequence
<com::sun::star::sheet::GeneralFunction
> aSubTotals
;
562 ::com::sun::star::sheet::DataPilotFieldSortInfo aSortInfo
; // stored user settings
563 ::com::sun::star::sheet::DataPilotFieldAutoShowInfo aAutoShowInfo
; // stored user settings
564 ::com::sun::star::sheet::DataPilotFieldLayoutInfo aLayoutInfo
; // stored user settings
565 // valid only from result calculation:
566 ::std::vector
<sal_Int32
> aGlobalOrder
; // result of sorting by name or position
567 long nSortMeasure
; // measure (index of data dimension) to sort by
568 long nAutoMeasure
; // measure (index of data dimension) for AutoShow
570 bool bEnableLayout
:1; // enabled only for row fields, not for the innermost one
573 ScDPLevel( ScDPSource
* pSrc
, long nD
, long nH
, long nL
);
574 virtual ~ScDPLevel();
576 ScDPMembers
* GetMembersObject();
579 virtual OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
580 virtual void SAL_CALL
setName( const OUString
& aName
)
581 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
584 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
585 getMembers() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
587 // XDataPilotMemberResults
588 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::sheet::MemberResult
> SAL_CALL
589 getResults() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
592 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
593 SAL_CALL
getPropertySetInfo( )
594 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
595 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
596 const ::com::sun::star::uno::Any
& aValue
)
597 throw(::com::sun::star::beans::UnknownPropertyException
,
598 ::com::sun::star::beans::PropertyVetoException
,
599 ::com::sun::star::lang::IllegalArgumentException
,
600 ::com::sun::star::lang::WrappedTargetException
,
601 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
602 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
603 const OUString
& PropertyName
)
604 throw(::com::sun::star::beans::UnknownPropertyException
,
605 ::com::sun::star::lang::WrappedTargetException
,
606 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
607 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
608 const ::com::sun::star::uno::Reference
<
609 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
610 throw(::com::sun::star::beans::UnknownPropertyException
,
611 ::com::sun::star::lang::WrappedTargetException
,
612 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
613 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
614 const ::com::sun::star::uno::Reference
<
615 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
616 throw(::com::sun::star::beans::UnknownPropertyException
,
617 ::com::sun::star::lang::WrappedTargetException
,
618 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
619 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
620 const ::com::sun::star::uno::Reference
<
621 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
622 throw(::com::sun::star::beans::UnknownPropertyException
,
623 ::com::sun::star::lang::WrappedTargetException
,
624 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
625 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
626 const ::com::sun::star::uno::Reference
<
627 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
628 throw(::com::sun::star::beans::UnknownPropertyException
,
629 ::com::sun::star::lang::WrappedTargetException
,
630 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
633 virtual OUString SAL_CALL
getImplementationName( )
634 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
635 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
636 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
637 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
638 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
640 com::sun::star::uno::Sequence
<com::sun::star::sheet::GeneralFunction
> getSubTotals() const;
641 bool getShowEmpty() const;
643 const ::com::sun::star::sheet::DataPilotFieldSortInfo
& GetSortInfo() const { return aSortInfo
; }
644 const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo
& GetAutoShow() const { return aAutoShowInfo
; }
646 void EvaluateSortOrder();
647 void SetEnableLayout(bool bSet
);
649 const ::std::vector
<sal_Int32
>& GetGlobalOrder() const { return aGlobalOrder
; }
650 ::std::vector
<sal_Int32
>& GetGlobalOrder() { return aGlobalOrder
; }
651 long GetSortMeasure() const { return nSortMeasure
; }
652 long GetAutoMeasure() const { return nAutoMeasure
; }
654 bool IsOutlineLayout() const
656 return bEnableLayout
&&
657 aLayoutInfo
.LayoutMode
!=
658 ::com::sun::star::sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT
;
661 bool IsSubtotalsAtTop() const
663 return bEnableLayout
&&
664 aLayoutInfo
.LayoutMode
==
665 ::com::sun::star::sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_TOP
;
668 bool IsAddEmpty() const
670 return bEnableLayout
&& aLayoutInfo
.AddEmptyLines
;
673 //! number format (for data fields and date fields)
676 // hash map from name to index in the member array, for fast name access
677 typedef ::boost::unordered_map
< OUString
, sal_Int32
, OUStringHash
> ScDPMembersHashMap
;
679 class ScDPMembers
: public cppu::WeakImplHelper2
<
680 com::sun::star::container::XNameAccess
,
681 com::sun::star::lang::XServiceInfo
>
684 typedef std::vector
<rtl::Reference
<ScDPMember
> > MembersType
;
690 mutable MembersType maMembers
;
691 mutable ScDPMembersHashMap aHashMap
;
694 ScDPMembers( ScDPSource
* pSrc
, long nD
, long nH
, long nL
);
695 virtual ~ScDPMembers();
698 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
699 throw(::com::sun::star::container::NoSuchElementException
,
700 ::com::sun::star::lang::WrappedTargetException
,
701 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
702 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
703 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
704 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
705 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
708 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
709 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
710 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
713 virtual OUString SAL_CALL
getImplementationName( )
714 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
715 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
716 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
717 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
718 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
720 long getCount() const;
721 ScDPMember
* getByIndex(long nIndex
) const;
723 long getMinMembers() const;
725 sal_Int32
GetIndexFromName( const OUString
& rName
) const; // <0 if not found
726 const std::vector
<sal_Int32
>& GetGlobalOrder();
727 const ScDPItemData
* GetSrcItemDataByIndex( SCROW nIndex
);
728 SCROW
GetSrcItemsCount();
731 class ScDPMember
: boost::noncopyable
, public cppu::WeakImplHelper3
<
732 com::sun::star::container::XNamed
,
733 com::sun::star::beans::XPropertySet
,
734 com::sun::star::lang::XServiceInfo
>
743 boost::scoped_ptr
<OUString
> mpLayoutName
;
745 sal_Int32 nPosition
; // manual sorting
750 ScDPMember(ScDPSource
* pSrc
, long nD
, long nH
, long nL
, SCROW nIndex
);
751 virtual ~ScDPMember();
753 OUString
GetNameStr() const;
754 void FillItemData( ScDPItemData
& rData
) const;
755 const ScDPItemData
* GetItemData() const;
756 SCROW
GetItemDataId() const { return mnDataId
; }
757 bool IsNamedItem(SCROW nIndex
) const;
759 SC_DLLPUBLIC
const OUString
* GetLayoutName() const;
762 sal_Int32
Compare( const ScDPMember
& rOther
) const; // visible order
765 virtual OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
766 virtual void SAL_CALL
setName( const OUString
& aName
)
767 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
770 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
771 SAL_CALL
getPropertySetInfo( )
772 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
773 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
774 const ::com::sun::star::uno::Any
& aValue
)
775 throw(::com::sun::star::beans::UnknownPropertyException
,
776 ::com::sun::star::beans::PropertyVetoException
,
777 ::com::sun::star::lang::IllegalArgumentException
,
778 ::com::sun::star::lang::WrappedTargetException
,
779 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
780 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
781 const OUString
& PropertyName
)
782 throw(::com::sun::star::beans::UnknownPropertyException
,
783 ::com::sun::star::lang::WrappedTargetException
,
784 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
785 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
786 const ::com::sun::star::uno::Reference
<
787 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
788 throw(::com::sun::star::beans::UnknownPropertyException
,
789 ::com::sun::star::lang::WrappedTargetException
,
790 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
791 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
792 const ::com::sun::star::uno::Reference
<
793 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
794 throw(::com::sun::star::beans::UnknownPropertyException
,
795 ::com::sun::star::lang::WrappedTargetException
,
796 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
797 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
798 const ::com::sun::star::uno::Reference
<
799 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
800 throw(::com::sun::star::beans::UnknownPropertyException
,
801 ::com::sun::star::lang::WrappedTargetException
,
802 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
803 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
804 const ::com::sun::star::uno::Reference
<
805 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
806 throw(::com::sun::star::beans::UnknownPropertyException
,
807 ::com::sun::star::lang::WrappedTargetException
,
808 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
811 virtual OUString SAL_CALL
getImplementationName( )
812 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
813 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
814 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
815 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
816 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
818 bool isVisible() const;
819 bool getShowDetails() const;
825 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */