Revert "tdf#110987: type detection, binary Office formats > templates"
[LibreOffice.git] / sc / inc / dapiuno.hxx
blob619585224f0816dac23d8735a7e61490185a9d6d
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 "cellsuno.hxx"
24 #include "dpglobal.hxx"
26 #include <svl/lstner.hxx>
27 #include <svl/itemprop.hxx>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <com/sun/star/lang/XUnoTunnel.hpp>
31 #include <com/sun/star/beans/XPropertySet.hpp>
32 #include <com/sun/star/container/XEnumerationAccess.hpp>
33 #include <com/sun/star/container/XNameContainer.hpp>
34 #include <com/sun/star/util/XModifyBroadcaster.hpp>
36 #include <com/sun/star/sheet/DataPilotFieldGroupInfo.hpp>
37 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
38 #include <com/sun/star/sheet/XDataPilotDataLayoutFieldSupplier.hpp>
39 #include <com/sun/star/sheet/XDataPilotDescriptor.hpp>
40 #include <com/sun/star/sheet/XDataPilotField.hpp>
41 #include <com/sun/star/sheet/XDataPilotFieldGrouping.hpp>
42 #include <com/sun/star/sheet/XDataPilotTable2.hpp>
43 #include <com/sun/star/sheet/XDataPilotTables.hpp>
45 #include <cppuhelper/implbase.hxx>
47 #include <memory>
48 #include <vector>
50 namespace com { namespace sun { namespace star { namespace sheet { struct DataPilotFieldAutoShowInfo; } } } }
51 namespace com { namespace sun { namespace star { namespace sheet { class XMembersAccess; } } } }
52 namespace com { namespace sun { namespace star { namespace sheet { struct DataPilotFieldLayoutInfo; } } } }
53 namespace com { namespace sun { namespace star { namespace sheet { struct DataPilotFieldReference; } } } }
54 namespace com { namespace sun { namespace star { namespace sheet { struct DataPilotFieldSortInfo; } } } }
57 class ScDocShell;
58 class ScDPSaveDimension;
59 struct ScDPNumGroupInfo;
61 class ScDataPilotTableObj;
62 class ScDataPilotFieldObj;
63 class ScDataPilotItemObj;
64 enum class ScGeneralFunction;
65 class ScDPObject;
67 class ScDataPilotConversion
69 public:
70 static ScGeneralFunction FirstFunc( PivotFunc nBits );
71 static PivotFunc FunctionBit( sal_Int16 eFunc );
73 static void FillGroupInfo(
74 css::sheet::DataPilotFieldGroupInfo& rInfo,
75 const ScDPNumGroupInfo& rGroupInfo );
78 /** DataPilotTables collection per sheet. */
79 class ScDataPilotTablesObj : public cppu::WeakImplHelper<
80 css::sheet::XDataPilotTables,
81 css::container::XEnumerationAccess,
82 css::container::XIndexAccess,
83 css::lang::XServiceInfo>,
84 public SfxListener
86 private:
87 ScDocShell* pDocShell;
88 SCTAB nTab;
90 ScDataPilotTableObj* GetObjectByIndex_Impl( sal_Int32 nIndex );
91 ScDataPilotTableObj* GetObjectByName_Impl(const OUString& aName);
93 public:
94 ScDataPilotTablesObj(ScDocShell* pDocSh, SCTAB nT);
95 virtual ~ScDataPilotTablesObj() override;
97 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
99 // XDataPilotTables
100 virtual css::uno::Reference< css::sheet::XDataPilotDescriptor > SAL_CALL
101 createDataPilotDescriptor() override;
102 virtual void SAL_CALL insertNewByName( const OUString& aName,
103 const css::table::CellAddress& aOutputAddress,
104 const css::uno::Reference< css::sheet::XDataPilotDescriptor >& xDescriptor ) override;
105 virtual void SAL_CALL removeByName( const OUString& aName ) override;
107 // XNameAccess
108 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
109 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
110 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
112 // XIndexAccess
113 virtual sal_Int32 SAL_CALL getCount() override;
114 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
116 // XEnumerationAccess
117 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
118 createEnumeration() override;
120 // XElementAccess
121 virtual css::uno::Type SAL_CALL getElementType() override;
122 virtual sal_Bool SAL_CALL hasElements() override;
124 // XServiceInfo
125 virtual OUString SAL_CALL getImplementationName() override;
126 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
127 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
130 // ScDataPilotDescriptorBase is never instantiated directly
131 class ScDataPilotDescriptorBase : public css::sheet::XDataPilotDescriptor,
132 public css::beans::XPropertySet,
133 public css::sheet::XDataPilotDataLayoutFieldSupplier,
134 public css::lang::XServiceInfo,
135 public css::lang::XUnoTunnel,
136 public css::lang::XTypeProvider,
137 public cppu::OWeakObject,
138 public SfxListener
140 private:
141 SfxItemPropertySet maPropSet;
142 ScDocShell* pDocShell;
144 public:
145 ScDataPilotDescriptorBase(ScDocShell* pDocSh);
146 virtual ~ScDataPilotDescriptorBase() override;
148 virtual css::uno::Any SAL_CALL queryInterface(
149 const css::uno::Type & rType ) override;
150 virtual void SAL_CALL acquire() throw() override;
151 virtual void SAL_CALL release() throw() override;
153 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
155 ScDocShell* GetDocShell() const { return pDocShell; }
157 // in the derivatives:
158 virtual ScDPObject* GetDPObject() const = 0;
159 virtual void SetDPObject(ScDPObject* pDPObj) = 0;
161 // XDataPilotDescriptor
162 // getName, setName, getTag, setTag in derived classes
164 virtual css::table::CellRangeAddress SAL_CALL getSourceRange() override;
165 virtual void SAL_CALL setSourceRange( const css::table::CellRangeAddress& aSourceRange ) override;
166 virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL
167 getFilterDescriptor() override;
168 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
169 getDataPilotFields() override;
170 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
171 getColumnFields() override;
172 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
173 getRowFields() override;
174 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
175 getPageFields() override;
176 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
177 getDataFields() override;
178 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
179 getHiddenFields() override;
181 // XPropertySet
182 virtual css::uno::Reference< css::beans::XPropertySetInfo >
183 SAL_CALL getPropertySetInfo( ) override;
184 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
185 const css::uno::Any& aValue ) override;
186 virtual css::uno::Any SAL_CALL getPropertyValue(
187 const OUString& PropertyName ) override;
188 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
189 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
190 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
191 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
192 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
193 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
194 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
195 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
197 // XDataPilotDataLayoutFieldSupplier
198 virtual css::uno::Reference< css::sheet::XDataPilotField >
199 SAL_CALL getDataLayoutField() override;
201 // XUnoTunnel
202 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence<
203 sal_Int8 >& aIdentifier ) override;
205 static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
206 SC_DLLPUBLIC static ScDataPilotDescriptorBase* getImplementation(const css::uno::Reference<css::sheet::XDataPilotDescriptor>& rObj);
208 // XTypeProvider (override in ScDataPilotTableObj)
209 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
210 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
212 // XServiceInfo is in derived classes
215 class ScDataPilotDescriptor : public ScDataPilotDescriptorBase
217 private:
218 std::unique_ptr<ScDPObject> mpDPObject;
220 public:
221 ScDataPilotDescriptor(ScDocShell* pDocSh);
222 virtual ~ScDataPilotDescriptor() override;
224 virtual ScDPObject* GetDPObject() const override;
225 virtual void SetDPObject(ScDPObject* pDPObj) override;
227 // rest of XDataPilotDescriptor (incl. XNamed)
228 virtual OUString SAL_CALL getName() override;
229 virtual void SAL_CALL setName( const OUString& aName ) override;
230 virtual OUString SAL_CALL getTag() override;
231 virtual void SAL_CALL setTag( const OUString& aTag ) override;
233 // XServiceInfo
234 virtual OUString SAL_CALL getImplementationName() override;
235 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
236 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
239 class ScDataPilotTableObj : public ScDataPilotDescriptorBase,
240 public css::sheet::XDataPilotTable2,
241 public css::util::XModifyBroadcaster
243 private:
244 SCTAB nTab;
245 OUString aName;
246 XModifyListenerArr_Impl aModifyListeners;
248 void Refreshed_Impl();
250 public:
251 ScDataPilotTableObj(ScDocShell* pDocSh, SCTAB nT, const OUString& rN);
252 virtual ~ScDataPilotTableObj() override;
254 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
255 virtual void SAL_CALL acquire() throw() override;
256 virtual void SAL_CALL release() throw() override;
258 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
260 virtual ScDPObject* GetDPObject() const override;
261 virtual void SetDPObject(ScDPObject* pDPObj) override;
263 // rest of XDataPilotDescriptor (incl. XNamed)
264 virtual OUString SAL_CALL getName() override;
265 virtual void SAL_CALL setName( const OUString& aName ) override;
266 virtual OUString SAL_CALL getTag() override;
267 virtual void SAL_CALL setTag( const OUString& aTag ) override;
269 // XDataPilotTable
270 virtual css::table::CellRangeAddress SAL_CALL getOutputRange() override;
271 virtual void SAL_CALL refresh() override;
273 // XDataPilotTable2
274 virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > >
275 SAL_CALL getDrillDownData(const css::table::CellAddress& aAddr) override;
277 virtual css::sheet::DataPilotTablePositionData
278 SAL_CALL getPositionData(const css::table::CellAddress& aAddr) override;
280 virtual void SAL_CALL insertDrillDownSheet(const css::table::CellAddress& aAddr) override;
282 virtual css::table::CellRangeAddress SAL_CALL getOutputRangeByType( sal_Int32 nType ) override;
284 // XModifyBroadcaster
285 virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
286 virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
288 // XTypeProvider (override)
289 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
290 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
292 // XServiceInfo
293 virtual OUString SAL_CALL getImplementationName() override;
294 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
295 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
298 struct ScFieldIdentifier
300 OUString maFieldName; /// Source field name.
301 sal_Int32 mnFieldIdx; /// Field index (if several fields with same name exist).
302 bool mbDataLayout; /// True = data layout field collecting all data fields as items.
304 explicit ScFieldIdentifier() :
305 mnFieldIdx( 0 ), mbDataLayout( false ) {}
307 explicit ScFieldIdentifier( const OUString& rFieldName, bool bDataLayout ) :
308 maFieldName( rFieldName ), mnFieldIdx( 0 ), mbDataLayout( bDataLayout ) {}
311 /** Base class of all implementation objects based on a DataPilot descriptor
312 or DataPilot table object. Wraps acquiring and releasing the parent. */
313 class ScDataPilotChildObjBase
315 protected:
316 explicit ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent );
317 explicit ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId );
318 virtual ~ScDataPilotChildObjBase();
320 /** Returns the wrapped DataPilot object (calls GetDPObject() at parent). */
321 ScDPObject* GetDPObject() const;
322 /** Sets the passed DataPilot object (calls SetDPObject() at parent). */
323 void SetDPObject( ScDPObject* pDPObject );
325 /** Returns the DataPilot dimension object related to the field described by maFieldId. */
326 ScDPSaveDimension* GetDPDimension( ScDPObject** ppDPObject = nullptr ) const;
328 /** Returns the number of members for the field described by maFieldId. */
329 sal_Int32 GetMemberCount() const;
330 /** Returns the collection of members for the field described by maFieldId. */
331 css::uno::Reference< css::sheet::XMembersAccess > GetMembers() const;
333 ScDocShell* GetDocShell() const;
334 protected:
335 rtl::Reference<ScDataPilotDescriptorBase> mxParent;
336 ScFieldIdentifier maFieldId;
338 private:
339 ScDataPilotChildObjBase& operator=( const ScDataPilotChildObjBase& ) = delete;
342 typedef ::cppu::WeakImplHelper
344 css::container::XEnumerationAccess,
345 css::container::XIndexAccess,
346 css::container::XNameAccess,
347 css::lang::XServiceInfo
349 ScDataPilotFieldsObjImpl;
351 /** Collection of all DataPilot fields, or of all fields from a specific dimension. */
352 class ScDataPilotFieldsObj : public ScDataPilotChildObjBase, public ScDataPilotFieldsObjImpl
354 public:
355 explicit ScDataPilotFieldsObj(
356 ScDataPilotDescriptorBase& rParent );
358 explicit ScDataPilotFieldsObj(
359 ScDataPilotDescriptorBase& rParent,
360 css::sheet::DataPilotFieldOrientation eOrient );
362 virtual ~ScDataPilotFieldsObj() override;
364 // XNameAccess
365 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
366 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
367 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
369 // XIndexAccess
370 virtual sal_Int32 SAL_CALL getCount() override;
371 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
373 // XEnumerationAccess
374 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
375 createEnumeration() override;
377 // XElementAccess
378 virtual css::uno::Type SAL_CALL getElementType() override;
379 virtual sal_Bool SAL_CALL hasElements() override;
381 // XServiceInfo
382 virtual OUString SAL_CALL getImplementationName() override;
383 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
384 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
386 private:
387 ScDataPilotFieldObj* GetObjectByIndex_Impl( sal_Int32 nIndex ) const;
388 ScDataPilotFieldObj* GetObjectByName_Impl( const OUString& rName ) const;
390 private:
391 css::uno::Any maOrient; /// Field orientation, no value = all fields.
394 typedef ::cppu::WeakImplHelper
396 css::container::XNamed,
397 css::beans::XPropertySet,
398 css::sheet::XDataPilotField,
399 css::sheet::XDataPilotFieldGrouping,
400 css::lang::XServiceInfo
402 ScDataPilotFieldObjImpl;
404 /** Implementation of a single DataPilot field. */
405 class ScDataPilotFieldObj : public ScDataPilotChildObjBase, public ScDataPilotFieldObjImpl
407 public:
408 ScDataPilotFieldObj(
409 ScDataPilotDescriptorBase& rParent,
410 const ScFieldIdentifier& rIdent );
412 ScDataPilotFieldObj(
413 ScDataPilotDescriptorBase& rParent,
414 const ScFieldIdentifier& rIdent,
415 const css::uno::Any& rOrient );
417 virtual ~ScDataPilotFieldObj() override;
419 // XNamed
420 virtual OUString SAL_CALL getName() override;
421 virtual void SAL_CALL setName(const OUString& aName) override;
423 // XPropertySet
424 virtual css::uno::Reference< css::beans::XPropertySetInfo >
425 SAL_CALL getPropertySetInfo( ) override;
426 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
427 const css::uno::Any& aValue ) override;
428 virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& PropertyName ) override;
429 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
430 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
431 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
432 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
433 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
434 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
435 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
436 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
438 // XDatePilotField
439 virtual css::uno::Reference<css::container::XIndexAccess> SAL_CALL
440 getItems() override;
442 // only called from property-functions:
443 css::sheet::DataPilotFieldOrientation getOrientation() const;
444 void setOrientation(css::sheet::DataPilotFieldOrientation Orientation);
445 sal_Int16 getFunction() const;
446 void setFunction(ScGeneralFunction Function);
447 css::uno::Sequence< sal_Int16 > getSubtotals() const;
448 void setSubtotals(const std::vector< ScGeneralFunction >& rFunctions);
449 void setCurrentPage(const OUString& sPage);
450 void setUseCurrentPage(bool bUse);
451 const css::sheet::DataPilotFieldAutoShowInfo* getAutoShowInfo();
452 void setAutoShowInfo(const css::sheet::DataPilotFieldAutoShowInfo* pInfo);
453 const css::sheet::DataPilotFieldLayoutInfo* getLayoutInfo();
454 void setLayoutInfo(const css::sheet::DataPilotFieldLayoutInfo* pInfo);
455 const css::sheet::DataPilotFieldReference* getReference();
456 void setReference(const css::sheet::DataPilotFieldReference* pInfo);
457 const css::sheet::DataPilotFieldSortInfo* getSortInfo();
458 void setSortInfo(const css::sheet::DataPilotFieldSortInfo* pInfo);
459 bool getShowEmpty() const;
460 void setShowEmpty(bool bShow);
461 bool getRepeatItemLabels() const;
462 void setRepeatItemLabels(bool bShow);
464 bool hasGroupInfo();
465 css::sheet::DataPilotFieldGroupInfo getGroupInfo();
466 void setGroupInfo(const css::sheet::DataPilotFieldGroupInfo* pInfo);
468 // XDataPilotFieldGrouping
469 static bool HasString(const css::uno::Sequence< OUString >& aItems, const OUString& aString);
470 virtual css::uno::Reference < css::sheet::XDataPilotField > SAL_CALL
471 createNameGroup(const css::uno::Sequence< OUString >& aItems) override;
472 virtual css::uno::Reference < css::sheet::XDataPilotField > SAL_CALL
473 createDateGroup(const css::sheet::DataPilotFieldGroupInfo& rInfo) override;
475 // XServiceInfo
476 virtual OUString SAL_CALL getImplementationName() override;
477 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
478 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
480 private:
481 css::uno::Reference< css::container::XIndexAccess >
482 mxItems;
483 SfxItemPropertySet maPropSet;
484 css::uno::Any maOrient;
487 typedef ::std::vector< OUString > ScFieldGroupMembers;
489 struct ScFieldGroup
491 OUString maName;
492 ScFieldGroupMembers maMembers;
495 typedef ::std::vector< ScFieldGroup > ScFieldGroups;
497 typedef ::cppu::WeakImplHelper
499 css::container::XNameContainer,
500 css::container::XEnumerationAccess,
501 css::container::XIndexAccess,
502 css::lang::XServiceInfo
504 ScDataPilotFieldGroupsObjImpl;
506 /** Implementation of all grouped items in a DataPilot field.
508 This is a stand-alone object without any connection to the base DataPilot
509 field. Grouping info has to be written back with the GroupInfo property of
510 the DataPilot field after modifying this object.
512 class ScDataPilotFieldGroupsObj : public ScDataPilotFieldGroupsObjImpl
514 public:
515 explicit ScDataPilotFieldGroupsObj( const ScFieldGroups& rGroups );
516 virtual ~ScDataPilotFieldGroupsObj() override;
518 // XNameAccess
519 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
520 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
521 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
523 // XNameReplace
524 virtual void SAL_CALL replaceByName( const OUString& aName,
525 const css::uno::Any& aElement ) override;
527 // XNameContainer
528 virtual void SAL_CALL insertByName( const OUString& aName,
529 const css::uno::Any& aElement ) override;
530 virtual void SAL_CALL removeByName( const OUString& Name ) override;
532 // XIndexAccess
533 virtual sal_Int32 SAL_CALL getCount() override;
534 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
536 // XEnumerationAccess
537 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
538 createEnumeration() override;
540 // XElementAccess
541 virtual css::uno::Type SAL_CALL getElementType() override;
542 virtual sal_Bool SAL_CALL hasElements() override;
544 // XServiceInfo
545 virtual OUString SAL_CALL getImplementationName() override;
546 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
547 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
549 // implementation
550 /// @throws css::uno::RuntimeException
551 ScFieldGroup& getFieldGroup( const OUString& rName );
552 /// @throws css::uno::RuntimeException
553 void renameFieldGroup( const OUString& rOldName, const OUString& rNewName );
555 private:
556 ScFieldGroups::iterator implFindByName( const OUString& rName );
558 private:
559 ScFieldGroups maGroups;
562 typedef ::cppu::WeakImplHelper
564 css::container::XNameContainer,
565 css::container::XEnumerationAccess,
566 css::container::XIndexAccess,
567 css::container::XNamed,
568 css::lang::XServiceInfo
570 ScDataPilotFieldGroupObjImpl;
572 class ScDataPilotFieldGroupObj : public ScDataPilotFieldGroupObjImpl
574 public:
575 explicit ScDataPilotFieldGroupObj( ScDataPilotFieldGroupsObj& rParent, const OUString& rGroupName );
576 virtual ~ScDataPilotFieldGroupObj() override;
578 // XNameAccess
579 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
580 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
581 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
583 // XNameReplace
584 virtual void SAL_CALL replaceByName( const OUString& aName,
585 const css::uno::Any& aElement ) override;
587 // XNameContainer
588 virtual void SAL_CALL insertByName( const OUString& aName,
589 const css::uno::Any& aElement ) override;
590 virtual void SAL_CALL removeByName( const OUString& Name ) override;
592 // XIndexAccess
593 virtual sal_Int32 SAL_CALL getCount() override;
594 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
596 // XEnumerationAccess
597 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
598 createEnumeration() override;
600 // XElementAccess
601 virtual css::uno::Type SAL_CALL getElementType() override;
602 virtual sal_Bool SAL_CALL hasElements() override;
604 // XNamed
605 virtual OUString SAL_CALL getName() override;
606 virtual void SAL_CALL setName( const OUString& aName ) override;
608 // XServiceInfo
609 virtual OUString SAL_CALL getImplementationName() override;
610 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
611 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
613 private:
614 rtl::Reference<ScDataPilotFieldGroupsObj> mxParent;
615 OUString maGroupName;
618 typedef ::cppu::WeakImplHelper
620 css::container::XNamed,
621 css::lang::XServiceInfo
623 ScDataPilotFieldGroupItemObjImpl;
625 class ScDataPilotFieldGroupItemObj : public ScDataPilotFieldGroupItemObjImpl
627 public:
628 explicit ScDataPilotFieldGroupItemObj( ScDataPilotFieldGroupObj& rParent, const OUString& rName );
629 virtual ~ScDataPilotFieldGroupItemObj() override;
631 // XNamed
632 virtual OUString SAL_CALL getName() override;
633 virtual void SAL_CALL setName( const OUString& aName ) override;
635 // XServiceInfo
636 virtual OUString SAL_CALL getImplementationName() override;
637 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
638 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
640 private:
641 rtl::Reference<ScDataPilotFieldGroupObj> mxParent;
642 OUString maName;
645 typedef ::cppu::WeakImplHelper
647 css::container::XEnumerationAccess,
648 css::container::XIndexAccess,
649 css::container::XNameAccess,
650 css::lang::XServiceInfo
652 ScDataPilotItemsObjImpl;
654 class ScDataPilotItemsObj : public ScDataPilotChildObjBase, public ScDataPilotItemsObjImpl
656 public:
657 explicit ScDataPilotItemsObj( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId );
658 virtual ~ScDataPilotItemsObj() override;
660 // XNameAccess
661 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
662 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
663 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
665 // XIndexAccess
666 virtual sal_Int32 SAL_CALL getCount() override;
667 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
669 // XEnumerationAccess
670 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
671 createEnumeration() override;
673 // XElementAccess
674 virtual css::uno::Type SAL_CALL getElementType() override;
675 virtual sal_Bool SAL_CALL hasElements() override;
677 // XServiceInfo
678 virtual OUString SAL_CALL getImplementationName() override;
679 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
680 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
682 private:
683 ScDataPilotItemObj* GetObjectByIndex_Impl( sal_Int32 nIndex ) const;
686 typedef ::cppu::WeakImplHelper
688 css::container::XNamed,
689 css::beans::XPropertySet,
690 css::lang::XServiceInfo
692 ScDataPilotItemObjImpl;
694 class ScDataPilotItemObj : public ScDataPilotChildObjBase, public ScDataPilotItemObjImpl
696 public:
697 explicit ScDataPilotItemObj(
698 ScDataPilotDescriptorBase& rParent,
699 const ScFieldIdentifier& rFieldId,
700 sal_Int32 nIndex );
702 virtual ~ScDataPilotItemObj() override;
704 // XNamed
705 virtual OUString SAL_CALL getName() override;
706 virtual void SAL_CALL setName( const OUString& aName ) override;
708 // XPropertySet
709 virtual css::uno::Reference< css::beans::XPropertySetInfo >
710 SAL_CALL getPropertySetInfo( ) override;
711 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
712 const css::uno::Any& aValue ) override;
713 virtual css::uno::Any SAL_CALL getPropertyValue(
714 const OUString& PropertyName ) override;
715 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
716 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
717 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
718 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
719 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
720 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
721 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
722 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
724 // XServiceInfo
725 virtual OUString SAL_CALL getImplementationName() override;
726 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
727 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
729 private:
730 SfxItemPropertySet maPropSet;
731 sal_Int32 mnIndex;
734 #endif
736 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */