Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / inc / cellsuno.hxx
blobe64c1065d5c7ee078a35670264eb4624fbcd41d6
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 #pragma once
22 #include <config_options.h>
23 #include "address.hxx"
24 #include "rangelst.hxx"
26 #include <formula/grammar.hxx>
27 #include <rtl/ref.hxx>
28 #include <sal/types.h>
29 #include <tools/link.hxx>
30 #include <svl/itemset.hxx>
31 #include <svl/lstner.hxx>
32 #include <svl/listener.hxx>
33 #include <com/sun/star/table/XTableChartsSupplier.hpp>
34 #include <com/sun/star/table/XTablePivotChartsSupplier.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/XCell2.hpp>
72 #include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
73 #include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
74 #include <com/sun/star/sheet/XScenariosSupplier.hpp>
75 #include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
76 #include <com/sun/star/sheet/XSheetAuditing.hpp>
77 #include <com/sun/star/sheet/XSheetOutline.hpp>
78 #include <com/sun/star/util/XProtectable.hpp>
79 #include <com/sun/star/sheet/XScenario.hpp>
80 #include <com/sun/star/sheet/XScenarioEnhanced.hpp>
81 #include <com/sun/star/util/XModifyBroadcaster.hpp>
82 #include <com/sun/star/beans/XPropertyState.hpp>
83 #include <com/sun/star/beans/XMultiPropertySet.hpp>
84 #include <com/sun/star/document/XActionLockable.hpp>
85 #include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
86 #include <com/sun/star/sheet/XExternalSheetName.hpp>
87 #include <com/sun/star/document/XEventsSupplier.hpp>
88 #include <comphelper/servicehelper.hxx>
89 #include <cppuhelper/implbase.hxx>
91 #include <memory>
92 #include <optional>
93 #include <vector>
95 namespace com::sun::star::table { struct BorderLine2; }
96 namespace com::sun::star::table { struct BorderLine; }
97 namespace com::sun::star::table { struct TableBorder2; }
98 namespace com::sun::star::table { struct TableBorder; }
100 class ScDocShell;
101 class ScMarkData;
102 class ScMemChart;
103 class ScPrintRangeSaver;
104 class ScAttrRectIterator;
105 class ScCellRangeObj;
106 class ScPatternAttr;
107 class SvxBoxItem;
108 class SvxBoxInfoItem;
109 class SvxItemPropertySet;
110 class SvxUnoText;
111 class ScDocument;
112 class SfxBroadcaster;
113 class SfxHint;
114 class SfxItemPropertyMap;
115 class SfxItemPropertySet;
116 struct SfxItemPropertyMapEntry;
118 namespace editeng { class SvxBorderLine; }
120 class ScLinkListener final : public SvtListener
122 Link<const SfxHint&,void> aLink;
123 public:
124 ScLinkListener(const Link<const SfxHint&,void>& rL) : aLink(rL) {}
125 virtual ~ScLinkListener() override;
126 virtual void Notify( const SfxHint& rHint ) override;
129 typedef std::vector< css::uno::Reference< css::util::XModifyListener > > XModifyListenerArr_Impl;
131 // ScCellRangesBase - base class for ScCellRangesObj (with access by index)
132 // and ScCellRangeObj (without access by index)
134 // XServiceInfo is implemented in derived classes
136 class ScHelperFunctions
138 public:
139 static const ::editeng::SvxBorderLine* GetBorderLine( ::editeng::SvxBorderLine& rLine, const css::table::BorderLine& rStruct );
140 static const ::editeng::SvxBorderLine* GetBorderLine( ::editeng::SvxBorderLine& rLine, const css::table::BorderLine2& rStruct );
141 static void FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const css::table::TableBorder& rBorder );
142 static void FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const css::table::TableBorder2& rBorder );
143 static void FillBorderLine( css::table::BorderLine& rStruct, const ::editeng::SvxBorderLine* pLine );
144 static void FillBorderLine( css::table::BorderLine2& rStruct, const ::editeng::SvxBorderLine* pLine );
145 static void AssignTableBorderToAny( css::uno::Any& rAny,
146 const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner, bool bInvalidateHorVerDist = false );
147 static void AssignTableBorder2ToAny( css::uno::Any& rAny,
148 const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner, bool bInvalidateHorVerDist = false );
149 static void ApplyBorder( ScDocShell* pDocShell, const ScRangeList& rRanges,
150 const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner );
153 namespace ooo::vba::excel {
154 class ScVbaCellRangeAccess; // Vba Helper class
157 class SC_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") ScCellRangesBase :
158 public cppu::WeakImplHelper<
159 css::beans::XPropertySet,
160 css::beans::XMultiPropertySet,
161 css::beans::XPropertyState,
162 css::sheet::XSheetOperation,
163 css::chart::XChartDataArray,
164 css::util::XIndent,
165 css::sheet::XCellRangesQuery,
166 css::sheet::XFormulaQuery,
167 css::util::XReplaceable,
168 css::util::XModifyBroadcaster,
169 css::lang::XServiceInfo,
170 css::beans::XTolerantMultiPropertySet>,
171 public SfxListener
173 friend class ScTabViewObj; // for select()
174 friend class ScTableSheetObj; // for createCursorByRange()
175 friend class ooo::vba::excel::ScVbaCellRangeAccess;
177 private:
178 const SfxItemPropertySet* pPropSet;
179 ScDocShell* pDocShell;
180 std::unique_ptr<ScLinkListener> pValueListener;
181 std::unique_ptr<ScPatternAttr> pCurrentFlat;
182 std::unique_ptr<ScPatternAttr> pCurrentDeep;
183 std::optional<SfxItemSet> moCurrentDataSet;
184 std::optional<SfxItemSet> moNoDfltCurrentDataSet;
185 std::unique_ptr<ScMarkData> pMarkData;
186 ScRangeList aRanges;
187 sal_Int64 nObjectId;
188 bool bChartColAsHdr;
189 bool bChartRowAsHdr;
190 bool bCursorOnly;
191 bool bGotDataChangedHint;
192 XModifyListenerArr_Impl aValueListeners;
194 DECL_DLLPRIVATE_LINK( ValueListenerHdl, const SfxHint&, void );
196 private:
197 void PaintGridRanges_Impl();
198 ScRangeListRef GetLimitedChartRanges_Impl( sal_Int32 nDataColumns, sal_Int32 nDataRows ) const;
199 void ForceChartListener_Impl();
200 std::unique_ptr<ScMemChart> CreateMemChart_Impl() const;
202 const ScPatternAttr* GetCurrentAttrsFlat();
203 const ScPatternAttr* GetCurrentAttrsDeep();
204 SfxItemSet* GetCurrentDataSet(bool bNoDflt = false);
205 void ForgetMarkData();
206 void ForgetCurrentAttrs();
208 css::uno::Reference<css::sheet::XSheetCellRanges>
209 QueryDifferences_Impl(const css::table::CellAddress& aCompare,
210 bool bColumnDiff);
211 css::uno::Reference<css::uno::XInterface>
212 Find_Impl(const css::uno::Reference<css::util::XSearchDescriptor>& xDesc,
213 const ScAddress* pLastPos);
215 protected:
216 const ScMarkData* GetMarkData();
218 // GetItemPropertyMap for derived classes must contain all entries, including base class
219 virtual const SfxItemPropertyMap& GetItemPropertyMap();
220 css::beans::PropertyState GetOnePropertyState(
221 sal_uInt16 nItemWhich, const SfxItemPropertyMapEntry* pEntry );
222 /// @throws css::uno::RuntimeException
223 virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
224 css::uno::Any& );
225 /// @throws css::lang::IllegalArgumentException
226 /// @throws css::uno::RuntimeException
227 virtual void SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
228 const css::uno::Any& aValue );
230 public:
231 ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR);
232 ScCellRangesBase(ScDocShell* pDocSh, ScRangeList aR);
233 virtual ~ScCellRangesBase() override;
235 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
236 virtual void RefChanged();
238 // from derived classes and by getImplementation
239 ScDocShell* GetDocShell() const { return pDocShell; }
240 ScDocument* GetDocument() const;
241 const ScRangeList& GetRangeList() const { return aRanges; }
242 void AddRange(const ScRange& rRange, const bool bMergeRanges);
244 // arouse object created via service:
245 void InitInsertRange(ScDocShell* pDocSh, const ScRange& rR);
247 void SetNewRange(const ScRange& rNew); // for cursor
248 void SetNewRanges(const ScRangeList& rNew);
250 void SetCursorOnly(bool bSet);
251 bool IsCursorOnly() const { return bCursorOnly; }
253 // XSheetOperation
254 virtual double SAL_CALL computeFunction( css::sheet::GeneralFunction nFunction ) override;
255 virtual void SAL_CALL clearContents( sal_Int32 nContentFlags ) override;
257 // XPropertySet
258 virtual css::uno::Reference< css::beans::XPropertySetInfo >
259 SAL_CALL getPropertySetInfo() override;
260 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
261 const css::uno::Any& aValue ) override;
262 virtual css::uno::Any SAL_CALL getPropertyValue(
263 const OUString& PropertyName ) override;
264 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
265 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
266 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
267 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
268 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
269 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
270 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
271 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
273 // XMultiPropertySet
274 virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames,
275 const css::uno::Sequence< css::uno::Any >& aValues ) override;
276 virtual css::uno::Sequence< css::uno::Any > SAL_CALL
277 getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
278 virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames,
279 const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
280 virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
281 virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames,
282 const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
284 // XTolerantMultiPropertySet
285 virtual css::uno::Sequence< css::beans::SetPropertyTolerantFailed > SAL_CALL
286 setPropertyValuesTolerant( const css::uno::Sequence< OUString >& aPropertyNames,
287 const css::uno::Sequence< css::uno::Any >& aValues ) override;
288 virtual css::uno::Sequence< css::beans::GetPropertyTolerantResult > SAL_CALL
289 getPropertyValuesTolerant( const css::uno::Sequence< OUString >& aPropertyNames ) override;
290 virtual css::uno::Sequence< css::beans::GetDirectPropertyTolerantResult > SAL_CALL
291 getDirectPropertyValuesTolerant( const css::uno::Sequence< OUString >& aPropertyNames ) override;
293 // XPropertyState
294 virtual css::beans::PropertyState SAL_CALL getPropertyState(
295 const OUString& PropertyName ) override;
296 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL
297 getPropertyStates( const css::uno::Sequence<
298 OUString >& aPropertyName ) override;
299 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
300 virtual css::uno::Any SAL_CALL getPropertyDefault(
301 const OUString& aPropertyName ) override;
303 // XIndent
304 virtual void SAL_CALL decrementIndent() override;
305 virtual void SAL_CALL incrementIndent() override;
307 // XChartData
308 virtual void SAL_CALL addChartDataChangeEventListener(
309 const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override;
310 virtual void SAL_CALL removeChartDataChangeEventListener( const css::uno::Reference<
311 css::chart::XChartDataChangeEventListener >& aListener ) override;
312 virtual double SAL_CALL getNotANumber() override;
313 virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) override;
315 // XChartDataArray
316 virtual css::uno::Sequence< css::uno::Sequence< double > > SAL_CALL
317 getData() override;
318 virtual void SAL_CALL setData( const css::uno::Sequence< css::uno::Sequence< double > >& aData ) override;
319 virtual css::uno::Sequence< OUString > SAL_CALL getRowDescriptions() override;
320 virtual void SAL_CALL setRowDescriptions( const css::uno::Sequence< OUString >& aRowDescriptions ) override;
321 virtual css::uno::Sequence< OUString > SAL_CALL getColumnDescriptions() override;
322 virtual void SAL_CALL setColumnDescriptions( const css::uno::Sequence< OUString >& aColumnDescriptions ) override;
324 // XCellRangesQuery
325 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
326 queryVisibleCells() override;
327 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
328 queryEmptyCells() override;
329 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
330 queryContentCells( sal_Int16 nContentFlags ) override;
331 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
332 queryFormulaCells( sal_Int32 nResultFlags ) override;
333 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
334 queryColumnDifferences(
335 const css::table::CellAddress& aCompare ) override;
336 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
337 queryRowDifferences(
338 const css::table::CellAddress& aCompare ) override;
339 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
340 queryIntersection(
341 const css::table::CellRangeAddress& aRange ) override;
343 // XFormulaQuery
344 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
345 queryDependents( sal_Bool bRecursive ) override;
346 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
347 queryPrecedents( sal_Bool bRecursive ) override;
349 // XSearchable
350 virtual css::uno::Reference< css::util::XSearchDescriptor > SAL_CALL
351 createSearchDescriptor() override;
352 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
353 findAll( const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override;
354 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
355 findFirst( const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override;
356 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
357 findNext( const css::uno::Reference< css::uno::XInterface >& xStartAt,
358 const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override;
360 // XReplaceable
361 virtual css::uno::Reference< css::util::XReplaceDescriptor > SAL_CALL
362 createReplaceDescriptor() override;
363 virtual sal_Int32 SAL_CALL replaceAll( const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override;
365 // XModifyBroadcaster
366 virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
367 virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
369 // XServiceInfo
370 virtual OUString SAL_CALL getImplementationName() override;
371 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
372 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
375 class UNLESS_MERGELIBS(SC_DLLPUBLIC) ScCellRangesObj final : public ScCellRangesBase,
376 public css::sheet::XSheetCellRangeContainer,
377 public css::container::XNameContainer,
378 public css::container::XEnumerationAccess
380 public:
381 struct ScNamedEntry
383 OUString aName;
384 ScRange aRange;
385 const OUString& GetName() const { return aName; }
386 const ScRange& GetRange() const { return aRange; }
388 private:
389 std::vector<ScNamedEntry> m_aNamedEntries;
391 rtl::Reference<ScCellRangeObj> GetObjectByIndex_Impl(sal_Int32 nIndex) const;
393 public:
394 IF_MERGELIBS(SC_DLLPUBLIC)
395 ScCellRangesObj(ScDocShell* pDocSh, const ScRangeList& rR);
396 virtual ~ScCellRangesObj() override;
398 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
399 IF_MERGELIBS(SC_DLLPUBLIC)
400 virtual void SAL_CALL acquire() noexcept override;
401 virtual void SAL_CALL release() noexcept override;
403 virtual void RefChanged() override;
405 // XSheetCellRanges
406 virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL
407 getCells() override;
408 virtual OUString SAL_CALL getRangeAddressesAsString() override;
409 virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
410 getRangeAddresses() override;
412 // XSheetCellRangeContainer
413 virtual void SAL_CALL addRangeAddress( const css::table::CellRangeAddress& rRange,
414 sal_Bool bMergeRanges ) override;
415 virtual void SAL_CALL removeRangeAddress( const css::table::CellRangeAddress& rRange ) override;
416 virtual void SAL_CALL addRangeAddresses( const css::uno::Sequence<
417 css::table::CellRangeAddress >& rRanges,
418 sal_Bool bMergeRanges ) override;
419 virtual void SAL_CALL removeRangeAddresses( const css::uno::Sequence<
420 css::table::CellRangeAddress >& rRanges ) override;
422 // XNameContainer
423 virtual void SAL_CALL insertByName( const OUString& aName,
424 const css::uno::Any& aElement ) override;
425 virtual void SAL_CALL removeByName( const OUString& Name ) override;
427 // XNameReplace
428 virtual void SAL_CALL replaceByName( const OUString& aName,
429 const css::uno::Any& aElement ) override;
431 // XNameAccess
432 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
433 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
434 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
436 // XIndexAccess
437 virtual sal_Int32 SAL_CALL getCount() override;
438 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
440 // XElementAccess
441 virtual css::uno::Type SAL_CALL getElementType() override;
442 virtual sal_Bool SAL_CALL hasElements() override;
444 // XEnumerationAccess
445 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
446 createEnumeration() override;
448 // XServiceInfo
449 virtual OUString SAL_CALL getImplementationName() override;
450 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
451 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
453 // XTypeProvider
454 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
455 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
458 class SC_DLLPUBLIC ScCellRangeObj : public ScCellRangesBase,
459 public css::sheet::XCellRangeAddressable,
460 public css::sheet::XSheetCellRange,
461 public css::sheet::XArrayFormulaRange,
462 public css::sheet::XArrayFormulaTokens,
463 public css::sheet::XCellRangeData,
464 public css::sheet::XCellRangeFormula,
465 public css::sheet::XMultipleOperation,
466 public css::util::XMergeable,
467 public css::sheet::XCellSeries,
468 public css::table::XAutoFormattable,
469 public css::util::XSortable,
470 public css::sheet::XSheetFilterableEx,
471 public css::sheet::XSubTotalCalculatable,
472 public css::util::XImportable,
473 public css::sheet::XCellFormatRangesSupplier,
474 public css::sheet::XUniqueCellFormatRangesSupplier,
475 public css::table::XColumnRowRange
477 private:
478 const SfxItemPropertySet* pRangePropSet;
479 ScRange aRange;
481 protected:
482 const ScRange& GetRange() const { return aRange; }
483 virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
484 virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
485 css::uno::Any& ) override;
486 virtual void SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
487 const css::uno::Any& aValue ) override;
489 /// @throws css::lang::IndexOutOfBoundsException
490 /// @throws css::uno::RuntimeException
491 css::uno::Reference< css::table::XCell >
492 GetCellByPosition_Impl( sal_Int32 nColumn, sal_Int32 nRow );
494 /// @throws css::uno::RuntimeException
495 void SetArrayFormula_Impl( const OUString& rFormula,
496 const formula::FormulaGrammar::Grammar eGrammar );
498 public:
499 ScCellRangeObj(ScDocShell* pDocSh, const ScRange& rR);
500 virtual ~ScCellRangeObj() override;
502 // uses ObjectShell from document, if set (returns NULL otherwise)
503 static css::uno::Reference<css::table::XCellRange>
504 CreateRangeFromDoc( const ScDocument& rDoc, const ScRange& rR );
506 virtual css::uno::Any SAL_CALL queryInterface(
507 const css::uno::Type & rType ) override;
508 virtual void SAL_CALL acquire() noexcept override;
509 virtual void SAL_CALL release() noexcept override;
511 virtual void RefChanged() override;
513 // XCellRangeAddressable
514 virtual css::table::CellRangeAddress SAL_CALL getRangeAddress() override;
516 // XSheetCellRange
517 virtual css::uno::Reference< css::sheet::XSpreadsheet > SAL_CALL
518 getSpreadsheet() override;
520 // XArrayFormulaRange
521 virtual OUString SAL_CALL getArrayFormula() override;
522 virtual void SAL_CALL setArrayFormula( const OUString& aFormula ) override;
524 // XArrayFormulaTokens
525 virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL getArrayTokens() override;
526 virtual void SAL_CALL setArrayTokens( const css::uno::Sequence<
527 css::sheet::FormulaToken >& aTokens ) override;
529 // XCellRangeData
530 virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getDataArray() override;
531 virtual void SAL_CALL setDataArray( const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aArray ) override;
533 // XCellRangeFormula
534 virtual css::uno::Sequence< css::uno::Sequence<
535 OUString > > SAL_CALL getFormulaArray() override;
536 virtual void SAL_CALL setFormulaArray( const css::uno::Sequence< css::uno::Sequence< OUString > >& aArray ) override;
538 // XMultipleOperation
539 virtual void SAL_CALL setTableOperation(
540 const css::table::CellRangeAddress& aFormulaRange,
541 css::sheet::TableOperationMode nMode,
542 const css::table::CellAddress& aColumnCell,
543 const css::table::CellAddress& aRowCell ) override;
545 // XMergeable
546 virtual void SAL_CALL merge( sal_Bool bMerge ) override;
547 virtual sal_Bool SAL_CALL getIsMerged() override;
549 // XCellSeries
550 virtual void SAL_CALL fillSeries( css::sheet::FillDirection nFillDirection,
551 css::sheet::FillMode nFillMode,
552 css::sheet::FillDateMode nFillDateMode,
553 double fStep, double fEndValue ) override;
554 virtual void SAL_CALL fillAuto( css::sheet::FillDirection nFillDirection,
555 sal_Int32 nSourceCount ) override;
557 // XAutoFormattable
558 virtual void SAL_CALL autoFormat( const OUString& aName ) override;
560 // XSortable
561 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL
562 createSortDescriptor() override;
563 virtual void SAL_CALL sort( const css::uno::Sequence<
564 css::beans::PropertyValue >& xDescriptor ) override;
566 // XSheetFilterableEx
567 virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL
568 createFilterDescriptorByObject( const css::uno::Reference<
569 css::sheet::XSheetFilterable >& xObject ) override;
571 // XSheetFilterable
572 virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL
573 createFilterDescriptor( sal_Bool bEmpty ) override;
574 virtual void SAL_CALL filter( const css::uno::Reference<
575 css::sheet::XSheetFilterDescriptor >& xDescriptor ) override;
577 // XSubTotalCalculatable
578 virtual css::uno::Reference< css::sheet::XSubTotalDescriptor > SAL_CALL
579 createSubTotalDescriptor( sal_Bool bEmpty ) override;
580 virtual void SAL_CALL applySubTotals(const css::uno::Reference< css::sheet::XSubTotalDescriptor >& xDescriptor,
581 sal_Bool bReplace) override;
582 virtual void SAL_CALL removeSubTotals() override;
584 // XImportable
585 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL
586 createImportDescriptor( sal_Bool bEmpty ) override;
587 virtual void SAL_CALL doImport( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor ) override;
589 // XCellFormatRangesSupplier
590 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
591 getCellFormatRanges() override;
593 // XUniqueCellFormatRangesSupplier
594 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
595 getUniqueCellFormatRanges() override;
597 // XColumnRowRange
598 virtual css::uno::Reference< css::table::XTableColumns > SAL_CALL
599 getColumns() override;
600 virtual css::uno::Reference< css::table::XTableRows > SAL_CALL
601 getRows() override;
603 // XCellRange
604 virtual css::uno::Reference< css::table::XCell > SAL_CALL
605 getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) override;
606 virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
607 getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop,
608 sal_Int32 nRight, sal_Int32 nBottom ) override;
609 virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
610 getCellRangeByName( const OUString& aRange ) override;
611 /// @throws css::uno::RuntimeException
612 css::uno::Reference< css::table::XCellRange >
613 getCellRangeByName( const OUString& aRange, const ScAddress::Details& rDetails );
615 // XPropertySet override due to Range-Properties
616 virtual css::uno::Reference< css::beans::XPropertySetInfo >
617 SAL_CALL getPropertySetInfo() override;
619 // XServiceInfo
620 virtual OUString SAL_CALL getImplementationName() override;
621 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
622 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
624 // XTypeProvider
625 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
626 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
629 //! really derive cell from range?
631 class SC_DLLPUBLIC ScCellObj final : public ScCellRangeObj,
632 public css::text::XText,
633 public css::container::XEnumerationAccess,
634 public css::table::XCell2,
635 public css::sheet::XFormulaTokens,
636 public css::sheet::XCellAddressable,
637 public css::sheet::XSheetAnnotationAnchor,
638 public css::text::XTextFieldsSupplier,
639 public css::document::XActionLockable
641 private:
642 rtl::Reference<SvxUnoText> mxUnoText;
643 const SfxItemPropertySet* pCellPropSet;
644 ScAddress aCellPos;
645 sal_Int16 nActionLockCount;
647 private:
648 OUString GetInputString_Impl(bool bEnglish) const;
649 OUString GetOutputString_Impl() const;
650 void SetString_Impl(const OUString& rString, bool bInterpret, bool bEnglish);
651 double GetValue_Impl() const;
652 void SetValue_Impl(double fValue);
653 css::table::CellContentType GetContentType_Impl();
654 sal_Int32 GetResultType_Impl() const;
656 virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
657 virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
658 css::uno::Any& ) override;
659 virtual void SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
660 const css::uno::Any& aValue ) override;
662 public:
663 static const SvxItemPropertySet* GetEditPropertySet();
664 static const SfxItemPropertyMap& GetCellPropertyMap();
666 ScCellObj(ScDocShell* pDocSh, const ScAddress& rP);
667 virtual ~ScCellObj() override;
669 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
670 virtual void SAL_CALL acquire() noexcept override;
671 virtual void SAL_CALL release() noexcept override;
673 virtual void RefChanged() override;
675 SvxUnoText& GetUnoText();
677 // XML import needs to set results at formula cells,
678 // not meant for any other purpose.
679 const ScAddress& GetPosition() const { return aCellPos; }
681 void InputEnglishString( const OUString& rText );
683 // XText
684 virtual void SAL_CALL insertTextContent( const css::uno::Reference< css::text::XTextRange >& xRange,
685 const css::uno::Reference< css::text::XTextContent >& xContent,
686 sal_Bool bAbsorb ) override;
687 virtual void SAL_CALL removeTextContent( const css::uno::Reference< css::text::XTextContent >& xContent ) override;
689 // XSimpleText
690 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
691 createTextCursor() override;
692 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
693 createTextCursorByRange( const css::uno::Reference< css::text::XTextRange >& aTextPosition ) override;
694 virtual void SAL_CALL insertString( const css::uno::Reference< css::text::XTextRange >& xRange,
695 const OUString& aString, sal_Bool bAbsorb ) override;
696 virtual void SAL_CALL insertControlCharacter( const css::uno::Reference< css::text::XTextRange >& xRange,
697 sal_Int16 nControlCharacter, sal_Bool bAbsorb ) override;
699 // XTextRange
700 virtual css::uno::Reference< css::text::XText > SAL_CALL
701 getText() override;
702 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
703 getStart() override;
704 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
705 getEnd() override;
706 virtual OUString SAL_CALL getString() override;
707 virtual void SAL_CALL setString( const OUString& aString ) override;
709 // XEnumerationAccess
710 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
711 createEnumeration() override;
713 // XElementAccess
714 virtual css::uno::Type SAL_CALL getElementType() override;
715 virtual sal_Bool SAL_CALL hasElements() override;
717 // XCell
718 virtual OUString SAL_CALL getFormula() override;
719 virtual void SAL_CALL setFormula( const OUString& aFormula ) override;
720 virtual void SAL_CALL setFormulaResult( double nValue ) override;
721 virtual void SAL_CALL setFormulaString( const OUString& aFormula ) override;
722 virtual double SAL_CALL getValue() override;
723 virtual void SAL_CALL setValue( double nValue ) override;
724 virtual css::table::CellContentType SAL_CALL getType() override;
725 virtual sal_Int32 SAL_CALL getError() override;
727 // XFormulaTokens
728 virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL getTokens() override;
729 virtual void SAL_CALL setTokens( const css::uno::Sequence< css::sheet::FormulaToken >& aTokens ) override;
731 // XCellAddressable
732 virtual css::table::CellAddress SAL_CALL getCellAddress() override;
734 // XSheetAnnotationAnchor
735 virtual css::uno::Reference< css::sheet::XSheetAnnotation > SAL_CALL
736 getAnnotation() override;
738 // XTextFieldsSupplier
739 virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL
740 getTextFields() override;
741 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL
742 getTextFieldMasters() override;
744 // XPropertySet override due to cell properties
745 virtual css::uno::Reference< css::beans::XPropertySetInfo >
746 SAL_CALL getPropertySetInfo() override;
748 // XServiceInfo
749 virtual OUString SAL_CALL getImplementationName() override;
750 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
751 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
753 // XTypeProvider
754 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
755 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
757 // XActionLockable
758 virtual sal_Bool SAL_CALL isActionLocked() override;
759 virtual void SAL_CALL addActionLock() override;
760 virtual void SAL_CALL removeActionLock() override;
761 virtual void SAL_CALL setActionLocks( sal_Int16 nLock ) override;
762 virtual sal_Int16 SAL_CALL resetActionLocks() override;
765 class SC_DLLPUBLIC ScTableSheetObj final : public ScCellRangeObj,
766 public css::sheet::XSpreadsheet,
767 public css::container::XNamed,
768 public css::sheet::XSheetPageBreak,
769 public css::sheet::XCellRangeMovement,
770 public css::table::XTableChartsSupplier,
771 public css::table::XTablePivotChartsSupplier,
772 public css::sheet::XDataPilotTablesSupplier,
773 public css::sheet::XScenariosSupplier,
774 public css::sheet::XSheetAnnotationsSupplier,
775 public css::drawing::XDrawPageSupplier,
776 public css::sheet::XPrintAreas,
777 public css::sheet::XSheetLinkable,
778 public css::sheet::XSheetAuditing,
779 public css::sheet::XSheetOutline,
780 public css::util::XProtectable,
781 public css::sheet::XScenario,
782 public css::sheet::XScenarioEnhanced,
783 public css::sheet::XExternalSheetName,
784 public css::document::XEventsSupplier
786 friend class ScTableSheetsObj; // for insertByName()
788 private:
789 const SfxItemPropertySet* pSheetPropSet;
791 SCTAB GetTab_Impl() const;
792 void PrintAreaUndo_Impl( std::unique_ptr<ScPrintRangeSaver> pOldRanges );
794 virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
795 virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
796 css::uno::Any& ) override;
797 virtual void SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
798 const css::uno::Any& aValue ) override;
800 public:
801 ScTableSheetObj(ScDocShell* pDocSh, SCTAB nTab);
802 virtual ~ScTableSheetObj() override;
804 void InitInsertSheet(ScDocShell* pDocSh, SCTAB nTab);
806 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
807 virtual void SAL_CALL acquire() noexcept override;
808 virtual void SAL_CALL release() noexcept override;
810 // XSpreadsheet
811 virtual css::uno::Reference< css::sheet::XSheetCellCursor >
812 SAL_CALL createCursor() override;
813 virtual css::uno::Reference< css::sheet::XSheetCellCursor > SAL_CALL
814 createCursorByRange( const css::uno::Reference<
815 css::sheet::XSheetCellRange >& aRange ) override;
817 // XSheetCellRange
818 virtual css::uno::Reference< css::sheet::XSpreadsheet > SAL_CALL
819 getSpreadsheet() override;
821 // XCellRange
822 virtual css::uno::Reference< css::table::XCell > SAL_CALL
823 getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) override;
824 virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
825 getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop,
826 sal_Int32 nRight, sal_Int32 nBottom ) override;
827 using ScCellRangeObj::getCellRangeByName;
828 virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
829 getCellRangeByName( const OUString& aRange ) override;
831 // XNamed
832 virtual OUString SAL_CALL getName() override;
833 virtual void SAL_CALL setName( const OUString& aName ) override;
835 // XSheetPageBreak
836 virtual css::uno::Sequence< css::sheet::TablePageBreakData > SAL_CALL
837 getColumnPageBreaks() override;
838 virtual css::uno::Sequence< css::sheet::TablePageBreakData > SAL_CALL
839 getRowPageBreaks() override;
840 virtual void SAL_CALL removeAllManualPageBreaks() override;
842 // XCellRangeMovement
843 virtual void SAL_CALL insertCells( const css::table::CellRangeAddress& aRange,
844 css::sheet::CellInsertMode nMode ) override;
845 virtual void SAL_CALL removeRange( const css::table::CellRangeAddress& aRange,
846 css::sheet::CellDeleteMode nMode ) override;
847 virtual void SAL_CALL moveRange( const css::table::CellAddress& aDestination,
848 const css::table::CellRangeAddress& aSource ) override;
849 virtual void SAL_CALL copyRange( const css::table::CellAddress& aDestination,
850 const css::table::CellRangeAddress& aSource ) override;
852 // XTableChartsSupplier
853 virtual css::uno::Reference< css::table::XTableCharts > SAL_CALL
854 getCharts() override;
856 // XTablePivotChartsSupplier
857 virtual css::uno::Reference<css::table::XTablePivotCharts> SAL_CALL
858 getPivotCharts() override;
860 // XDataPilotTablesSupplier
861 virtual css::uno::Reference< css::sheet::XDataPilotTables > SAL_CALL
862 getDataPilotTables() override;
864 // XScenariosSupplier
865 virtual css::uno::Reference< css::sheet::XScenarios > SAL_CALL
866 getScenarios() override;
868 // XSheetAnnotationsSupplier
869 virtual css::uno::Reference< css::sheet::XSheetAnnotations > SAL_CALL
870 getAnnotations() override;
872 // XDrawPageSupplier
873 virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL
874 getDrawPage() override;
876 // XPrintAreas
877 virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
878 getPrintAreas() override;
879 virtual void SAL_CALL setPrintAreas( const css::uno::Sequence<
880 css::table::CellRangeAddress >& aPrintAreas ) override;
881 virtual sal_Bool SAL_CALL getPrintTitleColumns() override;
882 virtual void SAL_CALL setPrintTitleColumns( sal_Bool bPrintTitleColumns ) override;
883 virtual css::table::CellRangeAddress SAL_CALL getTitleColumns() override;
884 virtual void SAL_CALL setTitleColumns(
885 const css::table::CellRangeAddress& aTitleColumns ) override;
886 virtual sal_Bool SAL_CALL getPrintTitleRows() override;
887 virtual void SAL_CALL setPrintTitleRows( sal_Bool bPrintTitleRows ) override;
888 virtual css::table::CellRangeAddress SAL_CALL getTitleRows() override;
889 virtual void SAL_CALL setTitleRows(
890 const css::table::CellRangeAddress& aTitleRows ) override;
892 // XSheetLinkable
893 virtual css::sheet::SheetLinkMode SAL_CALL getLinkMode() override;
894 virtual void SAL_CALL setLinkMode( css::sheet::SheetLinkMode nLinkMode ) override;
895 virtual OUString SAL_CALL getLinkUrl() override;
896 virtual void SAL_CALL setLinkUrl( const OUString& aLinkUrl ) override;
897 virtual OUString SAL_CALL getLinkSheetName() override;
898 virtual void SAL_CALL setLinkSheetName( const OUString& aLinkSheetName ) override;
899 virtual void SAL_CALL link( const OUString& aUrl,
900 const OUString& aSheetName,
901 const OUString& aFilterName,
902 const OUString& aFilterOptions,
903 css::sheet::SheetLinkMode nMode ) override;
905 // XSheetAuditing
906 virtual sal_Bool SAL_CALL hideDependents( const css::table::CellAddress& aPosition ) override;
907 virtual sal_Bool SAL_CALL hidePrecedents( const css::table::CellAddress& aPosition ) override;
908 virtual sal_Bool SAL_CALL showDependents( const css::table::CellAddress& aPosition ) override;
909 virtual sal_Bool SAL_CALL showPrecedents( const css::table::CellAddress& aPosition ) override;
910 virtual sal_Bool SAL_CALL showErrors( const css::table::CellAddress& aPosition ) override;
911 virtual sal_Bool SAL_CALL showInvalid() override;
912 virtual void SAL_CALL clearArrows() override;
914 // XSheetOutline
915 virtual void SAL_CALL group( const css::table::CellRangeAddress& aRange,
916 css::table::TableOrientation nOrientation ) override;
917 virtual void SAL_CALL ungroup( const css::table::CellRangeAddress& aRange,
918 css::table::TableOrientation nOrientation ) override;
919 virtual void SAL_CALL autoOutline( const css::table::CellRangeAddress& aRange ) override;
920 virtual void SAL_CALL clearOutline() override;
921 virtual void SAL_CALL hideDetail( const css::table::CellRangeAddress& aRange ) override;
922 virtual void SAL_CALL showDetail( const css::table::CellRangeAddress& aRange ) override;
923 virtual void SAL_CALL showLevel( sal_Int16 nLevel,
924 css::table::TableOrientation nOrientation ) override;
926 // XProtectable
927 virtual void SAL_CALL protect( const OUString& aPassword ) override;
928 virtual void SAL_CALL unprotect( const OUString& aPassword ) override;
929 virtual sal_Bool SAL_CALL isProtected() override;
931 // XScenario
932 virtual sal_Bool SAL_CALL getIsScenario() override;
933 virtual OUString SAL_CALL getScenarioComment() override;
934 virtual void SAL_CALL setScenarioComment( const OUString& aScenarioComment ) override;
935 virtual void SAL_CALL addRanges( const css::uno::Sequence<
936 css::table::CellRangeAddress >& aRanges ) override;
937 virtual void SAL_CALL apply() override;
938 // XScenarioEnhanced
939 virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
940 getRanges( ) override;
942 // XExternalSheetName
943 virtual void SAL_CALL setExternalName( const OUString& aUrl, const OUString& aSheetName ) override;
945 // XEventsSupplier
946 virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override;
948 // XPropertySet override due to sheet properties
949 virtual css::uno::Reference< css::beans::XPropertySetInfo >
950 SAL_CALL getPropertySetInfo() override;
952 // XServiceInfo
953 virtual OUString SAL_CALL getImplementationName() override;
954 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
955 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
957 // XTypeProvider
958 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
959 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
962 class ScTableColumnObj final : public ScCellRangeObj,
963 public css::container::XNamed
965 private:
966 const SfxItemPropertySet* pColPropSet;
968 virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
969 virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
970 css::uno::Any& ) override;
971 virtual void SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
972 const css::uno::Any& aValue ) override;
974 public:
975 ScTableColumnObj(ScDocShell* pDocSh, SCCOL nCol, SCTAB nTab);
976 virtual ~ScTableColumnObj() override;
978 virtual css::uno::Any SAL_CALL queryInterface(
979 const css::uno::Type & rType ) override;
980 virtual void SAL_CALL acquire() noexcept override;
981 virtual void SAL_CALL release() noexcept override;
983 // XNamed
984 virtual OUString SAL_CALL getName() override;
985 virtual void SAL_CALL setName( const OUString& aName ) override;
987 // XPropertySet override due to column properties
988 virtual css::uno::Reference< css::beans::XPropertySetInfo >
989 SAL_CALL getPropertySetInfo() override;
991 // XServiceInfo
992 virtual OUString SAL_CALL getImplementationName() override;
993 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
994 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
996 // XTypeProvider
997 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
998 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
1001 class ScTableRowObj final : public ScCellRangeObj
1003 private:
1004 const SfxItemPropertySet* pRowPropSet;
1006 virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
1007 virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
1008 css::uno::Any& ) override;
1009 virtual void SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
1010 const css::uno::Any& aValue ) override;
1012 public:
1013 ScTableRowObj(ScDocShell* pDocSh, SCROW nRow, SCTAB nTab);
1014 virtual ~ScTableRowObj() override;
1016 // XPropertySet override due to row properties
1017 virtual css::uno::Reference< css::beans::XPropertySetInfo >
1018 SAL_CALL getPropertySetInfo() override;
1020 // XServiceInfo
1021 virtual OUString SAL_CALL getImplementationName() override;
1022 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1023 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1026 class ScCellsObj final : public cppu::WeakImplHelper<
1027 css::container::XEnumerationAccess,
1028 css::lang::XServiceInfo >,
1029 public SfxListener
1031 private:
1032 ScDocShell* pDocShell;
1033 ScRangeList aRanges;
1035 public:
1036 ScCellsObj(ScDocShell* pDocSh, ScRangeList aR);
1037 virtual ~ScCellsObj() override;
1039 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1041 // XEnumerationAccess
1042 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
1043 createEnumeration() override;
1045 // XElementAccess
1046 virtual css::uno::Type SAL_CALL getElementType() override;
1047 virtual sal_Bool SAL_CALL hasElements() override;
1049 // XServiceInfo
1050 virtual OUString SAL_CALL getImplementationName() override;
1051 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1052 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1055 class ScCellsEnumeration final : public cppu::WeakImplHelper<
1056 css::container::XEnumeration,
1057 css::lang::XServiceInfo >,
1058 public SfxListener
1060 private:
1061 ScDocShell* pDocShell;
1062 ScRangeList aRanges;
1063 ScAddress aPos;
1064 std::unique_ptr<ScMarkData> pMark;
1065 bool bAtEnd;
1067 private:
1068 void Advance_Impl();
1069 void CheckPos_Impl();
1071 public:
1072 ScCellsEnumeration(ScDocShell* pDocSh, ScRangeList aR);
1073 virtual ~ScCellsEnumeration() override;
1075 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1077 // XEnumeration
1078 virtual sal_Bool SAL_CALL hasMoreElements() override;
1079 virtual css::uno::Any SAL_CALL nextElement() override;
1081 // XServiceInfo
1082 virtual OUString SAL_CALL getImplementationName() override;
1083 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1084 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1087 class ScCellFormatsObj final : public cppu::WeakImplHelper<
1088 css::container::XIndexAccess,
1089 css::container::XEnumerationAccess,
1090 css::lang::XServiceInfo >,
1091 public SfxListener
1093 private:
1094 ScDocShell* pDocShell;
1095 ScRange aTotalRange;
1097 private:
1098 rtl::Reference<ScCellRangeObj> GetObjectByIndex_Impl(tools::Long nIndex) const;
1100 public:
1101 ScCellFormatsObj(ScDocShell* pDocSh, const ScRange& rR);
1102 virtual ~ScCellFormatsObj() override;
1104 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1106 // XIndexAccess
1107 virtual sal_Int32 SAL_CALL getCount() override;
1108 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
1110 // XEnumerationAccess
1111 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
1112 createEnumeration() override;
1114 // XElementAccess
1115 virtual css::uno::Type SAL_CALL getElementType() override;
1116 virtual sal_Bool SAL_CALL hasElements() override;
1118 // XServiceInfo
1119 virtual OUString SAL_CALL getImplementationName() override;
1120 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1121 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1124 class ScCellFormatsEnumeration final : public cppu::WeakImplHelper<
1125 css::container::XEnumeration,
1126 css::lang::XServiceInfo >,
1127 public SfxListener
1129 private:
1130 ScDocShell* pDocShell;
1131 SCTAB nTab;
1132 std::unique_ptr<ScAttrRectIterator> pIter;
1133 ScRange aNext;
1134 bool bAtEnd;
1135 bool bDirty;
1137 private:
1138 void Advance_Impl();
1139 rtl::Reference<ScCellRangeObj> NextObject_Impl();
1141 public:
1142 ScCellFormatsEnumeration(ScDocShell* pDocSh, const ScRange& rR);
1143 virtual ~ScCellFormatsEnumeration() override;
1145 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1147 // XEnumeration
1148 virtual sal_Bool SAL_CALL hasMoreElements() override;
1149 virtual css::uno::Any SAL_CALL nextElement() override;
1151 // XServiceInfo
1152 virtual OUString SAL_CALL getImplementationName() override;
1153 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1154 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1157 class ScUniqueCellFormatsObj final : public cppu::WeakImplHelper<
1158 css::container::XIndexAccess,
1159 css::container::XEnumerationAccess,
1160 css::lang::XServiceInfo >,
1161 public SfxListener
1163 private:
1164 ScDocShell* pDocShell;
1165 std::vector<ScRangeList> aRangeLists;
1167 public:
1168 ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange& rR);
1169 virtual ~ScUniqueCellFormatsObj() override;
1171 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1173 // XIndexAccess
1174 virtual sal_Int32 SAL_CALL getCount() override;
1175 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
1177 // XEnumerationAccess
1178 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
1179 createEnumeration() override;
1181 // XElementAccess
1182 virtual css::uno::Type SAL_CALL getElementType() override;
1183 virtual sal_Bool SAL_CALL hasElements() override;
1185 // XServiceInfo
1186 virtual OUString SAL_CALL getImplementationName() override;
1187 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1188 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1191 class ScUniqueCellFormatsEnumeration final : public cppu::WeakImplHelper<
1192 css::container::XEnumeration,
1193 css::lang::XServiceInfo >,
1194 public SfxListener
1196 private:
1197 std::vector<ScRangeList> aRangeLists;
1198 ScDocShell* pDocShell;
1199 sal_Int32 nCurrentPosition;
1201 public:
1202 ScUniqueCellFormatsEnumeration(ScDocShell* pDocShell, std::vector<ScRangeList>&& rRangeLists);
1203 virtual ~ScUniqueCellFormatsEnumeration() override;
1205 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1207 // XEnumeration
1208 virtual sal_Bool SAL_CALL hasMoreElements() override;
1209 virtual css::uno::Any SAL_CALL nextElement() override;
1211 // XServiceInfo
1212 virtual OUString SAL_CALL getImplementationName() override;
1213 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1214 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1217 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */