Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / inc / dapiuno.hxx
blob8edab4cceccb56dc1470ee88089601f379798c7f
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 SC_DAPIUNO_HXX
21 #define SC_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/GeneralFunction.hpp>
45 #include <com/sun/star/sheet/XDataPilotDataLayoutFieldSupplier.hpp>
46 #include <com/sun/star/sheet/XDataPilotDescriptor.hpp>
47 #include <com/sun/star/sheet/XDataPilotField.hpp>
48 #include <com/sun/star/sheet/XDataPilotFieldGrouping.hpp>
49 #include <com/sun/star/sheet/XDataPilotTable.hpp>
50 #include <com/sun/star/sheet/XDataPilotTable2.hpp>
51 #include <com/sun/star/sheet/XDataPilotTables.hpp>
53 #include <cppuhelper/implbase2.hxx>
54 #include <cppuhelper/implbase3.hxx>
55 #include <cppuhelper/implbase4.hxx>
56 #include <cppuhelper/implbase5.hxx>
58 #include <memory>
59 #include <vector>
61 namespace com { namespace sun { namespace star { namespace sheet {
62 struct DataPilotFieldFilter;
63 struct DataPilotTablePositionData;
64 }}}}
66 class ScDocShell;
67 class ScDPSaveDimension;
68 struct ScDPNumGroupInfo;
70 class ScDataPilotTableObj;
71 class ScDataPilotFieldObj;
72 class ScDataPilotItemObj;
75 class ScDataPilotConversion
77 public:
78 static com::sun::star::sheet::GeneralFunction FirstFunc( sal_uInt16 nBits );
79 static sal_uInt16 FunctionBit( com::sun::star::sheet::GeneralFunction eFunc );
81 static void FillGroupInfo(
82 ::com::sun::star::sheet::DataPilotFieldGroupInfo& rInfo,
83 const ScDPNumGroupInfo& rGroupInfo );
86 /** DataPilotTables collection per sheet. */
87 class ScDataPilotTablesObj : public cppu::WeakImplHelper4<
88 com::sun::star::sheet::XDataPilotTables,
89 com::sun::star::container::XEnumerationAccess,
90 com::sun::star::container::XIndexAccess,
91 com::sun::star::lang::XServiceInfo>,
92 public SfxListener
94 private:
95 ScDocShell* pDocShell;
96 SCTAB nTab;
98 ScDataPilotTableObj* GetObjectByIndex_Impl( sal_Int32 nIndex );
99 ScDataPilotTableObj* GetObjectByName_Impl(const OUString& aName);
101 public:
102 ScDataPilotTablesObj(ScDocShell* pDocSh, SCTAB nT);
103 virtual ~ScDataPilotTablesObj();
105 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
107 // XDataPilotTables
108 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotDescriptor > SAL_CALL
109 createDataPilotDescriptor() throw(::com::sun::star::uno::RuntimeException);
110 virtual void SAL_CALL insertNewByName( const OUString& aName,
111 const ::com::sun::star::table::CellAddress& aOutputAddress,
112 const ::com::sun::star::uno::Reference<
113 ::com::sun::star::sheet::XDataPilotDescriptor >& xDescriptor )
114 throw(::com::sun::star::uno::RuntimeException);
115 virtual void SAL_CALL removeByName( const OUString& aName )
116 throw(::com::sun::star::uno::RuntimeException);
118 // XNameAccess
119 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
120 throw(::com::sun::star::container::NoSuchElementException,
121 ::com::sun::star::lang::WrappedTargetException,
122 ::com::sun::star::uno::RuntimeException);
123 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames()
124 throw(::com::sun::star::uno::RuntimeException);
125 virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
126 throw(::com::sun::star::uno::RuntimeException);
128 // XIndexAccess
129 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
130 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
131 throw(::com::sun::star::lang::IndexOutOfBoundsException,
132 ::com::sun::star::lang::WrappedTargetException,
133 ::com::sun::star::uno::RuntimeException);
135 // XEnumerationAccess
136 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
137 createEnumeration() throw(::com::sun::star::uno::RuntimeException);
139 // XElementAccess
140 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
141 throw(::com::sun::star::uno::RuntimeException);
142 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
144 // XServiceInfo
145 virtual OUString SAL_CALL getImplementationName()
146 throw(::com::sun::star::uno::RuntimeException);
147 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
148 throw(::com::sun::star::uno::RuntimeException);
149 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
150 throw(::com::sun::star::uno::RuntimeException);
153 // ScDataPilotDescriptorBase is never instantiated directly
154 class ScDataPilotDescriptorBase : public com::sun::star::sheet::XDataPilotDescriptor,
155 public com::sun::star::beans::XPropertySet,
156 public com::sun::star::sheet::XDataPilotDataLayoutFieldSupplier,
157 public com::sun::star::lang::XServiceInfo,
158 public com::sun::star::lang::XUnoTunnel,
159 public com::sun::star::lang::XTypeProvider,
160 public cppu::OWeakObject,
161 public SfxListener
163 private:
164 SfxItemPropertySet maPropSet;
165 ScDocShell* pDocShell;
167 public:
168 ScDataPilotDescriptorBase(ScDocShell* pDocSh);
169 virtual ~ScDataPilotDescriptorBase();
171 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
172 const ::com::sun::star::uno::Type & rType )
173 throw(::com::sun::star::uno::RuntimeException);
174 virtual void SAL_CALL acquire() throw();
175 virtual void SAL_CALL release() throw();
177 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
179 ScDocShell* GetDocShell() const { return pDocShell; }
181 // in the derivatives:
182 virtual ScDPObject* GetDPObject() const = 0;
183 virtual void SetDPObject(ScDPObject* pDPObj) = 0;
185 // XDataPilotDescriptor
186 // getName, setName, getTag, setTag in derived classes
188 virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getSourceRange()
189 throw(::com::sun::star::uno::RuntimeException);
190 virtual void SAL_CALL setSourceRange( const ::com::sun::star::table::CellRangeAddress& aSourceRange )
191 throw(::com::sun::star::uno::RuntimeException);
192 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetFilterDescriptor > SAL_CALL
193 getFilterDescriptor() throw(::com::sun::star::uno::RuntimeException);
194 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
195 getDataPilotFields() throw(::com::sun::star::uno::RuntimeException);
196 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
197 getColumnFields() throw(::com::sun::star::uno::RuntimeException);
198 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
199 getRowFields() throw(::com::sun::star::uno::RuntimeException);
200 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
201 getPageFields() throw(::com::sun::star::uno::RuntimeException);
202 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
203 getDataFields() throw(::com::sun::star::uno::RuntimeException);
204 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
205 getHiddenFields() throw(::com::sun::star::uno::RuntimeException);
207 // XPropertySet
208 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
209 SAL_CALL getPropertySetInfo( )
210 throw(::com::sun::star::uno::RuntimeException);
211 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
212 const ::com::sun::star::uno::Any& aValue )
213 throw(::com::sun::star::beans::UnknownPropertyException,
214 ::com::sun::star::beans::PropertyVetoException,
215 ::com::sun::star::lang::IllegalArgumentException,
216 ::com::sun::star::lang::WrappedTargetException,
217 ::com::sun::star::uno::RuntimeException);
218 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
219 const OUString& PropertyName )
220 throw(::com::sun::star::beans::UnknownPropertyException,
221 ::com::sun::star::lang::WrappedTargetException,
222 ::com::sun::star::uno::RuntimeException);
223 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
224 const ::com::sun::star::uno::Reference<
225 ::com::sun::star::beans::XPropertyChangeListener >& xListener )
226 throw(::com::sun::star::beans::UnknownPropertyException,
227 ::com::sun::star::lang::WrappedTargetException,
228 ::com::sun::star::uno::RuntimeException);
229 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
230 const ::com::sun::star::uno::Reference<
231 ::com::sun::star::beans::XPropertyChangeListener >& aListener )
232 throw(::com::sun::star::beans::UnknownPropertyException,
233 ::com::sun::star::lang::WrappedTargetException,
234 ::com::sun::star::uno::RuntimeException);
235 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
236 const ::com::sun::star::uno::Reference<
237 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
238 throw(::com::sun::star::beans::UnknownPropertyException,
239 ::com::sun::star::lang::WrappedTargetException,
240 ::com::sun::star::uno::RuntimeException);
241 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
242 const ::com::sun::star::uno::Reference<
243 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
244 throw(::com::sun::star::beans::UnknownPropertyException,
245 ::com::sun::star::lang::WrappedTargetException,
246 ::com::sun::star::uno::RuntimeException);
248 // XDataPilotDataLayoutFieldSupplier
249 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >
250 SAL_CALL getDataLayoutField()
251 throw(::com::sun::star::uno::RuntimeException);
253 // XUnoTunnel
254 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
255 sal_Int8 >& aIdentifier )
256 throw(::com::sun::star::uno::RuntimeException);
258 static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
259 SC_DLLPUBLIC static ScDataPilotDescriptorBase* getImplementation( const com::sun::star::uno::Reference<
260 com::sun::star::sheet::XDataPilotDescriptor> xObj );
262 // XTypeProvider (overloaded in ScDataPilotTableObj)
263 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
264 throw(::com::sun::star::uno::RuntimeException);
265 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
266 throw(::com::sun::star::uno::RuntimeException);
268 // XServiceInfo is in derived classes
271 class ScDataPilotDescriptor : public ScDataPilotDescriptorBase
273 private:
274 ScDPObject* mpDPObject;
276 public:
277 ScDataPilotDescriptor(ScDocShell* pDocSh);
278 virtual ~ScDataPilotDescriptor();
280 virtual ScDPObject* GetDPObject() const;
281 virtual void SetDPObject(ScDPObject* pDPObj);
283 // rest of XDataPilotDescriptor (incl. XNamed)
284 virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
285 virtual void SAL_CALL setName( const OUString& aName )
286 throw(::com::sun::star::uno::RuntimeException);
287 virtual OUString SAL_CALL getTag() throw(::com::sun::star::uno::RuntimeException);
288 virtual void SAL_CALL setTag( const OUString& aTag )
289 throw(::com::sun::star::uno::RuntimeException);
291 // XServiceInfo
292 virtual OUString SAL_CALL getImplementationName()
293 throw(::com::sun::star::uno::RuntimeException);
294 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
295 throw(::com::sun::star::uno::RuntimeException);
296 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
297 throw(::com::sun::star::uno::RuntimeException);
300 class ScDataPilotTableObj : public ScDataPilotDescriptorBase,
301 public com::sun::star::sheet::XDataPilotTable2,
302 public com::sun::star::util::XModifyBroadcaster
304 private:
305 SCTAB nTab;
306 OUString aName;
307 XModifyListenerArr_Impl aModifyListeners;
309 void Refreshed_Impl();
311 public:
312 ScDataPilotTableObj(ScDocShell* pDocSh, SCTAB nT, const OUString& rN);
313 virtual ~ScDataPilotTableObj();
315 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
316 const ::com::sun::star::uno::Type & rType )
317 throw(::com::sun::star::uno::RuntimeException);
318 virtual void SAL_CALL acquire() throw();
319 virtual void SAL_CALL release() throw();
321 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
323 virtual ScDPObject* GetDPObject() const;
324 virtual void SetDPObject(ScDPObject* pDPObj);
326 // rest of XDataPilotDescriptor (incl. XNamed)
327 virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
328 virtual void SAL_CALL setName( const OUString& aName )
329 throw(::com::sun::star::uno::RuntimeException);
330 virtual OUString SAL_CALL getTag() throw(::com::sun::star::uno::RuntimeException);
331 virtual void SAL_CALL setTag( const OUString& aTag )
332 throw(::com::sun::star::uno::RuntimeException);
334 // XDataPilotTable
335 virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getOutputRange()
336 throw(::com::sun::star::uno::RuntimeException);
337 virtual void SAL_CALL refresh() throw(::com::sun::star::uno::RuntimeException);
339 // XDataPilotTable2
340 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >
341 SAL_CALL getDrillDownData(const ::com::sun::star::table::CellAddress& aAddr)
342 throw(::com::sun::star::uno::RuntimeException);
344 virtual ::com::sun::star::sheet::DataPilotTablePositionData
345 SAL_CALL getPositionData(const ::com::sun::star::table::CellAddress& aAddr)
346 throw(::com::sun::star::uno::RuntimeException);
348 virtual void SAL_CALL insertDrillDownSheet(const ::com::sun::star::table::CellAddress& aAddr)
349 throw(::com::sun::star::uno::RuntimeException);
351 virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getOutputRangeByType( sal_Int32 nType )
352 throw(::com::sun::star::lang::IllegalArgumentException,
353 ::com::sun::star::uno::RuntimeException);
355 // XModifyBroadcaster
356 virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference<
357 ::com::sun::star::util::XModifyListener >& aListener )
358 throw (::com::sun::star::uno::RuntimeException);
359 virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference<
360 ::com::sun::star::util::XModifyListener >& aListener )
361 throw (::com::sun::star::uno::RuntimeException);
363 // XTypeProvider (overloaded)
364 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
365 throw(::com::sun::star::uno::RuntimeException);
366 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
367 throw(::com::sun::star::uno::RuntimeException);
369 // XServiceInfo
370 virtual OUString SAL_CALL getImplementationName()
371 throw(::com::sun::star::uno::RuntimeException);
372 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
373 throw(::com::sun::star::uno::RuntimeException);
374 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
375 throw(::com::sun::star::uno::RuntimeException);
378 struct ScFieldIdentifier
380 OUString maFieldName; /// Source field name.
381 sal_Int32 mnFieldIdx; /// Field index (if several fields with same name exist).
382 bool mbDataLayout; /// True = data layout field collecting all data fields as items.
384 inline explicit ScFieldIdentifier() :
385 mnFieldIdx( 0 ), mbDataLayout( false ) {}
387 inline explicit ScFieldIdentifier( const OUString& rFieldName, sal_Int32 nFieldIdx, bool bDataLayout ) :
388 maFieldName( rFieldName ), mnFieldIdx( nFieldIdx ), mbDataLayout( bDataLayout ) {}
391 /** Base class of all implementation objects based on a DataPilot descriptor
392 or DataPilot table object. Wraps acquiring and releasing the parent. */
393 class ScDataPilotChildObjBase
395 protected:
396 explicit ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent );
397 explicit ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId );
398 virtual ~ScDataPilotChildObjBase();
400 /** Returns the wrapped DataPilot object (calls GetDPObject() at parent). */
401 ScDPObject* GetDPObject() const;
402 /** Sets the passed DataPilot object (calls SetDPObject() at parent). */
403 void SetDPObject( ScDPObject* pDPObject );
405 /** Returns the DataPilot dimension object related to the field described by maFieldId. */
406 ScDPSaveDimension* GetDPDimension( ScDPObject** ppDPObject = 0 ) const;
408 /** Returns the number of members for the field described by maFieldId. */
409 sal_Int32 GetMemberCount() const;
410 /** Returns the collection of members for the field described by maFieldId. */
411 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
412 GetMembers() const;
414 ScDocShell* GetDocShell() const;
415 protected:
416 ScDataPilotDescriptorBase& mrParent;
417 ScFieldIdentifier maFieldId;
419 private:
420 ScDataPilotChildObjBase& operator=( const ScDataPilotChildObjBase& );
423 typedef ::cppu::WeakImplHelper4
425 ::com::sun::star::container::XEnumerationAccess,
426 ::com::sun::star::container::XIndexAccess,
427 ::com::sun::star::container::XNameAccess,
428 ::com::sun::star::lang::XServiceInfo
430 ScDataPilotFieldsObjImpl;
432 /** Collection of all DataPilot fields, or of all fields from a specific dimension. */
433 class ScDataPilotFieldsObj : public ScDataPilotChildObjBase, public ScDataPilotFieldsObjImpl
435 public:
436 explicit ScDataPilotFieldsObj(
437 ScDataPilotDescriptorBase& rParent );
439 explicit ScDataPilotFieldsObj(
440 ScDataPilotDescriptorBase& rParent,
441 ::com::sun::star::sheet::DataPilotFieldOrientation eOrient );
443 virtual ~ScDataPilotFieldsObj();
445 // XNameAccess
446 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
447 throw(::com::sun::star::container::NoSuchElementException,
448 ::com::sun::star::lang::WrappedTargetException,
449 ::com::sun::star::uno::RuntimeException);
450 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames()
451 throw(::com::sun::star::uno::RuntimeException);
452 virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
453 throw(::com::sun::star::uno::RuntimeException);
455 // XIndexAccess
456 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
457 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
458 throw(::com::sun::star::lang::IndexOutOfBoundsException,
459 ::com::sun::star::lang::WrappedTargetException,
460 ::com::sun::star::uno::RuntimeException);
462 // XEnumerationAccess
463 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
464 createEnumeration() throw(::com::sun::star::uno::RuntimeException);
466 // XElementAccess
467 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
468 throw(::com::sun::star::uno::RuntimeException);
469 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
471 // XServiceInfo
472 virtual OUString SAL_CALL getImplementationName()
473 throw(::com::sun::star::uno::RuntimeException);
474 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
475 throw(::com::sun::star::uno::RuntimeException);
476 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
477 throw(::com::sun::star::uno::RuntimeException);
479 private:
480 ScDataPilotFieldObj* GetObjectByIndex_Impl( sal_Int32 nIndex ) const;
481 ScDataPilotFieldObj* GetObjectByName_Impl( const OUString& rName ) const;
483 private:
484 ::com::sun::star::uno::Any maOrient; /// Field orientation, no value = all fields.
487 typedef ::cppu::WeakImplHelper5
489 ::com::sun::star::container::XNamed,
490 ::com::sun::star::beans::XPropertySet,
491 ::com::sun::star::sheet::XDataPilotField,
492 ::com::sun::star::sheet::XDataPilotFieldGrouping,
493 ::com::sun::star::lang::XServiceInfo
495 ScDataPilotFieldObjImpl;
497 /** Implementation of a single DataPilot field. */
498 class ScDataPilotFieldObj : public ScDataPilotChildObjBase, public ScDataPilotFieldObjImpl
500 public:
501 ScDataPilotFieldObj(
502 ScDataPilotDescriptorBase& rParent,
503 const ScFieldIdentifier& rIdent );
505 ScDataPilotFieldObj(
506 ScDataPilotDescriptorBase& rParent,
507 const ScFieldIdentifier& rIdent,
508 const ::com::sun::star::uno::Any& rOrient );
510 virtual ~ScDataPilotFieldObj();
512 // XNamed
513 virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
514 virtual void SAL_CALL setName( const OUString& aName )
515 throw(::com::sun::star::uno::RuntimeException);
517 // XPropertySet
518 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
519 SAL_CALL getPropertySetInfo( )
520 throw(::com::sun::star::uno::RuntimeException);
521 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
522 const ::com::sun::star::uno::Any& aValue )
523 throw(::com::sun::star::beans::UnknownPropertyException,
524 ::com::sun::star::beans::PropertyVetoException,
525 ::com::sun::star::lang::IllegalArgumentException,
526 ::com::sun::star::lang::WrappedTargetException,
527 ::com::sun::star::uno::RuntimeException);
528 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
529 const OUString& PropertyName )
530 throw(::com::sun::star::beans::UnknownPropertyException,
531 ::com::sun::star::lang::WrappedTargetException,
532 ::com::sun::star::uno::RuntimeException);
533 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
534 const ::com::sun::star::uno::Reference<
535 ::com::sun::star::beans::XPropertyChangeListener >& xListener )
536 throw(::com::sun::star::beans::UnknownPropertyException,
537 ::com::sun::star::lang::WrappedTargetException,
538 ::com::sun::star::uno::RuntimeException);
539 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
540 const ::com::sun::star::uno::Reference<
541 ::com::sun::star::beans::XPropertyChangeListener >& aListener )
542 throw(::com::sun::star::beans::UnknownPropertyException,
543 ::com::sun::star::lang::WrappedTargetException,
544 ::com::sun::star::uno::RuntimeException);
545 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
546 const ::com::sun::star::uno::Reference<
547 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
548 throw(::com::sun::star::beans::UnknownPropertyException,
549 ::com::sun::star::lang::WrappedTargetException,
550 ::com::sun::star::uno::RuntimeException);
551 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
552 const ::com::sun::star::uno::Reference<
553 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
554 throw(::com::sun::star::beans::UnknownPropertyException,
555 ::com::sun::star::lang::WrappedTargetException,
556 ::com::sun::star::uno::RuntimeException);
558 // XDatePilotField
559 virtual com::sun::star::uno::Reference<com::sun::star::container::XIndexAccess> SAL_CALL
560 getItems() throw (::com::sun::star::uno::RuntimeException);
562 // only called from property-functions:
563 com::sun::star::sheet::DataPilotFieldOrientation getOrientation(void) const;
564 void setOrientation(com::sun::star::sheet::DataPilotFieldOrientation Orientation);
565 com::sun::star::sheet::GeneralFunction getFunction(void) const;
566 void setFunction(com::sun::star::sheet::GeneralFunction Function);
567 com::sun::star::uno::Sequence< com::sun::star::sheet::GeneralFunction > getSubtotals() const;
568 void setSubtotals(const com::sun::star::uno::Sequence< com::sun::star::sheet::GeneralFunction >& rFunctions);
569 OUString getCurrentPage() const;
570 void setCurrentPage(const OUString& sPage);
571 sal_Bool getUseCurrentPage() const;
572 void setUseCurrentPage(sal_Bool bUse);
573 const com::sun::star::sheet::DataPilotFieldAutoShowInfo* getAutoShowInfo();
574 void setAutoShowInfo(const com::sun::star::sheet::DataPilotFieldAutoShowInfo* pInfo);
575 const com::sun::star::sheet::DataPilotFieldLayoutInfo* getLayoutInfo();
576 void setLayoutInfo(const com::sun::star::sheet::DataPilotFieldLayoutInfo* pInfo);
577 const com::sun::star::sheet::DataPilotFieldReference* getReference();
578 void setReference(const com::sun::star::sheet::DataPilotFieldReference* pInfo);
579 const com::sun::star::sheet::DataPilotFieldSortInfo* getSortInfo();
580 void setSortInfo(const com::sun::star::sheet::DataPilotFieldSortInfo* pInfo);
581 sal_Bool getShowEmpty() const;
582 void setShowEmpty(sal_Bool bShow);
584 sal_Bool hasGroupInfo();
585 com::sun::star::sheet::DataPilotFieldGroupInfo getGroupInfo();
586 void setGroupInfo(const com::sun::star::sheet::DataPilotFieldGroupInfo* pInfo);
588 // XDataPilotFieldGrouping
589 sal_Bool HasString(const com::sun::star::uno::Sequence< OUString >& aItems, const OUString& aString);
590 virtual com::sun::star::uno::Reference < com::sun::star::sheet::XDataPilotField > SAL_CALL
591 createNameGroup(const com::sun::star::uno::Sequence< OUString >& aItems)
592 throw (::com::sun::star::uno::RuntimeException,
593 ::com::sun::star::lang::IllegalArgumentException);
594 virtual com::sun::star::uno::Reference < com::sun::star::sheet::XDataPilotField > SAL_CALL
595 createDateGroup(const com::sun::star::sheet::DataPilotFieldGroupInfo& rInfo)
596 throw (::com::sun::star::uno::RuntimeException,
597 ::com::sun::star::lang::IllegalArgumentException);
599 // XServiceInfo
600 virtual OUString SAL_CALL getImplementationName()
601 throw(::com::sun::star::uno::RuntimeException);
602 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
603 throw(::com::sun::star::uno::RuntimeException);
604 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
605 throw(::com::sun::star::uno::RuntimeException);
607 private:
608 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >
609 mxItems;
610 SfxItemPropertySet maPropSet;
611 ::com::sun::star::uno::Any maOrient;
614 typedef ::std::vector< OUString > ScFieldGroupMembers;
616 struct ScFieldGroup
618 OUString maName;
619 ScFieldGroupMembers maMembers;
622 typedef ::std::vector< ScFieldGroup > ScFieldGroups;
624 typedef ::cppu::WeakImplHelper4
626 ::com::sun::star::container::XNameContainer,
627 ::com::sun::star::container::XEnumerationAccess,
628 ::com::sun::star::container::XIndexAccess,
629 ::com::sun::star::lang::XServiceInfo
631 ScDataPilotFieldGroupsObjImpl;
633 /** Implementation of all grouped items in a DataPilot field.
635 This is a stand-alone object without any connection to the base DataPilot
636 field. Grouping info has to be written back with the GroupInfo property of
637 the DataPilot field after modifying this object.
639 class ScDataPilotFieldGroupsObj : public ScDataPilotFieldGroupsObjImpl
641 public:
642 explicit ScDataPilotFieldGroupsObj( const ScFieldGroups& rGroups );
643 virtual ~ScDataPilotFieldGroupsObj();
645 // XNameAccess
646 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
647 throw(::com::sun::star::container::NoSuchElementException,
648 ::com::sun::star::lang::WrappedTargetException,
649 ::com::sun::star::uno::RuntimeException);
650 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames()
651 throw(::com::sun::star::uno::RuntimeException);
652 virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
653 throw(::com::sun::star::uno::RuntimeException);
655 // XNameReplace
656 virtual void SAL_CALL replaceByName( const OUString& aName,
657 const ::com::sun::star::uno::Any& aElement )
658 throw (::com::sun::star::lang::IllegalArgumentException,
659 ::com::sun::star::container::NoSuchElementException,
660 ::com::sun::star::lang::WrappedTargetException,
661 ::com::sun::star::uno::RuntimeException);
663 // XNameContainer
664 virtual void SAL_CALL insertByName( const OUString& aName,
665 const ::com::sun::star::uno::Any& aElement )
666 throw (::com::sun::star::lang::IllegalArgumentException,
667 ::com::sun::star::container::ElementExistException,
668 ::com::sun::star::lang::WrappedTargetException,
669 ::com::sun::star::uno::RuntimeException);
670 virtual void SAL_CALL removeByName( const OUString& Name )
671 throw (::com::sun::star::container::NoSuchElementException,
672 ::com::sun::star::lang::WrappedTargetException,
673 ::com::sun::star::uno::RuntimeException);
675 // XIndexAccess
676 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
677 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
678 throw(::com::sun::star::lang::IndexOutOfBoundsException,
679 ::com::sun::star::lang::WrappedTargetException,
680 ::com::sun::star::uno::RuntimeException);
682 // XEnumerationAccess
683 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
684 createEnumeration() throw(::com::sun::star::uno::RuntimeException);
686 // XElementAccess
687 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
688 throw(::com::sun::star::uno::RuntimeException);
689 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
691 // XServiceInfo
692 virtual OUString SAL_CALL getImplementationName()
693 throw(::com::sun::star::uno::RuntimeException);
694 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
695 throw(::com::sun::star::uno::RuntimeException);
696 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
697 throw(::com::sun::star::uno::RuntimeException);
699 // implementation
700 ScFieldGroup& getFieldGroup( const OUString& rName ) throw(::com::sun::star::uno::RuntimeException);
701 void renameFieldGroup( const OUString& rOldName, const OUString& rNewName ) throw(::com::sun::star::uno::RuntimeException);
703 private:
704 ScFieldGroups::iterator implFindByName( const OUString& rName );
706 private:
707 ScFieldGroups maGroups;
710 typedef ::cppu::WeakImplHelper5
712 ::com::sun::star::container::XNameContainer,
713 ::com::sun::star::container::XEnumerationAccess,
714 ::com::sun::star::container::XIndexAccess,
715 ::com::sun::star::container::XNamed,
716 ::com::sun::star::lang::XServiceInfo
718 ScDataPilotFieldGroupObjImpl;
720 class ScDataPilotFieldGroupObj : public ScDataPilotFieldGroupObjImpl
722 public:
723 explicit ScDataPilotFieldGroupObj( ScDataPilotFieldGroupsObj& rParent, const OUString& rGroupName );
724 virtual ~ScDataPilotFieldGroupObj();
726 // XNameAccess
727 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
728 throw(::com::sun::star::container::NoSuchElementException,
729 ::com::sun::star::lang::WrappedTargetException,
730 ::com::sun::star::uno::RuntimeException);
731 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames()
732 throw(::com::sun::star::uno::RuntimeException);
733 virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
734 throw(::com::sun::star::uno::RuntimeException);
736 // XNameReplace
737 virtual void SAL_CALL replaceByName( const OUString& aName,
738 const ::com::sun::star::uno::Any& aElement )
739 throw (::com::sun::star::lang::IllegalArgumentException,
740 ::com::sun::star::container::NoSuchElementException,
741 ::com::sun::star::lang::WrappedTargetException,
742 ::com::sun::star::uno::RuntimeException);
744 // XNameContainer
745 virtual void SAL_CALL insertByName( const OUString& aName,
746 const ::com::sun::star::uno::Any& aElement )
747 throw (::com::sun::star::lang::IllegalArgumentException,
748 ::com::sun::star::container::ElementExistException,
749 ::com::sun::star::lang::WrappedTargetException,
750 ::com::sun::star::uno::RuntimeException);
751 virtual void SAL_CALL removeByName( const OUString& Name )
752 throw (::com::sun::star::container::NoSuchElementException,
753 ::com::sun::star::lang::WrappedTargetException,
754 ::com::sun::star::uno::RuntimeException);
756 // XIndexAccess
757 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
758 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
759 throw(::com::sun::star::lang::IndexOutOfBoundsException,
760 ::com::sun::star::lang::WrappedTargetException,
761 ::com::sun::star::uno::RuntimeException);
763 // XEnumerationAccess
764 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
765 createEnumeration() throw(::com::sun::star::uno::RuntimeException);
767 // XElementAccess
768 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
769 throw(::com::sun::star::uno::RuntimeException);
770 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
772 // XNamed
773 virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
774 virtual void SAL_CALL setName( const OUString& aName )
775 throw(::com::sun::star::uno::RuntimeException);
777 // XServiceInfo
778 virtual OUString SAL_CALL getImplementationName()
779 throw(::com::sun::star::uno::RuntimeException);
780 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
781 throw(::com::sun::star::uno::RuntimeException);
782 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
783 throw(::com::sun::star::uno::RuntimeException);
785 private:
786 ScDataPilotFieldGroupsObj& mrParent;
787 OUString maGroupName;
790 typedef ::cppu::WeakImplHelper2
792 ::com::sun::star::container::XNamed,
793 ::com::sun::star::lang::XServiceInfo
795 ScDataPilotFieldGroupItemObjImpl;
797 class ScDataPilotFieldGroupItemObj : public ScDataPilotFieldGroupItemObjImpl
799 public:
800 explicit ScDataPilotFieldGroupItemObj( ScDataPilotFieldGroupObj& rParent, const OUString& rName );
801 virtual ~ScDataPilotFieldGroupItemObj();
803 // XNamed
804 virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
805 virtual void SAL_CALL setName( const OUString& aName )
806 throw(::com::sun::star::uno::RuntimeException);
808 // XServiceInfo
809 virtual OUString SAL_CALL getImplementationName()
810 throw(::com::sun::star::uno::RuntimeException);
811 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
812 throw(::com::sun::star::uno::RuntimeException);
813 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
814 throw(::com::sun::star::uno::RuntimeException);
816 private:
817 ScDataPilotFieldGroupObj& mrParent;
818 OUString maName;
821 typedef ::cppu::WeakImplHelper4
823 ::com::sun::star::container::XEnumerationAccess,
824 ::com::sun::star::container::XIndexAccess,
825 ::com::sun::star::container::XNameAccess,
826 ::com::sun::star::lang::XServiceInfo
828 ScDataPilotItemsObjImpl;
830 class ScDataPilotItemsObj : public ScDataPilotChildObjBase, public ScDataPilotItemsObjImpl
832 public:
833 explicit ScDataPilotItemsObj( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId );
834 virtual ~ScDataPilotItemsObj();
836 // XNameAccess
837 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
838 throw(::com::sun::star::container::NoSuchElementException,
839 ::com::sun::star::lang::WrappedTargetException,
840 ::com::sun::star::uno::RuntimeException);
841 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames()
842 throw(::com::sun::star::uno::RuntimeException);
843 virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
844 throw(::com::sun::star::uno::RuntimeException);
846 // XIndexAccess
847 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
848 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
849 throw(::com::sun::star::lang::IndexOutOfBoundsException,
850 ::com::sun::star::lang::WrappedTargetException,
851 ::com::sun::star::uno::RuntimeException);
853 // XEnumerationAccess
854 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
855 createEnumeration() throw(::com::sun::star::uno::RuntimeException);
857 // XElementAccess
858 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
859 throw(::com::sun::star::uno::RuntimeException);
860 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
862 // XServiceInfo
863 virtual OUString SAL_CALL getImplementationName()
864 throw(::com::sun::star::uno::RuntimeException);
865 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
866 throw(::com::sun::star::uno::RuntimeException);
867 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
868 throw(::com::sun::star::uno::RuntimeException);
870 private:
871 ScDataPilotItemObj* GetObjectByIndex_Impl( sal_Int32 nIndex ) const;
874 typedef ::cppu::WeakImplHelper3
876 ::com::sun::star::container::XNamed,
877 ::com::sun::star::beans::XPropertySet,
878 ::com::sun::star::lang::XServiceInfo
880 ScDataPilotItemObjImpl;
882 class ScDataPilotItemObj : public ScDataPilotChildObjBase, public ScDataPilotItemObjImpl
884 public:
885 explicit ScDataPilotItemObj(
886 ScDataPilotDescriptorBase& rParent,
887 const ScFieldIdentifier& rFieldId,
888 sal_Int32 nIndex );
890 virtual ~ScDataPilotItemObj();
892 // XNamed
893 virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
894 virtual void SAL_CALL setName( const OUString& aName )
895 throw(::com::sun::star::uno::RuntimeException);
897 // XPropertySet
898 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
899 SAL_CALL getPropertySetInfo( )
900 throw(::com::sun::star::uno::RuntimeException);
901 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
902 const ::com::sun::star::uno::Any& aValue )
903 throw(::com::sun::star::beans::UnknownPropertyException,
904 ::com::sun::star::beans::PropertyVetoException,
905 ::com::sun::star::lang::IllegalArgumentException,
906 ::com::sun::star::lang::WrappedTargetException,
907 ::com::sun::star::uno::RuntimeException);
908 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
909 const OUString& PropertyName )
910 throw(::com::sun::star::beans::UnknownPropertyException,
911 ::com::sun::star::lang::WrappedTargetException,
912 ::com::sun::star::uno::RuntimeException);
913 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
914 const ::com::sun::star::uno::Reference<
915 ::com::sun::star::beans::XPropertyChangeListener >& xListener )
916 throw(::com::sun::star::beans::UnknownPropertyException,
917 ::com::sun::star::lang::WrappedTargetException,
918 ::com::sun::star::uno::RuntimeException);
919 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
920 const ::com::sun::star::uno::Reference<
921 ::com::sun::star::beans::XPropertyChangeListener >& aListener )
922 throw(::com::sun::star::beans::UnknownPropertyException,
923 ::com::sun::star::lang::WrappedTargetException,
924 ::com::sun::star::uno::RuntimeException);
925 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
926 const ::com::sun::star::uno::Reference<
927 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
928 throw(::com::sun::star::beans::UnknownPropertyException,
929 ::com::sun::star::lang::WrappedTargetException,
930 ::com::sun::star::uno::RuntimeException);
931 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
932 const ::com::sun::star::uno::Reference<
933 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
934 throw(::com::sun::star::beans::UnknownPropertyException,
935 ::com::sun::star::lang::WrappedTargetException,
936 ::com::sun::star::uno::RuntimeException);
938 // XServiceInfo
939 virtual OUString SAL_CALL getImplementationName()
940 throw(::com::sun::star::uno::RuntimeException);
941 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
942 throw(::com::sun::star::uno::RuntimeException);
943 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
944 throw(::com::sun::star::uno::RuntimeException);
946 private:
947 SfxItemPropertySet maPropSet;
948 sal_Int32 mnIndex;
951 #endif
953 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */