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 SC_DPTABSRC_HXX
21 #define SC_DPTABSRC_HXX
23 #include <tools/string.hxx>
24 #include "global.hxx" // enum ScSubTotalFunc
25 #include <com/sun/star/sheet/XDimensionsSupplier.hpp>
26 #include <com/sun/star/sheet/XHierarchiesSupplier.hpp>
27 #include <com/sun/star/sheet/XLevelsSupplier.hpp>
28 #include <com/sun/star/sheet/XMembersSupplier.hpp>
29 #include <com/sun/star/sheet/XDataPilotResults.hpp>
30 #include <com/sun/star/sheet/XDataPilotMemberResults.hpp>
31 #include <com/sun/star/sheet/MemberResult.hpp>
32 #include <com/sun/star/sheet/GeneralFunction.hpp>
33 #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
34 #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
35 #include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
36 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
37 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
38 #include <com/sun/star/util/XRefreshable.hpp>
39 #include <com/sun/star/sheet/XDrillDownDataSupplier.hpp>
40 #include <com/sun/star/util/XCloneable.hpp>
41 #include <com/sun/star/beans/XPropertySet.hpp>
42 #include <com/sun/star/lang/XServiceInfo.hpp>
43 #include <com/sun/star/container/XNamed.hpp>
44 #include <cppuhelper/implbase2.hxx>
45 #include <cppuhelper/implbase3.hxx>
46 #include <cppuhelper/implbase5.hxx>
47 #include <cppuhelper/implbase6.hxx>
48 #include "rtl/ref.hxx"
50 #include "dptabdat.hxx"
51 #include "dpglobal.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
81 class ScDPHierarchies
;
89 class ScDPSource
: public cppu::WeakImplHelper6
<
90 com::sun::star::sheet::XDimensionsSupplier
,
91 com::sun::star::sheet::XDataPilotResults
,
92 com::sun::star::util::XRefreshable
,
93 com::sun::star::sheet::XDrillDownDataSupplier
,
94 com::sun::star::beans::XPropertySet
,
95 com::sun::star::lang::XServiceInfo
>
98 ScDPTableData
* pData
; // data source (ScDPObject manages its life time)
99 ScDPDimensions
* pDimensions
; // api objects
102 std::vector
<long> maColDims
;
103 std::vector
<long> maRowDims
;
104 std::vector
<long> maDataDims
;
105 std::vector
<long> maPageDims
;
109 bool bIgnoreEmptyRows
;
115 ScDPResultData
* pResData
; // keep the rest in this!
116 ScDPResultMember
* pColResRoot
;
117 ScDPResultMember
* pRowResRoot
;
118 com::sun::star::uno::Sequence
<com::sun::star::sheet::MemberResult
>* pColResults
;
119 com::sun::star::uno::Sequence
<com::sun::star::sheet::MemberResult
>* pRowResults
;
120 std::vector
<ScDPLevel
*> aColLevelList
;
121 std::vector
<ScDPLevel
*> aRowLevelList
;
122 bool bResultOverflow
;
123 bool bPageFiltered
; // set if page field filters have been applied to cache table
125 SAL_WNODEPRECATED_DECLARATIONS_PUSH
126 ::std::auto_ptr
<rtl::OUString
> mpGrandTotalName
;
127 SAL_WNODEPRECATED_DECLARATIONS_POP
129 void CreateRes_Impl();
130 void FillMemberResults();
131 void FillLevelList( sal_uInt16 nOrientation
, std::vector
<ScDPLevel
*> &rList
);
132 void FillCalcInfo(bool bIsRow
, ScDPTableData::CalcInfo
& rInfo
, bool &bHasAutoShow
);
135 * Compile a list of dimension indices that are either, column, row or
136 * page dimensions (i.e. all but data dimensions).
138 void GetCategoryDimensionIndices(::boost::unordered_set
<sal_Int32
>& rCatDims
);
141 * Set visibilities of individual rows in the cache table based on the
144 void FilterCacheByPageDimensions();
146 void SetDupCount( long nNew
);
148 rtl::OUString
getDataDescription(); //! ???
150 void setIgnoreEmptyRows(bool bSet
);
151 void setRepeatIfEmpty(bool bSet
);
156 ScDPSource( ScDPTableData
* pD
);
157 virtual ~ScDPSource();
159 ScDPTableData
* GetData() { return pData
; }
160 const ScDPTableData
* GetData() const { return pData
; }
162 const ::rtl::OUString
* GetGrandTotalName() const;
164 sal_uInt16
GetOrientation(long nColumn
);
165 void SetOrientation(long nColumn
, sal_uInt16 nNew
);
166 long GetPosition(long nColumn
);
168 long GetDataDimensionCount();
169 ScDPDimension
* GetDataDimension(long nIndex
);
170 rtl::OUString
GetDataDimName(long nIndex
);
171 const ScDPCache
* GetCache();
172 const ScDPItemData
* GetItemDataById( long nDim
, long nId
);
173 long GetDataLayoutDim(){ return pData
->GetColumnCount(); }
174 SCROW
GetMemberId( long nDim
, const ScDPItemData
& rData
);
175 sal_Bool
IsDataLayoutDimension(long nDim
);
176 sal_uInt16
GetDataLayoutOrientation();
178 sal_Bool
IsDateDimension(long nDim
);
180 sal_Bool
SubTotalAllowed(long nColumn
); //! move to ScDPResultData
182 ScDPDimension
* AddDuplicated(long nSource
, const rtl::OUString
& rNewName
);
183 long GetDupCount() const { return nDupCount
; }
185 long GetSourceDim(long nDim
);
187 const com::sun::star::uno::Sequence
<com::sun::star::sheet::MemberResult
>*
188 GetMemberResults( ScDPLevel
* pLevel
);
190 ScDPDimensions
* GetDimensionsObject();
192 // XDimensionsSupplier
193 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>
194 SAL_CALL
getDimensions( )
195 throw(::com::sun::star::uno::RuntimeException
);
198 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
<
199 ::com::sun::star::sheet::DataResult
> > SAL_CALL
getResults( )
200 throw(::com::sun::star::uno::RuntimeException
);
203 virtual void SAL_CALL
refresh() throw(::com::sun::star::uno::RuntimeException
);
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
);
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
);
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
);
218 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
219 SAL_CALL
getPropertySetInfo( )
220 throw(::com::sun::star::uno::RuntimeException
);
221 virtual void SAL_CALL
setPropertyValue( const ::rtl::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
);
228 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
229 const ::rtl::OUString
& PropertyName
)
230 throw(::com::sun::star::beans::UnknownPropertyException
,
231 ::com::sun::star::lang::WrappedTargetException
,
232 ::com::sun::star::uno::RuntimeException
);
233 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::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
);
239 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::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
);
245 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::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
);
251 virtual void SAL_CALL
removeVetoableChangeListener( const ::rtl::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
);
259 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
260 throw(::com::sun::star::uno::RuntimeException
);
261 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
262 throw(::com::sun::star::uno::RuntimeException
);
263 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
264 throw(::com::sun::star::uno::RuntimeException
);
267 class ScDPDimensions
: public cppu::WeakImplHelper2
<
268 com::sun::star::container::XNameAccess
,
269 com::sun::star::lang::XServiceInfo
>
274 ScDPDimension
** ppDims
;
277 ScDPDimensions( ScDPSource
* pSrc
);
278 virtual ~ScDPDimensions();
283 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
)
284 throw(::com::sun::star::container::NoSuchElementException
,
285 ::com::sun::star::lang::WrappedTargetException
,
286 ::com::sun::star::uno::RuntimeException
);
287 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames()
288 throw(::com::sun::star::uno::RuntimeException
);
289 virtual sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
)
290 throw(::com::sun::star::uno::RuntimeException
);
293 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
294 throw(::com::sun::star::uno::RuntimeException
);
295 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
298 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
299 throw(::com::sun::star::uno::RuntimeException
);
300 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
301 throw(::com::sun::star::uno::RuntimeException
);
302 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
303 throw(::com::sun::star::uno::RuntimeException
);
305 virtual long getCount() const;
306 virtual ScDPDimension
* getByIndex(long nIndex
) const;
309 class ScDPDimension
: boost::noncopyable
, public cppu::WeakImplHelper5
<
310 com::sun::star::sheet::XHierarchiesSupplier
,
311 com::sun::star::container::XNamed
,
312 com::sun::star::util::XCloneable
,
313 com::sun::star::beans::XPropertySet
,
314 com::sun::star::lang::XServiceInfo
>
317 long nDim
; // dimension index (== column ID)
318 ScDPHierarchies
* pHierarchies
;
320 sal_uInt16 nFunction
; // enum GeneralFunction
321 rtl::OUString aName
; // if empty, take from source
322 boost::scoped_ptr
<rtl::OUString
> mpLayoutName
;
323 boost::scoped_ptr
<rtl::OUString
> mpSubtotalName
;
324 long nSourceDim
; // >=0 if dup'ed
325 ::com::sun::star::sheet::DataPilotFieldReference
326 aReferenceValue
; // settings for "show data as" / "displayed value"
327 bool bHasSelectedPage
;
328 rtl::OUString aSelectedPage
;
329 ScDPItemData
* pSelectedData
; // internal, temporary, created from aSelectedPage
330 bool mbHasHiddenMember
;
333 ScDPDimension( ScDPSource
* pSrc
, long nD
);
334 virtual ~ScDPDimension();
336 long GetDimension() const { return nDim
; } // dimension index in source
337 long GetSourceDim() const { return nSourceDim
; } // >=0 if dup'ed
339 ScDPDimension
* CreateCloneObject();
340 ScDPHierarchies
* GetHierarchiesObject();
342 SC_DLLPUBLIC
const ::rtl::OUString
* GetLayoutName() const;
343 const ::rtl::OUString
* GetSubtotalName() const;
346 virtual ::rtl::OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
);
347 virtual void SAL_CALL
setName( const ::rtl::OUString
& aName
)
348 throw(::com::sun::star::uno::RuntimeException
);
350 // XHierarchiesSupplier
351 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
352 getHierarchies() throw(::com::sun::star::uno::RuntimeException
);
355 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::util::XCloneable
> SAL_CALL
356 createClone() throw(::com::sun::star::uno::RuntimeException
);
359 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
360 SAL_CALL
getPropertySetInfo( )
361 throw(::com::sun::star::uno::RuntimeException
);
362 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
,
363 const ::com::sun::star::uno::Any
& aValue
)
364 throw(::com::sun::star::beans::UnknownPropertyException
,
365 ::com::sun::star::beans::PropertyVetoException
,
366 ::com::sun::star::lang::IllegalArgumentException
,
367 ::com::sun::star::lang::WrappedTargetException
,
368 ::com::sun::star::uno::RuntimeException
);
369 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
370 const ::rtl::OUString
& PropertyName
)
371 throw(::com::sun::star::beans::UnknownPropertyException
,
372 ::com::sun::star::lang::WrappedTargetException
,
373 ::com::sun::star::uno::RuntimeException
);
374 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
375 const ::com::sun::star::uno::Reference
<
376 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
377 throw(::com::sun::star::beans::UnknownPropertyException
,
378 ::com::sun::star::lang::WrappedTargetException
,
379 ::com::sun::star::uno::RuntimeException
);
380 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
381 const ::com::sun::star::uno::Reference
<
382 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
383 throw(::com::sun::star::beans::UnknownPropertyException
,
384 ::com::sun::star::lang::WrappedTargetException
,
385 ::com::sun::star::uno::RuntimeException
);
386 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
387 const ::com::sun::star::uno::Reference
<
388 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
389 throw(::com::sun::star::beans::UnknownPropertyException
,
390 ::com::sun::star::lang::WrappedTargetException
,
391 ::com::sun::star::uno::RuntimeException
);
392 virtual void SAL_CALL
removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
393 const ::com::sun::star::uno::Reference
<
394 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
395 throw(::com::sun::star::beans::UnknownPropertyException
,
396 ::com::sun::star::lang::WrappedTargetException
,
397 ::com::sun::star::uno::RuntimeException
);
400 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
401 throw(::com::sun::star::uno::RuntimeException
);
402 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
403 throw(::com::sun::star::uno::RuntimeException
);
404 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
405 throw(::com::sun::star::uno::RuntimeException
);
407 sal_uInt16
getOrientation() const;
408 void setOrientation(sal_uInt16 nNew
);
409 long getPosition() const;
410 bool getIsDataLayoutDimension() const;
411 sal_uInt16
getFunction() const;
412 void setFunction(sal_uInt16 nNew
); // for data dimension
413 long getUsedHierarchy() const;
414 void setUsedHierarchy(long nNew
);
416 bool HasSelectedPage() const { return bHasSelectedPage
; }
417 const ScDPItemData
& GetSelectedData();
419 const ::com::sun::star::sheet::DataPilotFieldReference
& GetReferenceValue() const;
422 class ScDPHierarchies
: public cppu::WeakImplHelper2
<
423 com::sun::star::container::XNameAccess
,
424 com::sun::star::lang::XServiceInfo
>
430 ScDPHierarchy
** ppHiers
;
433 ScDPHierarchies( ScDPSource
* pSrc
, long nD
);
434 virtual ~ScDPHierarchies();
437 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
)
438 throw(::com::sun::star::container::NoSuchElementException
,
439 ::com::sun::star::lang::WrappedTargetException
,
440 ::com::sun::star::uno::RuntimeException
);
441 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames()
442 throw(::com::sun::star::uno::RuntimeException
);
443 virtual sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
)
444 throw(::com::sun::star::uno::RuntimeException
);
447 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
448 throw(::com::sun::star::uno::RuntimeException
);
449 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
452 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
453 throw(::com::sun::star::uno::RuntimeException
);
454 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
455 throw(::com::sun::star::uno::RuntimeException
);
456 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
457 throw(::com::sun::star::uno::RuntimeException
);
459 virtual long getCount() const;
460 virtual ScDPHierarchy
* getByIndex(long nIndex
) const;
463 class ScDPHierarchy
: public cppu::WeakImplHelper3
<
464 com::sun::star::sheet::XLevelsSupplier
,
465 com::sun::star::container::XNamed
,
466 com::sun::star::lang::XServiceInfo
>
475 ScDPHierarchy( ScDPSource
* pSrc
, long nD
, long nH
);
476 virtual ~ScDPHierarchy();
478 ScDPLevels
* GetLevelsObject();
481 virtual ::rtl::OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
);
482 virtual void SAL_CALL
setName( const ::rtl::OUString
& aName
)
483 throw(::com::sun::star::uno::RuntimeException
);
486 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
487 getLevels() throw(::com::sun::star::uno::RuntimeException
);
490 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
491 throw(::com::sun::star::uno::RuntimeException
);
492 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
493 throw(::com::sun::star::uno::RuntimeException
);
494 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
495 throw(::com::sun::star::uno::RuntimeException
);
498 class ScDPLevels
: public cppu::WeakImplHelper2
<
499 com::sun::star::container::XNameAccess
,
500 com::sun::star::lang::XServiceInfo
>
510 ScDPLevels( ScDPSource
* pSrc
, long nD
, long nH
);
511 virtual ~ScDPLevels();
514 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
)
515 throw(::com::sun::star::container::NoSuchElementException
,
516 ::com::sun::star::lang::WrappedTargetException
,
517 ::com::sun::star::uno::RuntimeException
);
518 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames()
519 throw(::com::sun::star::uno::RuntimeException
);
520 virtual sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
)
521 throw(::com::sun::star::uno::RuntimeException
);
524 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
525 throw(::com::sun::star::uno::RuntimeException
);
526 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
529 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
530 throw(::com::sun::star::uno::RuntimeException
);
531 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
532 throw(::com::sun::star::uno::RuntimeException
);
533 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
534 throw(::com::sun::star::uno::RuntimeException
);
536 virtual long getCount() const;
537 virtual ScDPLevel
* getByIndex(long nIndex
) const;
540 class ScDPLevel
: public cppu::WeakImplHelper5
<
541 com::sun::star::sheet::XMembersSupplier
,
542 com::sun::star::container::XNamed
,
543 com::sun::star::sheet::XDataPilotMemberResults
,
544 com::sun::star::beans::XPropertySet
,
545 com::sun::star::lang::XServiceInfo
>
552 ScDPMembers
* pMembers
;
553 com::sun::star::uno::Sequence
<com::sun::star::sheet::GeneralFunction
> aSubTotals
;
554 ::com::sun::star::sheet::DataPilotFieldSortInfo aSortInfo
; // stored user settings
555 ::com::sun::star::sheet::DataPilotFieldAutoShowInfo aAutoShowInfo
; // stored user settings
556 ::com::sun::star::sheet::DataPilotFieldLayoutInfo aLayoutInfo
; // stored user settings
557 // valid only from result calculation:
558 ::std::vector
<sal_Int32
> aGlobalOrder
; // result of sorting by name or position
559 long nSortMeasure
; // measure (index of data dimension) to sort by
560 long nAutoMeasure
; // measure (index of data dimension) for AutoShow
562 bool bEnableLayout
:1; // enabled only for row fields, not for the innermost one
565 ScDPLevel( ScDPSource
* pSrc
, long nD
, long nH
, long nL
);
566 virtual ~ScDPLevel();
568 ScDPMembers
* GetMembersObject();
571 virtual ::rtl::OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
);
572 virtual void SAL_CALL
setName( const ::rtl::OUString
& aName
)
573 throw(::com::sun::star::uno::RuntimeException
);
576 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
577 getMembers() throw(::com::sun::star::uno::RuntimeException
);
579 // XDataPilotMemberResults
580 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::sheet::MemberResult
> SAL_CALL
581 getResults() throw(::com::sun::star::uno::RuntimeException
);
584 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
585 SAL_CALL
getPropertySetInfo( )
586 throw(::com::sun::star::uno::RuntimeException
);
587 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
,
588 const ::com::sun::star::uno::Any
& aValue
)
589 throw(::com::sun::star::beans::UnknownPropertyException
,
590 ::com::sun::star::beans::PropertyVetoException
,
591 ::com::sun::star::lang::IllegalArgumentException
,
592 ::com::sun::star::lang::WrappedTargetException
,
593 ::com::sun::star::uno::RuntimeException
);
594 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
595 const ::rtl::OUString
& PropertyName
)
596 throw(::com::sun::star::beans::UnknownPropertyException
,
597 ::com::sun::star::lang::WrappedTargetException
,
598 ::com::sun::star::uno::RuntimeException
);
599 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
600 const ::com::sun::star::uno::Reference
<
601 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
602 throw(::com::sun::star::beans::UnknownPropertyException
,
603 ::com::sun::star::lang::WrappedTargetException
,
604 ::com::sun::star::uno::RuntimeException
);
605 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
606 const ::com::sun::star::uno::Reference
<
607 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
608 throw(::com::sun::star::beans::UnknownPropertyException
,
609 ::com::sun::star::lang::WrappedTargetException
,
610 ::com::sun::star::uno::RuntimeException
);
611 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
612 const ::com::sun::star::uno::Reference
<
613 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
614 throw(::com::sun::star::beans::UnknownPropertyException
,
615 ::com::sun::star::lang::WrappedTargetException
,
616 ::com::sun::star::uno::RuntimeException
);
617 virtual void SAL_CALL
removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
618 const ::com::sun::star::uno::Reference
<
619 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
620 throw(::com::sun::star::beans::UnknownPropertyException
,
621 ::com::sun::star::lang::WrappedTargetException
,
622 ::com::sun::star::uno::RuntimeException
);
625 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
626 throw(::com::sun::star::uno::RuntimeException
);
627 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
628 throw(::com::sun::star::uno::RuntimeException
);
629 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
630 throw(::com::sun::star::uno::RuntimeException
);
632 com::sun::star::uno::Sequence
<com::sun::star::sheet::GeneralFunction
> getSubTotals() const;
633 bool getShowEmpty() const;
635 const ::com::sun::star::sheet::DataPilotFieldSortInfo
& GetSortInfo() const { return aSortInfo
; }
636 const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo
& GetAutoShow() const { return aAutoShowInfo
; }
638 void EvaluateSortOrder();
639 void SetEnableLayout(bool bSet
);
641 const ::std::vector
<sal_Int32
>& GetGlobalOrder() const { return aGlobalOrder
; }
642 ::std::vector
<sal_Int32
>& GetGlobalOrder() { return aGlobalOrder
; }
643 long GetSortMeasure() const { return nSortMeasure
; }
644 long GetAutoMeasure() const { return nAutoMeasure
; }
646 bool IsOutlineLayout() const
648 return bEnableLayout
&&
649 aLayoutInfo
.LayoutMode
!=
650 ::com::sun::star::sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT
;
653 bool IsSubtotalsAtTop() const
655 return bEnableLayout
&&
656 aLayoutInfo
.LayoutMode
==
657 ::com::sun::star::sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_TOP
;
660 bool IsAddEmpty() const
662 return bEnableLayout
&& aLayoutInfo
.AddEmptyLines
;
665 //! number format (for data fields and date fields)
668 // hash map from name to index in the member array, for fast name access
669 typedef ::boost::unordered_map
< ::rtl::OUString
, sal_Int32
, ::rtl::OUStringHash
> ScDPMembersHashMap
;
671 class ScDPMembers
: public cppu::WeakImplHelper2
<
672 com::sun::star::container::XNameAccess
,
673 com::sun::star::lang::XServiceInfo
>
676 typedef std::vector
<rtl::Reference
<ScDPMember
> > MembersType
;
682 mutable MembersType maMembers
;
683 mutable ScDPMembersHashMap aHashMap
;
686 ScDPMembers( ScDPSource
* pSrc
, long nD
, long nH
, long nL
);
687 virtual ~ScDPMembers();
690 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
)
691 throw(::com::sun::star::container::NoSuchElementException
,
692 ::com::sun::star::lang::WrappedTargetException
,
693 ::com::sun::star::uno::RuntimeException
);
694 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames()
695 throw(::com::sun::star::uno::RuntimeException
);
696 virtual sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
)
697 throw(::com::sun::star::uno::RuntimeException
);
700 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
701 throw(::com::sun::star::uno::RuntimeException
);
702 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
705 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
706 throw(::com::sun::star::uno::RuntimeException
);
707 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
708 throw(::com::sun::star::uno::RuntimeException
);
709 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
710 throw(::com::sun::star::uno::RuntimeException
);
712 long getCount() const;
713 ScDPMember
* getByIndex(long nIndex
) const;
715 long getMinMembers() const;
717 sal_Int32
GetIndexFromName( const ::rtl::OUString
& rName
) const; // <0 if not found
718 const std::vector
<sal_Int32
>& GetGlobalOrder();
719 const ScDPItemData
* GetSrcItemDataByIndex( SCROW nIndex
);
720 SCROW
GetSrcItemsCount();
723 class ScDPMember
: boost::noncopyable
, public cppu::WeakImplHelper3
<
724 com::sun::star::container::XNamed
,
725 com::sun::star::beans::XPropertySet
,
726 com::sun::star::lang::XServiceInfo
>
735 boost::scoped_ptr
<rtl::OUString
> mpLayoutName
;
737 sal_Int32 nPosition
; // manual sorting
742 ScDPMember(ScDPSource
* pSrc
, long nD
, long nH
, long nL
, SCROW nIndex
);
743 virtual ~ScDPMember();
745 rtl::OUString
GetNameStr() const;
746 void FillItemData( ScDPItemData
& rData
) const;
747 const ScDPItemData
* GetItemData() const;
748 SCROW
GetItemDataId() const { return mnDataId
; }
749 bool IsNamedItem(SCROW nIndex
) const;
751 SC_DLLPUBLIC
const ::rtl::OUString
* GetLayoutName() const;
754 sal_Int32
Compare( const ScDPMember
& rOther
) const; // visible order
757 virtual ::rtl::OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
);
758 virtual void SAL_CALL
setName( const ::rtl::OUString
& aName
)
759 throw(::com::sun::star::uno::RuntimeException
);
762 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
763 SAL_CALL
getPropertySetInfo( )
764 throw(::com::sun::star::uno::RuntimeException
);
765 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
,
766 const ::com::sun::star::uno::Any
& aValue
)
767 throw(::com::sun::star::beans::UnknownPropertyException
,
768 ::com::sun::star::beans::PropertyVetoException
,
769 ::com::sun::star::lang::IllegalArgumentException
,
770 ::com::sun::star::lang::WrappedTargetException
,
771 ::com::sun::star::uno::RuntimeException
);
772 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
773 const ::rtl::OUString
& PropertyName
)
774 throw(::com::sun::star::beans::UnknownPropertyException
,
775 ::com::sun::star::lang::WrappedTargetException
,
776 ::com::sun::star::uno::RuntimeException
);
777 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
778 const ::com::sun::star::uno::Reference
<
779 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
780 throw(::com::sun::star::beans::UnknownPropertyException
,
781 ::com::sun::star::lang::WrappedTargetException
,
782 ::com::sun::star::uno::RuntimeException
);
783 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
784 const ::com::sun::star::uno::Reference
<
785 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
786 throw(::com::sun::star::beans::UnknownPropertyException
,
787 ::com::sun::star::lang::WrappedTargetException
,
788 ::com::sun::star::uno::RuntimeException
);
789 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
790 const ::com::sun::star::uno::Reference
<
791 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
792 throw(::com::sun::star::beans::UnknownPropertyException
,
793 ::com::sun::star::lang::WrappedTargetException
,
794 ::com::sun::star::uno::RuntimeException
);
795 virtual void SAL_CALL
removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
796 const ::com::sun::star::uno::Reference
<
797 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
798 throw(::com::sun::star::beans::UnknownPropertyException
,
799 ::com::sun::star::lang::WrappedTargetException
,
800 ::com::sun::star::uno::RuntimeException
);
803 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
804 throw(::com::sun::star::uno::RuntimeException
);
805 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
806 throw(::com::sun::star::uno::RuntimeException
);
807 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
808 throw(::com::sun::star::uno::RuntimeException
);
810 bool isVisible() const;
811 bool getShowDetails() const;
817 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */