LOK: tilebench improvements
[LibreOffice.git] / sc / inc / dptabsrc.hxx
blobf7bc070e81faac7408534303f2a82d29b196ddc2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
23 #include "global.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/DataPilotFieldAutoShowInfo.hpp>
32 #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
33 #include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
34 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
35 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
36 #include <com/sun/star/sheet/DataPilotFieldOrientation.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/implbase.hxx>
44 #include <rtl/ref.hxx>
46 #include "dptabdat.hxx"
47 #include "dpglobal.hxx"
48 #include "dpresfilter.hxx"
50 #include <list>
51 #include <memory>
52 #include <unordered_map>
53 #include <unordered_set>
54 #include <vector>
56 namespace com { namespace sun { namespace star {
57 namespace sheet {
58 struct DataPilotFieldFilter;
60 namespace table {
61 struct CellAddress;
63 }}}
65 class ScDPResultMember;
66 class ScDPResultData;
67 class ScDPItemData;
68 class ScDPTableData;
69 class ScDPDimensions;
70 class ScDPDimension;
71 class ScDPHierarchies;
72 class ScDPHierarchy;
73 class ScDPLevels;
74 class ScDPLevel;
75 class ScDPMembers;
76 class ScDPMember;
77 enum class ScGeneralFunction;
79 // implementation of DataPilotSource using ScDPTableData
81 class ScDPSource : public cppu::WeakImplHelper<
82 css::sheet::XDimensionsSupplier,
83 css::sheet::XDataPilotResults,
84 css::util::XRefreshable,
85 css::sheet::XDrillDownDataSupplier,
86 css::beans::XPropertySet,
87 css::lang::XServiceInfo >
89 private:
90 ScDPTableData* pData; // data source (ScDPObject manages its life time)
91 rtl::Reference<ScDPDimensions> pDimensions; // api objects
92 // settings:
94 std::vector<long> maColDims;
95 std::vector<long> maRowDims;
96 std::vector<long> maDataDims;
97 std::vector<long> maPageDims;
98 ScDPResultTree maResFilterSet;
100 bool bColumnGrand;
101 bool bRowGrand;
102 bool bIgnoreEmptyRows;
103 bool bRepeatIfEmpty;
105 long nDupCount;
107 // results:
108 ScDPResultData* pResData; // keep the rest in this!
109 ScDPResultMember* pColResRoot;
110 ScDPResultMember* pRowResRoot;
111 css::uno::Sequence<css::sheet::MemberResult>* pColResults;
112 css::uno::Sequence<css::sheet::MemberResult>* pRowResults;
113 std::vector<ScDPLevel*> aColLevelList;
114 std::vector<ScDPLevel*> aRowLevelList;
115 bool bResultOverflow;
116 bool bPageFiltered; // set if page field filters have been applied to cache table
118 ::std::unique_ptr<OUString> mpGrandTotalName;
120 void CreateRes_Impl();
121 void FillMemberResults();
122 void FillLevelList( css::sheet::DataPilotFieldOrientation nOrientation, std::vector<ScDPLevel*> &rList );
123 void FillCalcInfo(bool bIsRow, ScDPTableData::CalcInfo& rInfo, bool &bHasAutoShow);
126 * Compile a list of dimension indices that are either, column, row or
127 * page dimensions (i.e. all but data dimensions).
129 void GetCategoryDimensionIndices(std::unordered_set<sal_Int32>& rCatDims);
132 * Set visibilities of individual rows in the cache table based on the
133 * page field data.
135 void FilterCacheByPageDimensions();
137 void SetDupCount( long nNew );
139 OUString getDataDescription(); //! ???
141 void setIgnoreEmptyRows(bool bSet);
142 void setRepeatIfEmpty(bool bSet);
144 void disposeData();
146 public:
147 ScDPSource( ScDPTableData* pD );
148 virtual ~ScDPSource() override;
150 ScDPTableData* GetData() { return pData; }
151 const ScDPTableData* GetData() const { return pData; }
153 const OUString* GetGrandTotalName() const;
155 css::sheet::DataPilotFieldOrientation
156 GetOrientation(long nColumn);
157 void SetOrientation(long nColumn, css::sheet::DataPilotFieldOrientation nNew);
158 long GetPosition(long nColumn);
160 long GetDataDimensionCount();
161 ScDPDimension* GetDataDimension(long nIndex);
162 OUString GetDataDimName(long nIndex);
163 const ScDPCache* GetCache();
164 const ScDPItemData* GetItemDataById( long nDim, long nId );
165 bool IsDataLayoutDimension(long nDim);
166 css::sheet::DataPilotFieldOrientation
167 GetDataLayoutOrientation();
169 bool IsDateDimension(long nDim);
171 bool SubTotalAllowed(long nColumn); //! move to ScDPResultData
173 ScDPDimension* AddDuplicated(const OUString& rNewName);
174 long GetDupCount() const { return nDupCount; }
176 long GetSourceDim(long nDim);
178 const css::uno::Sequence<css::sheet::MemberResult>*
179 GetMemberResults( const ScDPLevel* pLevel );
181 ScDPDimensions* GetDimensionsObject();
183 // XDimensionsSupplier
184 virtual css::uno::Reference< css::container::XNameAccess >
185 SAL_CALL getDimensions( ) override;
187 // XDataPilotResults
188 virtual css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult > > SAL_CALL getResults( ) override;
190 virtual css::uno::Sequence<double> SAL_CALL
191 getFilteredResults(
192 const css::uno::Sequence<css::sheet::DataPilotFieldFilter>& aFilters ) override;
194 // XRefreshable
195 virtual void SAL_CALL refresh() override;
196 virtual void SAL_CALL addRefreshListener( const css::uno::Reference< css::util::XRefreshListener >& l ) override;
197 virtual void SAL_CALL removeRefreshListener( const css::uno::Reference< css::util::XRefreshListener >& l ) override;
199 // XDrillDownDataSupplier
200 virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > >
201 SAL_CALL getDrillDownData(const css::uno::Sequence<
202 css::sheet::DataPilotFieldFilter >& aFilters ) override;
204 // XPropertySet
205 virtual css::uno::Reference< css::beans::XPropertySetInfo >
206 SAL_CALL getPropertySetInfo( ) override;
207 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
208 const css::uno::Any& aValue ) override;
209 virtual css::uno::Any SAL_CALL getPropertyValue(
210 const OUString& PropertyName ) override;
211 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
212 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
213 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
214 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
215 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
216 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
217 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
218 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
220 // XServiceInfo
221 virtual OUString SAL_CALL getImplementationName( ) override;
222 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
223 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
225 #if DUMP_PIVOT_TABLE
226 void DumpResults() const;
227 #endif
230 class ScDPDimensions : public cppu::WeakImplHelper<
231 css::container::XNameAccess,
232 css::lang::XServiceInfo >
234 private:
235 ScDPSource* pSource;
236 long nDimCount;
237 std::unique_ptr<rtl::Reference<ScDPDimension>[]>
238 ppDims;
240 public:
241 ScDPDimensions( ScDPSource* pSrc );
242 virtual ~ScDPDimensions() override;
244 void CountChanged();
246 // XNameAccess
247 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
248 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
249 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
251 // XElementAccess
252 virtual css::uno::Type SAL_CALL getElementType() override;
253 virtual sal_Bool SAL_CALL hasElements() override;
255 // XServiceInfo
256 virtual OUString SAL_CALL getImplementationName( ) override;
257 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
258 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
260 long getCount() const;
261 ScDPDimension* getByIndex(long nIndex) const;
264 class ScDPDimension : public cppu::WeakImplHelper<
265 css::sheet::XHierarchiesSupplier,
266 css::container::XNamed,
267 css::util::XCloneable,
268 css::beans::XPropertySet,
269 css::lang::XServiceInfo >
271 ScDPSource* pSource;
272 long nDim; // dimension index (== column ID)
273 rtl::Reference<ScDPHierarchies> mxHierarchies;
274 ScGeneralFunction nFunction;
275 OUString aName; // if empty, take from source
276 std::unique_ptr<OUString> mpLayoutName;
277 std::unique_ptr<OUString> mpSubtotalName;
278 long nSourceDim; // >=0 if dup'ed
279 css::sheet::DataPilotFieldReference
280 aReferenceValue; // settings for "show data as" / "displayed value"
281 bool bHasSelectedPage;
282 OUString aSelectedPage;
283 std::unique_ptr<ScDPItemData>
284 pSelectedData; // internal, temporary, created from aSelectedPage
285 bool mbHasHiddenMember;
287 public:
288 ScDPDimension( ScDPSource* pSrc, long nD );
289 virtual ~ScDPDimension() override;
290 ScDPDimension(const ScDPDimension&) = delete;
291 ScDPDimension& operator=(const ScDPDimension&) = delete;
293 long GetDimension() const { return nDim; } // dimension index in source
294 long GetSourceDim() const { return nSourceDim; } // >=0 if dup'ed
296 ScDPDimension* CreateCloneObject();
297 ScDPHierarchies* GetHierarchiesObject();
299 SC_DLLPUBLIC const OUString* GetLayoutName() const;
300 const OUString* GetSubtotalName() const;
302 // XNamed
303 virtual OUString SAL_CALL getName() override;
304 virtual void SAL_CALL setName( const OUString& aName ) override;
306 // XHierarchiesSupplier
307 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL
308 getHierarchies() override;
310 // XCloneable
311 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL
312 createClone() override;
314 // XPropertySet
315 virtual css::uno::Reference< css::beans::XPropertySetInfo >
316 SAL_CALL getPropertySetInfo( ) override;
317 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
318 const css::uno::Any& aValue ) override;
319 virtual css::uno::Any SAL_CALL getPropertyValue(
320 const OUString& PropertyName ) override;
321 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
322 const css::uno::Reference<
323 css::beans::XPropertyChangeListener >& xListener ) override;
324 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
325 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
326 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
327 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
328 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
329 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
331 // XServiceInfo
332 virtual OUString SAL_CALL getImplementationName( ) override;
333 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
334 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
336 css::sheet::DataPilotFieldOrientation getOrientation() const;
337 bool getIsDataLayoutDimension() const;
338 ScGeneralFunction getFunction() const { return nFunction;}
339 void setFunction(ScGeneralFunction nNew); // for data dimension
340 static long getUsedHierarchy() { return 0;}
342 bool HasSelectedPage() const { return bHasSelectedPage; }
343 const ScDPItemData& GetSelectedData();
345 const css::sheet::DataPilotFieldReference& GetReferenceValue() const { return aReferenceValue;}
348 class ScDPHierarchies : public cppu::WeakImplHelper<
349 css::container::XNameAccess,
350 css::lang::XServiceInfo >
352 private:
353 ScDPSource* pSource;
354 long nDim;
355 // date columns have 3 hierarchies (flat/quarter/week), other columns only one
356 // #i52547# don't offer the incomplete date hierarchy implementation
357 static const long nHierCount = 1;
358 std::unique_ptr<rtl::Reference<ScDPHierarchy>[]>
359 ppHiers;
361 public:
362 ScDPHierarchies( ScDPSource* pSrc, long nD );
363 virtual ~ScDPHierarchies() override;
365 // XNameAccess
366 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
367 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
368 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
370 // XElementAccess
371 virtual css::uno::Type SAL_CALL getElementType() override;
372 virtual sal_Bool SAL_CALL hasElements() override;
374 // XServiceInfo
375 virtual OUString SAL_CALL getImplementationName( ) override;
376 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
377 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
379 static long getCount();
380 ScDPHierarchy* getByIndex(long nIndex) const;
383 class ScDPHierarchy : public cppu::WeakImplHelper<
384 css::sheet::XLevelsSupplier,
385 css::container::XNamed,
386 css::lang::XServiceInfo >
388 private:
389 ScDPSource* pSource;
390 long nDim;
391 long nHier;
392 rtl::Reference<ScDPLevels> mxLevels;
394 public:
395 ScDPHierarchy( ScDPSource* pSrc, long nD, long nH );
396 virtual ~ScDPHierarchy() override;
398 ScDPLevels* GetLevelsObject();
400 // XNamed
401 virtual OUString SAL_CALL getName() override;
402 virtual void SAL_CALL setName( const OUString& aName ) override;
404 // XLevelsSupplier
405 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL
406 getLevels() override;
408 // XServiceInfo
409 virtual OUString SAL_CALL getImplementationName( ) override;
410 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
411 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
414 class ScDPLevels : public cppu::WeakImplHelper<
415 css::container::XNameAccess,
416 css::lang::XServiceInfo >
418 private:
419 ScDPSource* pSource;
420 long nDim;
421 long nHier;
422 long nLevCount;
423 std::unique_ptr<rtl::Reference<ScDPLevel>[]>
424 ppLevs;
426 public:
427 ScDPLevels( ScDPSource* pSrc, long nD, long nH );
428 virtual ~ScDPLevels() override;
430 // XNameAccess
431 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
432 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
433 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
435 // XElementAccess
436 virtual css::uno::Type SAL_CALL getElementType() override;
437 virtual sal_Bool SAL_CALL hasElements() override;
439 // XServiceInfo
440 virtual OUString SAL_CALL getImplementationName( ) override;
441 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
442 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
444 long getCount() const;
445 ScDPLevel* getByIndex(long nIndex) const;
448 class ScDPLevel : public cppu::WeakImplHelper<
449 css::sheet::XMembersSupplier,
450 css::container::XNamed,
451 css::sheet::XDataPilotMemberResults,
452 css::beans::XPropertySet,
453 css::lang::XServiceInfo >
455 private:
456 ScDPSource* pSource;
457 long nDim;
458 long nHier;
459 long nLev;
460 rtl::Reference<ScDPMembers> mxMembers;
461 css::uno::Sequence<sal_Int16> aSubTotals;
462 css::sheet::DataPilotFieldSortInfo aSortInfo; // stored user settings
463 css::sheet::DataPilotFieldAutoShowInfo aAutoShowInfo; // stored user settings
464 css::sheet::DataPilotFieldLayoutInfo aLayoutInfo; // stored user settings
465 // valid only from result calculation:
466 ::std::vector<sal_Int32> aGlobalOrder; // result of sorting by name or position
467 long nSortMeasure; // measure (index of data dimension) to sort by
468 long nAutoMeasure; // measure (index of data dimension) for AutoShow
469 bool bShowEmpty:1;
470 bool bEnableLayout:1; // enabled only for row fields, not for the innermost one
471 bool bRepeatItemLabels:1;
473 public:
474 ScDPLevel( ScDPSource* pSrc, long nD, long nH, long nL );
475 virtual ~ScDPLevel() override;
477 ScDPMembers* GetMembersObject();
479 // XNamed
480 virtual OUString SAL_CALL getName() override;
481 virtual void SAL_CALL setName( const OUString& aName ) override;
483 // XMembersSupplier
484 virtual css::uno::Reference< css::sheet::XMembersAccess > SAL_CALL
485 getMembers() override;
487 // XDataPilotMemberResults
488 virtual css::uno::Sequence< css::sheet::MemberResult > SAL_CALL
489 getResults() override;
491 // XPropertySet
492 virtual css::uno::Reference< css::beans::XPropertySetInfo >
493 SAL_CALL getPropertySetInfo( ) override;
494 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
495 const css::uno::Any& aValue ) override;
496 virtual css::uno::Any SAL_CALL getPropertyValue(
497 const OUString& PropertyName ) override;
498 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
499 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
500 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
501 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
502 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
503 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
504 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
505 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
507 // XServiceInfo
508 virtual OUString SAL_CALL getImplementationName( ) override;
509 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
510 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
512 css::uno::Sequence<sal_Int16> getSubTotals() const;
513 bool getShowEmpty() const { return bShowEmpty;}
514 bool getRepeatItemLabels() const { return bRepeatItemLabels; }
516 const css::sheet::DataPilotFieldSortInfo& GetSortInfo() const { return aSortInfo; }
517 const css::sheet::DataPilotFieldAutoShowInfo& GetAutoShow() const { return aAutoShowInfo; }
519 void EvaluateSortOrder();
520 void SetEnableLayout(bool bSet);
522 const ::std::vector<sal_Int32>& GetGlobalOrder() const { return aGlobalOrder; }
523 ::std::vector<sal_Int32>& GetGlobalOrder() { return aGlobalOrder; }
524 long GetSortMeasure() const { return nSortMeasure; }
525 long GetAutoMeasure() const { return nAutoMeasure; }
527 bool IsOutlineLayout() const
529 return bEnableLayout &&
530 aLayoutInfo.LayoutMode !=
531 css::sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT;
534 bool IsSubtotalsAtTop() const
536 return bEnableLayout &&
537 aLayoutInfo.LayoutMode ==
538 css::sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_TOP;
541 bool IsAddEmpty() const
543 return bEnableLayout && aLayoutInfo.AddEmptyLines;
546 //! number format (for data fields and date fields)
549 // hash map from name to index in the member array, for fast name access
550 typedef std::unordered_map< OUString, sal_Int32 > ScDPMembersHashMap;
552 class ScDPMembers : public cppu::WeakImplHelper<
553 css::sheet::XMembersAccess,
554 css::lang::XServiceInfo >
556 private:
557 typedef std::vector<rtl::Reference<ScDPMember> > MembersType;
558 ScDPSource* pSource;
559 long nDim;
560 long nHier;
561 long nLev;
562 long nMbrCount;
563 mutable MembersType maMembers;
564 mutable ScDPMembersHashMap aHashMap;
566 public:
567 ScDPMembers( ScDPSource* pSrc, long nD, long nH, long nL );
568 virtual ~ScDPMembers() override;
570 // XMembersAccess
571 virtual css::uno::Sequence< OUString > SAL_CALL getLocaleIndependentElementNames() override;
573 // XNameAccess
574 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
575 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
576 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
578 // XElementAccess
579 virtual css::uno::Type SAL_CALL getElementType() override;
580 virtual sal_Bool SAL_CALL hasElements() override;
582 // XServiceInfo
583 virtual OUString SAL_CALL getImplementationName( ) override;
584 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
585 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
587 long getCount() const { return nMbrCount;}
588 ScDPMember* getByIndex(long nIndex) const;
590 long getMinMembers() const;
592 sal_Int32 GetIndexFromName( const OUString& rName ) const; // <0 if not found
593 const ScDPItemData* GetSrcItemDataByIndex( SCROW nIndex);
595 private:
596 /// @throws css::uno::RuntimeException
597 css::uno::Sequence< OUString > getElementNames( bool bLocaleIndependent ) const;
600 class ScDPMember : public cppu::WeakImplHelper<
601 css::container::XNamed,
602 css::beans::XPropertySet,
603 css::lang::XServiceInfo >
605 private:
606 ScDPSource* pSource;
607 long nDim;
608 long nHier;
609 long nLev;
611 SCROW mnDataId;
612 std::unique_ptr<OUString> mpLayoutName;
614 sal_Int32 nPosition; // manual sorting
615 bool bVisible;
616 bool bShowDet;
618 public:
619 ScDPMember(ScDPSource* pSrc, long nD, long nH, long nL, SCROW nIndex);
620 virtual ~ScDPMember() override;
621 ScDPMember(const ScDPMember&) = delete;
622 ScDPMember& operator=(const ScDPMember&) = delete;
624 OUString GetNameStr( bool bLocaleIndependent ) const;
625 ScDPItemData FillItemData() const;
626 const ScDPItemData* GetItemData() const;
627 SCROW GetItemDataId() const { return mnDataId; }
628 bool IsNamedItem(SCROW nIndex) const;
630 SC_DLLPUBLIC const OUString* GetLayoutName() const;
631 long GetDim() const { return nDim;}
633 sal_Int32 Compare( const ScDPMember& rOther ) const; // visible order
635 // XNamed
636 virtual OUString SAL_CALL getName() override;
637 virtual void SAL_CALL setName( const OUString& aName ) override;
639 // XPropertySet
640 virtual css::uno::Reference< css::beans::XPropertySetInfo >
641 SAL_CALL getPropertySetInfo( ) override;
642 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
643 const css::uno::Any& aValue ) override;
644 virtual css::uno::Any SAL_CALL getPropertyValue(
645 const OUString& PropertyName ) override;
646 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
647 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
648 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
649 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
650 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
651 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
652 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
653 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
655 // XServiceInfo
656 virtual OUString SAL_CALL getImplementationName( ) override;
657 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
658 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
660 bool isVisible() const { return bVisible;}
661 bool getShowDetails() const { return bShowDet;}
664 #endif
666 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */