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