tdf#165002 sidebar a11y: Set a11y names for styles tool buttons
[LibreOffice.git] / sc / inc / dptabsrc.hxx
blobd9381c40c64a9c6ae9b19bd2fd54ffee060e829a
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 #pragma once
22 #include <com/sun/star/sheet/XDimensionsSupplier.hpp>
23 #include <com/sun/star/sheet/XHierarchiesSupplier.hpp>
24 #include <com/sun/star/sheet/XLevelsSupplier.hpp>
25 #include <com/sun/star/sheet/XMembersSupplier.hpp>
26 #include <com/sun/star/sheet/XDataPilotResults.hpp>
27 #include <com/sun/star/sheet/XDataPilotMemberResults.hpp>
28 #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
29 #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
30 #include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
31 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
32 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
33 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
34 #include <com/sun/star/util/XRefreshable.hpp>
35 #include <com/sun/star/sheet/XDrillDownDataSupplier.hpp>
36 #include <com/sun/star/util/XCloneable.hpp>
37 #include <com/sun/star/beans/XPropertySet.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <com/sun/star/container/XNamed.hpp>
40 #include <cppuhelper/implbase.hxx>
41 #include <rtl/ref.hxx>
43 #include "dptabdat.hxx"
44 #include "dpresfilter.hxx"
46 #include <memory>
47 #include <unordered_map>
48 #include <unordered_set>
49 #include <vector>
50 #include <optional>
52 namespace com::sun::star {
53 namespace sheet {
54 struct DataPilotFieldFilter;
55 struct MemberResult;
59 class ScDPResultMember;
60 class ScDPResultData;
61 class ScDPItemData;
62 class ScDPDimensions;
63 class ScDPDimension;
64 class ScDPHierarchies;
65 class ScDPHierarchy;
66 class ScDPLevels;
67 class ScDPLevel;
68 class ScDPMembers;
69 class ScDPMember;
70 enum class ScGeneralFunction;
72 // implementation of DataPilotSource using ScDPTableData
74 class ScDPSource final : public cppu::WeakImplHelper<
75 css::sheet::XDimensionsSupplier,
76 css::sheet::XDataPilotResults,
77 css::util::XRefreshable,
78 css::sheet::XDrillDownDataSupplier,
79 css::beans::XPropertySet,
80 css::lang::XServiceInfo >
82 private:
83 ScDPTableData* mpData; // data source (ScDPObject manages its life time)
84 rtl::Reference<ScDPDimensions> mpDimensions; // api objects
86 // settings:
87 std::vector<sal_Int32> maColDims;
88 std::vector<sal_Int32> maRowDims;
89 std::vector<sal_Int32> maDataDims;
90 std::vector<sal_Int32> maPageDims;
91 ScDPResultTree maResFilterSet;
93 bool mbColumnGrand = true;
94 bool mbRowGrand = true;
95 bool mbIgnoreEmptyRows = false;
96 bool mbRepeatIfEmpty = false;
97 sal_Int32 mnDupCount = 0;
99 // results:
100 std::unique_ptr<ScDPResultData> mpResultData; // keep the rest in this!
101 std::unique_ptr<ScDPResultMember> mpColumnResultRoot;
102 std::unique_ptr<ScDPResultMember> mpRowResultRoot;
103 std::unique_ptr<css::uno::Sequence<css::sheet::MemberResult>[]> mpColumnResults;
104 std::unique_ptr<css::uno::Sequence<css::sheet::MemberResult>[]> mpRowResults;
105 std::vector<ScDPLevel*> maColumnLevelList;
106 std::vector<ScDPLevel*> maRowLevelList;
107 bool mbResultOverflow = false;
108 bool mbPageFiltered = false; // set if page field filters have been applied to cache table
110 std::optional<OUString> mpGrandTotalName;
112 void CreateRes_Impl();
113 void FillMemberResults();
114 void FillLevelList( css::sheet::DataPilotFieldOrientation nOrientation, std::vector<ScDPLevel*> &rList );
115 void FillCalcInfo(bool bIsRow, ScDPTableData::CalcInfo& rInfo, bool &bHasAutoShow);
118 * Compile a list of dimension indices that are either, column, row or
119 * page dimensions (i.e. all but data dimensions).
121 void GetCategoryDimensionIndices(std::unordered_set<sal_Int32>& rCatDims);
124 * Set visibilities of individual rows in the cache table based on the
125 * page field data.
127 void FilterCacheByPageDimensions();
129 void SetDupCount( tools::Long nNew );
131 OUString getDataDescription(); //! ???
133 void setIgnoreEmptyRows(bool bSet);
134 void setRepeatIfEmpty(bool bSet);
136 void disposeData();
138 public:
139 ScDPSource( ScDPTableData* pD );
140 virtual ~ScDPSource() override;
142 ScDPTableData* GetData() { return mpData; }
143 const ScDPTableData* GetData() const { return mpData; }
145 const std::optional<OUString> &
146 GetGrandTotalName() const;
148 css::sheet::DataPilotFieldOrientation
149 GetOrientation(sal_Int32 nColumn);
150 void SetOrientation(sal_Int32 nColumn, css::sheet::DataPilotFieldOrientation nNew);
151 sal_Int32 GetPosition(sal_Int32 nColumn);
153 sal_Int32 GetDataDimensionCount() const;
154 ScDPDimension* GetDataDimension(sal_Int32 nIndex);
155 OUString GetDataDimName(sal_Int32 nIndex);
156 const ScDPCache* GetCache();
157 const ScDPItemData* GetItemDataById( sal_Int32 nDim, sal_Int32 nId );
158 bool IsDataLayoutDimension(sal_Int32 nDim);
159 css::sheet::DataPilotFieldOrientation
160 GetDataLayoutOrientation();
162 bool IsDateDimension(sal_Int32 nDim);
164 bool SubTotalAllowed(sal_Int32 nColumn); //! move to ScDPResultData
166 ScDPDimension* AddDuplicated(std::u16string_view rNewName);
167 sal_Int32 GetDupCount() const { return mnDupCount; }
169 sal_Int32 GetSourceDim(sal_Int32 nDim);
171 const css::uno::Sequence<css::sheet::MemberResult>*
172 GetMemberResults( const ScDPLevel* pLevel );
174 ScDPDimensions* GetDimensionsObject();
176 // XDimensionsSupplier
177 virtual css::uno::Reference< css::container::XNameAccess >
178 SAL_CALL getDimensions( ) override;
180 // XDataPilotResults
181 virtual css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult > > SAL_CALL getResults( ) override;
183 virtual css::uno::Sequence<double> SAL_CALL
184 getFilteredResults(
185 const css::uno::Sequence<css::sheet::DataPilotFieldFilter>& aFilters ) override;
187 // XRefreshable
188 virtual void SAL_CALL refresh() override;
189 virtual void SAL_CALL addRefreshListener( const css::uno::Reference< css::util::XRefreshListener >& l ) override;
190 virtual void SAL_CALL removeRefreshListener( const css::uno::Reference< css::util::XRefreshListener >& l ) override;
192 // XDrillDownDataSupplier
193 virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > >
194 SAL_CALL getDrillDownData(const css::uno::Sequence<
195 css::sheet::DataPilotFieldFilter >& aFilters ) override;
197 // XPropertySet
198 virtual css::uno::Reference< css::beans::XPropertySetInfo >
199 SAL_CALL getPropertySetInfo( ) override;
200 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
201 const css::uno::Any& aValue ) override;
202 virtual css::uno::Any SAL_CALL getPropertyValue(
203 const OUString& PropertyName ) override;
204 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
205 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
206 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
207 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
208 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
209 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
210 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
211 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
213 // XServiceInfo
214 virtual OUString SAL_CALL getImplementationName( ) override;
215 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
216 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
218 #if DUMP_PIVOT_TABLE
219 void DumpResults() const;
220 #endif
223 class ScDPDimensions final : public cppu::WeakImplHelper<
224 css::container::XNameAccess,
225 css::lang::XServiceInfo >
227 private:
228 ScDPSource* pSource;
229 sal_Int32 nDimCount;
230 std::unique_ptr<rtl::Reference<ScDPDimension>[]>
231 ppDims;
233 public:
234 ScDPDimensions( ScDPSource* pSrc );
235 virtual ~ScDPDimensions() override;
237 void CountChanged();
239 // XNameAccess
240 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
241 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
242 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
244 // XElementAccess
245 virtual css::uno::Type SAL_CALL getElementType() override;
246 virtual sal_Bool SAL_CALL hasElements() override;
248 // XServiceInfo
249 virtual OUString SAL_CALL getImplementationName( ) override;
250 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
251 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
253 tools::Long getCount() const;
254 ScDPDimension* getByIndex(tools::Long nIndex) const;
257 class ScDPDimension final : public cppu::WeakImplHelper<
258 css::sheet::XHierarchiesSupplier,
259 css::container::XNamed,
260 css::util::XCloneable,
261 css::beans::XPropertySet,
262 css::lang::XServiceInfo >
264 ScDPSource* pSource;
265 sal_Int32 nDim; // dimension index (== column ID)
266 rtl::Reference<ScDPHierarchies> mxHierarchies;
267 ScGeneralFunction nFunction;
268 OUString aName; // if empty, take from source
269 std::optional<OUString> mpLayoutName;
270 std::optional<OUString> mpSubtotalName;
271 sal_Int32 nSourceDim; // >=0 if dup'ed
272 css::sheet::DataPilotFieldReference
273 aReferenceValue; // settings for "show data as" / "displayed value"
274 bool bHasSelectedPage;
275 OUString aSelectedPage;
276 std::unique_ptr<ScDPItemData>
277 pSelectedData; // internal, temporary, created from aSelectedPage
278 bool mbHasHiddenMember;
280 public:
281 ScDPDimension( ScDPSource* pSrc, tools::Long nD );
282 virtual ~ScDPDimension() override;
283 ScDPDimension(const ScDPDimension&) = delete;
284 ScDPDimension& operator=(const ScDPDimension&) = delete;
286 sal_Int32 GetDimension() const { return nDim; } // dimension index in source
287 sal_Int32 GetSourceDim() const { return nSourceDim; } // >=0 if dup'ed
289 ScDPDimension* CreateCloneObject();
290 ScDPHierarchies* GetHierarchiesObject();
292 const std::optional<OUString> & GetLayoutName() const;
293 const std::optional<OUString> & GetSubtotalName() const;
295 // XNamed
296 virtual OUString SAL_CALL getName() override;
297 virtual void SAL_CALL setName( const OUString& aName ) override;
299 // XHierarchiesSupplier
300 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL
301 getHierarchies() override;
303 // XCloneable
304 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL
305 createClone() override;
307 // XPropertySet
308 virtual css::uno::Reference< css::beans::XPropertySetInfo >
309 SAL_CALL getPropertySetInfo( ) override;
310 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
311 const css::uno::Any& aValue ) override;
312 virtual css::uno::Any SAL_CALL getPropertyValue(
313 const OUString& PropertyName ) override;
314 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
315 const css::uno::Reference<
316 css::beans::XPropertyChangeListener >& xListener ) override;
317 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
318 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
319 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
320 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
321 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
322 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
324 // XServiceInfo
325 virtual OUString SAL_CALL getImplementationName( ) override;
326 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
327 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
329 css::sheet::DataPilotFieldOrientation getOrientation() const;
330 bool getIsDataLayoutDimension() const;
331 ScGeneralFunction getFunction() const { return nFunction;}
332 void setFunction(ScGeneralFunction nNew); // for data dimension
333 static tools::Long getUsedHierarchy() { return 0;}
335 bool HasSelectedPage() const { return bHasSelectedPage; }
336 const ScDPItemData& GetSelectedData();
338 const css::sheet::DataPilotFieldReference& GetReferenceValue() const { return aReferenceValue;}
341 class ScDPHierarchies final : public cppu::WeakImplHelper<
342 css::container::XNameAccess,
343 css::lang::XServiceInfo >
345 private:
346 ScDPSource* pSource;
347 sal_Int32 nDim;
348 // date columns have 3 hierarchies (flat/quarter/week), other columns only one
349 // #i52547# don't offer the incomplete date hierarchy implementation
350 static const tools::Long nHierCount = 1;
351 std::unique_ptr<rtl::Reference<ScDPHierarchy>[]>
352 ppHiers;
354 public:
355 ScDPHierarchies( ScDPSource* pSrc, tools::Long nD );
356 virtual ~ScDPHierarchies() override;
358 // XNameAccess
359 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
360 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
361 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
363 // XElementAccess
364 virtual css::uno::Type SAL_CALL getElementType() override;
365 virtual sal_Bool SAL_CALL hasElements() override;
367 // XServiceInfo
368 virtual OUString SAL_CALL getImplementationName( ) override;
369 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
370 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
372 static sal_Int32 getCount();
373 ScDPHierarchy* getByIndex(tools::Long nIndex) const;
376 class ScDPHierarchy final : public cppu::WeakImplHelper<
377 css::sheet::XLevelsSupplier,
378 css::container::XNamed,
379 css::lang::XServiceInfo >
381 private:
382 ScDPSource* pSource;
383 sal_Int32 nDim;
384 sal_Int32 nHier;
385 rtl::Reference<ScDPLevels> mxLevels;
387 public:
388 ScDPHierarchy( ScDPSource* pSrc, sal_Int32 nDim, sal_Int32 nHier );
389 virtual ~ScDPHierarchy() override;
391 ScDPLevels* GetLevelsObject();
393 // XNamed
394 virtual OUString SAL_CALL getName() override;
395 virtual void SAL_CALL setName( const OUString& aName ) override;
397 // XLevelsSupplier
398 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL
399 getLevels() override;
401 // XServiceInfo
402 virtual OUString SAL_CALL getImplementationName( ) override;
403 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
404 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
407 class ScDPLevels final : public cppu::WeakImplHelper<
408 css::container::XNameAccess,
409 css::lang::XServiceInfo >
411 private:
412 ScDPSource* pSource;
413 sal_Int32 nDim;
414 sal_Int32 nHier;
415 sal_Int32 nLevCount;
416 std::unique_ptr<rtl::Reference<ScDPLevel>[]>
417 ppLevs;
419 public:
420 ScDPLevels( ScDPSource* pSrc, sal_Int32 nDim, sal_Int32 nHier );
421 virtual ~ScDPLevels() override;
423 // XNameAccess
424 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
425 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
426 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
428 // XElementAccess
429 virtual css::uno::Type SAL_CALL getElementType() override;
430 virtual sal_Bool SAL_CALL hasElements() override;
432 // XServiceInfo
433 virtual OUString SAL_CALL getImplementationName( ) override;
434 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
435 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
437 sal_Int32 getCount() const;
438 ScDPLevel* getByIndex(sal_Int32 nIndex) const;
441 class ScDPLevel final : public cppu::WeakImplHelper<
442 css::sheet::XMembersSupplier,
443 css::container::XNamed,
444 css::sheet::XDataPilotMemberResults,
445 css::beans::XPropertySet,
446 css::lang::XServiceInfo >
448 private:
449 ScDPSource* pSource;
450 sal_Int32 nDim;
451 sal_Int32 nHier;
452 sal_Int32 nLev;
453 rtl::Reference<ScDPMembers> mxMembers;
454 css::uno::Sequence<sal_Int16> aSubTotals;
455 css::sheet::DataPilotFieldSortInfo aSortInfo; // stored user settings
456 css::sheet::DataPilotFieldAutoShowInfo aAutoShowInfo; // stored user settings
457 css::sheet::DataPilotFieldLayoutInfo aLayoutInfo; // stored user settings
458 // valid only from result calculation:
459 ::std::vector<sal_Int32> aGlobalOrder; // result of sorting by name or position
460 sal_Int32 nSortMeasure; // measure (index of data dimension) to sort by
461 sal_Int32 nAutoMeasure; // measure (index of data dimension) for AutoShow
462 bool bShowEmpty:1;
463 bool bEnableLayout:1; // enabled only for row fields, not for the innermost one
464 bool bRepeatItemLabels:1;
466 public:
467 ScDPLevel( ScDPSource* pSrc, sal_Int32 nDim, sal_Int32 nHier, sal_Int32 nLevel );
468 virtual ~ScDPLevel() override;
470 ScDPMembers* GetMembersObject();
472 // XNamed
473 virtual OUString SAL_CALL getName() override;
474 virtual void SAL_CALL setName( const OUString& aName ) override;
476 // XMembersSupplier
477 virtual css::uno::Reference< css::sheet::XMembersAccess > SAL_CALL
478 getMembers() override;
480 // XDataPilotMemberResults
481 virtual css::uno::Sequence< css::sheet::MemberResult > SAL_CALL
482 getResults() override;
484 // XPropertySet
485 virtual css::uno::Reference< css::beans::XPropertySetInfo >
486 SAL_CALL getPropertySetInfo( ) override;
487 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
488 const css::uno::Any& aValue ) override;
489 virtual css::uno::Any SAL_CALL getPropertyValue(
490 const OUString& PropertyName ) override;
491 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
492 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
493 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
494 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
495 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
496 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
497 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
498 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
500 // XServiceInfo
501 virtual OUString SAL_CALL getImplementationName( ) override;
502 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
503 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
505 css::uno::Sequence<sal_Int16> getSubTotals() const;
506 bool getShowEmpty() const { return bShowEmpty;}
507 bool getRepeatItemLabels() const { return bRepeatItemLabels; }
509 const css::sheet::DataPilotFieldSortInfo& GetSortInfo() const { return aSortInfo; }
510 const css::sheet::DataPilotFieldAutoShowInfo& GetAutoShow() const { return aAutoShowInfo; }
512 void EvaluateSortOrder();
513 void SetEnableLayout(bool bSet);
515 const ::std::vector<sal_Int32>& GetGlobalOrder() const { return aGlobalOrder; }
516 ::std::vector<sal_Int32>& GetGlobalOrder() { return aGlobalOrder; }
517 sal_Int32 GetSortMeasure() const { return nSortMeasure; }
518 sal_Int32 GetAutoMeasure() const { return nAutoMeasure; }
520 bool IsOutlineLayout() const
522 return bEnableLayout &&
523 aLayoutInfo.LayoutMode !=
524 css::sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT;
527 bool IsSubtotalsAtTop() const
529 return bEnableLayout &&
530 (aLayoutInfo.LayoutMode ==
531 css::sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_TOP ||
532 aLayoutInfo.LayoutMode ==
533 css::sheet::DataPilotFieldLayoutMode::COMPACT_LAYOUT);
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 final : 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 sal_Int32 nDim;
555 sal_Int32 nHier;
556 sal_Int32 nLev;
557 sal_Int32 nMbrCount;
558 mutable MembersType maMembers;
559 mutable ScDPMembersHashMap aHashMap;
561 public:
562 ScDPMembers( ScDPSource* pSrc, sal_Int32 nDim, sal_Int32 nHier, sal_Int32 nLev );
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 sal_Int32 getCount() const { return nMbrCount;}
583 ScDPMember* getByIndex(sal_Int32 nIndex) const;
585 sal_Int32 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 final : public cppu::WeakImplHelper<
596 css::container::XNamed,
597 css::beans::XPropertySet,
598 css::lang::XServiceInfo >
600 private:
601 ScDPSource* pSource;
602 sal_Int32 nDim;
603 sal_Int32 nHier;
604 sal_Int32 nLev;
606 SCROW mnDataId;
607 std::optional<OUString> mpLayoutName;
609 sal_Int32 nPosition; // manual sorting
610 bool bVisible;
611 bool bShowDet;
613 public:
614 ScDPMember(ScDPSource* pSrc, sal_Int32 nDim, sal_Int32 nHier, sal_Int32 nLev, 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 std::optional<OUString> & GetLayoutName() const;
626 tools::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 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */