Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_sc / dapiuno.hxx
blob95a1bfb238d6883a7670911c593bf275189febdc
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dapiuno.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_DAPIUNO_HXX
32 #define SC_DAPIUNO_HXX
34 #ifndef SC_SCGLOB_HXX
35 #include "global.hxx"
36 #endif
38 #ifndef SC_RANGEUTL_HXX
39 #include "rangeutl.hxx" // ScArea
40 #endif
42 #ifndef _SFXLSTNER_HXX //autogen
43 #include <bf_svtools/lstner.hxx>
44 #endif
46 #ifndef _SFX_ITEMPROP_HXX
47 #include <bf_svtools/itemprop.hxx>
48 #endif
50 #ifndef _COM_SUN_STAR_SHEET_XDATAPILOTTABLE_HPP_
51 #include <com/sun/star/sheet/XDataPilotTable.hpp>
52 #endif
53 #ifndef _COM_SUN_STAR_SHEET_XDATAPILOTTABLES_HPP_
54 #include <com/sun/star/sheet/XDataPilotTables.hpp>
55 #endif
56 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
57 #include <com/sun/star/lang/XServiceInfo.hpp>
58 #endif
59 #ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_
60 #include <com/sun/star/container/XEnumerationAccess.hpp>
61 #endif
62 #ifndef _COM_SUN_STAR_SHEET_GENERALFUNCTION_HPP_
63 #include <com/sun/star/sheet/GeneralFunction.hpp>
64 #endif
65 #ifndef _COM_SUN_STAR_SHEET_DATAPILOTFIELDORIENTATION_HPP_
66 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
67 #endif
68 #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
69 #include <com/sun/star/lang/XUnoTunnel.hpp>
70 #endif
71 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
72 #include <com/sun/star/beans/XPropertySet.hpp>
73 #endif
75 #ifndef _CPPUHELPER_IMPLBASE3_HXX_
76 #include <cppuhelper/implbase3.hxx>
77 #endif
78 #ifndef _CPPUHELPER_IMPLBASE4_HXX_
79 #include <cppuhelper/implbase4.hxx>
80 #endif
81 namespace binfilter {
84 class ScDocShell;
85 class ScPivot;
87 class ScDataPilotTableObj;
88 class ScDataPilotFieldObj;
91 #define SC_FIELDORIENT_ALL USHRT_MAX
94 class ScDataPilotConversion
96 public:
97 static ::com::sun::star::sheet::GeneralFunction FirstFunc( USHORT nBits );
98 static USHORT FunctionBit( ::com::sun::star::sheet::GeneralFunction eFunc );
103 // DataPilotTables Collection ist pro Tabelle
105 class ScDataPilotTablesObj : public cppu::WeakImplHelper4<
106 ::com::sun::star::sheet::XDataPilotTables,
107 ::com::sun::star::container::XEnumerationAccess,
108 ::com::sun::star::container::XIndexAccess,
109 ::com::sun::star::lang::XServiceInfo>,
110 public SfxListener
112 private:
113 ScDocShell* pDocShell;
114 USHORT nTab;
116 ScDataPilotTableObj* GetObjectByIndex_Impl(USHORT nIndex);
117 ScDataPilotTableObj* GetObjectByName_Impl(const ::rtl::OUString& aName);
119 public:
120 ScDataPilotTablesObj(ScDocShell* pDocSh, USHORT nT);
121 virtual ~ScDataPilotTablesObj();
123 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
125 // XDataPilotTables
126 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotDescriptor > SAL_CALL
127 createDataPilotDescriptor() throw(::com::sun::star::uno::RuntimeException);
128 virtual void SAL_CALL insertNewByName( const ::rtl::OUString& aName,
129 const ::com::sun::star::table::CellAddress& aOutputAddress,
130 const ::com::sun::star::uno::Reference<
131 ::com::sun::star::sheet::XDataPilotDescriptor >& xDescriptor )
132 throw(::com::sun::star::uno::RuntimeException);
133 virtual void SAL_CALL removeByName( const ::rtl::OUString& aName )
134 throw(::com::sun::star::uno::RuntimeException);
136 // XNameAccess
137 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
138 throw(::com::sun::star::container::NoSuchElementException,
139 ::com::sun::star::lang::WrappedTargetException,
140 ::com::sun::star::uno::RuntimeException);
141 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
142 throw(::com::sun::star::uno::RuntimeException);
143 virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
144 throw(::com::sun::star::uno::RuntimeException);
146 // XIndexAccess
147 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
148 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
149 throw(::com::sun::star::lang::IndexOutOfBoundsException,
150 ::com::sun::star::lang::WrappedTargetException,
151 ::com::sun::star::uno::RuntimeException);
153 // XEnumerationAccess
154 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
155 createEnumeration() throw(::com::sun::star::uno::RuntimeException);
157 // XElementAccess
158 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
159 throw(::com::sun::star::uno::RuntimeException);
160 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
162 // XServiceInfo
163 virtual ::rtl::OUString SAL_CALL getImplementationName()
164 throw(::com::sun::star::uno::RuntimeException);
165 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
166 throw(::com::sun::star::uno::RuntimeException);
167 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
168 throw(::com::sun::star::uno::RuntimeException);
172 // ScDataPilotDescriptorBase is never instantiated directly
173 class ScDataPilotDescriptorBase : public ::com::sun::star::sheet::XDataPilotDescriptor,
174 public ::com::sun::star::lang::XServiceInfo,
175 public ::com::sun::star::lang::XUnoTunnel,
176 public ::com::sun::star::lang::XTypeProvider,
177 public cppu::OWeakObject,
178 public SfxListener
180 private:
181 ScDocShell* pDocShell;
183 public:
184 ScDataPilotDescriptorBase(ScDocShell* pDocSh);
185 virtual ~ScDataPilotDescriptorBase();
187 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
188 const ::com::sun::star::uno::Type & rType )
189 throw(::com::sun::star::uno::RuntimeException);
190 virtual void SAL_CALL acquire() throw();
191 virtual void SAL_CALL release() throw();
193 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
195 ScDocShell* GetDocShell() const { return pDocShell; }
197 // in den Ableitungen:
198 virtual void GetParam( ScPivotParam& rParam, ScQueryParam& rQuery,
199 ScArea& rSrcArea ) const = 0;
200 virtual void SetParam( const ScPivotParam& rParam, const ScQueryParam& rQuery,
201 const ScArea& rSrcArea ) = 0;
203 // XDataPilotDescriptor
204 // getName, setName, getTag, setTag in derived classes
206 virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getSourceRange()
207 throw(::com::sun::star::uno::RuntimeException);
208 virtual void SAL_CALL setSourceRange( const ::com::sun::star::table::CellRangeAddress& aSourceRange )
209 throw(::com::sun::star::uno::RuntimeException);
210 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetFilterDescriptor > SAL_CALL
211 getFilterDescriptor() throw(::com::sun::star::uno::RuntimeException);
212 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
213 getDataPilotFields() throw(::com::sun::star::uno::RuntimeException);
214 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
215 getColumnFields() throw(::com::sun::star::uno::RuntimeException);
216 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
217 getRowFields() throw(::com::sun::star::uno::RuntimeException);
218 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
219 getPageFields() throw(::com::sun::star::uno::RuntimeException);
220 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
221 getDataFields() throw(::com::sun::star::uno::RuntimeException);
222 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
223 getHiddenFields() throw(::com::sun::star::uno::RuntimeException);
225 // XUnoTunnel
226 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
227 sal_Int8 >& aIdentifier )
228 throw(::com::sun::star::uno::RuntimeException);
230 static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
231 static ScDataPilotDescriptorBase* getImplementation( const ::com::sun::star::uno::Reference<
232 ::com::sun::star::sheet::XDataPilotDescriptor> xObj );
234 // XTypeProvider (overloaded in ScDataPilotTableObj)
235 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
236 throw(::com::sun::star::uno::RuntimeException);
237 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
238 throw(::com::sun::star::uno::RuntimeException);
240 // XServiceInfo is in derived classes
244 class ScDataPilotDescriptor : public ScDataPilotDescriptorBase
246 private:
247 ScPivotParam aParam;
248 ScQueryParam aQuery;
249 ScArea aSrcArea;
250 String aNameStr;
251 String aTagStr;
253 public:
254 ScDataPilotDescriptor(ScDocShell* pDocSh);
255 virtual ~ScDataPilotDescriptor();
257 virtual void GetParam( ScPivotParam& rParam, ScQueryParam& rQuery, ScArea& rSrcArea ) const;
258 virtual void SetParam( const ScPivotParam& rParam,
259 const ScQueryParam& rQuery, const ScArea& rSrcArea );
261 // rest of XDataPilotDescriptor (incl. XNamed)
262 virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
263 virtual void SAL_CALL setName( const ::rtl::OUString& aName )
264 throw(::com::sun::star::uno::RuntimeException);
265 virtual ::rtl::OUString SAL_CALL getTag() throw(::com::sun::star::uno::RuntimeException);
266 virtual void SAL_CALL setTag( const ::rtl::OUString& aTag )
267 throw(::com::sun::star::uno::RuntimeException);
269 // XServiceInfo
270 virtual ::rtl::OUString SAL_CALL getImplementationName()
271 throw(::com::sun::star::uno::RuntimeException);
272 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
273 throw(::com::sun::star::uno::RuntimeException);
274 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
275 throw(::com::sun::star::uno::RuntimeException);
279 class ScDataPilotTableObj : public ScDataPilotDescriptorBase,
280 public ::com::sun::star::sheet::XDataPilotTable
282 private:
283 USHORT nTab;
284 String aName;
286 public:
287 ScDataPilotTableObj(ScDocShell* pDocSh, USHORT nT, const String& rN);
288 virtual ~ScDataPilotTableObj();
290 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
291 const ::com::sun::star::uno::Type & rType )
292 throw(::com::sun::star::uno::RuntimeException);
293 virtual void SAL_CALL acquire() throw();
294 virtual void SAL_CALL release() throw();
296 virtual void GetParam( ScPivotParam& rParam, ScQueryParam& rQuery, ScArea& rSrcArea ) const;
297 virtual void SetParam( const ScPivotParam& rParam,
298 const ScQueryParam& rQuery, const ScArea& rSrcArea );
300 // rest of XDataPilotDescriptor (incl. XNamed)
301 virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
302 virtual void SAL_CALL setName( const ::rtl::OUString& aName )
303 throw(::com::sun::star::uno::RuntimeException);
304 virtual ::rtl::OUString SAL_CALL getTag() throw(::com::sun::star::uno::RuntimeException);
305 virtual void SAL_CALL setTag( const ::rtl::OUString& aTag )
306 throw(::com::sun::star::uno::RuntimeException);
308 // XDataPilotTable
309 virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getOutputRange()
310 throw(::com::sun::star::uno::RuntimeException);
311 virtual void SAL_CALL refresh() throw(::com::sun::star::uno::RuntimeException);
313 // XTypeProvider (overloaded)
314 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
315 throw(::com::sun::star::uno::RuntimeException);
316 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
317 throw(::com::sun::star::uno::RuntimeException);
319 // XServiceInfo
320 virtual ::rtl::OUString SAL_CALL getImplementationName()
321 throw(::com::sun::star::uno::RuntimeException);
322 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
323 throw(::com::sun::star::uno::RuntimeException);
324 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
325 throw(::com::sun::star::uno::RuntimeException);
329 class ScDataPilotFieldsObj : public cppu::WeakImplHelper4<
330 ::com::sun::star::container::XEnumerationAccess,
331 ::com::sun::star::container::XIndexAccess,
332 ::com::sun::star::container::XNameAccess,
333 ::com::sun::star::lang::XServiceInfo>
335 private:
336 ScDataPilotDescriptorBase* pParent;
337 USHORT nType; // DataPilotFieldOrientation oder SC_FIELDORIENT_ALL
339 ScDataPilotFieldObj* GetObjectByIndex_Impl(USHORT nIndex) const;
340 ScDataPilotFieldObj* GetObjectByName_Impl(const ::rtl::OUString& aName) const;
342 public:
343 ScDataPilotFieldsObj(ScDataPilotDescriptorBase* pPar, USHORT nTy);
344 virtual ~ScDataPilotFieldsObj();
346 // XNameAccess
347 virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
348 throw(::com::sun::star::container::NoSuchElementException,
349 ::com::sun::star::lang::WrappedTargetException,
350 ::com::sun::star::uno::RuntimeException);
351 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
352 throw(::com::sun::star::uno::RuntimeException);
353 virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
354 throw(::com::sun::star::uno::RuntimeException);
356 // XIndexAccess
357 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
358 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
359 throw(::com::sun::star::lang::IndexOutOfBoundsException,
360 ::com::sun::star::lang::WrappedTargetException,
361 ::com::sun::star::uno::RuntimeException);
363 // XEnumerationAccess
364 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
365 createEnumeration() throw(::com::sun::star::uno::RuntimeException);
367 // XElementAccess
368 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
369 throw(::com::sun::star::uno::RuntimeException);
370 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
372 // XServiceInfo
373 virtual ::rtl::OUString SAL_CALL getImplementationName()
374 throw(::com::sun::star::uno::RuntimeException);
375 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
376 throw(::com::sun::star::uno::RuntimeException);
377 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
378 throw(::com::sun::star::uno::RuntimeException);
382 class ScDataPilotFieldObj : public cppu::WeakImplHelper3<
383 ::com::sun::star::container::XNamed,
384 ::com::sun::star::beans::XPropertySet,
385 ::com::sun::star::lang::XServiceInfo>
387 private:
388 SfxItemPropertySet aPropSet;
389 ScDataPilotDescriptorBase* pParent;
390 USHORT nField; // Spalte im Datenbereich
391 USHORT nSourceType;
392 USHORT nSourcePos;
393 USHORT nLastFunc; // valid while type is HIDDEN (or PAGE)
395 public:
396 ScDataPilotFieldObj(ScDataPilotDescriptorBase* pPar,
397 USHORT nF, USHORT nST, USHORT nSP);
398 virtual ~ScDataPilotFieldObj();
400 // XNamed
401 virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
402 virtual void SAL_CALL setName( const ::rtl::OUString& aName )
403 throw(::com::sun::star::uno::RuntimeException);
405 // XPropertySet
406 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
407 SAL_CALL getPropertySetInfo( )
408 throw(::com::sun::star::uno::RuntimeException);
409 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
410 const ::com::sun::star::uno::Any& aValue )
411 throw(::com::sun::star::beans::UnknownPropertyException,
412 ::com::sun::star::beans::PropertyVetoException,
413 ::com::sun::star::lang::IllegalArgumentException,
414 ::com::sun::star::lang::WrappedTargetException,
415 ::com::sun::star::uno::RuntimeException);
416 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
417 const ::rtl::OUString& PropertyName )
418 throw(::com::sun::star::beans::UnknownPropertyException,
419 ::com::sun::star::lang::WrappedTargetException,
420 ::com::sun::star::uno::RuntimeException);
421 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
422 const ::com::sun::star::uno::Reference<
423 ::com::sun::star::beans::XPropertyChangeListener >& xListener )
424 throw(::com::sun::star::beans::UnknownPropertyException,
425 ::com::sun::star::lang::WrappedTargetException,
426 ::com::sun::star::uno::RuntimeException);
427 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
428 const ::com::sun::star::uno::Reference<
429 ::com::sun::star::beans::XPropertyChangeListener >& aListener )
430 throw(::com::sun::star::beans::UnknownPropertyException,
431 ::com::sun::star::lang::WrappedTargetException,
432 ::com::sun::star::uno::RuntimeException);
433 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName,
434 const ::com::sun::star::uno::Reference<
435 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
436 throw(::com::sun::star::beans::UnknownPropertyException,
437 ::com::sun::star::lang::WrappedTargetException,
438 ::com::sun::star::uno::RuntimeException);
439 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
440 const ::com::sun::star::uno::Reference<
441 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
442 throw(::com::sun::star::beans::UnknownPropertyException,
443 ::com::sun::star::lang::WrappedTargetException,
444 ::com::sun::star::uno::RuntimeException);
446 // nur noch aus Property-Funktionen gerufen:
447 ::com::sun::star::sheet::DataPilotFieldOrientation getOrientation(void) const;
448 void setOrientation(::com::sun::star::sheet::DataPilotFieldOrientation Orientation);
449 ::com::sun::star::sheet::GeneralFunction getFunction(void) const;
450 void setFunction(::com::sun::star::sheet::GeneralFunction Function);
452 // XServiceInfo
453 virtual ::rtl::OUString SAL_CALL getImplementationName()
454 throw(::com::sun::star::uno::RuntimeException);
455 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
456 throw(::com::sun::star::uno::RuntimeException);
457 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
458 throw(::com::sun::star::uno::RuntimeException);
462 } //namespace binfilter
463 #endif