Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / dapiuno.hxx
blob1f183501c9ba6f38eef8a6e7dad00d2de451d502
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_DAPIUNO_HXX
21 #define INCLUDED_SC_INC_DAPIUNO_HXX
23 #include "global.hxx"
24 #include "dpobject.hxx"
25 #include "rangeutl.hxx"
26 #include "cellsuno.hxx"
28 #include <svl/lstner.hxx>
29 #include <svl/itemprop.hxx>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/lang/XUnoTunnel.hpp>
33 #include <com/sun/star/beans/XPropertySet.hpp>
34 #include <com/sun/star/container/XEnumerationAccess.hpp>
35 #include <com/sun/star/container/XNameContainer.hpp>
36 #include <com/sun/star/util/XModifyBroadcaster.hpp>
38 #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
39 #include <com/sun/star/sheet/DataPilotFieldGroupInfo.hpp>
40 #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
41 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
42 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
43 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
44 #include <com/sun/star/sheet/XDataPilotDataLayoutFieldSupplier.hpp>
45 #include <com/sun/star/sheet/XDataPilotDescriptor.hpp>
46 #include <com/sun/star/sheet/XDataPilotField.hpp>
47 #include <com/sun/star/sheet/XDataPilotFieldGrouping.hpp>
48 #include <com/sun/star/sheet/XDataPilotTable.hpp>
49 #include <com/sun/star/sheet/XDataPilotTable2.hpp>
50 #include <com/sun/star/sheet/XDataPilotTables.hpp>
52 #include <cppuhelper/implbase.hxx>
54 #include <memory>
55 #include <vector>
57 namespace com { namespace sun { namespace star { namespace sheet {
58 struct DataPilotFieldFilter;
59 struct DataPilotTablePositionData;
60 }}}}
62 class ScDocShell;
63 class ScDPSaveDimension;
64 struct ScDPNumGroupInfo;
66 class ScDataPilotTableObj;
67 class ScDataPilotFieldObj;
68 class ScDataPilotItemObj;
69 enum class ScGeneralFunction;
71 class ScDataPilotConversion
73 public:
74 static ScGeneralFunction FirstFunc( PivotFunc nBits );
75 static PivotFunc FunctionBit( sal_Int16 eFunc );
77 static void FillGroupInfo(
78 css::sheet::DataPilotFieldGroupInfo& rInfo,
79 const ScDPNumGroupInfo& rGroupInfo );
82 /** DataPilotTables collection per sheet. */
83 class ScDataPilotTablesObj : public cppu::WeakImplHelper<
84 css::sheet::XDataPilotTables,
85 css::container::XEnumerationAccess,
86 css::container::XIndexAccess,
87 css::lang::XServiceInfo>,
88 public SfxListener
90 private:
91 ScDocShell* pDocShell;
92 SCTAB nTab;
94 ScDataPilotTableObj* GetObjectByIndex_Impl( sal_Int32 nIndex );
95 ScDataPilotTableObj* GetObjectByName_Impl(const OUString& aName);
97 public:
98 ScDataPilotTablesObj(ScDocShell* pDocSh, SCTAB nT);
99 virtual ~ScDataPilotTablesObj() override;
101 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
103 // XDataPilotTables
104 virtual css::uno::Reference< css::sheet::XDataPilotDescriptor > SAL_CALL
105 createDataPilotDescriptor() override;
106 virtual void SAL_CALL insertNewByName( const OUString& aName,
107 const css::table::CellAddress& aOutputAddress,
108 const css::uno::Reference< css::sheet::XDataPilotDescriptor >& xDescriptor ) override;
109 virtual void SAL_CALL removeByName( const OUString& aName ) override;
111 // XNameAccess
112 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
113 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
114 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
116 // XIndexAccess
117 virtual sal_Int32 SAL_CALL getCount() override;
118 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
120 // XEnumerationAccess
121 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
122 createEnumeration() override;
124 // XElementAccess
125 virtual css::uno::Type SAL_CALL getElementType() override;
126 virtual sal_Bool SAL_CALL hasElements() override;
128 // XServiceInfo
129 virtual OUString SAL_CALL getImplementationName() override;
130 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
131 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
134 // ScDataPilotDescriptorBase is never instantiated directly
135 class ScDataPilotDescriptorBase : public css::sheet::XDataPilotDescriptor,
136 public css::beans::XPropertySet,
137 public css::sheet::XDataPilotDataLayoutFieldSupplier,
138 public css::lang::XServiceInfo,
139 public css::lang::XUnoTunnel,
140 public css::lang::XTypeProvider,
141 public cppu::OWeakObject,
142 public SfxListener
144 private:
145 SfxItemPropertySet maPropSet;
146 ScDocShell* pDocShell;
148 public:
149 ScDataPilotDescriptorBase(ScDocShell* pDocSh);
150 virtual ~ScDataPilotDescriptorBase() override;
152 virtual css::uno::Any SAL_CALL queryInterface(
153 const css::uno::Type & rType ) override;
154 virtual void SAL_CALL acquire() throw() override;
155 virtual void SAL_CALL release() throw() override;
157 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
159 ScDocShell* GetDocShell() const { return pDocShell; }
161 // in the derivatives:
162 virtual ScDPObject* GetDPObject() const = 0;
163 virtual void SetDPObject(ScDPObject* pDPObj) = 0;
165 // XDataPilotDescriptor
166 // getName, setName, getTag, setTag in derived classes
168 virtual css::table::CellRangeAddress SAL_CALL getSourceRange() override;
169 virtual void SAL_CALL setSourceRange( const css::table::CellRangeAddress& aSourceRange ) override;
170 virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL
171 getFilterDescriptor() override;
172 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
173 getDataPilotFields() override;
174 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
175 getColumnFields() override;
176 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
177 getRowFields() override;
178 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
179 getPageFields() override;
180 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
181 getDataFields() override;
182 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
183 getHiddenFields() override;
185 // XPropertySet
186 virtual css::uno::Reference< css::beans::XPropertySetInfo >
187 SAL_CALL getPropertySetInfo( ) override;
188 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
189 const css::uno::Any& aValue ) override;
190 virtual css::uno::Any SAL_CALL getPropertyValue(
191 const OUString& PropertyName ) override;
192 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
193 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
194 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
195 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
196 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
197 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
198 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
199 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
201 // XDataPilotDataLayoutFieldSupplier
202 virtual css::uno::Reference< css::sheet::XDataPilotField >
203 SAL_CALL getDataLayoutField() override;
205 // XUnoTunnel
206 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence<
207 sal_Int8 >& aIdentifier ) override;
209 static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
210 SC_DLLPUBLIC static ScDataPilotDescriptorBase* getImplementation(const css::uno::Reference<css::sheet::XDataPilotDescriptor>& rObj);
212 // XTypeProvider (override in ScDataPilotTableObj)
213 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
214 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
216 // XServiceInfo is in derived classes
219 class ScDataPilotDescriptor : public ScDataPilotDescriptorBase
221 private:
222 std::unique_ptr<ScDPObject> mpDPObject;
224 public:
225 ScDataPilotDescriptor(ScDocShell* pDocSh);
226 virtual ~ScDataPilotDescriptor() override;
228 virtual ScDPObject* GetDPObject() const override;
229 virtual void SetDPObject(ScDPObject* pDPObj) override;
231 // rest of XDataPilotDescriptor (incl. XNamed)
232 virtual OUString SAL_CALL getName() override;
233 virtual void SAL_CALL setName( const OUString& aName ) override;
234 virtual OUString SAL_CALL getTag() override;
235 virtual void SAL_CALL setTag( const OUString& aTag ) override;
237 // XServiceInfo
238 virtual OUString SAL_CALL getImplementationName() override;
239 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
240 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
243 class ScDataPilotTableObj : public ScDataPilotDescriptorBase,
244 public css::sheet::XDataPilotTable2,
245 public css::util::XModifyBroadcaster
247 private:
248 SCTAB nTab;
249 OUString aName;
250 XModifyListenerArr_Impl aModifyListeners;
252 void Refreshed_Impl();
254 public:
255 ScDataPilotTableObj(ScDocShell* pDocSh, SCTAB nT, const OUString& rN);
256 virtual ~ScDataPilotTableObj() override;
258 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
259 virtual void SAL_CALL acquire() throw() override;
260 virtual void SAL_CALL release() throw() override;
262 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
264 virtual ScDPObject* GetDPObject() const override;
265 virtual void SetDPObject(ScDPObject* pDPObj) override;
267 // rest of XDataPilotDescriptor (incl. XNamed)
268 virtual OUString SAL_CALL getName() override;
269 virtual void SAL_CALL setName( const OUString& aName ) override;
270 virtual OUString SAL_CALL getTag() override;
271 virtual void SAL_CALL setTag( const OUString& aTag ) override;
273 // XDataPilotTable
274 virtual css::table::CellRangeAddress SAL_CALL getOutputRange() override;
275 virtual void SAL_CALL refresh() override;
277 // XDataPilotTable2
278 virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > >
279 SAL_CALL getDrillDownData(const css::table::CellAddress& aAddr) override;
281 virtual css::sheet::DataPilotTablePositionData
282 SAL_CALL getPositionData(const css::table::CellAddress& aAddr) override;
284 virtual void SAL_CALL insertDrillDownSheet(const css::table::CellAddress& aAddr) override;
286 virtual css::table::CellRangeAddress SAL_CALL getOutputRangeByType( sal_Int32 nType ) override;
288 // XModifyBroadcaster
289 virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
290 virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
292 // XTypeProvider (override)
293 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
294 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
296 // XServiceInfo
297 virtual OUString SAL_CALL getImplementationName() override;
298 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
299 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
302 struct ScFieldIdentifier
304 OUString maFieldName; /// Source field name.
305 sal_Int32 mnFieldIdx; /// Field index (if several fields with same name exist).
306 bool mbDataLayout; /// True = data layout field collecting all data fields as items.
308 explicit ScFieldIdentifier() :
309 mnFieldIdx( 0 ), mbDataLayout( false ) {}
311 explicit ScFieldIdentifier( const OUString& rFieldName, bool bDataLayout ) :
312 maFieldName( rFieldName ), mnFieldIdx( 0 ), mbDataLayout( bDataLayout ) {}
315 /** Base class of all implementation objects based on a DataPilot descriptor
316 or DataPilot table object. Wraps acquiring and releasing the parent. */
317 class ScDataPilotChildObjBase
319 protected:
320 explicit ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent );
321 explicit ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId );
322 virtual ~ScDataPilotChildObjBase();
324 /** Returns the wrapped DataPilot object (calls GetDPObject() at parent). */
325 ScDPObject* GetDPObject() const;
326 /** Sets the passed DataPilot object (calls SetDPObject() at parent). */
327 void SetDPObject( ScDPObject* pDPObject );
329 /** Returns the DataPilot dimension object related to the field described by maFieldId. */
330 ScDPSaveDimension* GetDPDimension( ScDPObject** ppDPObject = nullptr ) const;
332 /** Returns the number of members for the field described by maFieldId. */
333 sal_Int32 GetMemberCount() const;
334 /** Returns the collection of members for the field described by maFieldId. */
335 css::uno::Reference< css::sheet::XMembersAccess > GetMembers() const;
337 ScDocShell* GetDocShell() const;
338 protected:
339 rtl::Reference<ScDataPilotDescriptorBase> mxParent;
340 ScFieldIdentifier maFieldId;
342 private:
343 ScDataPilotChildObjBase& operator=( const ScDataPilotChildObjBase& ) = delete;
346 typedef ::cppu::WeakImplHelper
348 css::container::XEnumerationAccess,
349 css::container::XIndexAccess,
350 css::container::XNameAccess,
351 css::lang::XServiceInfo
353 ScDataPilotFieldsObjImpl;
355 /** Collection of all DataPilot fields, or of all fields from a specific dimension. */
356 class ScDataPilotFieldsObj : public ScDataPilotChildObjBase, public ScDataPilotFieldsObjImpl
358 public:
359 explicit ScDataPilotFieldsObj(
360 ScDataPilotDescriptorBase& rParent );
362 explicit ScDataPilotFieldsObj(
363 ScDataPilotDescriptorBase& rParent,
364 css::sheet::DataPilotFieldOrientation eOrient );
366 virtual ~ScDataPilotFieldsObj() override;
368 // XNameAccess
369 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
370 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
371 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
373 // XIndexAccess
374 virtual sal_Int32 SAL_CALL getCount() override;
375 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
377 // XEnumerationAccess
378 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
379 createEnumeration() override;
381 // XElementAccess
382 virtual css::uno::Type SAL_CALL getElementType() override;
383 virtual sal_Bool SAL_CALL hasElements() override;
385 // XServiceInfo
386 virtual OUString SAL_CALL getImplementationName() override;
387 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
388 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
390 private:
391 ScDataPilotFieldObj* GetObjectByIndex_Impl( sal_Int32 nIndex ) const;
392 ScDataPilotFieldObj* GetObjectByName_Impl( const OUString& rName ) const;
394 private:
395 css::uno::Any maOrient; /// Field orientation, no value = all fields.
398 typedef ::cppu::WeakImplHelper
400 css::container::XNamed,
401 css::beans::XPropertySet,
402 css::sheet::XDataPilotField,
403 css::sheet::XDataPilotFieldGrouping,
404 css::lang::XServiceInfo
406 ScDataPilotFieldObjImpl;
408 /** Implementation of a single DataPilot field. */
409 class ScDataPilotFieldObj : public ScDataPilotChildObjBase, public ScDataPilotFieldObjImpl
411 public:
412 ScDataPilotFieldObj(
413 ScDataPilotDescriptorBase& rParent,
414 const ScFieldIdentifier& rIdent );
416 ScDataPilotFieldObj(
417 ScDataPilotDescriptorBase& rParent,
418 const ScFieldIdentifier& rIdent,
419 const css::uno::Any& rOrient );
421 virtual ~ScDataPilotFieldObj() override;
423 // XNamed
424 virtual OUString SAL_CALL getName() override;
425 virtual void SAL_CALL setName(const OUString& aName) override;
427 // XPropertySet
428 virtual css::uno::Reference< css::beans::XPropertySetInfo >
429 SAL_CALL getPropertySetInfo( ) override;
430 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
431 const css::uno::Any& aValue ) override;
432 virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& PropertyName ) override;
433 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
434 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
435 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
436 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
437 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
438 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
439 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
440 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
442 // XDatePilotField
443 virtual css::uno::Reference<css::container::XIndexAccess> SAL_CALL
444 getItems() override;
446 // only called from property-functions:
447 css::sheet::DataPilotFieldOrientation getOrientation() const;
448 void setOrientation(css::sheet::DataPilotFieldOrientation Orientation);
449 sal_Int16 getFunction() const;
450 void setFunction(ScGeneralFunction Function);
451 css::uno::Sequence< sal_Int16 > getSubtotals() const;
452 void setSubtotals(const std::vector< ScGeneralFunction >& rFunctions);
453 void setCurrentPage(const OUString& sPage);
454 void setUseCurrentPage(bool bUse);
455 const css::sheet::DataPilotFieldAutoShowInfo* getAutoShowInfo();
456 void setAutoShowInfo(const css::sheet::DataPilotFieldAutoShowInfo* pInfo);
457 const css::sheet::DataPilotFieldLayoutInfo* getLayoutInfo();
458 void setLayoutInfo(const css::sheet::DataPilotFieldLayoutInfo* pInfo);
459 const css::sheet::DataPilotFieldReference* getReference();
460 void setReference(const css::sheet::DataPilotFieldReference* pInfo);
461 const css::sheet::DataPilotFieldSortInfo* getSortInfo();
462 void setSortInfo(const css::sheet::DataPilotFieldSortInfo* pInfo);
463 bool getShowEmpty() const;
464 void setShowEmpty(bool bShow);
465 bool getRepeatItemLabels() const;
466 void setRepeatItemLabels(bool bShow);
468 bool hasGroupInfo();
469 css::sheet::DataPilotFieldGroupInfo getGroupInfo();
470 void setGroupInfo(const css::sheet::DataPilotFieldGroupInfo* pInfo);
472 // XDataPilotFieldGrouping
473 static bool HasString(const css::uno::Sequence< OUString >& aItems, const OUString& aString);
474 virtual css::uno::Reference < css::sheet::XDataPilotField > SAL_CALL
475 createNameGroup(const css::uno::Sequence< OUString >& aItems) override;
476 virtual css::uno::Reference < css::sheet::XDataPilotField > SAL_CALL
477 createDateGroup(const css::sheet::DataPilotFieldGroupInfo& rInfo) override;
479 // XServiceInfo
480 virtual OUString SAL_CALL getImplementationName() override;
481 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
482 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
484 private:
485 css::uno::Reference< css::container::XIndexAccess >
486 mxItems;
487 SfxItemPropertySet maPropSet;
488 css::uno::Any maOrient;
491 typedef ::std::vector< OUString > ScFieldGroupMembers;
493 struct ScFieldGroup
495 OUString maName;
496 ScFieldGroupMembers maMembers;
499 typedef ::std::vector< ScFieldGroup > ScFieldGroups;
501 typedef ::cppu::WeakImplHelper
503 css::container::XNameContainer,
504 css::container::XEnumerationAccess,
505 css::container::XIndexAccess,
506 css::lang::XServiceInfo
508 ScDataPilotFieldGroupsObjImpl;
510 /** Implementation of all grouped items in a DataPilot field.
512 This is a stand-alone object without any connection to the base DataPilot
513 field. Grouping info has to be written back with the GroupInfo property of
514 the DataPilot field after modifying this object.
516 class ScDataPilotFieldGroupsObj : public ScDataPilotFieldGroupsObjImpl
518 public:
519 explicit ScDataPilotFieldGroupsObj( const ScFieldGroups& rGroups );
520 virtual ~ScDataPilotFieldGroupsObj() override;
522 // XNameAccess
523 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
524 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
525 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
527 // XNameReplace
528 virtual void SAL_CALL replaceByName( const OUString& aName,
529 const css::uno::Any& aElement ) override;
531 // XNameContainer
532 virtual void SAL_CALL insertByName( const OUString& aName,
533 const css::uno::Any& aElement ) override;
534 virtual void SAL_CALL removeByName( const OUString& Name ) override;
536 // XIndexAccess
537 virtual sal_Int32 SAL_CALL getCount() override;
538 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
540 // XEnumerationAccess
541 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
542 createEnumeration() override;
544 // XElementAccess
545 virtual css::uno::Type SAL_CALL getElementType() override;
546 virtual sal_Bool SAL_CALL hasElements() override;
548 // XServiceInfo
549 virtual OUString SAL_CALL getImplementationName() override;
550 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
551 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
553 // implementation
554 /// @throws css::uno::RuntimeException
555 ScFieldGroup& getFieldGroup( const OUString& rName );
556 /// @throws css::uno::RuntimeException
557 void renameFieldGroup( const OUString& rOldName, const OUString& rNewName );
559 private:
560 ScFieldGroups::iterator implFindByName( const OUString& rName );
562 private:
563 ScFieldGroups maGroups;
566 typedef ::cppu::WeakImplHelper
568 css::container::XNameContainer,
569 css::container::XEnumerationAccess,
570 css::container::XIndexAccess,
571 css::container::XNamed,
572 css::lang::XServiceInfo
574 ScDataPilotFieldGroupObjImpl;
576 class ScDataPilotFieldGroupObj : public ScDataPilotFieldGroupObjImpl
578 public:
579 explicit ScDataPilotFieldGroupObj( ScDataPilotFieldGroupsObj& rParent, const OUString& rGroupName );
580 virtual ~ScDataPilotFieldGroupObj() override;
582 // XNameAccess
583 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
584 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
585 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
587 // XNameReplace
588 virtual void SAL_CALL replaceByName( const OUString& aName,
589 const css::uno::Any& aElement ) override;
591 // XNameContainer
592 virtual void SAL_CALL insertByName( const OUString& aName,
593 const css::uno::Any& aElement ) override;
594 virtual void SAL_CALL removeByName( const OUString& Name ) override;
596 // XIndexAccess
597 virtual sal_Int32 SAL_CALL getCount() override;
598 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
600 // XEnumerationAccess
601 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
602 createEnumeration() override;
604 // XElementAccess
605 virtual css::uno::Type SAL_CALL getElementType() override;
606 virtual sal_Bool SAL_CALL hasElements() override;
608 // XNamed
609 virtual OUString SAL_CALL getName() override;
610 virtual void SAL_CALL setName( const OUString& aName ) override;
612 // XServiceInfo
613 virtual OUString SAL_CALL getImplementationName() override;
614 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
615 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
617 private:
618 rtl::Reference<ScDataPilotFieldGroupsObj> mxParent;
619 OUString maGroupName;
622 typedef ::cppu::WeakImplHelper
624 css::container::XNamed,
625 css::lang::XServiceInfo
627 ScDataPilotFieldGroupItemObjImpl;
629 class ScDataPilotFieldGroupItemObj : public ScDataPilotFieldGroupItemObjImpl
631 public:
632 explicit ScDataPilotFieldGroupItemObj( ScDataPilotFieldGroupObj& rParent, const OUString& rName );
633 virtual ~ScDataPilotFieldGroupItemObj() override;
635 // XNamed
636 virtual OUString SAL_CALL getName() override;
637 virtual void SAL_CALL setName( const OUString& aName ) override;
639 // XServiceInfo
640 virtual OUString SAL_CALL getImplementationName() override;
641 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
642 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
644 private:
645 rtl::Reference<ScDataPilotFieldGroupObj> mxParent;
646 OUString maName;
649 typedef ::cppu::WeakImplHelper
651 css::container::XEnumerationAccess,
652 css::container::XIndexAccess,
653 css::container::XNameAccess,
654 css::lang::XServiceInfo
656 ScDataPilotItemsObjImpl;
658 class ScDataPilotItemsObj : public ScDataPilotChildObjBase, public ScDataPilotItemsObjImpl
660 public:
661 explicit ScDataPilotItemsObj( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId );
662 virtual ~ScDataPilotItemsObj() override;
664 // XNameAccess
665 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
666 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
667 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
669 // XIndexAccess
670 virtual sal_Int32 SAL_CALL getCount() override;
671 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
673 // XEnumerationAccess
674 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
675 createEnumeration() override;
677 // XElementAccess
678 virtual css::uno::Type SAL_CALL getElementType() override;
679 virtual sal_Bool SAL_CALL hasElements() override;
681 // XServiceInfo
682 virtual OUString SAL_CALL getImplementationName() override;
683 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
684 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
686 private:
687 ScDataPilotItemObj* GetObjectByIndex_Impl( sal_Int32 nIndex ) const;
690 typedef ::cppu::WeakImplHelper
692 css::container::XNamed,
693 css::beans::XPropertySet,
694 css::lang::XServiceInfo
696 ScDataPilotItemObjImpl;
698 class ScDataPilotItemObj : public ScDataPilotChildObjBase, public ScDataPilotItemObjImpl
700 public:
701 explicit ScDataPilotItemObj(
702 ScDataPilotDescriptorBase& rParent,
703 const ScFieldIdentifier& rFieldId,
704 sal_Int32 nIndex );
706 virtual ~ScDataPilotItemObj() override;
708 // XNamed
709 virtual OUString SAL_CALL getName() override;
710 virtual void SAL_CALL setName( const OUString& aName ) override;
712 // XPropertySet
713 virtual css::uno::Reference< css::beans::XPropertySetInfo >
714 SAL_CALL getPropertySetInfo( ) override;
715 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
716 const css::uno::Any& aValue ) override;
717 virtual css::uno::Any SAL_CALL getPropertyValue(
718 const OUString& PropertyName ) override;
719 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
720 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
721 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
722 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
723 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
724 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
725 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
726 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
728 // XServiceInfo
729 virtual OUString SAL_CALL getImplementationName() override;
730 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
731 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
733 private:
734 SfxItemPropertySet maPropSet;
735 sal_Int32 mnIndex;
738 #endif
740 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */