Bump version to 6.4-15
[LibreOffice.git] / sc / inc / dptabsrc.hxx
bloba5eb7f74ecc1c142f0a81a84a1dc11519788eb3a
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 <com/sun/star/sheet/XDimensionsSupplier.hpp>
24 #include <com/sun/star/sheet/XHierarchiesSupplier.hpp>
25 #include <com/sun/star/sheet/XLevelsSupplier.hpp>
26 #include <com/sun/star/sheet/XMembersSupplier.hpp>
27 #include <com/sun/star/sheet/XDataPilotResults.hpp>
28 #include <com/sun/star/sheet/XDataPilotMemberResults.hpp>
29 #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
30 #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
31 #include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
32 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
33 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
34 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
35 #include <com/sun/star/util/XRefreshable.hpp>
36 #include <com/sun/star/sheet/XDrillDownDataSupplier.hpp>
37 #include <com/sun/star/util/XCloneable.hpp>
38 #include <com/sun/star/beans/XPropertySet.hpp>
39 #include <com/sun/star/lang/XServiceInfo.hpp>
40 #include <com/sun/star/container/XNamed.hpp>
41 #include <cppuhelper/implbase.hxx>
42 #include <rtl/ref.hxx>
44 #include "dptabdat.hxx"
45 #include "dpresfilter.hxx"
47 #include <memory>
48 #include <unordered_map>
49 #include <unordered_set>
50 #include <vector>
51 #include <boost/optional.hpp>
53 namespace com { namespace sun { namespace star {
54 namespace sheet {
55 struct DataPilotFieldFilter;
56 struct MemberResult;
58 }}}
60 class ScDPResultMember;
61 class ScDPResultData;
62 class ScDPItemData;
63 class ScDPDimensions;
64 class ScDPDimension;
65 class ScDPHierarchies;
66 class ScDPHierarchy;
67 class ScDPLevels;
68 class ScDPLevel;
69 class ScDPMembers;
70 class ScDPMember;
71 enum class ScGeneralFunction;
73 // implementation of DataPilotSource using ScDPTableData
75 class ScDPSource final : public cppu::WeakImplHelper<
76 css::sheet::XDimensionsSupplier,
77 css::sheet::XDataPilotResults,
78 css::util::XRefreshable,
79 css::sheet::XDrillDownDataSupplier,
80 css::beans::XPropertySet,
81 css::lang::XServiceInfo >
83 private:
84 ScDPTableData* pData; // data source (ScDPObject manages its life time)
85 rtl::Reference<ScDPDimensions> pDimensions; // api objects
86 // settings:
88 std::vector<long> maColDims;
89 std::vector<long> maRowDims;
90 std::vector<long> maDataDims;
91 std::vector<long> maPageDims;
92 ScDPResultTree maResFilterSet;
94 bool bColumnGrand;
95 bool bRowGrand;
96 bool bIgnoreEmptyRows;
97 bool bRepeatIfEmpty;
99 long nDupCount;
101 // results:
102 std::unique_ptr<ScDPResultData> pResData; // keep the rest in this!
103 std::unique_ptr<ScDPResultMember> pColResRoot;
104 std::unique_ptr<ScDPResultMember> pRowResRoot;
105 std::unique_ptr<css::uno::Sequence<css::sheet::MemberResult>[]> pColResults;
106 std::unique_ptr<css::uno::Sequence<css::sheet::MemberResult>[]> pRowResults;
107 std::vector<ScDPLevel*> aColLevelList;
108 std::vector<ScDPLevel*> aRowLevelList;
109 bool bResultOverflow;
110 bool bPageFiltered; // set if page field filters have been applied to cache table
112 boost::optional<OUString> mpGrandTotalName;
114 void CreateRes_Impl();
115 void FillMemberResults();
116 void FillLevelList( css::sheet::DataPilotFieldOrientation nOrientation, std::vector<ScDPLevel*> &rList );
117 void FillCalcInfo(bool bIsRow, ScDPTableData::CalcInfo& rInfo, bool &bHasAutoShow);
120 * Compile a list of dimension indices that are either, column, row or
121 * page dimensions (i.e. all but data dimensions).
123 void GetCategoryDimensionIndices(std::unordered_set<sal_Int32>& rCatDims);
126 * Set visibilities of individual rows in the cache table based on the
127 * page field data.
129 void FilterCacheByPageDimensions();
131 void SetDupCount( long nNew );
133 OUString getDataDescription(); //! ???
135 void setIgnoreEmptyRows(bool bSet);
136 void setRepeatIfEmpty(bool bSet);
138 void disposeData();
140 public:
141 ScDPSource( ScDPTableData* pD );
142 virtual ~ScDPSource() override;
144 ScDPTableData* GetData() { return pData; }
145 const ScDPTableData* GetData() const { return pData; }
147 const boost::optional<OUString> &
148 GetGrandTotalName() const;
150 css::sheet::DataPilotFieldOrientation
151 GetOrientation(long nColumn);
152 void SetOrientation(long nColumn, css::sheet::DataPilotFieldOrientation nNew);
153 long GetPosition(long nColumn);
155 long GetDataDimensionCount() const;
156 ScDPDimension* GetDataDimension(long nIndex);
157 OUString GetDataDimName(long nIndex);
158 const ScDPCache* GetCache();
159 const ScDPItemData* GetItemDataById( long nDim, long nId );
160 bool IsDataLayoutDimension(long nDim);
161 css::sheet::DataPilotFieldOrientation
162 GetDataLayoutOrientation();
164 bool IsDateDimension(long nDim);
166 bool SubTotalAllowed(long nColumn); //! move to ScDPResultData
168 ScDPDimension* AddDuplicated(const OUString& rNewName);
169 long GetDupCount() const { return nDupCount; }
171 long GetSourceDim(long nDim);
173 const css::uno::Sequence<css::sheet::MemberResult>*
174 GetMemberResults( const ScDPLevel* pLevel );
176 ScDPDimensions* GetDimensionsObject();
178 // XDimensionsSupplier
179 virtual css::uno::Reference< css::container::XNameAccess >
180 SAL_CALL getDimensions( ) override;
182 // XDataPilotResults
183 virtual css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult > > SAL_CALL getResults( ) override;
185 virtual css::uno::Sequence<double> SAL_CALL
186 getFilteredResults(
187 const css::uno::Sequence<css::sheet::DataPilotFieldFilter>& aFilters ) override;
189 // XRefreshable
190 virtual void SAL_CALL refresh() override;
191 virtual void SAL_CALL addRefreshListener( const css::uno::Reference< css::util::XRefreshListener >& l ) override;
192 virtual void SAL_CALL removeRefreshListener( const css::uno::Reference< css::util::XRefreshListener >& l ) override;
194 // XDrillDownDataSupplier
195 virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > >
196 SAL_CALL getDrillDownData(const css::uno::Sequence<
197 css::sheet::DataPilotFieldFilter >& aFilters ) override;
199 // XPropertySet
200 virtual css::uno::Reference< css::beans::XPropertySetInfo >
201 SAL_CALL getPropertySetInfo( ) override;
202 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
203 const css::uno::Any& aValue ) override;
204 virtual css::uno::Any SAL_CALL getPropertyValue(
205 const OUString& PropertyName ) override;
206 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
207 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
208 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
209 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
210 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
211 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
212 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
213 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
215 // XServiceInfo
216 virtual OUString SAL_CALL getImplementationName( ) override;
217 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
218 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
220 #if DUMP_PIVOT_TABLE
221 void DumpResults() const;
222 #endif
225 class ScDPDimensions : public cppu::WeakImplHelper<
226 css::container::XNameAccess,
227 css::lang::XServiceInfo >
229 private:
230 ScDPSource* pSource;
231 long nDimCount;
232 std::unique_ptr<rtl::Reference<ScDPDimension>[]>
233 ppDims;
235 public:
236 ScDPDimensions( ScDPSource* pSrc );
237 virtual ~ScDPDimensions() override;
239 void CountChanged();
241 // XNameAccess
242 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
243 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
244 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
246 // XElementAccess
247 virtual css::uno::Type SAL_CALL getElementType() override;
248 virtual sal_Bool SAL_CALL hasElements() override;
250 // XServiceInfo
251 virtual OUString SAL_CALL getImplementationName( ) override;
252 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
253 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
255 long getCount() const;
256 ScDPDimension* getByIndex(long nIndex) const;
259 class ScDPDimension : public cppu::WeakImplHelper<
260 css::sheet::XHierarchiesSupplier,
261 css::container::XNamed,
262 css::util::XCloneable,
263 css::beans::XPropertySet,
264 css::lang::XServiceInfo >
266 ScDPSource* pSource;
267 long const nDim; // dimension index (== column ID)
268 rtl::Reference<ScDPHierarchies> mxHierarchies;
269 ScGeneralFunction nFunction;
270 OUString aName; // if empty, take from source
271 boost::optional<OUString> mpLayoutName;
272 boost::optional<OUString> mpSubtotalName;
273 long nSourceDim; // >=0 if dup'ed
274 css::sheet::DataPilotFieldReference
275 aReferenceValue; // settings for "show data as" / "displayed value"
276 bool bHasSelectedPage;
277 OUString aSelectedPage;
278 std::unique_ptr<ScDPItemData>
279 pSelectedData; // internal, temporary, created from aSelectedPage
280 bool mbHasHiddenMember;
282 public:
283 ScDPDimension( ScDPSource* pSrc, long nD );
284 virtual ~ScDPDimension() override;
285 ScDPDimension(const ScDPDimension&) = delete;
286 ScDPDimension& operator=(const ScDPDimension&) = delete;
288 long GetDimension() const { return nDim; } // dimension index in source
289 long GetSourceDim() const { return nSourceDim; } // >=0 if dup'ed
291 ScDPDimension* CreateCloneObject();
292 ScDPHierarchies* GetHierarchiesObject();
294 const boost::optional<OUString> & GetLayoutName() const;
295 const boost::optional<OUString> & GetSubtotalName() const;
297 // XNamed
298 virtual OUString SAL_CALL getName() override;
299 virtual void SAL_CALL setName( const OUString& aName ) override;
301 // XHierarchiesSupplier
302 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL
303 getHierarchies() override;
305 // XCloneable
306 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL
307 createClone() override;
309 // XPropertySet
310 virtual css::uno::Reference< css::beans::XPropertySetInfo >
311 SAL_CALL getPropertySetInfo( ) override;
312 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
313 const css::uno::Any& aValue ) override;
314 virtual css::uno::Any SAL_CALL getPropertyValue(
315 const OUString& PropertyName ) override;
316 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
317 const css::uno::Reference<
318 css::beans::XPropertyChangeListener >& xListener ) override;
319 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
320 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
321 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
322 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
323 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
324 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
326 // XServiceInfo
327 virtual OUString SAL_CALL getImplementationName( ) override;
328 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
329 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
331 css::sheet::DataPilotFieldOrientation getOrientation() const;
332 bool getIsDataLayoutDimension() const;
333 ScGeneralFunction getFunction() const { return nFunction;}
334 void setFunction(ScGeneralFunction nNew); // for data dimension
335 static long getUsedHierarchy() { return 0;}
337 bool HasSelectedPage() const { return bHasSelectedPage; }
338 const ScDPItemData& GetSelectedData();
340 const css::sheet::DataPilotFieldReference& GetReferenceValue() const { return aReferenceValue;}
343 class ScDPHierarchies : public cppu::WeakImplHelper<
344 css::container::XNameAccess,
345 css::lang::XServiceInfo >
347 private:
348 ScDPSource* const pSource;
349 long const nDim;
350 // date columns have 3 hierarchies (flat/quarter/week), other columns only one
351 // #i52547# don't offer the incomplete date hierarchy implementation
352 static const long nHierCount = 1;
353 std::unique_ptr<rtl::Reference<ScDPHierarchy>[]>
354 ppHiers;
356 public:
357 ScDPHierarchies( ScDPSource* pSrc, long nD );
358 virtual ~ScDPHierarchies() override;
360 // XNameAccess
361 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
362 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
363 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
365 // XElementAccess
366 virtual css::uno::Type SAL_CALL getElementType() override;
367 virtual sal_Bool SAL_CALL hasElements() override;
369 // XServiceInfo
370 virtual OUString SAL_CALL getImplementationName( ) override;
371 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
372 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
374 static long getCount();
375 ScDPHierarchy* getByIndex(long nIndex) const;
378 class ScDPHierarchy : public cppu::WeakImplHelper<
379 css::sheet::XLevelsSupplier,
380 css::container::XNamed,
381 css::lang::XServiceInfo >
383 private:
384 ScDPSource* const pSource;
385 long const nDim;
386 long const nHier;
387 rtl::Reference<ScDPLevels> mxLevels;
389 public:
390 ScDPHierarchy( ScDPSource* pSrc, long nD, long nH );
391 virtual ~ScDPHierarchy() override;
393 ScDPLevels* GetLevelsObject();
395 // XNamed
396 virtual OUString SAL_CALL getName() override;
397 virtual void SAL_CALL setName( const OUString& aName ) override;
399 // XLevelsSupplier
400 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL
401 getLevels() override;
403 // XServiceInfo
404 virtual OUString SAL_CALL getImplementationName( ) override;
405 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
406 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
409 class ScDPLevels : public cppu::WeakImplHelper<
410 css::container::XNameAccess,
411 css::lang::XServiceInfo >
413 private:
414 ScDPSource* pSource;
415 long const nDim;
416 long const nHier;
417 long nLevCount;
418 std::unique_ptr<rtl::Reference<ScDPLevel>[]>
419 ppLevs;
421 public:
422 ScDPLevels( ScDPSource* pSrc, long nD, long nH );
423 virtual ~ScDPLevels() override;
425 // XNameAccess
426 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
427 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
428 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
430 // XElementAccess
431 virtual css::uno::Type SAL_CALL getElementType() override;
432 virtual sal_Bool SAL_CALL hasElements() override;
434 // XServiceInfo
435 virtual OUString SAL_CALL getImplementationName( ) override;
436 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
437 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
439 long getCount() const;
440 ScDPLevel* getByIndex(long nIndex) const;
443 class ScDPLevel : public cppu::WeakImplHelper<
444 css::sheet::XMembersSupplier,
445 css::container::XNamed,
446 css::sheet::XDataPilotMemberResults,
447 css::beans::XPropertySet,
448 css::lang::XServiceInfo >
450 private:
451 ScDPSource* pSource;
452 long const nDim;
453 long const nHier;
454 long const nLev;
455 rtl::Reference<ScDPMembers> mxMembers;
456 css::uno::Sequence<sal_Int16> aSubTotals;
457 css::sheet::DataPilotFieldSortInfo aSortInfo; // stored user settings
458 css::sheet::DataPilotFieldAutoShowInfo aAutoShowInfo; // stored user settings
459 css::sheet::DataPilotFieldLayoutInfo aLayoutInfo; // stored user settings
460 // valid only from result calculation:
461 ::std::vector<sal_Int32> aGlobalOrder; // result of sorting by name or position
462 long nSortMeasure; // measure (index of data dimension) to sort by
463 long nAutoMeasure; // measure (index of data dimension) for AutoShow
464 bool bShowEmpty:1;
465 bool bEnableLayout:1; // enabled only for row fields, not for the innermost one
466 bool bRepeatItemLabels:1;
468 public:
469 ScDPLevel( ScDPSource* pSrc, long nD, long nH, long nL );
470 virtual ~ScDPLevel() override;
472 ScDPMembers* GetMembersObject();
474 // XNamed
475 virtual OUString SAL_CALL getName() override;
476 virtual void SAL_CALL setName( const OUString& aName ) override;
478 // XMembersSupplier
479 virtual css::uno::Reference< css::sheet::XMembersAccess > SAL_CALL
480 getMembers() override;
482 // XDataPilotMemberResults
483 virtual css::uno::Sequence< css::sheet::MemberResult > SAL_CALL
484 getResults() override;
486 // XPropertySet
487 virtual css::uno::Reference< css::beans::XPropertySetInfo >
488 SAL_CALL getPropertySetInfo( ) override;
489 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
490 const css::uno::Any& aValue ) override;
491 virtual css::uno::Any SAL_CALL getPropertyValue(
492 const OUString& PropertyName ) override;
493 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
494 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
495 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
496 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
497 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
498 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
499 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
500 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
502 // XServiceInfo
503 virtual OUString SAL_CALL getImplementationName( ) override;
504 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
505 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
507 css::uno::Sequence<sal_Int16> getSubTotals() const;
508 bool getShowEmpty() const { return bShowEmpty;}
509 bool getRepeatItemLabels() const { return bRepeatItemLabels; }
511 const css::sheet::DataPilotFieldSortInfo& GetSortInfo() const { return aSortInfo; }
512 const css::sheet::DataPilotFieldAutoShowInfo& GetAutoShow() const { return aAutoShowInfo; }
514 void EvaluateSortOrder();
515 void SetEnableLayout(bool bSet);
517 const ::std::vector<sal_Int32>& GetGlobalOrder() const { return aGlobalOrder; }
518 ::std::vector<sal_Int32>& GetGlobalOrder() { return aGlobalOrder; }
519 long GetSortMeasure() const { return nSortMeasure; }
520 long GetAutoMeasure() const { return nAutoMeasure; }
522 bool IsOutlineLayout() const
524 return bEnableLayout &&
525 aLayoutInfo.LayoutMode !=
526 css::sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT;
529 bool IsSubtotalsAtTop() const
531 return bEnableLayout &&
532 aLayoutInfo.LayoutMode ==
533 css::sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_TOP;
536 bool IsAddEmpty() const
538 return bEnableLayout && aLayoutInfo.AddEmptyLines;
541 //! number format (for data fields and date fields)
544 // hash map from name to index in the member array, for fast name access
545 typedef std::unordered_map< OUString, sal_Int32 > ScDPMembersHashMap;
547 class ScDPMembers : public cppu::WeakImplHelper<
548 css::sheet::XMembersAccess,
549 css::lang::XServiceInfo >
551 private:
552 typedef std::vector<rtl::Reference<ScDPMember> > MembersType;
553 ScDPSource* pSource;
554 long nDim;
555 long nHier;
556 long const nLev;
557 long nMbrCount;
558 mutable MembersType maMembers;
559 mutable ScDPMembersHashMap aHashMap;
561 public:
562 ScDPMembers( ScDPSource* pSrc, long nD, long nH, long nL );
563 virtual ~ScDPMembers() override;
565 // XMembersAccess
566 virtual css::uno::Sequence< OUString > SAL_CALL getLocaleIndependentElementNames() override;
568 // XNameAccess
569 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
570 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
571 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
573 // XElementAccess
574 virtual css::uno::Type SAL_CALL getElementType() override;
575 virtual sal_Bool SAL_CALL hasElements() override;
577 // XServiceInfo
578 virtual OUString SAL_CALL getImplementationName( ) override;
579 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
580 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
582 long getCount() const { return nMbrCount;}
583 ScDPMember* getByIndex(long nIndex) const;
585 long getMinMembers() const;
587 sal_Int32 GetIndexFromName( const OUString& rName ) const; // <0 if not found
588 const ScDPItemData* GetSrcItemDataByIndex( SCROW nIndex);
590 private:
591 /// @throws css::uno::RuntimeException
592 css::uno::Sequence< OUString > getElementNames( bool bLocaleIndependent ) const;
595 class ScDPMember : public cppu::WeakImplHelper<
596 css::container::XNamed,
597 css::beans::XPropertySet,
598 css::lang::XServiceInfo >
600 private:
601 ScDPSource* pSource;
602 long nDim;
603 long const nHier;
604 long const nLev;
606 SCROW const mnDataId;
607 boost::optional<OUString> mpLayoutName;
609 sal_Int32 nPosition; // manual sorting
610 bool bVisible;
611 bool bShowDet;
613 public:
614 ScDPMember(ScDPSource* pSrc, long nD, long nH, long nL, SCROW nIndex);
615 virtual ~ScDPMember() override;
616 ScDPMember(const ScDPMember&) = delete;
617 ScDPMember& operator=(const ScDPMember&) = delete;
619 OUString GetNameStr( bool bLocaleIndependent ) const;
620 ScDPItemData FillItemData() const;
621 const ScDPItemData* GetItemData() const;
622 SCROW GetItemDataId() const { return mnDataId; }
623 bool IsNamedItem(SCROW nIndex) const;
625 const boost::optional<OUString> & GetLayoutName() const;
626 long GetDim() const { return nDim;}
628 sal_Int32 Compare( const ScDPMember& rOther ) const; // visible order
630 // XNamed
631 virtual OUString SAL_CALL getName() override;
632 virtual void SAL_CALL setName( const OUString& aName ) override;
634 // XPropertySet
635 virtual css::uno::Reference< css::beans::XPropertySetInfo >
636 SAL_CALL getPropertySetInfo( ) override;
637 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
638 const css::uno::Any& aValue ) override;
639 virtual css::uno::Any SAL_CALL getPropertyValue(
640 const OUString& PropertyName ) override;
641 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
642 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
643 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
644 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
645 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
646 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
647 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
648 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
650 // XServiceInfo
651 virtual OUString SAL_CALL getImplementationName( ) override;
652 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
653 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
655 bool isVisible() const { return bVisible;}
656 bool getShowDetails() const { return bShowDet;}
659 #endif
661 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */