Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / inc / dapiuno.hxx
blob88c24ce1a4dc5894383971dbe26b5a8ffcc76b1d
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 "cellsuno.hxx"
23 #include "dpglobal.hxx"
25 #include <svl/lstner.hxx>
26 #include <svl/itemprop.hxx>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <com/sun/star/beans/XPropertySet.hpp>
30 #include <com/sun/star/container/XEnumerationAccess.hpp>
31 #include <com/sun/star/container/XNameContainer.hpp>
32 #include <com/sun/star/util/XModifyBroadcaster.hpp>
34 #include <com/sun/star/sheet/DataPilotFieldGroupInfo.hpp>
35 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
36 #include <com/sun/star/sheet/XDataPilotDataLayoutFieldSupplier.hpp>
37 #include <com/sun/star/sheet/XDataPilotDescriptor.hpp>
38 #include <com/sun/star/sheet/XDataPilotField.hpp>
39 #include <com/sun/star/sheet/XDataPilotFieldGrouping.hpp>
40 #include <com/sun/star/sheet/XDataPilotTable2.hpp>
41 #include <com/sun/star/sheet/XDataPilotTables.hpp>
43 #include <cppuhelper/implbase.hxx>
45 #include <memory>
46 #include <utility>
47 #include <vector>
49 namespace com::sun::star::sheet { struct DataPilotFieldAutoShowInfo; }
50 namespace com::sun::star::sheet { class XMembersAccess; }
51 namespace com::sun::star::sheet { struct DataPilotFieldLayoutInfo; }
52 namespace com::sun::star::sheet { struct DataPilotFieldReference; }
53 namespace com::sun::star::sheet { struct DataPilotFieldSortInfo; }
56 class ScDocShell;
57 class ScDPSaveDimension;
58 struct ScDPNumGroupInfo;
60 class ScDataPilotTableObj;
61 class ScDataPilotFieldObj;
62 class ScDataPilotItemObj;
63 enum class ScGeneralFunction;
64 class ScDPObject;
66 class ScDataPilotConversion
68 public:
69 static ScGeneralFunction FirstFunc( PivotFunc nBits );
70 static PivotFunc FunctionBit( sal_Int16 eFunc );
72 static void FillGroupInfo(
73 css::sheet::DataPilotFieldGroupInfo& rInfo,
74 const ScDPNumGroupInfo& rGroupInfo );
77 /** DataPilotTables collection per sheet. */
78 class ScDataPilotTablesObj final : public cppu::WeakImplHelper<
79 css::sheet::XDataPilotTables,
80 css::container::XEnumerationAccess,
81 css::container::XIndexAccess,
82 css::lang::XServiceInfo>,
83 public SfxListener
85 private:
86 ScDocShell* pDocShell;
87 SCTAB nTab;
89 rtl::Reference<ScDataPilotTableObj> GetObjectByIndex_Impl( sal_Int32 nIndex );
90 rtl::Reference<ScDataPilotTableObj> GetObjectByName_Impl(const OUString& aName);
92 public:
93 ScDataPilotTablesObj(ScDocShell& rDocSh, SCTAB nT);
94 virtual ~ScDataPilotTablesObj() override;
96 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
98 // XDataPilotTables
99 virtual css::uno::Reference< css::sheet::XDataPilotDescriptor > SAL_CALL
100 createDataPilotDescriptor() override;
101 virtual void SAL_CALL insertNewByName( const OUString& aName,
102 const css::table::CellAddress& aOutputAddress,
103 const css::uno::Reference< css::sheet::XDataPilotDescriptor >& xDescriptor ) override;
104 virtual void SAL_CALL removeByName( const OUString& aName ) override;
106 // XNameAccess
107 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
108 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
109 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
111 // XIndexAccess
112 virtual sal_Int32 SAL_CALL getCount() override;
113 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
115 // XEnumerationAccess
116 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
117 createEnumeration() override;
119 // XElementAccess
120 virtual css::uno::Type SAL_CALL getElementType() override;
121 virtual sal_Bool SAL_CALL hasElements() override;
123 // XServiceInfo
124 virtual OUString SAL_CALL getImplementationName() override;
125 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
126 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
129 // ScDataPilotDescriptorBase is never instantiated directly
130 class SC_DLLPUBLIC ScDataPilotDescriptorBase : public cppu::WeakImplHelper<
131 css::sheet::XDataPilotDescriptor,
132 css::beans::XPropertySet,
133 css::sheet::XDataPilotDataLayoutFieldSupplier,
134 css::lang::XServiceInfo>,
135 public SfxListener
137 private:
138 SfxItemPropertySet maPropSet;
139 ScDocShell* pDocShell;
141 public:
142 ScDataPilotDescriptorBase(ScDocShell& rDocSh);
143 virtual ~ScDataPilotDescriptorBase() override;
145 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
147 ScDocShell* GetDocShell() const { return pDocShell; }
149 // in the derivatives:
150 virtual ScDPObject* GetDPObject() const = 0;
151 virtual void SetDPObject(ScDPObject* pDPObj) = 0;
153 // XDataPilotDescriptor
154 // getName, setName, getTag, setTag in derived classes
156 virtual css::table::CellRangeAddress SAL_CALL getSourceRange() override;
157 virtual void SAL_CALL setSourceRange( const css::table::CellRangeAddress& aSourceRange ) override;
158 virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL
159 getFilterDescriptor() override;
160 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
161 getDataPilotFields() override;
162 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
163 getColumnFields() override;
164 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
165 getRowFields() override;
166 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
167 getPageFields() override;
168 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
169 getDataFields() override;
170 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
171 getHiddenFields() override;
173 // XPropertySet
174 virtual css::uno::Reference< css::beans::XPropertySetInfo >
175 SAL_CALL getPropertySetInfo( ) override;
176 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
177 const css::uno::Any& aValue ) override;
178 virtual css::uno::Any SAL_CALL getPropertyValue(
179 const OUString& PropertyName ) override;
180 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
181 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
182 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
183 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
184 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
185 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
186 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
187 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
189 // XDataPilotDataLayoutFieldSupplier
190 virtual css::uno::Reference< css::sheet::XDataPilotField >
191 SAL_CALL getDataLayoutField() override;
193 // XServiceInfo is in derived classes
196 class ScDataPilotDescriptor final : public ScDataPilotDescriptorBase
198 private:
199 std::unique_ptr<ScDPObject> mpDPObject;
201 public:
202 ScDataPilotDescriptor(ScDocShell& rDocSh);
203 virtual ~ScDataPilotDescriptor() override;
205 virtual ScDPObject* GetDPObject() const override;
206 virtual void SetDPObject(ScDPObject* pDPObj) override;
208 // rest of XDataPilotDescriptor (incl. XNamed)
209 virtual OUString SAL_CALL getName() override;
210 virtual void SAL_CALL setName( const OUString& aName ) override;
211 virtual OUString SAL_CALL getTag() override;
212 virtual void SAL_CALL setTag( const OUString& aTag ) override;
214 // XServiceInfo
215 virtual OUString SAL_CALL getImplementationName() override;
216 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
217 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
220 class ScDataPilotTableObj final : public ScDataPilotDescriptorBase,
221 public css::sheet::XDataPilotTable2,
222 public css::util::XModifyBroadcaster
224 private:
225 SCTAB nTab;
226 OUString aName;
227 XModifyListenerArr_Impl aModifyListeners;
229 void Refreshed_Impl();
231 public:
232 ScDataPilotTableObj(ScDocShell& rDocSh, SCTAB nT, OUString aN);
233 virtual ~ScDataPilotTableObj() override;
235 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
236 virtual void SAL_CALL acquire() noexcept override;
237 virtual void SAL_CALL release() noexcept override;
239 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
241 virtual ScDPObject* GetDPObject() const override;
242 virtual void SetDPObject(ScDPObject* pDPObj) override;
244 // rest of XDataPilotDescriptor (incl. XNamed)
245 virtual OUString SAL_CALL getName() override;
246 virtual void SAL_CALL setName( const OUString& aName ) override;
247 virtual OUString SAL_CALL getTag() override;
248 virtual void SAL_CALL setTag( const OUString& aTag ) override;
250 // XDataPilotTable
251 virtual css::table::CellRangeAddress SAL_CALL getOutputRange() override;
252 virtual void SAL_CALL refresh() override;
254 // XDataPilotTable2
255 virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > >
256 SAL_CALL getDrillDownData(const css::table::CellAddress& aAddr) override;
258 virtual css::sheet::DataPilotTablePositionData
259 SAL_CALL getPositionData(const css::table::CellAddress& aAddr) override;
261 virtual void SAL_CALL insertDrillDownSheet(const css::table::CellAddress& aAddr) override;
263 virtual css::table::CellRangeAddress SAL_CALL getOutputRangeByType( sal_Int32 nType ) override;
265 // XModifyBroadcaster
266 virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
267 virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
269 // XTypeProvider (override)
270 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
271 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
273 // XServiceInfo
274 virtual OUString SAL_CALL getImplementationName() override;
275 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
276 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
279 struct ScFieldIdentifier
281 OUString maFieldName; /// Source field name.
282 sal_Int32 mnFieldIdx; /// Field index (if several fields with same name exist).
283 bool mbDataLayout; /// True = data layout field collecting all data fields as items.
285 explicit ScFieldIdentifier() :
286 mnFieldIdx( 0 ), mbDataLayout( false ) {}
288 explicit ScFieldIdentifier( OUString aFieldName, bool bDataLayout ) :
289 maFieldName(std::move( aFieldName )), mnFieldIdx( 0 ), mbDataLayout( bDataLayout ) {}
292 /** Base class of all implementation objects based on a DataPilot descriptor
293 or DataPilot table object. Wraps acquiring and releasing the parent. */
294 class ScDataPilotChildObjBase
296 protected:
297 explicit ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent );
298 explicit ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent, ScFieldIdentifier aFieldId );
299 virtual ~ScDataPilotChildObjBase();
301 /** Returns the wrapped DataPilot object (calls GetDPObject() at parent). */
302 ScDPObject* GetDPObject() const;
303 /** Sets the passed DataPilot object (calls SetDPObject() at parent). */
304 void SetDPObject( ScDPObject* pDPObject );
306 /** Returns the DataPilot dimension object related to the field described by maFieldId. */
307 ScDPSaveDimension* GetDPDimension( ScDPObject** ppDPObject = nullptr ) const;
309 /** Returns the number of members for the field described by maFieldId. */
310 sal_Int32 GetMemberCount() const;
311 /** Returns the collection of members for the field described by maFieldId. */
312 css::uno::Reference< css::sheet::XMembersAccess > GetMembers() const;
314 ScDocShell* GetDocShell() const;
315 protected:
316 rtl::Reference<ScDataPilotDescriptorBase> mxParent;
317 ScFieldIdentifier maFieldId;
319 private:
320 ScDataPilotChildObjBase& operator=( const ScDataPilotChildObjBase& ) = delete;
323 typedef ::cppu::WeakImplHelper
325 css::container::XEnumerationAccess,
326 css::container::XIndexAccess,
327 css::container::XNameAccess,
328 css::lang::XServiceInfo
330 ScDataPilotFieldsObjImpl;
332 /** Collection of all DataPilot fields, or of all fields from a specific dimension. */
333 class ScDataPilotFieldsObj final : public ScDataPilotChildObjBase, public ScDataPilotFieldsObjImpl
335 public:
336 explicit ScDataPilotFieldsObj(
337 ScDataPilotDescriptorBase& rParent );
339 explicit ScDataPilotFieldsObj(
340 ScDataPilotDescriptorBase& rParent,
341 css::sheet::DataPilotFieldOrientation eOrient );
343 virtual ~ScDataPilotFieldsObj() override;
345 // XNameAccess
346 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
347 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
348 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
350 // XIndexAccess
351 virtual sal_Int32 SAL_CALL getCount() override;
352 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
354 // XEnumerationAccess
355 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
356 createEnumeration() override;
358 // XElementAccess
359 virtual css::uno::Type SAL_CALL getElementType() override;
360 virtual sal_Bool SAL_CALL hasElements() override;
362 // XServiceInfo
363 virtual OUString SAL_CALL getImplementationName() override;
364 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
365 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
367 private:
368 rtl::Reference<ScDataPilotFieldObj> GetObjectByIndex_Impl( sal_Int32 nIndex ) const;
369 rtl::Reference<ScDataPilotFieldObj> GetObjectByName_Impl( const OUString& rName ) const;
371 private:
372 css::uno::Any maOrient; /// Field orientation, no value = all fields.
375 typedef ::cppu::WeakImplHelper
377 css::container::XNamed,
378 css::beans::XPropertySet,
379 css::sheet::XDataPilotField,
380 css::sheet::XDataPilotFieldGrouping,
381 css::lang::XServiceInfo
383 ScDataPilotFieldObjImpl;
385 /** Implementation of a single DataPilot field. */
386 class ScDataPilotFieldObj final : public ScDataPilotChildObjBase, public ScDataPilotFieldObjImpl
388 public:
389 ScDataPilotFieldObj(
390 ScDataPilotDescriptorBase& rParent,
391 const ScFieldIdentifier& rIdent );
393 ScDataPilotFieldObj(
394 ScDataPilotDescriptorBase& rParent,
395 const ScFieldIdentifier& rIdent,
396 css::uno::Any aOrient );
398 virtual ~ScDataPilotFieldObj() override;
400 // XNamed
401 virtual OUString SAL_CALL getName() override;
402 virtual void SAL_CALL setName(const OUString& aName) override;
404 // XPropertySet
405 virtual css::uno::Reference< css::beans::XPropertySetInfo >
406 SAL_CALL getPropertySetInfo( ) override;
407 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
408 const css::uno::Any& aValue ) override;
409 virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& PropertyName ) override;
410 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
411 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
412 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
413 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
414 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
415 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
416 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
417 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
419 // XDatePilotField
420 virtual css::uno::Reference<css::container::XIndexAccess> SAL_CALL
421 getItems() override;
423 // only called from property-functions:
424 css::sheet::DataPilotFieldOrientation getOrientation() const;
425 void setOrientation(css::sheet::DataPilotFieldOrientation Orientation);
426 sal_Int16 getFunction() const;
427 void setFunction(ScGeneralFunction Function);
428 css::uno::Sequence< sal_Int16 > getSubtotals() const;
429 void setSubtotals(const std::vector< ScGeneralFunction >& rFunctions);
430 void setCurrentPage(const OUString& sPage);
431 void setUseCurrentPage(bool bUse);
432 const css::sheet::DataPilotFieldAutoShowInfo* getAutoShowInfo() const;
433 void setAutoShowInfo(const css::sheet::DataPilotFieldAutoShowInfo* pInfo);
434 const css::sheet::DataPilotFieldLayoutInfo* getLayoutInfo() const;
435 void setLayoutInfo(const css::sheet::DataPilotFieldLayoutInfo* pInfo);
436 const css::sheet::DataPilotFieldReference* getReference() const;
437 void setReference(const css::sheet::DataPilotFieldReference* pInfo);
438 const css::sheet::DataPilotFieldSortInfo* getSortInfo() const;
439 void setSortInfo(const css::sheet::DataPilotFieldSortInfo* pInfo);
440 bool getShowEmpty() const;
441 void setShowEmpty(bool bShow);
442 bool getRepeatItemLabels() const;
443 void setRepeatItemLabels(bool bShow);
445 bool hasGroupInfo() const;
446 css::sheet::DataPilotFieldGroupInfo getGroupInfo();
447 void setGroupInfo(const css::sheet::DataPilotFieldGroupInfo* pInfo);
449 // XDataPilotFieldGrouping
450 virtual css::uno::Reference < css::sheet::XDataPilotField > SAL_CALL
451 createNameGroup(const css::uno::Sequence< OUString >& aItems) override;
452 virtual css::uno::Reference < css::sheet::XDataPilotField > SAL_CALL
453 createDateGroup(const css::sheet::DataPilotFieldGroupInfo& rInfo) override;
455 // XServiceInfo
456 virtual OUString SAL_CALL getImplementationName() override;
457 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
458 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
460 private:
461 css::uno::Reference< css::container::XIndexAccess >
462 mxItems;
463 SfxItemPropertySet maPropSet;
464 css::uno::Any maOrient;
467 typedef ::std::vector< OUString > ScFieldGroupMembers;
469 struct ScFieldGroup
471 OUString maName;
472 ScFieldGroupMembers maMembers;
475 typedef ::std::vector< ScFieldGroup > ScFieldGroups;
477 typedef ::cppu::WeakImplHelper
479 css::container::XNameContainer,
480 css::container::XEnumerationAccess,
481 css::container::XIndexAccess,
482 css::lang::XServiceInfo
484 ScDataPilotFieldGroupsObjImpl;
486 /** Implementation of all grouped items in a DataPilot field.
488 This is a stand-alone object without any connection to the base DataPilot
489 field. Grouping info has to be written back with the GroupInfo property of
490 the DataPilot field after modifying this object.
492 class ScDataPilotFieldGroupsObj final : public ScDataPilotFieldGroupsObjImpl
494 public:
495 explicit ScDataPilotFieldGroupsObj( ScFieldGroups&& rGroups );
496 virtual ~ScDataPilotFieldGroupsObj() override;
498 // XNameAccess
499 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
500 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
501 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
503 // XNameReplace
504 virtual void SAL_CALL replaceByName( const OUString& aName,
505 const css::uno::Any& aElement ) override;
507 // XNameContainer
508 virtual void SAL_CALL insertByName( const OUString& aName,
509 const css::uno::Any& aElement ) override;
510 virtual void SAL_CALL removeByName( const OUString& Name ) override;
512 // XIndexAccess
513 virtual sal_Int32 SAL_CALL getCount() override;
514 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
516 // XEnumerationAccess
517 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
518 createEnumeration() override;
520 // XElementAccess
521 virtual css::uno::Type SAL_CALL getElementType() override;
522 virtual sal_Bool SAL_CALL hasElements() override;
524 // XServiceInfo
525 virtual OUString SAL_CALL getImplementationName() override;
526 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
527 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
529 // implementation
530 /// @throws css::uno::RuntimeException
531 ScFieldGroup& getFieldGroup( const OUString& rName );
532 /// @throws css::uno::RuntimeException
533 void renameFieldGroup( const OUString& rOldName, const OUString& rNewName );
535 private:
536 ScFieldGroups::iterator implFindByName( const OUString& rName );
538 private:
539 ScFieldGroups maGroups;
542 typedef ::cppu::WeakImplHelper
544 css::container::XNameContainer,
545 css::container::XEnumerationAccess,
546 css::container::XIndexAccess,
547 css::container::XNamed,
548 css::lang::XServiceInfo
550 ScDataPilotFieldGroupObjImpl;
552 class ScDataPilotFieldGroupObj final : public ScDataPilotFieldGroupObjImpl
554 public:
555 explicit ScDataPilotFieldGroupObj( ScDataPilotFieldGroupsObj& rParent, OUString aGroupName );
556 virtual ~ScDataPilotFieldGroupObj() override;
558 // XNameAccess
559 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
560 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
561 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
563 // XNameReplace
564 virtual void SAL_CALL replaceByName( const OUString& aName,
565 const css::uno::Any& aElement ) override;
567 // XNameContainer
568 virtual void SAL_CALL insertByName( const OUString& aName,
569 const css::uno::Any& aElement ) override;
570 virtual void SAL_CALL removeByName( const OUString& Name ) override;
572 // XIndexAccess
573 virtual sal_Int32 SAL_CALL getCount() override;
574 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
576 // XEnumerationAccess
577 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
578 createEnumeration() override;
580 // XElementAccess
581 virtual css::uno::Type SAL_CALL getElementType() override;
582 virtual sal_Bool SAL_CALL hasElements() override;
584 // XNamed
585 virtual OUString SAL_CALL getName() override;
586 virtual void SAL_CALL setName( const OUString& aName ) override;
588 // XServiceInfo
589 virtual OUString SAL_CALL getImplementationName() override;
590 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
591 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
593 private:
594 rtl::Reference<ScDataPilotFieldGroupsObj> mxParent;
595 OUString maGroupName;
598 typedef ::cppu::WeakImplHelper
600 css::container::XNamed,
601 css::lang::XServiceInfo
603 ScDataPilotFieldGroupItemObjImpl;
605 class ScDataPilotFieldGroupItemObj final : public ScDataPilotFieldGroupItemObjImpl
607 public:
608 explicit ScDataPilotFieldGroupItemObj( ScDataPilotFieldGroupObj& rParent, OUString aName );
609 virtual ~ScDataPilotFieldGroupItemObj() override;
611 // XNamed
612 virtual OUString SAL_CALL getName() override;
613 virtual void SAL_CALL setName( const OUString& aName ) override;
615 // XServiceInfo
616 virtual OUString SAL_CALL getImplementationName() override;
617 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
618 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
620 private:
621 rtl::Reference<ScDataPilotFieldGroupObj> mxParent;
622 OUString maName;
625 typedef ::cppu::WeakImplHelper
627 css::container::XEnumerationAccess,
628 css::container::XIndexAccess,
629 css::container::XNameAccess,
630 css::lang::XServiceInfo
632 ScDataPilotItemsObjImpl;
634 class ScDataPilotItemsObj final : public ScDataPilotChildObjBase, public ScDataPilotItemsObjImpl
636 public:
637 explicit ScDataPilotItemsObj( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId );
638 virtual ~ScDataPilotItemsObj() override;
640 // XNameAccess
641 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
642 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
643 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
645 // XIndexAccess
646 virtual sal_Int32 SAL_CALL getCount() override;
647 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
649 // XEnumerationAccess
650 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
651 createEnumeration() override;
653 // XElementAccess
654 virtual css::uno::Type SAL_CALL getElementType() override;
655 virtual sal_Bool SAL_CALL hasElements() override;
657 // XServiceInfo
658 virtual OUString SAL_CALL getImplementationName() override;
659 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
660 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
662 private:
663 ScDataPilotItemObj* GetObjectByIndex_Impl( sal_Int32 nIndex ) const;
666 typedef ::cppu::WeakImplHelper
668 css::container::XNamed,
669 css::beans::XPropertySet,
670 css::lang::XServiceInfo
672 ScDataPilotItemObjImpl;
674 class ScDataPilotItemObj final : public ScDataPilotChildObjBase, public ScDataPilotItemObjImpl
676 public:
677 explicit ScDataPilotItemObj(
678 ScDataPilotDescriptorBase& rParent,
679 const ScFieldIdentifier& rFieldId,
680 sal_Int32 nIndex );
682 virtual ~ScDataPilotItemObj() override;
684 // XNamed
685 virtual OUString SAL_CALL getName() override;
686 virtual void SAL_CALL setName( const OUString& aName ) override;
688 // XPropertySet
689 virtual css::uno::Reference< css::beans::XPropertySetInfo >
690 SAL_CALL getPropertySetInfo( ) override;
691 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
692 const css::uno::Any& aValue ) override;
693 virtual css::uno::Any SAL_CALL getPropertyValue(
694 const OUString& PropertyName ) override;
695 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
696 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
697 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
698 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
699 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
700 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
701 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
702 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
704 // XServiceInfo
705 virtual OUString SAL_CALL getImplementationName() override;
706 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
707 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
709 private:
710 SfxItemPropertySet maPropSet;
711 sal_Int32 mnIndex;
714 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */