1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dptabsrc.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_DPTABSRC_HXX
32 #define SC_DPTABSRC_HXX
37 #include <tools/string.hxx>
38 #include <tools/list.hxx>
39 #include "global.hxx" // enum ScSubTotalFunc
40 #include <com/sun/star/sheet/XDimensionsSupplier.hpp>
41 #include <com/sun/star/sheet/XHierarchiesSupplier.hpp>
42 #include <com/sun/star/sheet/XLevelsSupplier.hpp>
43 #include <com/sun/star/sheet/XMembersSupplier.hpp>
44 #include <com/sun/star/sheet/XDataPilotResults.hpp>
45 #include <com/sun/star/sheet/XDataPilotMemberResults.hpp>
46 #include <com/sun/star/sheet/MemberResult.hpp>
47 #include <com/sun/star/sheet/GeneralFunction.hpp>
48 #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
49 #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
50 #include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
51 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
52 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
53 #include <com/sun/star/util/XRefreshable.hpp>
54 #include <com/sun/star/sheet/XDrillDownDataSupplier.hpp>
55 #include <com/sun/star/util/XCloneable.hpp>
56 #include <com/sun/star/beans/XPropertySet.hpp>
57 #include <com/sun/star/lang/XServiceInfo.hpp>
58 #include <com/sun/star/container/XNamed.hpp>
59 #include <cppuhelper/implbase2.hxx>
60 #include <cppuhelper/implbase3.hxx>
61 #include <cppuhelper/implbase5.hxx>
62 #include <cppuhelper/implbase6.hxx>
64 #include "dptabdat.hxx"
66 namespace com
{ namespace sun
{ namespace star
{
68 struct DataPilotFieldFilter
;
75 class ScDPResultMember
;
80 // ------------------------------------------------------------------------
84 #define SC_DAPI_MAXFIELDS 256
87 // --------------------------------------------------------------------
89 // implementation of DataPilotSource using ScDPTableData
95 class ScDPHierarchies
;
103 class ScDPSource
: public cppu::WeakImplHelper6
<
104 com::sun::star::sheet::XDimensionsSupplier
,
105 com::sun::star::sheet::XDataPilotResults
,
106 com::sun::star::util::XRefreshable
,
107 com::sun::star::sheet::XDrillDownDataSupplier
,
108 com::sun::star::beans::XPropertySet
,
109 com::sun::star::lang::XServiceInfo
>
112 ScDPTableData
* pData
; // data source (ScDPObject manages its life time)
113 ScDPDimensions
* pDimensions
; // api objects
115 long nColDims
[SC_DAPI_MAXFIELDS
];
116 long nRowDims
[SC_DAPI_MAXFIELDS
];
117 long nDataDims
[SC_DAPI_MAXFIELDS
];
118 long nPageDims
[SC_DAPI_MAXFIELDS
];
125 BOOL bIgnoreEmptyRows
;
131 ScDPResultData
* pResData
; // keep the rest in this!
132 ScDPResultMember
* pColResRoot
;
133 ScDPResultMember
* pRowResRoot
;
134 com::sun::star::uno::Sequence
<com::sun::star::sheet::MemberResult
>* pColResults
;
135 com::sun::star::uno::Sequence
<com::sun::star::sheet::MemberResult
>* pRowResults
;
138 BOOL bResultOverflow
;
140 ::std::auto_ptr
<rtl::OUString
> mpGrandTotalName
;
142 void CreateRes_Impl();
143 void FillMemberResults();
144 void FillLevelList( USHORT nOrientation
, List
& rList
);
145 void FillCalcInfo(bool bIsRow
, ScDPTableData::CalcInfo
& rInfo
, bool &bHasAutoShow
);
148 * Compile a list of dimension indices that are either, column, row or
149 * page dimensions (i.e. all but data dimensions).
151 void GetCategoryDimensionIndices(::std::hash_set
<sal_Int32
>& rCatDims
);
154 * Set visibilities of individual rows in the cache table based on the
157 void FilterCacheTableByPageDimensions();
159 void SetDupCount( long nNew
);
162 ScDPSource( ScDPTableData
* pD
); // TableData is deleted by Source
163 virtual ~ScDPSource();
165 ScDPTableData
* GetData() { return pData
; }
166 const ScDPTableData
* GetData() const { return pData
; }
168 void SetGrandTotalName(const ::rtl::OUString
& rName
);
169 const ::rtl::OUString
* GetGrandTotalName() const;
171 USHORT
GetOrientation(long nColumn
);
172 void SetOrientation(long nColumn
, USHORT nNew
);
173 long GetPosition(long nColumn
);
175 long GetDataDimensionCount();
176 ScDPDimension
* GetDataDimension(long nIndex
);
177 String
GetDataDimName(long nIndex
);
178 BOOL
IsDataLayoutDimension(long nDim
);
179 USHORT
GetDataLayoutOrientation();
181 BOOL
IsDateDimension(long nDim
);
183 BOOL
SubTotalAllowed(long nColumn
); //! move to ScDPResultData
185 ScDPDimension
* AddDuplicated(long nSource
, const String
& rNewName
);
186 long GetDupCount() const { return nDupCount
; }
188 long GetSourceDim(long nDim
);
190 const com::sun::star::uno::Sequence
<com::sun::star::sheet::MemberResult
>*
191 GetMemberResults( ScDPLevel
* pLevel
);
193 ScDPDimensions
* GetDimensionsObject();
195 //UNUSED2009-05 void DumpState( ScDocument* pDoc, const ScAddress& rPos );
197 // XDimensionsSupplier
198 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>
199 SAL_CALL
getDimensions( )
200 throw(::com::sun::star::uno::RuntimeException
);
203 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
<
204 ::com::sun::star::sheet::DataResult
> > SAL_CALL
getResults( )
205 throw(::com::sun::star::uno::RuntimeException
);
208 virtual void SAL_CALL
refresh() throw(::com::sun::star::uno::RuntimeException
);
209 virtual void SAL_CALL
addRefreshListener( const ::com::sun::star::uno::Reference
<
210 ::com::sun::star::util::XRefreshListener
>& l
)
211 throw(::com::sun::star::uno::RuntimeException
);
212 virtual void SAL_CALL
removeRefreshListener( const ::com::sun::star::uno::Reference
<
213 ::com::sun::star::util::XRefreshListener
>& l
)
214 throw(::com::sun::star::uno::RuntimeException
);
216 // XDrillDownDataSupplier
217 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> >
218 SAL_CALL
getDrillDownData(const ::com::sun::star::uno::Sequence
<
219 ::com::sun::star::sheet::DataPilotFieldFilter
>& aFilters
)
220 throw(::com::sun::star::uno::RuntimeException
);
223 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
224 SAL_CALL
getPropertySetInfo( )
225 throw(::com::sun::star::uno::RuntimeException
);
226 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
,
227 const ::com::sun::star::uno::Any
& aValue
)
228 throw(::com::sun::star::beans::UnknownPropertyException
,
229 ::com::sun::star::beans::PropertyVetoException
,
230 ::com::sun::star::lang::IllegalArgumentException
,
231 ::com::sun::star::lang::WrappedTargetException
,
232 ::com::sun::star::uno::RuntimeException
);
233 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
234 const ::rtl::OUString
& PropertyName
)
235 throw(::com::sun::star::beans::UnknownPropertyException
,
236 ::com::sun::star::lang::WrappedTargetException
,
237 ::com::sun::star::uno::RuntimeException
);
238 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
239 const ::com::sun::star::uno::Reference
<
240 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
241 throw(::com::sun::star::beans::UnknownPropertyException
,
242 ::com::sun::star::lang::WrappedTargetException
,
243 ::com::sun::star::uno::RuntimeException
);
244 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
245 const ::com::sun::star::uno::Reference
<
246 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
247 throw(::com::sun::star::beans::UnknownPropertyException
,
248 ::com::sun::star::lang::WrappedTargetException
,
249 ::com::sun::star::uno::RuntimeException
);
250 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
251 const ::com::sun::star::uno::Reference
<
252 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
253 throw(::com::sun::star::beans::UnknownPropertyException
,
254 ::com::sun::star::lang::WrappedTargetException
,
255 ::com::sun::star::uno::RuntimeException
);
256 virtual void SAL_CALL
removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
257 const ::com::sun::star::uno::Reference
<
258 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
259 throw(::com::sun::star::beans::UnknownPropertyException
,
260 ::com::sun::star::lang::WrappedTargetException
,
261 ::com::sun::star::uno::RuntimeException
);
264 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
265 throw(::com::sun::star::uno::RuntimeException
);
266 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
267 throw(::com::sun::star::uno::RuntimeException
);
268 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
269 throw(::com::sun::star::uno::RuntimeException
);
271 virtual String
getDataDescription(); //! ???
273 virtual BOOL
getColumnGrand() const;
274 virtual void setColumnGrand(BOOL bSet
);
275 virtual BOOL
getRowGrand() const;
276 virtual void setRowGrand(BOOL bSet
);
278 virtual BOOL
getIgnoreEmptyRows() const;
279 virtual void setIgnoreEmptyRows(BOOL bSet
);
280 virtual BOOL
getRepeatIfEmpty() const;
281 virtual void setRepeatIfEmpty(BOOL bSet
);
283 virtual void validate(); //! ???
284 virtual void disposeData();
287 class ScDPDimensions
: public cppu::WeakImplHelper2
<
288 com::sun::star::container::XNameAccess
,
289 com::sun::star::lang::XServiceInfo
>
294 ScDPDimension
** ppDims
;
297 ScDPDimensions( ScDPSource
* pSrc
);
298 virtual ~ScDPDimensions();
303 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
)
304 throw(::com::sun::star::container::NoSuchElementException
,
305 ::com::sun::star::lang::WrappedTargetException
,
306 ::com::sun::star::uno::RuntimeException
);
307 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames()
308 throw(::com::sun::star::uno::RuntimeException
);
309 virtual sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
)
310 throw(::com::sun::star::uno::RuntimeException
);
313 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
314 throw(::com::sun::star::uno::RuntimeException
);
315 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
318 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
319 throw(::com::sun::star::uno::RuntimeException
);
320 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
321 throw(::com::sun::star::uno::RuntimeException
);
322 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
323 throw(::com::sun::star::uno::RuntimeException
);
325 virtual long getCount() const;
326 virtual ScDPDimension
* getByIndex(long nIndex
) const;
329 class ScDPDimension
: public cppu::WeakImplHelper5
<
330 com::sun::star::sheet::XHierarchiesSupplier
,
331 com::sun::star::container::XNamed
,
332 com::sun::star::util::XCloneable
,
333 com::sun::star::beans::XPropertySet
,
334 com::sun::star::lang::XServiceInfo
>
338 long nDim
; // dimension index (== column ID)
339 ScDPHierarchies
* pHierarchies
;
341 USHORT nFunction
; // enum GeneralFunction
342 String aName
; // if empty, take from source
343 ::std::auto_ptr
<rtl::OUString
> mpLayoutName
;
344 ::std::auto_ptr
<rtl::OUString
> mpSubtotalName
;
345 long nSourceDim
; // >=0 if dup'ed
346 ::com::sun::star::sheet::DataPilotFieldReference
347 aReferenceValue
; // settings for "show data as" / "displayed value"
348 BOOL bHasSelectedPage
;
349 String aSelectedPage
;
350 ScDPItemData
* pSelectedData
; // internal, temporary, created from aSelectedPage
351 sal_Bool mbHasHiddenMember
;
354 ScDPDimension( ScDPSource
* pSrc
, long nD
);
355 virtual ~ScDPDimension();
357 long GetDimension() const { return nDim
; } // dimension index in source
358 long GetSourceDim() const { return nSourceDim
; } // >=0 if dup'ed
360 ScDPDimension
* CreateCloneObject();
361 ScDPHierarchies
* GetHierarchiesObject();
363 SC_DLLPUBLIC
const ::rtl::OUString
* GetLayoutName() const;
364 const ::rtl::OUString
* GetSubtotalName() const;
367 virtual ::rtl::OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
);
368 virtual void SAL_CALL
setName( const ::rtl::OUString
& aName
)
369 throw(::com::sun::star::uno::RuntimeException
);
371 // XHierarchiesSupplier
372 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
373 getHierarchies() throw(::com::sun::star::uno::RuntimeException
);
376 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::util::XCloneable
> SAL_CALL
377 createClone() throw(::com::sun::star::uno::RuntimeException
);
380 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
381 SAL_CALL
getPropertySetInfo( )
382 throw(::com::sun::star::uno::RuntimeException
);
383 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
,
384 const ::com::sun::star::uno::Any
& aValue
)
385 throw(::com::sun::star::beans::UnknownPropertyException
,
386 ::com::sun::star::beans::PropertyVetoException
,
387 ::com::sun::star::lang::IllegalArgumentException
,
388 ::com::sun::star::lang::WrappedTargetException
,
389 ::com::sun::star::uno::RuntimeException
);
390 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
391 const ::rtl::OUString
& PropertyName
)
392 throw(::com::sun::star::beans::UnknownPropertyException
,
393 ::com::sun::star::lang::WrappedTargetException
,
394 ::com::sun::star::uno::RuntimeException
);
395 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
396 const ::com::sun::star::uno::Reference
<
397 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
398 throw(::com::sun::star::beans::UnknownPropertyException
,
399 ::com::sun::star::lang::WrappedTargetException
,
400 ::com::sun::star::uno::RuntimeException
);
401 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
402 const ::com::sun::star::uno::Reference
<
403 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
404 throw(::com::sun::star::beans::UnknownPropertyException
,
405 ::com::sun::star::lang::WrappedTargetException
,
406 ::com::sun::star::uno::RuntimeException
);
407 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
408 const ::com::sun::star::uno::Reference
<
409 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
410 throw(::com::sun::star::beans::UnknownPropertyException
,
411 ::com::sun::star::lang::WrappedTargetException
,
412 ::com::sun::star::uno::RuntimeException
);
413 virtual void SAL_CALL
removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
414 const ::com::sun::star::uno::Reference
<
415 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
416 throw(::com::sun::star::beans::UnknownPropertyException
,
417 ::com::sun::star::lang::WrappedTargetException
,
418 ::com::sun::star::uno::RuntimeException
);
421 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
422 throw(::com::sun::star::uno::RuntimeException
);
423 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
424 throw(::com::sun::star::uno::RuntimeException
);
425 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
426 throw(::com::sun::star::uno::RuntimeException
);
428 virtual USHORT
getOrientation() const;
429 virtual void setOrientation(USHORT nNew
);
430 virtual long getPosition() const;
431 virtual void setPosition(long nNew
);
432 virtual BOOL
getIsDataLayoutDimension() const;
433 virtual USHORT
getFunction() const;
434 virtual void setFunction(USHORT nNew
); // for data dimension
435 virtual long getUsedHierarchy() const;
436 virtual void setUsedHierarchy(long nNew
);
437 virtual BOOL
isDuplicated() const;
439 BOOL
HasSelectedPage() const { return bHasSelectedPage
; }
440 const ScDPItemData
& GetSelectedData();
442 const ::com::sun::star::sheet::DataPilotFieldReference
& GetReferenceValue() const;
444 //UNUSED2009-05 BOOL IsValidPage( const ScDPItemData& rData );
447 class ScDPHierarchies
: public cppu::WeakImplHelper2
<
448 com::sun::star::container::XNameAccess
,
449 com::sun::star::lang::XServiceInfo
>
455 ScDPHierarchy
** ppHiers
;
458 ScDPHierarchies( ScDPSource
* pSrc
, long nD
);
459 virtual ~ScDPHierarchies();
462 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
)
463 throw(::com::sun::star::container::NoSuchElementException
,
464 ::com::sun::star::lang::WrappedTargetException
,
465 ::com::sun::star::uno::RuntimeException
);
466 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames()
467 throw(::com::sun::star::uno::RuntimeException
);
468 virtual sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
)
469 throw(::com::sun::star::uno::RuntimeException
);
472 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
473 throw(::com::sun::star::uno::RuntimeException
);
474 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
477 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
478 throw(::com::sun::star::uno::RuntimeException
);
479 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
480 throw(::com::sun::star::uno::RuntimeException
);
481 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
482 throw(::com::sun::star::uno::RuntimeException
);
484 virtual long getCount() const;
485 virtual ScDPHierarchy
* getByIndex(long nIndex
) const;
488 class ScDPHierarchy
: public cppu::WeakImplHelper3
<
489 com::sun::star::sheet::XLevelsSupplier
,
490 com::sun::star::container::XNamed
,
491 com::sun::star::lang::XServiceInfo
>
500 ScDPHierarchy( ScDPSource
* pSrc
, long nD
, long nH
);
501 virtual ~ScDPHierarchy();
503 ScDPLevels
* GetLevelsObject();
506 virtual ::rtl::OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
);
507 virtual void SAL_CALL
setName( const ::rtl::OUString
& aName
)
508 throw(::com::sun::star::uno::RuntimeException
);
511 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
512 getLevels() throw(::com::sun::star::uno::RuntimeException
);
515 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
516 throw(::com::sun::star::uno::RuntimeException
);
517 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
518 throw(::com::sun::star::uno::RuntimeException
);
519 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
520 throw(::com::sun::star::uno::RuntimeException
);
523 class ScDPLevels
: public cppu::WeakImplHelper2
<
524 com::sun::star::container::XNameAccess
,
525 com::sun::star::lang::XServiceInfo
>
535 ScDPLevels( ScDPSource
* pSrc
, long nD
, long nH
);
536 virtual ~ScDPLevels();
539 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
)
540 throw(::com::sun::star::container::NoSuchElementException
,
541 ::com::sun::star::lang::WrappedTargetException
,
542 ::com::sun::star::uno::RuntimeException
);
543 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames()
544 throw(::com::sun::star::uno::RuntimeException
);
545 virtual sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
)
546 throw(::com::sun::star::uno::RuntimeException
);
549 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
550 throw(::com::sun::star::uno::RuntimeException
);
551 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
554 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
555 throw(::com::sun::star::uno::RuntimeException
);
556 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
557 throw(::com::sun::star::uno::RuntimeException
);
558 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
559 throw(::com::sun::star::uno::RuntimeException
);
561 virtual long getCount() const;
562 virtual ScDPLevel
* getByIndex(long nIndex
) const;
565 class ScDPLevel
: public cppu::WeakImplHelper5
<
566 com::sun::star::sheet::XMembersSupplier
,
567 com::sun::star::container::XNamed
,
568 com::sun::star::sheet::XDataPilotMemberResults
,
569 com::sun::star::beans::XPropertySet
,
570 com::sun::star::lang::XServiceInfo
>
577 ScDPMembers
* pMembers
;
578 com::sun::star::uno::Sequence
<com::sun::star::sheet::GeneralFunction
> aSubTotals
;
580 ::com::sun::star::sheet::DataPilotFieldSortInfo aSortInfo
; // stored user settings
581 ::com::sun::star::sheet::DataPilotFieldAutoShowInfo aAutoShowInfo
; // stored user settings
582 ::com::sun::star::sheet::DataPilotFieldLayoutInfo aLayoutInfo
; // stored user settings
583 // valid only from result calculation:
584 ::std::vector
<sal_Int32
> aGlobalOrder
; // result of sorting by name or position
585 long nSortMeasure
; // measure (index of data dimension) to sort by
586 long nAutoMeasure
; // measure (index of data dimension) for AutoShow
587 BOOL bEnableLayout
; // enabled only for row fields, not for the innermost one
590 ScDPLevel( ScDPSource
* pSrc
, long nD
, long nH
, long nL
);
591 virtual ~ScDPLevel();
593 ScDPMembers
* GetMembersObject();
596 virtual ::rtl::OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
);
597 virtual void SAL_CALL
setName( const ::rtl::OUString
& aName
)
598 throw(::com::sun::star::uno::RuntimeException
);
601 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> SAL_CALL
602 getMembers() throw(::com::sun::star::uno::RuntimeException
);
604 // XDataPilotMemberResults
605 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::sheet::MemberResult
> SAL_CALL
606 getResults() throw(::com::sun::star::uno::RuntimeException
);
609 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
610 SAL_CALL
getPropertySetInfo( )
611 throw(::com::sun::star::uno::RuntimeException
);
612 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
,
613 const ::com::sun::star::uno::Any
& aValue
)
614 throw(::com::sun::star::beans::UnknownPropertyException
,
615 ::com::sun::star::beans::PropertyVetoException
,
616 ::com::sun::star::lang::IllegalArgumentException
,
617 ::com::sun::star::lang::WrappedTargetException
,
618 ::com::sun::star::uno::RuntimeException
);
619 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
620 const ::rtl::OUString
& PropertyName
)
621 throw(::com::sun::star::beans::UnknownPropertyException
,
622 ::com::sun::star::lang::WrappedTargetException
,
623 ::com::sun::star::uno::RuntimeException
);
624 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
625 const ::com::sun::star::uno::Reference
<
626 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
627 throw(::com::sun::star::beans::UnknownPropertyException
,
628 ::com::sun::star::lang::WrappedTargetException
,
629 ::com::sun::star::uno::RuntimeException
);
630 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
631 const ::com::sun::star::uno::Reference
<
632 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
633 throw(::com::sun::star::beans::UnknownPropertyException
,
634 ::com::sun::star::lang::WrappedTargetException
,
635 ::com::sun::star::uno::RuntimeException
);
636 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
637 const ::com::sun::star::uno::Reference
<
638 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
639 throw(::com::sun::star::beans::UnknownPropertyException
,
640 ::com::sun::star::lang::WrappedTargetException
,
641 ::com::sun::star::uno::RuntimeException
);
642 virtual void SAL_CALL
removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
643 const ::com::sun::star::uno::Reference
<
644 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
645 throw(::com::sun::star::beans::UnknownPropertyException
,
646 ::com::sun::star::lang::WrappedTargetException
,
647 ::com::sun::star::uno::RuntimeException
);
650 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
651 throw(::com::sun::star::uno::RuntimeException
);
652 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
653 throw(::com::sun::star::uno::RuntimeException
);
654 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
655 throw(::com::sun::star::uno::RuntimeException
);
657 virtual com::sun::star::uno::Sequence
<com::sun::star::sheet::GeneralFunction
> getSubTotals() const;
658 virtual void setSubTotals(const com::sun::star::uno::Sequence
<
659 com::sun::star::sheet::GeneralFunction
>& rNew
);
660 virtual BOOL
getShowEmpty() const;
661 virtual void setShowEmpty(BOOL bSet
);
663 const ::com::sun::star::sheet::DataPilotFieldSortInfo
& GetSortInfo() const { return aSortInfo
; }
664 const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo
& GetAutoShow() const { return aAutoShowInfo
; }
666 void EvaluateSortOrder();
667 void SetEnableLayout( BOOL bSet
);
669 const ::std::vector
<sal_Int32
>& GetGlobalOrder() const { return aGlobalOrder
; }
670 ::std::vector
<sal_Int32
>& GetGlobalOrder() { return aGlobalOrder
; }
671 long GetSortMeasure() const { return nSortMeasure
; }
672 long GetAutoMeasure() const { return nAutoMeasure
; }
674 BOOL
IsOutlineLayout() const
675 { return bEnableLayout
&&
676 aLayoutInfo
.LayoutMode
!=
677 ::com::sun::star::sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT
; }
679 BOOL
IsSubtotalsAtTop() const
680 { return bEnableLayout
&&
681 aLayoutInfo
.LayoutMode
==
682 ::com::sun::star::sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_TOP
; }
684 BOOL
IsAddEmpty() const { return bEnableLayout
&& aLayoutInfo
.AddEmptyLines
; }
686 //! number format (for data fields and date fields)
689 // hash map from name to index in the member array, for fast name access
690 typedef ::std::hash_map
< ::rtl::OUString
, sal_Int32
, ::rtl::OUStringHash
> ScDPMembersHashMap
;
692 class ScDPMembers
: public cppu::WeakImplHelper2
<
693 com::sun::star::container::XNameAccess
,
694 com::sun::star::lang::XServiceInfo
>
703 mutable ScDPMembersHashMap aHashMap
;
706 ScDPMembers( ScDPSource
* pSrc
, long nD
, long nH
, long nL
);
707 virtual ~ScDPMembers();
710 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
)
711 throw(::com::sun::star::container::NoSuchElementException
,
712 ::com::sun::star::lang::WrappedTargetException
,
713 ::com::sun::star::uno::RuntimeException
);
714 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames()
715 throw(::com::sun::star::uno::RuntimeException
);
716 virtual sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
)
717 throw(::com::sun::star::uno::RuntimeException
);
720 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
721 throw(::com::sun::star::uno::RuntimeException
);
722 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
725 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
726 throw(::com::sun::star::uno::RuntimeException
);
727 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
728 throw(::com::sun::star::uno::RuntimeException
);
729 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
730 throw(::com::sun::star::uno::RuntimeException
);
732 virtual long getCount() const;
733 virtual ScDPMember
* getByIndex(long nIndex
) const;
735 long getMinMembers() const;
737 sal_Int32
GetIndexFromName( const ::rtl::OUString
& rName
) const; // <0 if not found
740 class ScDPMember
: public cppu::WeakImplHelper3
<
741 com::sun::star::container::XNamed
,
742 com::sun::star::beans::XPropertySet
,
743 com::sun::star::lang::XServiceInfo
>
752 ::std::auto_ptr
<rtl::OUString
> mpLayoutName
;
754 sal_Int32 nPosition
; // manual sorting
759 ScDPMember( ScDPSource
* pSrc
, long nD
, long nH
, long nL
,
760 const String
& rN
, double fV
, BOOL bHV
);
761 virtual ~ScDPMember();
763 BOOL
IsNamedItem( const ScDPItemData
& r
) const;
764 String
GetNameStr() const;
765 void FillItemData( ScDPItemData
& rData
) const;
766 SC_DLLPUBLIC
const ::rtl::OUString
* GetLayoutName() const;
768 sal_Int32
Compare( const ScDPMember
& rOther
) const; // visible order
771 virtual ::rtl::OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
);
772 virtual void SAL_CALL
setName( const ::rtl::OUString
& aName
)
773 throw(::com::sun::star::uno::RuntimeException
);
776 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
777 SAL_CALL
getPropertySetInfo( )
778 throw(::com::sun::star::uno::RuntimeException
);
779 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
,
780 const ::com::sun::star::uno::Any
& aValue
)
781 throw(::com::sun::star::beans::UnknownPropertyException
,
782 ::com::sun::star::beans::PropertyVetoException
,
783 ::com::sun::star::lang::IllegalArgumentException
,
784 ::com::sun::star::lang::WrappedTargetException
,
785 ::com::sun::star::uno::RuntimeException
);
786 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
787 const ::rtl::OUString
& PropertyName
)
788 throw(::com::sun::star::beans::UnknownPropertyException
,
789 ::com::sun::star::lang::WrappedTargetException
,
790 ::com::sun::star::uno::RuntimeException
);
791 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
792 const ::com::sun::star::uno::Reference
<
793 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
794 throw(::com::sun::star::beans::UnknownPropertyException
,
795 ::com::sun::star::lang::WrappedTargetException
,
796 ::com::sun::star::uno::RuntimeException
);
797 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
798 const ::com::sun::star::uno::Reference
<
799 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
800 throw(::com::sun::star::beans::UnknownPropertyException
,
801 ::com::sun::star::lang::WrappedTargetException
,
802 ::com::sun::star::uno::RuntimeException
);
803 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::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
);
809 virtual void SAL_CALL
removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
810 const ::com::sun::star::uno::Reference
<
811 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
812 throw(::com::sun::star::beans::UnknownPropertyException
,
813 ::com::sun::star::lang::WrappedTargetException
,
814 ::com::sun::star::uno::RuntimeException
);
817 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
818 throw(::com::sun::star::uno::RuntimeException
);
819 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
820 throw(::com::sun::star::uno::RuntimeException
);
821 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
822 throw(::com::sun::star::uno::RuntimeException
);
824 virtual BOOL
getIsVisible() const;
825 virtual void setIsVisible(BOOL bSet
);
826 virtual BOOL
getShowDetails() const;
827 virtual void setShowDetails(BOOL bSet
);
829 sal_Int32
getPosition() const;
830 void setPosition(sal_Int32 nNew
);