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