xref: /aoo42x/main/sc/inc/cellsuno.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SC_CELLSUNO_HXX
29 #define SC_CELLSUNO_HXX
30 
31 #include "global.hxx"			// ScRange, ScAddress
32 #include "rangelst.hxx"			// ScRangeList
33 
34 #include "formula/grammar.hxx"
35 #include <svl/lstner.hxx>
36 #include <svl/listener.hxx>
37 #include <svl/itemprop.hxx>
38 #include <com/sun/star/table/XTableChartsSupplier.hpp>
39 #include <com/sun/star/chart/XChartDataArray.hpp>
40 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
41 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
42 #include <com/sun/star/sheet/XSheetCellRange.hpp>
43 #include <com/sun/star/sheet/XFormulaQuery.hpp>
44 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
45 #include <com/sun/star/sheet/XSheetOperation.hpp>
46 #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
47 #include <com/sun/star/sheet/XCellFormatRangesSupplier.hpp>
48 #include <com/sun/star/sheet/XUniqueCellFormatRangesSupplier.hpp>
49 #include <com/sun/star/sheet/XCellRangesQuery.hpp>
50 #include <com/sun/star/sheet/XSheetFilterableEx.hpp>
51 #include <com/sun/star/sheet/XSpreadsheet.hpp>
52 #include <com/sun/star/sheet/XSheetPageBreak.hpp>
53 #include <com/sun/star/sheet/XCellRangeMovement.hpp>
54 #include <com/sun/star/text/XText.hpp>
55 #include <com/sun/star/sheet/XPrintAreas.hpp>
56 #include <com/sun/star/sheet/XSheetLinkable.hpp>
57 #include <com/sun/star/sheet/XSubTotalCalculatable.hpp>
58 #include <com/sun/star/sheet/XArrayFormulaRange.hpp>
59 #include <com/sun/star/sheet/XCellRangeData.hpp>
60 #include <com/sun/star/sheet/XCellRangeFormula.hpp>
61 #include <com/sun/star/sheet/XCellSeries.hpp>
62 #include <com/sun/star/sheet/XMultipleOperation.hpp>
63 #include <com/sun/star/sheet/XFormulaTokens.hpp>
64 #include <com/sun/star/sheet/XArrayFormulaTokens.hpp>
65 #include <com/sun/star/sheet/XCellAddressable.hpp>
66 #include <com/sun/star/util/XReplaceable.hpp>
67 #include <com/sun/star/util/XIndent.hpp>
68 #include <com/sun/star/lang/XServiceInfo.hpp>
69 #include <com/sun/star/container/XNameContainer.hpp>
70 #include <com/sun/star/util/XMergeable.hpp>
71 #include <com/sun/star/table/XAutoFormattable.hpp>
72 #include <com/sun/star/util/XSortable.hpp>
73 #include <com/sun/star/util/XImportable.hpp>
74 #include <com/sun/star/table/XColumnRowRange.hpp>
75 #include <com/sun/star/table/BorderLine.hpp>
76 #include <com/sun/star/table/TableBorder.hpp>
77 #include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
78 #include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
79 #include <com/sun/star/sheet/XScenariosSupplier.hpp>
80 #include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
81 #include <com/sun/star/sheet/XSheetAuditing.hpp>
82 #include <com/sun/star/sheet/XSheetOutline.hpp>
83 #include <com/sun/star/util/XProtectable.hpp>
84 #include <com/sun/star/sheet/XScenario.hpp>
85 #include <com/sun/star/sheet/XScenarioEnhanced.hpp>
86 #include <com/sun/star/util/XModifyBroadcaster.hpp>
87 #include <com/sun/star/beans/XPropertyState.hpp>
88 #include <com/sun/star/beans/XMultiPropertySet.hpp>
89 #include <com/sun/star/lang/XUnoTunnel.hpp>
90 #include <com/sun/star/document/XActionLockable.hpp>
91 #include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
92 #include <com/sun/star/sheet/XExternalSheetName.hpp>
93 #include <com/sun/star/document/XEventsSupplier.hpp>
94 #include <cppuhelper/implbase2.hxx>
95 #include <cppuhelper/implbase3.hxx>
96 
97 #ifndef __SGI_STL_VECTOR
98 #include <vector>
99 #endif
100 
101 class ScDocShell;
102 class ScMarkData;
103 class ScMemChart;
104 class ScPrintRangeSaver;
105 class ScAttrRectIterator;
106 class ScCellRangeObj;
107 class SvxUnoText;
108 class ScLinkListener;
109 class ScPatternAttr;
110 class SvxBorderLine;
111 class SvxBoxItem;
112 class SvxBoxInfoItem;
113 class SvxItemPropertySet;
114 
115 class ScLinkListener : public SvtListener
116 {
117 	Link	aLink;
118 public:
119 					ScLinkListener(const Link& rL) : aLink(rL) {}
120 	virtual			~ScLinkListener();
121 	virtual void	Notify( SvtBroadcaster& rBC, const SfxHint& rHint );
122 };
123 
124 typedef ::com::sun::star::uno::Reference<
125 			::com::sun::star::util::XModifyListener >* XModifyListenerPtr;
126 SV_DECL_PTRARR_DEL( XModifyListenerArr_Impl, XModifyListenerPtr, 4, 4 )
127 
128 class ScNamedEntry;
129 typedef ScNamedEntry* ScNamedEntryPtr;
130 SV_DECL_PTRARR_DEL( ScNamedEntryArr_Impl, ScNamedEntryPtr, 4, 4 )
131 
132 
133 //	ScCellRangesBase - Basisklasse fuer ScCellRangesObj (mit Index-Access)
134 //									und ScCellRangeObj (ohne Index-Access)
135 
136 //	XServiceInfo ist in den Ableitungen implementiert
137 
138 class ScHelperFunctions
139 {
140 public:
141     static const SvxBorderLine* GetBorderLine( SvxBorderLine& rLine, const com::sun::star::table::BorderLine& rStruct );
142     static void FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const com::sun::star::table::TableBorder& rBorder );
143     static void FillBorderLine( com::sun::star::table::BorderLine& rStruct, const SvxBorderLine* pLine );
144     static void FillTableBorder( com::sun::star::table::TableBorder& rBorder,
145 							const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner );
146     static void ApplyBorder( ScDocShell* pDocShell, const ScRangeList& rRanges,
147 						const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner );
148 };
149 
150 namespace ooo
151 {
152     namespace vba {
153         namespace excel {
154 	class ScVbaCellRangeAccess;  // Vba Helper class
155     }
156     }
157 }
158 
159 class SC_DLLPUBLIC ScCellRangesBase : public com::sun::star::beans::XPropertySet,
160 						 public com::sun::star::beans::XMultiPropertySet,
161 						 public com::sun::star::beans::XPropertyState,
162 						 public com::sun::star::sheet::XSheetOperation,
163 						 public com::sun::star::chart::XChartDataArray,
164 						 public com::sun::star::util::XIndent,
165 						 public com::sun::star::sheet::XCellRangesQuery,
166 						 public com::sun::star::sheet::XFormulaQuery,
167 						 public com::sun::star::util::XReplaceable,
168 						 public com::sun::star::util::XModifyBroadcaster,
169 						 public com::sun::star::lang::XServiceInfo,
170 						 public com::sun::star::lang::XUnoTunnel,
171 						 public com::sun::star::lang::XTypeProvider,
172                          public com::sun::star::beans::XTolerantMultiPropertySet,
173 						 public cppu::OWeakObject,
174 						 public SfxListener
175 {
176 	friend class ScTabViewObj;		// fuer select()
177 	friend class ScTableSheetObj;	// fuer createCursorByRange()
178  	friend class ooo::vba::excel::ScVbaCellRangeAccess;
179 
180 private:
181 	const SfxItemPropertySet* pPropSet;
182 	ScDocShell*				pDocShell;
183 	ScLinkListener*			pValueListener;
184 	ScPatternAttr*			pCurrentFlat;
185 	ScPatternAttr*			pCurrentDeep;
186 	SfxItemSet*				pCurrentDataSet;
187 	SfxItemSet*				pNoDfltCurrentDataSet;
188 	ScMarkData*				pMarkData;
189 	ScRangeList				aRanges;
190     sal_Int64               nObjectId;
191 	sal_Bool					bChartColAsHdr;
192 	sal_Bool					bChartRowAsHdr;
193 	sal_Bool					bCursorOnly;
194 	sal_Bool					bGotDataChangedHint;
195 	XModifyListenerArr_Impl aValueListeners;
196 
197 	DECL_LINK( ValueListenerHdl, SfxHint* );
198 
199 private:
200 	void			PaintRanges_Impl( sal_uInt16 nPart );
201 	ScRangeListRef	GetLimitedChartRanges_Impl( long nDataColumns, long nDataRows ) const;
202 	void			ForceChartListener_Impl();
203     ScMemChart*     CreateMemChart_Impl() const;
204 
205 	const ScPatternAttr*	GetCurrentAttrsFlat();
206 	const ScPatternAttr*	GetCurrentAttrsDeep();
207 	SfxItemSet*				GetCurrentDataSet(bool bNoDflt = false);
208     void                    ForgetMarkData();
209 	void					ForgetCurrentAttrs();
210 
211 	com::sun::star::uno::Reference<com::sun::star::sheet::XSheetCellRanges>
212 							QueryDifferences_Impl(const com::sun::star::table::CellAddress& aCompare,
213 													sal_Bool bColumnDiff);
214 	com::sun::star::uno::Reference<com::sun::star::uno::XInterface>
215 							Find_Impl(const com::sun::star::uno::Reference<
216 										com::sun::star::util::XSearchDescriptor>& xDesc,
217 									const ScAddress* pLastPos);
218 
219 protected:
220     const ScMarkData*       GetMarkData();
221 
222 	// GetItemPropertyMap for derived classes must contain all entries, including base class
223 	virtual const SfxItemPropertyMap* GetItemPropertyMap();
224 	virtual ::com::sun::star::beans::PropertyState GetOnePropertyState(
225                                 sal_uInt16 nItemWhich, const SfxItemPropertySimpleEntry* pEntry );
226     virtual void            GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
227 								::com::sun::star::uno::Any& )
228 								throw(::com::sun::star::uno::RuntimeException);
229     virtual void            SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
230 												const ::com::sun::star::uno::Any& aValue )
231 								throw(::com::sun::star::lang::IllegalArgumentException,
232 										::com::sun::star::uno::RuntimeException);
233 
234 public:
235 							ScCellRangesBase();		// fuer SMART_REFLECTION Krempel
236 							ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR);
237 							ScCellRangesBase(ScDocShell* pDocSh, const ScRangeList& rR);
238 	virtual					~ScCellRangesBase();
239 
240 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
241 								const ::com::sun::star::uno::Type & rType )
242 									throw(::com::sun::star::uno::RuntimeException);
243 	virtual void SAL_CALL	acquire() throw();
244 	virtual void SAL_CALL	release() throw();
245 
246 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
247 	virtual void			RefChanged();
248 
249 							// aus Ableitungen, aber auch per getImplementation
250 	ScDocShell*				GetDocShell() const		{ return pDocShell; }
251 	ScDocument*				GetDocument() const;
252 	const ScRangeList&		GetRangeList() const	{ return aRanges; }
253 	void					AddRange(const ScRange& rRange, const sal_Bool bMergeRanges);
254 
255 							// per Service erzeugtes Objekt zum Leben erwecken:
256 	void					InitInsertRange(ScDocShell* pDocSh, const ScRange& rR);
257 
258 	void					SetNewRange(const ScRange& rNew);	// fuer Cursor
259 	void					SetNewRanges(const ScRangeList& rNew);
260 
261 	void					SetCursorOnly(sal_Bool bSet);
262 	sal_Bool					IsCursorOnly() const			{ return bCursorOnly; }
263 
264 							// XSheetOperation
265 	virtual double SAL_CALL	computeFunction( ::com::sun::star::sheet::GeneralFunction nFunction )
266 								throw(::com::sun::star::uno::Exception,
267 										::com::sun::star::uno::RuntimeException);
268 	virtual void SAL_CALL	clearContents( sal_Int32 nContentFlags )
269 								throw(::com::sun::star::uno::RuntimeException);
270 
271 							// XPropertySet
272 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
273 							SAL_CALL getPropertySetInfo()
274 								throw(::com::sun::star::uno::RuntimeException);
275 	virtual void SAL_CALL	setPropertyValue( const ::rtl::OUString& aPropertyName,
276 									const ::com::sun::star::uno::Any& aValue )
277 								throw(::com::sun::star::beans::UnknownPropertyException,
278 									::com::sun::star::beans::PropertyVetoException,
279 									::com::sun::star::lang::IllegalArgumentException,
280 									::com::sun::star::lang::WrappedTargetException,
281 									::com::sun::star::uno::RuntimeException);
282 	virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
283 									const ::rtl::OUString& PropertyName )
284 								throw(::com::sun::star::beans::UnknownPropertyException,
285 									::com::sun::star::lang::WrappedTargetException,
286 									::com::sun::star::uno::RuntimeException);
287 	virtual void SAL_CALL	addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
288 									const ::com::sun::star::uno::Reference<
289 										::com::sun::star::beans::XPropertyChangeListener >& xListener )
290 								throw(::com::sun::star::beans::UnknownPropertyException,
291 									::com::sun::star::lang::WrappedTargetException,
292 									::com::sun::star::uno::RuntimeException);
293 	virtual void SAL_CALL	removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
294 									const ::com::sun::star::uno::Reference<
295 										::com::sun::star::beans::XPropertyChangeListener >& aListener )
296 								throw(::com::sun::star::beans::UnknownPropertyException,
297 									::com::sun::star::lang::WrappedTargetException,
298 									::com::sun::star::uno::RuntimeException);
299 	virtual void SAL_CALL	addVetoableChangeListener( const ::rtl::OUString& PropertyName,
300 									const ::com::sun::star::uno::Reference<
301 										::com::sun::star::beans::XVetoableChangeListener >& aListener )
302 								throw(::com::sun::star::beans::UnknownPropertyException,
303 									::com::sun::star::lang::WrappedTargetException,
304 									::com::sun::star::uno::RuntimeException);
305 	virtual void SAL_CALL	removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
306 									const ::com::sun::star::uno::Reference<
307 										::com::sun::star::beans::XVetoableChangeListener >& aListener )
308 								throw(::com::sun::star::beans::UnknownPropertyException,
309 									::com::sun::star::lang::WrappedTargetException,
310 									::com::sun::star::uno::RuntimeException);
311 
312 							// XMultiPropertySet
313 	virtual void SAL_CALL	setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames,
314 									const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues )
315 								throw (::com::sun::star::beans::PropertyVetoException,
316 									::com::sun::star::lang::IllegalArgumentException,
317 									::com::sun::star::lang::WrappedTargetException,
318 									::com::sun::star::uno::RuntimeException);
319 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL
320 							getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames )
321 								throw (::com::sun::star::uno::RuntimeException);
322 	virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames,
323 									const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
324 								throw (::com::sun::star::uno::RuntimeException);
325 	virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
326 								throw (::com::sun::star::uno::RuntimeException);
327 	virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames,
328 									const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
329 								throw (::com::sun::star::uno::RuntimeException);
330 
331                             // XTolerantMultiPropertySet
332     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::SetPropertyTolerantFailed > SAL_CALL
333         setPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames,
334                                     const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues )
335                                     throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
336     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetPropertyTolerantResult > SAL_CALL
337         getPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames )
338                                     throw (::com::sun::star::uno::RuntimeException);
339     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL
340         getDirectPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames )
341                                     throw (::com::sun::star::uno::RuntimeException);
342 
343 							// XPropertyState
344 	virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState(
345 									const ::rtl::OUString& PropertyName )
346 								throw(::com::sun::star::beans::UnknownPropertyException,
347 									::com::sun::star::uno::RuntimeException);
348 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL
349 							getPropertyStates( const ::com::sun::star::uno::Sequence<
350 										::rtl::OUString >& aPropertyName )
351 								throw(::com::sun::star::beans::UnknownPropertyException,
352 									::com::sun::star::uno::RuntimeException);
353 	virtual void SAL_CALL	setPropertyToDefault( const ::rtl::OUString& PropertyName )
354 								throw(::com::sun::star::beans::UnknownPropertyException,
355 									::com::sun::star::uno::RuntimeException);
356 	virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(
357 									const ::rtl::OUString& aPropertyName )
358 								throw(::com::sun::star::beans::UnknownPropertyException,
359 									::com::sun::star::lang::WrappedTargetException,
360 									::com::sun::star::uno::RuntimeException);
361 
362 							// XIndent
363 	virtual void SAL_CALL	decrementIndent() throw(::com::sun::star::uno::RuntimeException);
364 	virtual void SAL_CALL	incrementIndent() throw(::com::sun::star::uno::RuntimeException);
365 
366 							// XChartData
367 	virtual void SAL_CALL	addChartDataChangeEventListener(
368 								const ::com::sun::star::uno::Reference<
369 									::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
370 								throw(::com::sun::star::uno::RuntimeException);
371 	virtual void SAL_CALL	removeChartDataChangeEventListener( const ::com::sun::star::uno::Reference<
372 									::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
373 								throw(::com::sun::star::uno::RuntimeException);
374 	virtual double SAL_CALL	getNotANumber() throw(::com::sun::star::uno::RuntimeException);
375 	virtual sal_Bool SAL_CALL isNotANumber( double nNumber )
376 								throw(::com::sun::star::uno::RuntimeException);
377 
378 							// XChartDataArray
379 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > > SAL_CALL
380 							getData() throw(::com::sun::star::uno::RuntimeException);
381 	virtual void SAL_CALL	setData( const ::com::sun::star::uno::Sequence<
382 								::com::sun::star::uno::Sequence< double > >& aData )
383 									throw(::com::sun::star::uno::RuntimeException);
384 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowDescriptions()
385 								throw(::com::sun::star::uno::RuntimeException);
386 	virtual void SAL_CALL setRowDescriptions( const ::com::sun::star::uno::Sequence<
387 								::rtl::OUString >& aRowDescriptions )
388 									throw(::com::sun::star::uno::RuntimeException);
389 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getColumnDescriptions()
390 								throw(::com::sun::star::uno::RuntimeException);
391 	virtual void SAL_CALL	setColumnDescriptions( const ::com::sun::star::uno::Sequence<
392 								::rtl::OUString >& aColumnDescriptions )
393 									throw(::com::sun::star::uno::RuntimeException);
394 
395 							// XCellRangesQuery
396 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL
397 							queryVisibleCells() throw(::com::sun::star::uno::RuntimeException);
398 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL
399 							queryEmptyCells() throw(::com::sun::star::uno::RuntimeException);
400 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL
401 							queryContentCells( sal_Int16 nContentFlags )
402 								throw(::com::sun::star::uno::RuntimeException);
403 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL
404 							queryFormulaCells( sal_Int32 nResultFlags )
405 								throw(::com::sun::star::uno::RuntimeException);
406 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL
407 							queryColumnDifferences(
408 								const ::com::sun::star::table::CellAddress& aCompare )
409 									throw(::com::sun::star::uno::RuntimeException);
410 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL
411 							queryRowDifferences(
412 								const ::com::sun::star::table::CellAddress& aCompare )
413 									throw(::com::sun::star::uno::RuntimeException);
414 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL
415 							queryIntersection(
416 								const ::com::sun::star::table::CellRangeAddress& aRange )
417 									throw(::com::sun::star::uno::RuntimeException);
418 
419 							// XFormulaQuery
420 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL
421 							queryDependents( sal_Bool bRecursive )
422 								throw(::com::sun::star::uno::RuntimeException);
423 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL
424 							queryPrecedents( sal_Bool bRecursive )
425 								throw(::com::sun::star::uno::RuntimeException);
426 
427 							// XSearchable
428 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor > SAL_CALL
429 							createSearchDescriptor()
430 								throw(::com::sun::star::uno::RuntimeException);
431 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
432 							findAll( const ::com::sun::star::uno::Reference<
433 								::com::sun::star::util::XSearchDescriptor >& xDesc )
434 									throw(::com::sun::star::uno::RuntimeException);
435 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
436 							findFirst( const ::com::sun::star::uno::Reference<
437 								::com::sun::star::util::XSearchDescriptor >& xDesc )
438 									throw(::com::sun::star::uno::RuntimeException);
439 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
440 							findNext( const ::com::sun::star::uno::Reference<
441 										::com::sun::star::uno::XInterface >& xStartAt,
442 									  const ::com::sun::star::uno::Reference<
443 										::com::sun::star::util::XSearchDescriptor >& xDesc )
444 									throw(::com::sun::star::uno::RuntimeException);
445 
446 							// XReplaceable
447 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XReplaceDescriptor > SAL_CALL
448 							createReplaceDescriptor() throw(::com::sun::star::uno::RuntimeException);
449 	virtual sal_Int32 SAL_CALL replaceAll( const ::com::sun::star::uno::Reference<
450 								::com::sun::star::util::XSearchDescriptor >& xDesc )
451 									throw(::com::sun::star::uno::RuntimeException);
452 
453 							// XModifyBroadcaster
454 	virtual void SAL_CALL	addModifyListener( const ::com::sun::star::uno::Reference<
455 									::com::sun::star::util::XModifyListener >& aListener )
456 								throw (::com::sun::star::uno::RuntimeException);
457 	virtual void SAL_CALL	removeModifyListener( const ::com::sun::star::uno::Reference<
458 									::com::sun::star::util::XModifyListener >& aListener )
459 								throw (::com::sun::star::uno::RuntimeException);
460 
461 							// XServiceInfo
462 	virtual ::rtl::OUString SAL_CALL getImplementationName()
463 								throw(::com::sun::star::uno::RuntimeException);
464 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
465 								throw(::com::sun::star::uno::RuntimeException);
466 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
467 								throw(::com::sun::star::uno::RuntimeException);
468 
469 							// XUnoTunnel
470 	virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
471 									sal_Int8 >& aIdentifier )
472 								throw(::com::sun::star::uno::RuntimeException);
473 
474 	static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
475 	static ScCellRangesBase* getImplementation( const com::sun::star::uno::Reference<
476 									com::sun::star::uno::XInterface> xObj );
477 
478 							// XTypeProvider
479 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
480 								throw(::com::sun::star::uno::RuntimeException);
481 	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
482 								throw(::com::sun::star::uno::RuntimeException);
483 };
484 
485 
486 class SC_DLLPUBLIC ScCellRangesObj : public ScCellRangesBase,
487 						public com::sun::star::sheet::XSheetCellRangeContainer,
488 						public com::sun::star::container::XNameContainer,
489 						public com::sun::star::container::XEnumerationAccess
490 {
491 private:
492 	ScNamedEntryArr_Impl	aNamedEntries;
493 
494     ScCellRangeObj*         GetObjectByIndex_Impl(sal_Int32 nIndex) const;
495 
496 public:
497 							ScCellRangesObj(ScDocShell* pDocSh, const ScRangeList& rR);
498 	virtual					~ScCellRangesObj();
499 
500 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
501 								const ::com::sun::star::uno::Type & rType )
502 									throw(::com::sun::star::uno::RuntimeException);
503 	virtual void SAL_CALL	acquire() throw();
504 	virtual void SAL_CALL	release() throw();
505 
506 	virtual void			RefChanged();
507 
508 							// XSheetCellRanges
509 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess > SAL_CALL
510 							getCells() throw(::com::sun::star::uno::RuntimeException);
511 	virtual ::rtl::OUString SAL_CALL getRangeAddressesAsString()
512 								throw(::com::sun::star::uno::RuntimeException);
513 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::table::CellRangeAddress > SAL_CALL
514 							getRangeAddresses() throw(::com::sun::star::uno::RuntimeException);
515 
516 							// XSheetCellRangeContainer
517 	virtual void SAL_CALL	addRangeAddress( const ::com::sun::star::table::CellRangeAddress& rRange,
518 										sal_Bool bMergeRanges )
519 									throw(::com::sun::star::uno::RuntimeException);
520 	virtual void SAL_CALL	removeRangeAddress( const ::com::sun::star::table::CellRangeAddress& rRange )
521 								throw(::com::sun::star::container::NoSuchElementException,
522 									::com::sun::star::uno::RuntimeException);
523 	virtual void SAL_CALL	addRangeAddresses( const ::com::sun::star::uno::Sequence<
524 										::com::sun::star::table::CellRangeAddress >& rRanges,
525 										sal_Bool bMergeRanges )
526 									throw(::com::sun::star::uno::RuntimeException);
527 	virtual void SAL_CALL	removeRangeAddresses( const ::com::sun::star::uno::Sequence<
528 										::com::sun::star::table::CellRangeAddress >& rRanges )
529 								throw(::com::sun::star::container::NoSuchElementException,
530 									::com::sun::star::uno::RuntimeException);
531 
532 							// XNameContainer
533 	virtual void SAL_CALL	insertByName( const ::rtl::OUString& aName,
534 								const ::com::sun::star::uno::Any& aElement )
535 									throw(::com::sun::star::lang::IllegalArgumentException,
536 										::com::sun::star::container::ElementExistException,
537 										::com::sun::star::lang::WrappedTargetException,
538 										::com::sun::star::uno::RuntimeException);
539 	virtual void SAL_CALL	removeByName( const ::rtl::OUString& Name )
540 								throw(::com::sun::star::container::NoSuchElementException,
541 									::com::sun::star::lang::WrappedTargetException,
542 									::com::sun::star::uno::RuntimeException);
543 
544 							// XNameReplace
545 	virtual void SAL_CALL	replaceByName( const ::rtl::OUString& aName,
546 								const ::com::sun::star::uno::Any& aElement )
547 									throw(::com::sun::star::lang::IllegalArgumentException,
548 										::com::sun::star::container::NoSuchElementException,
549 										::com::sun::star::lang::WrappedTargetException,
550 										::com::sun::star::uno::RuntimeException);
551 
552 							// XNameAccess
553 	virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
554 								throw(::com::sun::star::container::NoSuchElementException,
555 									::com::sun::star::lang::WrappedTargetException,
556 									::com::sun::star::uno::RuntimeException);
557 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
558 								throw(::com::sun::star::uno::RuntimeException);
559 	virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
560 								throw(::com::sun::star::uno::RuntimeException);
561 
562 							// XIndexAccess
563 	virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
564 	virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
565 								throw(::com::sun::star::lang::IndexOutOfBoundsException,
566 									::com::sun::star::lang::WrappedTargetException,
567 									::com::sun::star::uno::RuntimeException);
568 
569 							// XElementAccess
570 	virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
571 								throw(::com::sun::star::uno::RuntimeException);
572 	virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
573 
574 							// XEnumerationAccess
575 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
576 							createEnumeration() throw(::com::sun::star::uno::RuntimeException);
577 
578 							// XServiceInfo
579 	virtual ::rtl::OUString SAL_CALL getImplementationName()
580 								throw(::com::sun::star::uno::RuntimeException);
581 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
582 								throw(::com::sun::star::uno::RuntimeException);
583 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
584 								throw(::com::sun::star::uno::RuntimeException);
585 
586 							// XTypeProvider
587 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
588 								throw(::com::sun::star::uno::RuntimeException);
589 	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
590 								throw(::com::sun::star::uno::RuntimeException);
591 };
592 
593 
594 class SC_DLLPUBLIC ScCellRangeObj : public ScCellRangesBase,
595 					   public com::sun::star::sheet::XCellRangeAddressable,
596 					   public com::sun::star::sheet::XSheetCellRange,
597 					   public com::sun::star::sheet::XArrayFormulaRange,
598 					   public com::sun::star::sheet::XArrayFormulaTokens,
599 					   public com::sun::star::sheet::XCellRangeData,
600 					   public com::sun::star::sheet::XCellRangeFormula,
601 					   public com::sun::star::sheet::XMultipleOperation,
602 					   public com::sun::star::util::XMergeable,
603 					   public com::sun::star::sheet::XCellSeries,
604 					   public com::sun::star::table::XAutoFormattable,
605 					   public com::sun::star::util::XSortable,
606 					   public com::sun::star::sheet::XSheetFilterableEx,
607 					   public com::sun::star::sheet::XSubTotalCalculatable,
608 					   public com::sun::star::util::XImportable,
609 					   public com::sun::star::sheet::XCellFormatRangesSupplier,
610 					   public com::sun::star::sheet::XUniqueCellFormatRangesSupplier,
611 					   public com::sun::star::table::XColumnRowRange
612 {
613 private:
614 	const SfxItemPropertySet*		pRangePropSet;
615 	ScRange					aRange;
616 
617 protected:
618 	const ScRange&			GetRange() const	{ return aRange; }
619 	virtual const SfxItemPropertyMap* GetItemPropertyMap();
620     virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
621 								::com::sun::star::uno::Any& )
622 								throw(::com::sun::star::uno::RuntimeException);
623     virtual void            SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
624 												const ::com::sun::star::uno::Any& aValue )
625 								throw(::com::sun::star::lang::IllegalArgumentException,
626 										::com::sun::star::uno::RuntimeException);
627 
628 	::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >
629 							GetCellByPosition_Impl( sal_Int32 nColumn, sal_Int32 nRow )
630 								throw(::com::sun::star::lang::IndexOutOfBoundsException,
631 									::com::sun::star::uno::RuntimeException);
632 
633             void            SetArrayFormula_Impl( const rtl::OUString& rFormula,
634                                 const rtl::OUString& rFormulaNmsp,
635                                 const formula::FormulaGrammar::Grammar eGrammar )
636                                     throw(::com::sun::star::uno::RuntimeException);
637 
638 public:
639 							ScCellRangeObj(ScDocShell* pDocSh, const ScRange& rR);
640 	virtual					~ScCellRangeObj();
641 
642 							// uses ObjectShell from document, if set (returns NULL otherwise)
643 	static com::sun::star::uno::Reference<com::sun::star::table::XCellRange>
644 							CreateRangeFromDoc( ScDocument* pDoc, const ScRange& rR );
645 
646 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
647 								const ::com::sun::star::uno::Type & rType )
648 									throw(::com::sun::star::uno::RuntimeException);
649 	virtual void SAL_CALL	acquire() throw();
650 	virtual void SAL_CALL	release() throw();
651 
652 	virtual void			RefChanged();
653 
654                             // via getImplementation()
655     virtual void            SetArrayFormulaWithGrammar( const ::rtl::OUString& rFormula,
656                                     const ::rtl::OUString& rFormulaNmsp,
657                                     const formula::FormulaGrammar::Grammar )
658                                 throw(::com::sun::star::uno::RuntimeException);
659 
660 	// XCellRange ist Basisklasse von XSheetCellRange und XSheetOperation
661 //	operator XCellRangeRef() const	{ return (XSheetCellRange*)this; }
662 
663 							// XCellRangeAddressable
664 	virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getRangeAddress()
665 								throw(::com::sun::star::uno::RuntimeException);
666 
667 							// XSheetCellRange
668 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet > SAL_CALL
669 							getSpreadsheet() throw(::com::sun::star::uno::RuntimeException);
670 
671 							// XArrayFormulaRange
672 	virtual ::rtl::OUString SAL_CALL getArrayFormula() throw(::com::sun::star::uno::RuntimeException);
673 	virtual void SAL_CALL 	setArrayFormula( const ::rtl::OUString& aFormula )
674 								throw(::com::sun::star::uno::RuntimeException);
675 
676                             // XArrayFormulaTokens
677     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > SAL_CALL getArrayTokens()
678                                 throw (::com::sun::star::uno::RuntimeException);
679     virtual void SAL_CALL   setArrayTokens( const ::com::sun::star::uno::Sequence<
680                                     ::com::sun::star::sheet::FormulaToken >& aTokens )
681                                 throw (::com::sun::star::uno::RuntimeException);
682 
683 							// XCellRangeData
684 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence<
685 							::com::sun::star::uno::Any > > SAL_CALL getDataArray()
686 								throw(::com::sun::star::uno::RuntimeException);
687 	virtual void SAL_CALL	setDataArray( const ::com::sun::star::uno::Sequence<
688 								::com::sun::star::uno::Sequence<
689 									::com::sun::star::uno::Any > >& aArray )
690 								throw(::com::sun::star::uno::RuntimeException);
691 
692 							// XCellRangeFormula
693 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence<
694 							::rtl::OUString > > SAL_CALL getFormulaArray()
695 								throw (::com::sun::star::uno::RuntimeException);
696 	virtual void SAL_CALL	setFormulaArray( const ::com::sun::star::uno::Sequence<
697 								::com::sun::star::uno::Sequence< ::rtl::OUString > >& aArray )
698 								throw (::com::sun::star::uno::RuntimeException);
699 
700 							// XMultipleOperation
701 	virtual void SAL_CALL	setTableOperation(
702 								const ::com::sun::star::table::CellRangeAddress& aFormulaRange,
703 								::com::sun::star::sheet::TableOperationMode nMode,
704 								const ::com::sun::star::table::CellAddress& aColumnCell,
705 								const ::com::sun::star::table::CellAddress& aRowCell )
706 									throw(::com::sun::star::uno::RuntimeException);
707 
708 							// XMergeable
709 	virtual void SAL_CALL	merge( sal_Bool bMerge ) throw(::com::sun::star::uno::RuntimeException);
710 	virtual sal_Bool SAL_CALL getIsMerged() throw(::com::sun::star::uno::RuntimeException);
711 
712 							// XCellSeries
713 	virtual void SAL_CALL	fillSeries( ::com::sun::star::sheet::FillDirection nFillDirection,
714 								::com::sun::star::sheet::FillMode nFillMode,
715 								::com::sun::star::sheet::FillDateMode nFillDateMode,
716 								double fStep, double fEndValue )
717 									throw(::com::sun::star::uno::RuntimeException);
718 	virtual void SAL_CALL	fillAuto( ::com::sun::star::sheet::FillDirection nFillDirection,
719 								sal_Int32 nSourceCount )
720 									throw(::com::sun::star::uno::RuntimeException);
721 
722 							// XAutoFormattable
723 	virtual void SAL_CALL	autoFormat( const ::rtl::OUString& aName )
724 								throw(::com::sun::star::lang::IllegalArgumentException,
725 									::com::sun::star::uno::RuntimeException);
726 
727 							// XSortable
728 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL
729 							createSortDescriptor() throw(::com::sun::star::uno::RuntimeException);
730 	virtual void SAL_CALL	sort( const ::com::sun::star::uno::Sequence<
731 								::com::sun::star::beans::PropertyValue >& xDescriptor )
732 									throw(::com::sun::star::uno::RuntimeException);
733 
734 							// XSheetFilterableEx
735 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetFilterDescriptor > SAL_CALL
736 							createFilterDescriptorByObject( const ::com::sun::star::uno::Reference<
737 								::com::sun::star::sheet::XSheetFilterable >& xObject )
738 									throw(::com::sun::star::uno::RuntimeException);
739 
740 							// XSheetFilterable
741 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetFilterDescriptor > SAL_CALL
742 							createFilterDescriptor( sal_Bool bEmpty )
743 								throw(::com::sun::star::uno::RuntimeException);
744 	virtual void SAL_CALL	filter( const ::com::sun::star::uno::Reference<
745 								::com::sun::star::sheet::XSheetFilterDescriptor >& xDescriptor )
746 									throw(::com::sun::star::uno::RuntimeException);
747 
748 							// XSubTotalCalculatable
749 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSubTotalDescriptor > SAL_CALL
750 							createSubTotalDescriptor( sal_Bool bEmpty )
751 								throw(::com::sun::star::uno::RuntimeException);
752 	virtual void SAL_CALL	applySubTotals( const ::com::sun::star::uno::Reference<
753 								::com::sun::star::sheet::XSubTotalDescriptor >& xDescriptor,
754 								sal_Bool bReplace ) throw(::com::sun::star::uno::RuntimeException);
755 	virtual void SAL_CALL	removeSubTotals() throw(::com::sun::star::uno::RuntimeException);
756 
757 							// XImportable
758 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL
759 							createImportDescriptor( sal_Bool bEmpty )
760 								throw(::com::sun::star::uno::RuntimeException);
761 	virtual void SAL_CALL	doImport( const ::com::sun::star::uno::Sequence<
762 								::com::sun::star::beans::PropertyValue >& aDescriptor )
763 									throw(::com::sun::star::uno::RuntimeException);
764 
765 							// XCellFormatRangesSupplier
766 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
767 							getCellFormatRanges() throw(::com::sun::star::uno::RuntimeException);
768 
769 							// XUniqueCellFormatRangesSupplier
770 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL
771 							getUniqueCellFormatRanges() throw(::com::sun::star::uno::RuntimeException);
772 
773 							// XColumnRowRange
774 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XTableColumns > SAL_CALL
775 							getColumns() throw(::com::sun::star::uno::RuntimeException);
776 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XTableRows > SAL_CALL
777 							getRows() throw(::com::sun::star::uno::RuntimeException);
778 
779 							// XCellRange
780 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL
781 							getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow )
782 								throw(::com::sun::star::lang::IndexOutOfBoundsException,
783 									::com::sun::star::uno::RuntimeException);
784 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL
785 							getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop,
786 								sal_Int32 nRight, sal_Int32 nBottom )
787 									throw(::com::sun::star::lang::IndexOutOfBoundsException,
788 										::com::sun::star::uno::RuntimeException);
789 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL
790 							getCellRangeByName( const ::rtl::OUString& aRange )
791 								throw(::com::sun::star::uno::RuntimeException);
792 	::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange >
793 							getCellRangeByName( const ::rtl::OUString& aRange,  const ScAddress::Details& rDetails )
794 								throw(::com::sun::star::uno::RuntimeException);
795 
796 							// XPropertySet ueberladen wegen Range-Properties
797 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
798 							SAL_CALL getPropertySetInfo()
799 								throw(::com::sun::star::uno::RuntimeException);
800 
801 							// XServiceInfo
802 	virtual ::rtl::OUString SAL_CALL getImplementationName()
803 								throw(::com::sun::star::uno::RuntimeException);
804 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
805 								throw(::com::sun::star::uno::RuntimeException);
806 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
807 								throw(::com::sun::star::uno::RuntimeException);
808 
809 							// XTypeProvider
810 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
811 								throw(::com::sun::star::uno::RuntimeException);
812 	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
813 								throw(::com::sun::star::uno::RuntimeException);
814 };
815 
816 
817 //!	really derive cell from range?
818 
819 class SC_DLLPUBLIC ScCellObj : public ScCellRangeObj,
820 				  public com::sun::star::text::XText,
821 				  public com::sun::star::container::XEnumerationAccess,
822 				  public com::sun::star::table::XCell,
823                   public com::sun::star::sheet::XFormulaTokens,
824 				  public com::sun::star::sheet::XCellAddressable,
825 				  public com::sun::star::sheet::XSheetAnnotationAnchor,
826 				  public com::sun::star::text::XTextFieldsSupplier,
827 					public com::sun::star::document::XActionLockable
828 {
829 private:
830 	SvxUnoText*				pUnoText;
831 	const SfxItemPropertySet*	pCellPropSet;
832 	ScAddress				aCellPos;
833 	sal_Int16				nActionLockCount;
834 
835 private:
836 	String		GetInputString_Impl(sal_Bool bEnglish) const;
837 	String		GetOutputString_Impl() const;
838 	void		SetString_Impl(const String& rString, sal_Bool bInterpret, sal_Bool bEnglish);
839 	double		GetValue_Impl() const;
840 	void		SetValue_Impl(double fValue);
841 	com::sun::star::table::CellContentType GetResultType_Impl();
842 
843 protected:
844 	virtual const SfxItemPropertyMap* GetItemPropertyMap();
845     virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
846 								::com::sun::star::uno::Any& )
847 								throw(::com::sun::star::uno::RuntimeException);
848     virtual void            SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
849 												const ::com::sun::star::uno::Any& aValue )
850 								throw(::com::sun::star::lang::IllegalArgumentException,
851 										::com::sun::star::uno::RuntimeException);
852 
853 public:
854     static const SvxItemPropertySet* GetEditPropertySet();
855     static const SfxItemPropertyMap* GetCellPropertyMap();
856 
857 							ScCellObj(ScDocShell* pDocSh, const ScAddress& rP);
858 	virtual					~ScCellObj();
859 
860 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
861 								const ::com::sun::star::uno::Type & rType )
862 									throw(::com::sun::star::uno::RuntimeException);
863 	virtual void SAL_CALL	acquire() throw();
864 	virtual void SAL_CALL	release() throw();
865 
866 	virtual void			RefChanged();
867 
868 	SvxUnoText&				GetUnoText();
869 
870 							// XML import needs to set results at formula cells,
871 							// not meant for any other purpose.
872 	void					SetFormulaResultString( const ::rtl::OUString& rResult );
873 	void					SetFormulaResultDouble( double fResult );
874     void                    SetFormulaWithGrammar( const ::rtl::OUString& rFormula,
875                                 const ::rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar );
876 	const ScAddress&		GetPosition() const { return aCellPos; }
877 
878     void                    InputEnglishString( const ::rtl::OUString& rText );
879 
880 							// XText
881 	virtual void SAL_CALL	insertTextContent( const ::com::sun::star::uno::Reference<
882 									::com::sun::star::text::XTextRange >& xRange,
883 								const ::com::sun::star::uno::Reference<
884 									::com::sun::star::text::XTextContent >& xContent,
885 								sal_Bool bAbsorb )
886 									throw(::com::sun::star::lang::IllegalArgumentException,
887 									::com::sun::star::uno::RuntimeException);
888 	virtual void SAL_CALL	removeTextContent( const ::com::sun::star::uno::Reference<
889 								::com::sun::star::text::XTextContent >& xContent )
890 									throw(::com::sun::star::container::NoSuchElementException,
891 											::com::sun::star::uno::RuntimeException);
892 
893 							// XSimpleText
894 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL
895 							createTextCursor() throw(::com::sun::star::uno::RuntimeException);
896 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL
897 							createTextCursorByRange( const ::com::sun::star::uno::Reference<
898 										::com::sun::star::text::XTextRange >& aTextPosition )
899 									throw(::com::sun::star::uno::RuntimeException);
900 	virtual void SAL_CALL	insertString( const ::com::sun::star::uno::Reference<
901 										::com::sun::star::text::XTextRange >& xRange,
902 										const ::rtl::OUString& aString, sal_Bool bAbsorb )
903 									throw(::com::sun::star::uno::RuntimeException);
904 	virtual void SAL_CALL	insertControlCharacter( const ::com::sun::star::uno::Reference<
905 										::com::sun::star::text::XTextRange >& xRange,
906 										sal_Int16 nControlCharacter, sal_Bool bAbsorb )
907 									throw(::com::sun::star::lang::IllegalArgumentException,
908 										::com::sun::star::uno::RuntimeException);
909 
910 							// XTextRange
911 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL
912 							getText() throw(::com::sun::star::uno::RuntimeException);
913 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL
914 							getStart() throw(::com::sun::star::uno::RuntimeException);
915 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL
916 							getEnd() throw(::com::sun::star::uno::RuntimeException);
917 	virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
918 	virtual void SAL_CALL	setString( const ::rtl::OUString& aString )
919 									throw(::com::sun::star::uno::RuntimeException);
920 
921 							// XEnumerationAccess
922 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
923 							createEnumeration() throw(::com::sun::star::uno::RuntimeException);
924 
925 							// XElementAccess
926 	virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
927 								throw(::com::sun::star::uno::RuntimeException);
928 	virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
929 
930 							// XCell
931 	virtual ::rtl::OUString SAL_CALL getFormula() throw(::com::sun::star::uno::RuntimeException);
932 	virtual void SAL_CALL	setFormula( const ::rtl::OUString& aFormula )
933 								throw(::com::sun::star::uno::RuntimeException);
934 	virtual double SAL_CALL getValue() throw(::com::sun::star::uno::RuntimeException);
935 	virtual void SAL_CALL	setValue( double nValue ) throw(::com::sun::star::uno::RuntimeException);
936 	virtual ::com::sun::star::table::CellContentType SAL_CALL getType()
937 								throw(::com::sun::star::uno::RuntimeException);
938 	virtual sal_Int32 SAL_CALL getError() throw(::com::sun::star::uno::RuntimeException);
939 
940                             // XFormulaTokens
941     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > SAL_CALL getTokens()
942                                 throw (::com::sun::star::uno::RuntimeException);
943     virtual void SAL_CALL   setTokens( const ::com::sun::star::uno::Sequence<
944                                     ::com::sun::star::sheet::FormulaToken >& aTokens )
945                                 throw (::com::sun::star::uno::RuntimeException);
946 
947 							// XCellAddressable
948 	virtual ::com::sun::star::table::CellAddress SAL_CALL getCellAddress()
949 								throw(::com::sun::star::uno::RuntimeException);
950 
951 							// XSheetAnnotationAnchor
952 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetAnnotation > SAL_CALL
953 							getAnnotation() throw(::com::sun::star::uno::RuntimeException);
954 
955 							// XTextFieldsSupplier
956 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess > SAL_CALL
957 							getTextFields() throw(::com::sun::star::uno::RuntimeException);
958 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL
959 							getTextFieldMasters() throw(::com::sun::star::uno::RuntimeException);
960 
961 							// XPropertySet ueberladen wegen Zell-Properties
962 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
963 							SAL_CALL getPropertySetInfo()
964 								throw(::com::sun::star::uno::RuntimeException);
965 
966 							// XServiceInfo
967 	virtual ::rtl::OUString SAL_CALL getImplementationName()
968 								throw(::com::sun::star::uno::RuntimeException);
969 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
970 								throw(::com::sun::star::uno::RuntimeException);
971 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
972 								throw(::com::sun::star::uno::RuntimeException);
973 
974 							// XTypeProvider
975 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
976 								throw(::com::sun::star::uno::RuntimeException);
977 	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
978 								throw(::com::sun::star::uno::RuntimeException);
979 
980 							// XActionLockable
981 	virtual sal_Bool SAL_CALL isActionLocked() throw(::com::sun::star::uno::RuntimeException);
982 	virtual void SAL_CALL	addActionLock() throw(::com::sun::star::uno::RuntimeException);
983 	virtual void SAL_CALL	removeActionLock() throw(::com::sun::star::uno::RuntimeException);
984 	virtual void SAL_CALL	setActionLocks( sal_Int16 nLock )
985 								throw(::com::sun::star::uno::RuntimeException);
986 	virtual sal_Int16 SAL_CALL resetActionLocks() throw(::com::sun::star::uno::RuntimeException);
987 
988 	static String		GetOutputString_Impl(ScDocument* pDoc, const ScAddress& aPos);
989 };
990 
991 
992 class ScTableSheetObj : public ScCellRangeObj,
993 						public com::sun::star::sheet::XSpreadsheet,
994 						public com::sun::star::container::XNamed,
995 						public com::sun::star::sheet::XSheetPageBreak,
996 						public com::sun::star::sheet::XCellRangeMovement,
997 						public com::sun::star::table::XTableChartsSupplier,
998 						public com::sun::star::sheet::XDataPilotTablesSupplier,
999 						public com::sun::star::sheet::XScenariosSupplier,
1000 						public com::sun::star::sheet::XSheetAnnotationsSupplier,
1001 						public com::sun::star::drawing::XDrawPageSupplier,
1002 						public com::sun::star::sheet::XPrintAreas,
1003 						public com::sun::star::sheet::XSheetLinkable,
1004 						public com::sun::star::sheet::XSheetAuditing,
1005 						public com::sun::star::sheet::XSheetOutline,
1006 						public com::sun::star::util::XProtectable,
1007 						public com::sun::star::sheet::XScenario,
1008 						public com::sun::star::sheet::XScenarioEnhanced,
1009                         public com::sun::star::sheet::XExternalSheetName,
1010                         public com::sun::star::document::XEventsSupplier
1011 {
1012 	friend class ScTableSheetsObj;		// fuer insertByName()
1013 
1014 private:
1015 	const SfxItemPropertySet*		pSheetPropSet;
1016 
1017 	SCTAB					GetTab_Impl() const;
1018 	void					PrintAreaUndo_Impl( ScPrintRangeSaver* pOldRanges );
1019 
1020 protected:
1021 	virtual const SfxItemPropertyMap* GetItemPropertyMap();
1022     virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
1023 								::com::sun::star::uno::Any& )
1024 								throw(::com::sun::star::uno::RuntimeException);
1025     virtual void            SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
1026 												const ::com::sun::star::uno::Any& aValue )
1027 								throw(::com::sun::star::lang::IllegalArgumentException,
1028 										::com::sun::star::uno::RuntimeException);
1029 
1030 public:
1031 							ScTableSheetObj(ScDocShell* pDocSh, SCTAB nTab);
1032 	virtual					~ScTableSheetObj();
1033 
1034 	void					InitInsertSheet(ScDocShell* pDocSh, SCTAB nTab);
1035 
1036 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
1037 								const ::com::sun::star::uno::Type & rType )
1038 									throw(::com::sun::star::uno::RuntimeException);
1039 	virtual void SAL_CALL	acquire() throw();
1040 	virtual void SAL_CALL	release() throw();
1041 
1042 							// XSpreadsheet
1043 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellCursor >
1044 							SAL_CALL createCursor() throw(::com::sun::star::uno::RuntimeException);
1045 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellCursor > SAL_CALL
1046 							createCursorByRange( const ::com::sun::star::uno::Reference<
1047 								::com::sun::star::sheet::XSheetCellRange >& aRange )
1048 									throw(::com::sun::star::uno::RuntimeException);
1049 
1050 							// XSheetCellRange
1051 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet > SAL_CALL
1052 							getSpreadsheet() throw(::com::sun::star::uno::RuntimeException);
1053 
1054 							// XCellRange
1055 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL
1056 							getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow )
1057 								throw(::com::sun::star::lang::IndexOutOfBoundsException,
1058 									::com::sun::star::uno::RuntimeException);
1059 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL
1060 							getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop,
1061 								sal_Int32 nRight, sal_Int32 nBottom )
1062 									throw(::com::sun::star::lang::IndexOutOfBoundsException,
1063 										::com::sun::star::uno::RuntimeException);
1064     using ScCellRangeObj::getCellRangeByName;
1065 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL
1066 							getCellRangeByName( const ::rtl::OUString& aRange )
1067 								throw(::com::sun::star::uno::RuntimeException);
1068 
1069 							// XNamed
1070 	virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
1071 	virtual void SAL_CALL	setName( const ::rtl::OUString& aName )
1072 								throw(::com::sun::star::uno::RuntimeException);
1073 
1074 							// XSheetPageBreak
1075 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::TablePageBreakData > SAL_CALL
1076 							getColumnPageBreaks() throw(::com::sun::star::uno::RuntimeException);
1077 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::TablePageBreakData > SAL_CALL
1078 							getRowPageBreaks() throw(::com::sun::star::uno::RuntimeException);
1079 	virtual void SAL_CALL	removeAllManualPageBreaks() throw(::com::sun::star::uno::RuntimeException);
1080 
1081 							// XCellRangeMovement
1082 	virtual void SAL_CALL	insertCells( const ::com::sun::star::table::CellRangeAddress& aRange,
1083 								::com::sun::star::sheet::CellInsertMode nMode )
1084 									throw(::com::sun::star::uno::RuntimeException);
1085 	virtual void SAL_CALL	removeRange( const ::com::sun::star::table::CellRangeAddress& aRange,
1086 								::com::sun::star::sheet::CellDeleteMode nMode )
1087 									throw(::com::sun::star::uno::RuntimeException);
1088 	virtual void SAL_CALL	moveRange( const ::com::sun::star::table::CellAddress& aDestination,
1089 								const ::com::sun::star::table::CellRangeAddress& aSource )
1090 									throw(::com::sun::star::uno::RuntimeException);
1091 	virtual void SAL_CALL	copyRange( const ::com::sun::star::table::CellAddress& aDestination,
1092 								const ::com::sun::star::table::CellRangeAddress& aSource )
1093 									throw(::com::sun::star::uno::RuntimeException);
1094 
1095 							// XTableChartsSupplier
1096 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XTableCharts > SAL_CALL
1097 							getCharts() throw(::com::sun::star::uno::RuntimeException);
1098 
1099 							// XDataPilotTablesSupplier
1100 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotTables > SAL_CALL
1101 							getDataPilotTables() throw(::com::sun::star::uno::RuntimeException);
1102 
1103 							// XScenariosSupplier
1104 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XScenarios > SAL_CALL
1105 							getScenarios() throw(::com::sun::star::uno::RuntimeException);
1106 
1107 							// XSheetAnnotationsSupplier
1108 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetAnnotations > SAL_CALL
1109 							getAnnotations() throw(::com::sun::star::uno::RuntimeException);
1110 
1111 							// XDrawPageSupplier
1112 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL
1113 							getDrawPage() throw(::com::sun::star::uno::RuntimeException);
1114 
1115 							// XPrintAreas
1116 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::table::CellRangeAddress > SAL_CALL
1117 							getPrintAreas() throw(::com::sun::star::uno::RuntimeException);
1118 	virtual void SAL_CALL setPrintAreas( const ::com::sun::star::uno::Sequence<
1119 								::com::sun::star::table::CellRangeAddress >& aPrintAreas )
1120 									throw(::com::sun::star::uno::RuntimeException);
1121 	virtual sal_Bool SAL_CALL getPrintTitleColumns() throw(::com::sun::star::uno::RuntimeException);
1122 	virtual void SAL_CALL	setPrintTitleColumns( sal_Bool bPrintTitleColumns )
1123 								throw(::com::sun::star::uno::RuntimeException);
1124 	virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getTitleColumns()
1125 								throw(::com::sun::star::uno::RuntimeException);
1126 	virtual void SAL_CALL	setTitleColumns(
1127 								const ::com::sun::star::table::CellRangeAddress& aTitleColumns )
1128 									throw(::com::sun::star::uno::RuntimeException);
1129 	virtual sal_Bool SAL_CALL getPrintTitleRows() throw(::com::sun::star::uno::RuntimeException);
1130 	virtual void SAL_CALL	setPrintTitleRows( sal_Bool bPrintTitleRows )
1131 								throw(::com::sun::star::uno::RuntimeException);
1132 	virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getTitleRows()
1133 								throw(::com::sun::star::uno::RuntimeException);
1134 	virtual void SAL_CALL	setTitleRows(
1135 								const ::com::sun::star::table::CellRangeAddress& aTitleRows )
1136 									throw(::com::sun::star::uno::RuntimeException);
1137 
1138 							// XSheetLinkable
1139 	virtual ::com::sun::star::sheet::SheetLinkMode SAL_CALL getLinkMode()
1140 								throw(::com::sun::star::uno::RuntimeException);
1141 	virtual void SAL_CALL	setLinkMode( ::com::sun::star::sheet::SheetLinkMode nLinkMode )
1142 								throw(::com::sun::star::uno::RuntimeException);
1143 	virtual ::rtl::OUString SAL_CALL getLinkUrl() throw(::com::sun::star::uno::RuntimeException);
1144 	virtual void SAL_CALL	setLinkUrl( const ::rtl::OUString& aLinkUrl )
1145 								throw(::com::sun::star::uno::RuntimeException);
1146 	virtual ::rtl::OUString SAL_CALL getLinkSheetName() throw(::com::sun::star::uno::RuntimeException);
1147 	virtual void SAL_CALL	setLinkSheetName( const ::rtl::OUString& aLinkSheetName )
1148 								throw(::com::sun::star::uno::RuntimeException);
1149 	virtual void SAL_CALL	link( const ::rtl::OUString& aUrl,
1150 								const ::rtl::OUString& aSheetName,
1151 								const ::rtl::OUString& aFilterName,
1152 								const ::rtl::OUString& aFilterOptions,
1153 								::com::sun::star::sheet::SheetLinkMode nMode )
1154 									throw(::com::sun::star::uno::RuntimeException);
1155 
1156 							// XSheetAuditing
1157 	virtual sal_Bool SAL_CALL hideDependents( const ::com::sun::star::table::CellAddress& aPosition )
1158 								throw(::com::sun::star::uno::RuntimeException);
1159 	virtual sal_Bool SAL_CALL hidePrecedents( const ::com::sun::star::table::CellAddress& aPosition )
1160 								throw(::com::sun::star::uno::RuntimeException);
1161 	virtual sal_Bool SAL_CALL showDependents( const ::com::sun::star::table::CellAddress& aPosition )
1162 								throw(::com::sun::star::uno::RuntimeException);
1163 	virtual sal_Bool SAL_CALL showPrecedents( const ::com::sun::star::table::CellAddress& aPosition )
1164 								throw(::com::sun::star::uno::RuntimeException);
1165 	virtual sal_Bool SAL_CALL showErrors( const ::com::sun::star::table::CellAddress& aPosition )
1166 								throw(::com::sun::star::uno::RuntimeException);
1167 	virtual sal_Bool SAL_CALL showInvalid() throw(::com::sun::star::uno::RuntimeException);
1168 	virtual void SAL_CALL	clearArrows() throw(::com::sun::star::uno::RuntimeException);
1169 
1170 							// XSheetOutline
1171 	virtual void SAL_CALL	group( const ::com::sun::star::table::CellRangeAddress& aRange,
1172 								::com::sun::star::table::TableOrientation nOrientation )
1173 									throw(::com::sun::star::uno::RuntimeException);
1174 	virtual void SAL_CALL	ungroup( const ::com::sun::star::table::CellRangeAddress& aRange,
1175 								::com::sun::star::table::TableOrientation nOrientation )
1176 									throw(::com::sun::star::uno::RuntimeException);
1177 	virtual void SAL_CALL	autoOutline( const ::com::sun::star::table::CellRangeAddress& aRange )
1178 								throw(::com::sun::star::uno::RuntimeException);
1179 	virtual void SAL_CALL	clearOutline() throw(::com::sun::star::uno::RuntimeException);
1180 	virtual void SAL_CALL	hideDetail( const ::com::sun::star::table::CellRangeAddress& aRange )
1181 								throw(::com::sun::star::uno::RuntimeException);
1182 	virtual void SAL_CALL	showDetail( const ::com::sun::star::table::CellRangeAddress& aRange )
1183 								throw(::com::sun::star::uno::RuntimeException);
1184 	virtual void SAL_CALL	showLevel( sal_Int16 nLevel,
1185 								::com::sun::star::table::TableOrientation nOrientation )
1186 									throw(::com::sun::star::uno::RuntimeException);
1187 
1188 							// XProtectable
1189 	virtual void SAL_CALL	protect( const ::rtl::OUString& aPassword )
1190 								throw(::com::sun::star::uno::RuntimeException);
1191 	virtual void SAL_CALL	unprotect( const ::rtl::OUString& aPassword )
1192 								throw(::com::sun::star::lang::IllegalArgumentException,
1193 									::com::sun::star::uno::RuntimeException);
1194 	virtual sal_Bool SAL_CALL isProtected() throw(::com::sun::star::uno::RuntimeException);
1195 
1196 							// XScenario
1197 	virtual sal_Bool SAL_CALL getIsScenario() throw(::com::sun::star::uno::RuntimeException);
1198 	virtual ::rtl::OUString SAL_CALL getScenarioComment() throw(::com::sun::star::uno::RuntimeException);
1199 	virtual void SAL_CALL	setScenarioComment( const ::rtl::OUString& aScenarioComment )
1200 								throw(::com::sun::star::uno::RuntimeException);
1201 	virtual void SAL_CALL	addRanges( const ::com::sun::star::uno::Sequence<
1202 								::com::sun::star::table::CellRangeAddress >& aRanges )
1203 									throw(::com::sun::star::uno::RuntimeException);
1204 	virtual void SAL_CALL	apply() throw(::com::sun::star::uno::RuntimeException);
1205 							// XScenarioEnhanced
1206     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::table::CellRangeAddress > SAL_CALL
1207                             getRanges(  )
1208                                     throw(::com::sun::star::uno::RuntimeException);
1209 
1210                             // XExternalSheetName
1211     virtual void SAL_CALL   setExternalName( const ::rtl::OUString& aUrl, const ::rtl::OUString& aSheetName )
1212                                 throw (::com::sun::star::container::ElementExistException,
1213                                        ::com::sun::star::uno::RuntimeException);
1214 
1215                             // XEventsSupplier
1216     virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents()
1217                                 throw (::com::sun::star::uno::RuntimeException);
1218 
1219 							// XPropertySet ueberladen wegen Sheet-Properties
1220 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
1221 							SAL_CALL getPropertySetInfo()
1222 								throw(::com::sun::star::uno::RuntimeException);
1223 
1224 							// XServiceInfo
1225 	virtual ::rtl::OUString SAL_CALL getImplementationName()
1226 								throw(::com::sun::star::uno::RuntimeException);
1227 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
1228 								throw(::com::sun::star::uno::RuntimeException);
1229 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
1230 								throw(::com::sun::star::uno::RuntimeException);
1231 
1232 							// XUnoTunnel
1233 	virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
1234 									sal_Int8 >& aIdentifier )
1235 								throw(::com::sun::star::uno::RuntimeException);
1236 
1237 	static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
1238 	static ScTableSheetObj* getImplementation( const com::sun::star::uno::Reference<
1239 									com::sun::star::uno::XInterface> xObj );
1240 
1241 							// XTypeProvider
1242 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
1243 								throw(::com::sun::star::uno::RuntimeException);
1244 	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
1245 								throw(::com::sun::star::uno::RuntimeException);
1246 };
1247 
1248 
1249 class ScTableColumnObj : public ScCellRangeObj,
1250 						 public com::sun::star::container::XNamed
1251 {
1252 private:
1253 	const SfxItemPropertySet*		pColPropSet;
1254 
1255 protected:
1256 	virtual const SfxItemPropertyMap* GetItemPropertyMap();
1257     virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
1258 								::com::sun::star::uno::Any& )
1259 								throw(::com::sun::star::uno::RuntimeException);
1260     virtual void            SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
1261 												const ::com::sun::star::uno::Any& aValue )
1262 								throw(::com::sun::star::lang::IllegalArgumentException,
1263 										::com::sun::star::uno::RuntimeException);
1264 
1265 public:
1266 							ScTableColumnObj(ScDocShell* pDocSh, SCCOL nCol, SCTAB nTab);
1267 	virtual					~ScTableColumnObj();
1268 
1269 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
1270 								const ::com::sun::star::uno::Type & rType )
1271 									throw(::com::sun::star::uno::RuntimeException);
1272 	virtual void SAL_CALL	acquire() throw();
1273 	virtual void SAL_CALL	release() throw();
1274 
1275 							// XNamed
1276 	virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
1277 	virtual void SAL_CALL	setName( const ::rtl::OUString& aName )
1278 								throw(::com::sun::star::uno::RuntimeException);
1279 
1280 							// XPropertySet ueberladen wegen Spalten-Properties
1281 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
1282 							SAL_CALL getPropertySetInfo()
1283 								throw(::com::sun::star::uno::RuntimeException);
1284 
1285 							// XServiceInfo
1286 	virtual ::rtl::OUString SAL_CALL getImplementationName()
1287 								throw(::com::sun::star::uno::RuntimeException);
1288 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
1289 								throw(::com::sun::star::uno::RuntimeException);
1290 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
1291 								throw(::com::sun::star::uno::RuntimeException);
1292 
1293 							// XTypeProvider
1294 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
1295 								throw(::com::sun::star::uno::RuntimeException);
1296 	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
1297 								throw(::com::sun::star::uno::RuntimeException);
1298 };
1299 
1300 
1301 class ScTableRowObj : public ScCellRangeObj
1302 {
1303 private:
1304 	const SfxItemPropertySet*		pRowPropSet;
1305 
1306 protected:
1307 	virtual const SfxItemPropertyMap* GetItemPropertyMap();
1308     virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
1309 								::com::sun::star::uno::Any& )
1310 								throw(::com::sun::star::uno::RuntimeException);
1311     virtual void            SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
1312 												const ::com::sun::star::uno::Any& aValue )
1313 								throw(::com::sun::star::lang::IllegalArgumentException,
1314 										::com::sun::star::uno::RuntimeException);
1315 
1316 public:
1317 							ScTableRowObj(ScDocShell* pDocSh, SCROW nRow, SCTAB nTab);
1318 	virtual					~ScTableRowObj();
1319 
1320 							// XPropertySet ueberladen wegen Zeilen-Properties
1321 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
1322 							SAL_CALL getPropertySetInfo()
1323 								throw(::com::sun::star::uno::RuntimeException);
1324 
1325 							// XServiceInfo
1326 	virtual ::rtl::OUString SAL_CALL getImplementationName()
1327 								throw(::com::sun::star::uno::RuntimeException);
1328 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
1329 								throw(::com::sun::star::uno::RuntimeException);
1330 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
1331 								throw(::com::sun::star::uno::RuntimeException);
1332 };
1333 
1334 
1335 class ScCellsObj : public cppu::WeakImplHelper2<
1336 							com::sun::star::container::XEnumerationAccess,
1337 							com::sun::star::lang::XServiceInfo >,
1338 						public SfxListener
1339 {
1340 private:
1341 	ScDocShell*				pDocShell;
1342 	ScRangeList				aRanges;
1343 
1344 public:
1345 							ScCellsObj(ScDocShell* pDocSh, const ScRangeList& rR);
1346 	virtual					~ScCellsObj();
1347 
1348 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
1349 
1350 							// XEnumerationAccess
1351 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
1352 							createEnumeration() throw(::com::sun::star::uno::RuntimeException);
1353 
1354 							// XElementAccess
1355 	virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
1356 								throw(::com::sun::star::uno::RuntimeException);
1357 	virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
1358 
1359 							// XServiceInfo
1360 	virtual ::rtl::OUString SAL_CALL getImplementationName()
1361 								throw(::com::sun::star::uno::RuntimeException);
1362 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
1363 								throw(::com::sun::star::uno::RuntimeException);
1364 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
1365 								throw(::com::sun::star::uno::RuntimeException);
1366 };
1367 
1368 
1369 class ScCellsEnumeration : public cppu::WeakImplHelper2<
1370 								com::sun::star::container::XEnumeration,
1371 								com::sun::star::lang::XServiceInfo >,
1372 							public SfxListener
1373 {
1374 private:
1375 	ScDocShell*				pDocShell;
1376 	ScRangeList				aRanges;
1377 	ScAddress				aPos;
1378 	ScMarkData*				pMark;
1379 	sal_Bool					bAtEnd;
1380 
1381 private:
1382 	void					Advance_Impl();
1383 	void					CheckPos_Impl();
1384 
1385 public:
1386 							ScCellsEnumeration(ScDocShell* pDocSh, const ScRangeList& rR);
1387 	virtual					~ScCellsEnumeration();
1388 
1389 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
1390 
1391 							// XEnumeration
1392 	virtual sal_Bool SAL_CALL hasMoreElements() throw(::com::sun::star::uno::RuntimeException);
1393 	virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
1394 								throw(::com::sun::star::container::NoSuchElementException,
1395 										::com::sun::star::lang::WrappedTargetException,
1396 										::com::sun::star::uno::RuntimeException);
1397 
1398 							// XServiceInfo
1399 	virtual ::rtl::OUString SAL_CALL getImplementationName()
1400 								throw(::com::sun::star::uno::RuntimeException);
1401 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
1402 								throw(::com::sun::star::uno::RuntimeException);
1403 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
1404 								throw(::com::sun::star::uno::RuntimeException);
1405 };
1406 
1407 class ScCellFormatsObj : public cppu::WeakImplHelper3<
1408 							com::sun::star::container::XIndexAccess,
1409 							com::sun::star::container::XEnumerationAccess,
1410 							com::sun::star::lang::XServiceInfo >,
1411 						public SfxListener
1412 {
1413 private:
1414 	ScDocShell*				pDocShell;
1415 	ScRange					aTotalRange;
1416 
1417 private:
1418 	ScCellRangeObj*			GetObjectByIndex_Impl(long nIndex) const;
1419 
1420 public:
1421 							ScCellFormatsObj(ScDocShell* pDocSh, const ScRange& rR);
1422 	virtual					~ScCellFormatsObj();
1423 
1424 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
1425 
1426 							// XIndexAccess
1427 	virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
1428 	virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
1429 								throw(::com::sun::star::lang::IndexOutOfBoundsException,
1430 									::com::sun::star::lang::WrappedTargetException,
1431 									::com::sun::star::uno::RuntimeException);
1432 
1433 							// XEnumerationAccess
1434 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
1435 							createEnumeration() throw(::com::sun::star::uno::RuntimeException);
1436 
1437 							// XElementAccess
1438 	virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
1439 								throw(::com::sun::star::uno::RuntimeException);
1440 	virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
1441 
1442 							// XServiceInfo
1443 	virtual ::rtl::OUString SAL_CALL getImplementationName()
1444 								throw(::com::sun::star::uno::RuntimeException);
1445 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
1446 								throw(::com::sun::star::uno::RuntimeException);
1447 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
1448 								throw(::com::sun::star::uno::RuntimeException);
1449 };
1450 
1451 
1452 class ScCellFormatsEnumeration : public cppu::WeakImplHelper2<
1453 									com::sun::star::container::XEnumeration,
1454 									com::sun::star::lang::XServiceInfo >,
1455 								 public SfxListener
1456 {
1457 private:
1458 	ScDocShell*				pDocShell;
1459 	SCTAB					nTab;
1460 	ScAttrRectIterator*		pIter;
1461 	ScRange					aNext;
1462 	sal_Bool					bAtEnd;
1463 	sal_Bool					bDirty;
1464 
1465 private:
1466 	void					Advance_Impl();
1467 	ScCellRangeObj*			NextObject_Impl();
1468 
1469 public:
1470 							ScCellFormatsEnumeration(ScDocShell* pDocSh, const ScRange& rR);
1471 	virtual					~ScCellFormatsEnumeration();
1472 
1473 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
1474 
1475 							// XEnumeration
1476 	virtual sal_Bool SAL_CALL hasMoreElements() throw(::com::sun::star::uno::RuntimeException);
1477 	virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
1478 								throw(::com::sun::star::container::NoSuchElementException,
1479 										::com::sun::star::lang::WrappedTargetException,
1480 										::com::sun::star::uno::RuntimeException);
1481 
1482 							// XServiceInfo
1483 	virtual ::rtl::OUString SAL_CALL getImplementationName()
1484 								throw(::com::sun::star::uno::RuntimeException);
1485 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
1486 								throw(::com::sun::star::uno::RuntimeException);
1487 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
1488 								throw(::com::sun::star::uno::RuntimeException);
1489 };
1490 
1491 typedef std::vector< ScRangeList > ScMyRangeLists;
1492 
1493 class ScUniqueCellFormatsObj : public cppu::WeakImplHelper3<
1494 							com::sun::star::container::XIndexAccess,
1495 							com::sun::star::container::XEnumerationAccess,
1496 							com::sun::star::lang::XServiceInfo >,
1497 						public SfxListener
1498 {
1499 private:
1500 	ScDocShell*						pDocShell;
1501 	ScRange							aTotalRange;
1502 	ScMyRangeLists					aRangeLists;
1503 
1504 private:
1505 	void							GetObjects_Impl();
1506 
1507 public:
1508 							ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange& rR);
1509 	virtual					~ScUniqueCellFormatsObj();
1510 
1511 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
1512 
1513 							// XIndexAccess
1514 	virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
1515 	virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
1516 								throw(::com::sun::star::lang::IndexOutOfBoundsException,
1517 									::com::sun::star::lang::WrappedTargetException,
1518 									::com::sun::star::uno::RuntimeException);
1519 
1520 							// XEnumerationAccess
1521 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
1522 							createEnumeration() throw(::com::sun::star::uno::RuntimeException);
1523 
1524 							// XElementAccess
1525 	virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
1526 								throw(::com::sun::star::uno::RuntimeException);
1527 	virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
1528 
1529 							// XServiceInfo
1530 	virtual ::rtl::OUString SAL_CALL getImplementationName()
1531 								throw(::com::sun::star::uno::RuntimeException);
1532 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
1533 								throw(::com::sun::star::uno::RuntimeException);
1534 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
1535 								throw(::com::sun::star::uno::RuntimeException);
1536 };
1537 
1538 class ScUniqueCellFormatsEnumeration : public cppu::WeakImplHelper2<
1539 									com::sun::star::container::XEnumeration,
1540 									com::sun::star::lang::XServiceInfo >,
1541 								 public SfxListener
1542 {
1543 private:
1544 	ScMyRangeLists					aRangeLists;
1545 	ScDocShell*						pDocShell;
1546 	sal_Int32						nCurrentPosition;
1547 
1548 public:
1549 							ScUniqueCellFormatsEnumeration(ScDocShell* pDocShell, const ScMyRangeLists& rRangeLists);
1550 	virtual					~ScUniqueCellFormatsEnumeration();
1551 
1552 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
1553 
1554 							// XEnumeration
1555 	virtual sal_Bool SAL_CALL hasMoreElements() throw(::com::sun::star::uno::RuntimeException);
1556 	virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
1557 								throw(::com::sun::star::container::NoSuchElementException,
1558 										::com::sun::star::lang::WrappedTargetException,
1559 										::com::sun::star::uno::RuntimeException);
1560 
1561 							// XServiceInfo
1562 	virtual ::rtl::OUString SAL_CALL getImplementationName()
1563 								throw(::com::sun::star::uno::RuntimeException);
1564 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
1565 								throw(::com::sun::star::uno::RuntimeException);
1566 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
1567 								throw(::com::sun::star::uno::RuntimeException);
1568 };
1569 
1570 
1571 #endif
1572 
1573