Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / dptabsrc.hxx
blob84f4513e0c09d0a4a174ea5bc90d99c6522a254c
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/MemberResult.hpp>
30 #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
31 #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
32 #include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
33 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
34 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
35 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
36 #include <com/sun/star/util/XRefreshable.hpp>
37 #include <com/sun/star/sheet/XDrillDownDataSupplier.hpp>
38 #include <com/sun/star/util/XCloneable.hpp>
39 #include <com/sun/star/beans/XPropertySet.hpp>
40 #include <com/sun/star/lang/XServiceInfo.hpp>
41 #include <com/sun/star/container/XNamed.hpp>
42 #include <cppuhelper/implbase.hxx>
43 #include <rtl/ref.hxx>
45 #include "dptabdat.hxx"
46 #include "dpresfilter.hxx"
48 #include <memory>
49 #include <unordered_map>
50 #include <unordered_set>
51 #include <vector>
52 #include <boost/optional.hpp>
54 namespace com { namespace sun { namespace star {
55 namespace sheet {
56 struct DataPilotFieldFilter;
58 namespace table {
59 struct CellAddress;
61 }}}
63 class ScDPResultMember;
64 class ScDPResultData;
65 class ScDPItemData;
66 class ScDPDimensions;
67 class ScDPDimension;
68 class ScDPHierarchies;
69 class ScDPHierarchy;
70 class ScDPLevels;
71 class ScDPLevel;
72 class ScDPMembers;
73 class ScDPMember;
74 enum class ScGeneralFunction;
76 // implementation of DataPilotSource using ScDPTableData
78 class ScDPSource : public cppu::WeakImplHelper<
79 css::sheet::XDimensionsSupplier,
80 css::sheet::XDataPilotResults,
81 css::util::XRefreshable,
82 css::sheet::XDrillDownDataSupplier,
83 css::beans::XPropertySet,
84 css::lang::XServiceInfo >
86 private:
87 ScDPTableData* pData; // data source (ScDPObject manages its life time)
88 rtl::Reference<ScDPDimensions> pDimensions; // api objects
89 // settings:
91 std::vector<long> maColDims;
92 std::vector<long> maRowDims;
93 std::vector<long> maDataDims;
94 std::vector<long> maPageDims;
95 ScDPResultTree maResFilterSet;
97 bool bColumnGrand;
98 bool bRowGrand;
99 bool bIgnoreEmptyRows;
100 bool bRepeatIfEmpty;
102 long nDupCount;
104 // results:
105 std::unique_ptr<ScDPResultData> pResData; // keep the rest in this!
106 std::unique_ptr<ScDPResultMember> pColResRoot;
107 std::unique_ptr<ScDPResultMember> pRowResRoot;
108 std::unique_ptr<css::uno::Sequence<css::sheet::MemberResult>[]> pColResults;
109 std::unique_ptr<css::uno::Sequence<css::sheet::MemberResult>[]> pRowResults;
110 std::vector<ScDPLevel*> aColLevelList;
111 std::vector<ScDPLevel*> aRowLevelList;
112 bool bResultOverflow;
113 bool bPageFiltered; // set if page field filters have been applied to cache table
115 boost::optional<OUString> mpGrandTotalName;
117 void CreateRes_Impl();
118 void FillMemberResults();
119 void FillLevelList( css::sheet::DataPilotFieldOrientation nOrientation, std::vector<ScDPLevel*> &rList );
120 void FillCalcInfo(bool bIsRow, ScDPTableData::CalcInfo& rInfo, bool &bHasAutoShow);
123 * Compile a list of dimension indices that are either, column, row or
124 * page dimensions (i.e. all but data dimensions).
126 void GetCategoryDimensionIndices(std::unordered_set<sal_Int32>& rCatDims);
129 * Set visibilities of individual rows in the cache table based on the
130 * page field data.
132 void FilterCacheByPageDimensions();
134 void SetDupCount( long nNew );
136 OUString getDataDescription(); //! ???
138 void setIgnoreEmptyRows(bool bSet);
139 void setRepeatIfEmpty(bool bSet);
141 void disposeData();
143 public:
144 ScDPSource( ScDPTableData* pD );
145 virtual ~ScDPSource() override;
147 ScDPTableData* GetData() { return pData; }
148 const ScDPTableData* GetData() const { return pData; }
150 const boost::optional<OUString> &
151 GetGrandTotalName() const;
153 css::sheet::DataPilotFieldOrientation
154 GetOrientation(long nColumn);
155 void SetOrientation(long nColumn, css::sheet::DataPilotFieldOrientation nNew);
156 long GetPosition(long nColumn);
158 long GetDataDimensionCount();
159 ScDPDimension* GetDataDimension(long nIndex);
160 OUString GetDataDimName(long nIndex);
161 const ScDPCache* GetCache();
162 const ScDPItemData* GetItemDataById( long nDim, long nId );
163 bool IsDataLayoutDimension(long nDim);
164 css::sheet::DataPilotFieldOrientation
165 GetDataLayoutOrientation();
167 bool IsDateDimension(long nDim);
169 bool SubTotalAllowed(long nColumn); //! move to ScDPResultData
171 ScDPDimension* AddDuplicated(const OUString& rNewName);
172 long GetDupCount() const { return nDupCount; }
174 long GetSourceDim(long nDim);
176 const css::uno::Sequence<css::sheet::MemberResult>*
177 GetMemberResults( const ScDPLevel* pLevel );
179 ScDPDimensions* GetDimensionsObject();
181 // XDimensionsSupplier
182 virtual css::uno::Reference< css::container::XNameAccess >
183 SAL_CALL getDimensions( ) override;
185 // XDataPilotResults
186 virtual css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult > > SAL_CALL getResults( ) override;
188 virtual css::uno::Sequence<double> SAL_CALL
189 getFilteredResults(
190 const css::uno::Sequence<css::sheet::DataPilotFieldFilter>& aFilters ) override;
192 // XRefreshable
193 virtual void SAL_CALL refresh() override;
194 virtual void SAL_CALL addRefreshListener( const css::uno::Reference< css::util::XRefreshListener >& l ) override;
195 virtual void SAL_CALL removeRefreshListener( const css::uno::Reference< css::util::XRefreshListener >& l ) override;
197 // XDrillDownDataSupplier
198 virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > >
199 SAL_CALL getDrillDownData(const css::uno::Sequence<
200 css::sheet::DataPilotFieldFilter >& aFilters ) override;
202 // XPropertySet
203 virtual css::uno::Reference< css::beans::XPropertySetInfo >
204 SAL_CALL getPropertySetInfo( ) override;
205 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
206 const css::uno::Any& aValue ) override;
207 virtual css::uno::Any SAL_CALL getPropertyValue(
208 const OUString& PropertyName ) override;
209 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
210 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
211 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
212 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
213 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
214 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
215 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
216 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
218 // XServiceInfo
219 virtual OUString SAL_CALL getImplementationName( ) override;
220 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
221 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
223 #if DUMP_PIVOT_TABLE
224 void DumpResults() const;
225 #endif
228 class ScDPDimensions : public cppu::WeakImplHelper<
229 css::container::XNameAccess,
230 css::lang::XServiceInfo >
232 private:
233 ScDPSource* pSource;
234 long nDimCount;
235 std::unique_ptr<rtl::Reference<ScDPDimension>[]>
236 ppDims;
238 public:
239 ScDPDimensions( ScDPSource* pSrc );
240 virtual ~ScDPDimensions() override;
242 void CountChanged();
244 // XNameAccess
245 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
246 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
247 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
249 // XElementAccess
250 virtual css::uno::Type SAL_CALL getElementType() override;
251 virtual sal_Bool SAL_CALL hasElements() override;
253 // XServiceInfo
254 virtual OUString SAL_CALL getImplementationName( ) override;
255 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
256 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
258 long getCount() const;
259 ScDPDimension* getByIndex(long nIndex) const;
262 class ScDPDimension : public cppu::WeakImplHelper<
263 css::sheet::XHierarchiesSupplier,
264 css::container::XNamed,
265 css::util::XCloneable,
266 css::beans::XPropertySet,
267 css::lang::XServiceInfo >
269 ScDPSource* pSource;
270 long nDim; // dimension index (== column ID)
271 rtl::Reference<ScDPHierarchies> mxHierarchies;
272 ScGeneralFunction nFunction;
273 OUString aName; // if empty, take from source
274 boost::optional<OUString> mpLayoutName;
275 boost::optional<OUString> mpSubtotalName;
276 long nSourceDim; // >=0 if dup'ed
277 css::sheet::DataPilotFieldReference
278 aReferenceValue; // settings for "show data as" / "displayed value"
279 bool bHasSelectedPage;
280 OUString aSelectedPage;
281 std::unique_ptr<ScDPItemData>
282 pSelectedData; // internal, temporary, created from aSelectedPage
283 bool mbHasHiddenMember;
285 public:
286 ScDPDimension( ScDPSource* pSrc, long nD );
287 virtual ~ScDPDimension() override;
288 ScDPDimension(const ScDPDimension&) = delete;
289 ScDPDimension& operator=(const ScDPDimension&) = delete;
291 long GetDimension() const { return nDim; } // dimension index in source
292 long GetSourceDim() const { return nSourceDim; } // >=0 if dup'ed
294 ScDPDimension* CreateCloneObject();
295 ScDPHierarchies* GetHierarchiesObject();
297 SC_DLLPUBLIC const boost::optional<OUString> & GetLayoutName() const;
298 const boost::optional<OUString> & GetSubtotalName() const;
300 // XNamed
301 virtual OUString SAL_CALL getName() override;
302 virtual void SAL_CALL setName( const OUString& aName ) override;
304 // XHierarchiesSupplier
305 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL
306 getHierarchies() override;
308 // XCloneable
309 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL
310 createClone() override;
312 // XPropertySet
313 virtual css::uno::Reference< css::beans::XPropertySetInfo >
314 SAL_CALL getPropertySetInfo( ) override;
315 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
316 const css::uno::Any& aValue ) override;
317 virtual css::uno::Any SAL_CALL getPropertyValue(
318 const OUString& PropertyName ) override;
319 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
320 const css::uno::Reference<
321 css::beans::XPropertyChangeListener >& xListener ) override;
322 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
323 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
324 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
325 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
326 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
327 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
329 // XServiceInfo
330 virtual OUString SAL_CALL getImplementationName( ) override;
331 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
332 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
334 css::sheet::DataPilotFieldOrientation getOrientation() const;
335 bool getIsDataLayoutDimension() const;
336 ScGeneralFunction getFunction() const { return nFunction;}
337 void setFunction(ScGeneralFunction nNew); // for data dimension
338 static long getUsedHierarchy() { return 0;}
340 bool HasSelectedPage() const { return bHasSelectedPage; }
341 const ScDPItemData& GetSelectedData();
343 const css::sheet::DataPilotFieldReference& GetReferenceValue() const { return aReferenceValue;}
346 class ScDPHierarchies : public cppu::WeakImplHelper<
347 css::container::XNameAccess,
348 css::lang::XServiceInfo >
350 private:
351 ScDPSource* pSource;
352 long nDim;
353 // date columns have 3 hierarchies (flat/quarter/week), other columns only one
354 // #i52547# don't offer the incomplete date hierarchy implementation
355 static const long nHierCount = 1;
356 std::unique_ptr<rtl::Reference<ScDPHierarchy>[]>
357 ppHiers;
359 public:
360 ScDPHierarchies( ScDPSource* pSrc, long nD );
361 virtual ~ScDPHierarchies() override;
363 // XNameAccess
364 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
365 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
366 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
368 // XElementAccess
369 virtual css::uno::Type SAL_CALL getElementType() override;
370 virtual sal_Bool SAL_CALL hasElements() override;
372 // XServiceInfo
373 virtual OUString SAL_CALL getImplementationName( ) override;
374 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
375 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
377 static long getCount();
378 ScDPHierarchy* getByIndex(long nIndex) const;
381 class ScDPHierarchy : public cppu::WeakImplHelper<
382 css::sheet::XLevelsSupplier,
383 css::container::XNamed,
384 css::lang::XServiceInfo >
386 private:
387 ScDPSource* pSource;
388 long nDim;
389 long nHier;
390 rtl::Reference<ScDPLevels> mxLevels;
392 public:
393 ScDPHierarchy( ScDPSource* pSrc, long nD, long nH );
394 virtual ~ScDPHierarchy() override;
396 ScDPLevels* GetLevelsObject();
398 // XNamed
399 virtual OUString SAL_CALL getName() override;
400 virtual void SAL_CALL setName( const OUString& aName ) override;
402 // XLevelsSupplier
403 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL
404 getLevels() override;
406 // XServiceInfo
407 virtual OUString SAL_CALL getImplementationName( ) override;
408 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
409 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
412 class ScDPLevels : public cppu::WeakImplHelper<
413 css::container::XNameAccess,
414 css::lang::XServiceInfo >
416 private:
417 ScDPSource* pSource;
418 long nDim;
419 long nHier;
420 long nLevCount;
421 std::unique_ptr<rtl::Reference<ScDPLevel>[]>
422 ppLevs;
424 public:
425 ScDPLevels( ScDPSource* pSrc, long nD, long nH );
426 virtual ~ScDPLevels() override;
428 // XNameAccess
429 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
430 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
431 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
433 // XElementAccess
434 virtual css::uno::Type SAL_CALL getElementType() override;
435 virtual sal_Bool SAL_CALL hasElements() override;
437 // XServiceInfo
438 virtual OUString SAL_CALL getImplementationName( ) override;
439 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
440 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
442 long getCount() const;
443 ScDPLevel* getByIndex(long nIndex) const;
446 class ScDPLevel : public cppu::WeakImplHelper<
447 css::sheet::XMembersSupplier,
448 css::container::XNamed,
449 css::sheet::XDataPilotMemberResults,
450 css::beans::XPropertySet,
451 css::lang::XServiceInfo >
453 private:
454 ScDPSource* pSource;
455 long nDim;
456 long nHier;
457 long nLev;
458 rtl::Reference<ScDPMembers> mxMembers;
459 css::uno::Sequence<sal_Int16> aSubTotals;
460 css::sheet::DataPilotFieldSortInfo aSortInfo; // stored user settings
461 css::sheet::DataPilotFieldAutoShowInfo aAutoShowInfo; // stored user settings
462 css::sheet::DataPilotFieldLayoutInfo aLayoutInfo; // stored user settings
463 // valid only from result calculation:
464 ::std::vector<sal_Int32> aGlobalOrder; // result of sorting by name or position
465 long nSortMeasure; // measure (index of data dimension) to sort by
466 long nAutoMeasure; // measure (index of data dimension) for AutoShow
467 bool bShowEmpty:1;
468 bool bEnableLayout:1; // enabled only for row fields, not for the innermost one
469 bool bRepeatItemLabels:1;
471 public:
472 ScDPLevel( ScDPSource* pSrc, long nD, long nH, long nL );
473 virtual ~ScDPLevel() override;
475 ScDPMembers* GetMembersObject();
477 // XNamed
478 virtual OUString SAL_CALL getName() override;
479 virtual void SAL_CALL setName( const OUString& aName ) override;
481 // XMembersSupplier
482 virtual css::uno::Reference< css::sheet::XMembersAccess > SAL_CALL
483 getMembers() override;
485 // XDataPilotMemberResults
486 virtual css::uno::Sequence< css::sheet::MemberResult > SAL_CALL
487 getResults() override;
489 // XPropertySet
490 virtual css::uno::Reference< css::beans::XPropertySetInfo >
491 SAL_CALL getPropertySetInfo( ) override;
492 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
493 const css::uno::Any& aValue ) override;
494 virtual css::uno::Any SAL_CALL getPropertyValue(
495 const OUString& PropertyName ) override;
496 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
497 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
498 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
499 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
500 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
501 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
502 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
503 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
505 // XServiceInfo
506 virtual OUString SAL_CALL getImplementationName( ) override;
507 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
508 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
510 css::uno::Sequence<sal_Int16> getSubTotals() const;
511 bool getShowEmpty() const { return bShowEmpty;}
512 bool getRepeatItemLabels() const { return bRepeatItemLabels; }
514 const css::sheet::DataPilotFieldSortInfo& GetSortInfo() const { return aSortInfo; }
515 const css::sheet::DataPilotFieldAutoShowInfo& GetAutoShow() const { return aAutoShowInfo; }
517 void EvaluateSortOrder();
518 void SetEnableLayout(bool bSet);
520 const ::std::vector<sal_Int32>& GetGlobalOrder() const { return aGlobalOrder; }
521 ::std::vector<sal_Int32>& GetGlobalOrder() { return aGlobalOrder; }
522 long GetSortMeasure() const { return nSortMeasure; }
523 long GetAutoMeasure() const { return nAutoMeasure; }
525 bool IsOutlineLayout() const
527 return bEnableLayout &&
528 aLayoutInfo.LayoutMode !=
529 css::sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT;
532 bool IsSubtotalsAtTop() const
534 return bEnableLayout &&
535 aLayoutInfo.LayoutMode ==
536 css::sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_TOP;
539 bool IsAddEmpty() const
541 return bEnableLayout && aLayoutInfo.AddEmptyLines;
544 //! number format (for data fields and date fields)
547 // hash map from name to index in the member array, for fast name access
548 typedef std::unordered_map< OUString, sal_Int32 > ScDPMembersHashMap;
550 class ScDPMembers : public cppu::WeakImplHelper<
551 css::sheet::XMembersAccess,
552 css::lang::XServiceInfo >
554 private:
555 typedef std::vector<rtl::Reference<ScDPMember> > MembersType;
556 ScDPSource* pSource;
557 long nDim;
558 long nHier;
559 long nLev;
560 long nMbrCount;
561 mutable MembersType maMembers;
562 mutable ScDPMembersHashMap aHashMap;
564 public:
565 ScDPMembers( ScDPSource* pSrc, long nD, long nH, long nL );
566 virtual ~ScDPMembers() override;
568 // XMembersAccess
569 virtual css::uno::Sequence< OUString > SAL_CALL getLocaleIndependentElementNames() override;
571 // XNameAccess
572 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
573 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
574 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
576 // XElementAccess
577 virtual css::uno::Type SAL_CALL getElementType() override;
578 virtual sal_Bool SAL_CALL hasElements() override;
580 // XServiceInfo
581 virtual OUString SAL_CALL getImplementationName( ) override;
582 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
583 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
585 long getCount() const { return nMbrCount;}
586 ScDPMember* getByIndex(long nIndex) const;
588 long getMinMembers() const;
590 sal_Int32 GetIndexFromName( const OUString& rName ) const; // <0 if not found
591 const ScDPItemData* GetSrcItemDataByIndex( SCROW nIndex);
593 private:
594 /// @throws css::uno::RuntimeException
595 css::uno::Sequence< OUString > getElementNames( bool bLocaleIndependent ) const;
598 class ScDPMember : public cppu::WeakImplHelper<
599 css::container::XNamed,
600 css::beans::XPropertySet,
601 css::lang::XServiceInfo >
603 private:
604 ScDPSource* pSource;
605 long nDim;
606 long nHier;
607 long nLev;
609 SCROW mnDataId;
610 boost::optional<OUString> mpLayoutName;
612 sal_Int32 nPosition; // manual sorting
613 bool bVisible;
614 bool bShowDet;
616 public:
617 ScDPMember(ScDPSource* pSrc, long nD, long nH, long nL, SCROW nIndex);
618 virtual ~ScDPMember() override;
619 ScDPMember(const ScDPMember&) = delete;
620 ScDPMember& operator=(const ScDPMember&) = delete;
622 OUString GetNameStr( bool bLocaleIndependent ) const;
623 ScDPItemData FillItemData() const;
624 const ScDPItemData* GetItemData() const;
625 SCROW GetItemDataId() const { return mnDataId; }
626 bool IsNamedItem(SCROW nIndex) const;
628 SC_DLLPUBLIC const boost::optional<OUString> & GetLayoutName() const;
629 long GetDim() const { return nDim;}
631 sal_Int32 Compare( const ScDPMember& rOther ) const; // visible order
633 // XNamed
634 virtual OUString SAL_CALL getName() override;
635 virtual void SAL_CALL setName( const OUString& aName ) override;
637 // XPropertySet
638 virtual css::uno::Reference< css::beans::XPropertySetInfo >
639 SAL_CALL getPropertySetInfo( ) override;
640 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
641 const css::uno::Any& aValue ) override;
642 virtual css::uno::Any SAL_CALL getPropertyValue(
643 const OUString& PropertyName ) override;
644 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
645 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
646 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
647 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
648 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
649 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
650 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
651 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
653 // XServiceInfo
654 virtual OUString SAL_CALL getImplementationName( ) override;
655 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
656 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
658 bool isVisible() const { return bVisible;}
659 bool getShowDetails() const { return bShowDet;}
662 #endif
664 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */