nss: upgrade to release 3.73
[LibreOffice.git] / sc / inc / cellsuno.hxx
blobee6b59eec1ab7f4ebe4acc0488d274ba10b6afc5
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 "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/lstner.hxx>
31 #include <svl/listener.hxx>
32 #include <com/sun/star/table/XTableChartsSupplier.hpp>
33 #include <com/sun/star/table/XTablePivotChartsSupplier.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/sheet/XDataPilotTablesSupplier.hpp>
72 #include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
73 #include <com/sun/star/sheet/XScenariosSupplier.hpp>
74 #include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
75 #include <com/sun/star/sheet/XSheetAuditing.hpp>
76 #include <com/sun/star/sheet/XSheetOutline.hpp>
77 #include <com/sun/star/util/XProtectable.hpp>
78 #include <com/sun/star/sheet/XScenario.hpp>
79 #include <com/sun/star/sheet/XScenarioEnhanced.hpp>
80 #include <com/sun/star/util/XModifyBroadcaster.hpp>
81 #include <com/sun/star/beans/XPropertyState.hpp>
82 #include <com/sun/star/beans/XMultiPropertySet.hpp>
83 #include <com/sun/star/lang/XUnoTunnel.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>
90 #include <cppuhelper/weakref.hxx>
92 #include <memory>
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 class SfxItemSet;
117 struct SfxItemPropertySimpleEntry;
119 namespace editeng { class SvxBorderLine; }
121 class ScLinkListener final : public SvtListener
123 Link<const SfxHint&,void> aLink;
124 public:
125 ScLinkListener(const Link<const SfxHint&,void>& rL) : aLink(rL) {}
126 virtual ~ScLinkListener() override;
127 virtual void Notify( const SfxHint& rHint ) override;
130 typedef std::vector< css::uno::Reference< css::util::XModifyListener > > XModifyListenerArr_Impl;
132 // ScCellRangesBase - base class for ScCellRangesObj (with access by index)
133 // and ScCellRangeObj (without access by index)
135 // XServiceInfo is implemented in derived classes
137 class ScHelperFunctions
139 public:
140 static const ::editeng::SvxBorderLine* GetBorderLine( ::editeng::SvxBorderLine& rLine, const css::table::BorderLine& rStruct );
141 static const ::editeng::SvxBorderLine* GetBorderLine( ::editeng::SvxBorderLine& rLine, const css::table::BorderLine2& rStruct );
142 static void FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const css::table::TableBorder& rBorder );
143 static void FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const css::table::TableBorder2& rBorder );
144 static void FillBorderLine( css::table::BorderLine& rStruct, const ::editeng::SvxBorderLine* pLine );
145 static void FillBorderLine( css::table::BorderLine2& rStruct, const ::editeng::SvxBorderLine* pLine );
146 static void AssignTableBorderToAny( css::uno::Any& rAny,
147 const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner, bool bInvalidateHorVerDist = false );
148 static void AssignTableBorder2ToAny( css::uno::Any& rAny,
149 const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner, bool bInvalidateHorVerDist = false );
150 static void ApplyBorder( ScDocShell* pDocShell, const ScRangeList& rRanges,
151 const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner );
154 namespace ooo::vba::excel {
155 class ScVbaCellRangeAccess; // Vba Helper class
158 class SC_DLLPUBLIC ScCellRangesBase :
159 public cppu::WeakImplHelper<
160 css::beans::XPropertySet,
161 css::beans::XMultiPropertySet,
162 css::beans::XPropertyState,
163 css::sheet::XSheetOperation,
164 css::chart::XChartDataArray,
165 css::util::XIndent,
166 css::sheet::XCellRangesQuery,
167 css::sheet::XFormulaQuery,
168 css::util::XReplaceable,
169 css::util::XModifyBroadcaster,
170 css::lang::XServiceInfo,
171 css::lang::XUnoTunnel,
172 css::beans::XTolerantMultiPropertySet>,
173 public SfxListener
175 friend class ScTabViewObj; // for select()
176 friend class ScTableSheetObj; // for createCursorByRange()
177 friend class ooo::vba::excel::ScVbaCellRangeAccess;
179 private:
180 css::uno::WeakReference<css::uno::XInterface> m_wThis;
181 const SfxItemPropertySet* pPropSet;
182 ScDocShell* pDocShell;
183 std::unique_ptr<ScLinkListener> pValueListener;
184 std::unique_ptr<ScPatternAttr> pCurrentFlat;
185 std::unique_ptr<ScPatternAttr> pCurrentDeep;
186 std::unique_ptr<SfxItemSet> pCurrentDataSet;
187 std::unique_ptr<SfxItemSet> pNoDfltCurrentDataSet;
188 std::unique_ptr<ScMarkData> pMarkData;
189 ScRangeList aRanges;
190 sal_Int64 nObjectId;
191 bool bChartColAsHdr;
192 bool bChartRowAsHdr;
193 bool bCursorOnly;
194 bool bGotDataChangedHint;
195 XModifyListenerArr_Impl aValueListeners;
197 DECL_LINK( ValueListenerHdl, const SfxHint&, void );
199 private:
200 void PaintGridRanges_Impl();
201 ScRangeListRef GetLimitedChartRanges_Impl( sal_Int32 nDataColumns, sal_Int32 nDataRows ) const;
202 void ForceChartListener_Impl();
203 std::unique_ptr<ScMemChart> CreateMemChart_Impl() const;
205 const ScPatternAttr* GetCurrentAttrsFlat();
206 const ScPatternAttr* GetCurrentAttrsDeep();
207 SfxItemSet* GetCurrentDataSet(bool bNoDflt = false);
208 void ForgetMarkData();
209 void ForgetCurrentAttrs();
211 css::uno::Reference<css::sheet::XSheetCellRanges>
212 QueryDifferences_Impl(const css::table::CellAddress& aCompare,
213 bool bColumnDiff);
214 css::uno::Reference<css::uno::XInterface>
215 Find_Impl(const css::uno::Reference<css::util::XSearchDescriptor>& xDesc,
216 const ScAddress* pLastPos);
218 protected:
219 const ScMarkData* GetMarkData();
221 // GetItemPropertyMap for derived classes must contain all entries, including base class
222 virtual const SfxItemPropertyMap& GetItemPropertyMap();
223 css::beans::PropertyState GetOnePropertyState(
224 sal_uInt16 nItemWhich, const SfxItemPropertySimpleEntry* pEntry );
225 /// @throws css::uno::RuntimeException
226 virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
227 css::uno::Any& );
228 /// @throws css::lang::IllegalArgumentException
229 /// @throws css::uno::RuntimeException
230 virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
231 const css::uno::Any& aValue );
233 public:
234 ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR);
235 ScCellRangesBase(ScDocShell* pDocSh, const ScRangeList& rR);
236 virtual ~ScCellRangesBase() override;
238 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
239 virtual void RefChanged();
241 // from derived classes and by getImplementation
242 ScDocShell* GetDocShell() const { return pDocShell; }
243 ScDocument* GetDocument() const;
244 const ScRangeList& GetRangeList() const { return aRanges; }
245 void AddRange(const ScRange& rRange, const bool bMergeRanges);
247 // arouse object created via service:
248 void InitInsertRange(ScDocShell* pDocSh, const ScRange& rR);
250 void SetNewRange(const ScRange& rNew); // for cursor
251 void SetNewRanges(const ScRangeList& rNew);
253 void SetCursorOnly(bool bSet);
254 bool IsCursorOnly() const { return bCursorOnly; }
256 // XSheetOperation
257 virtual double SAL_CALL computeFunction( css::sheet::GeneralFunction nFunction ) override;
258 virtual void SAL_CALL clearContents( sal_Int32 nContentFlags ) override;
260 // XPropertySet
261 virtual css::uno::Reference< css::beans::XPropertySetInfo >
262 SAL_CALL getPropertySetInfo() override;
263 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
264 const css::uno::Any& aValue ) override;
265 virtual css::uno::Any SAL_CALL getPropertyValue(
266 const OUString& PropertyName ) override;
267 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
268 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
269 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
270 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
271 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
272 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
273 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
274 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
276 // XMultiPropertySet
277 virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames,
278 const css::uno::Sequence< css::uno::Any >& aValues ) override;
279 virtual css::uno::Sequence< css::uno::Any > SAL_CALL
280 getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
281 virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames,
282 const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
283 virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
284 virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames,
285 const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
287 // XTolerantMultiPropertySet
288 virtual css::uno::Sequence< css::beans::SetPropertyTolerantFailed > SAL_CALL
289 setPropertyValuesTolerant( const css::uno::Sequence< OUString >& aPropertyNames,
290 const css::uno::Sequence< css::uno::Any >& aValues ) override;
291 virtual css::uno::Sequence< css::beans::GetPropertyTolerantResult > SAL_CALL
292 getPropertyValuesTolerant( const css::uno::Sequence< OUString >& aPropertyNames ) override;
293 virtual css::uno::Sequence< css::beans::GetDirectPropertyTolerantResult > SAL_CALL
294 getDirectPropertyValuesTolerant( const css::uno::Sequence< OUString >& aPropertyNames ) override;
296 // XPropertyState
297 virtual css::beans::PropertyState SAL_CALL getPropertyState(
298 const OUString& PropertyName ) override;
299 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL
300 getPropertyStates( const css::uno::Sequence<
301 OUString >& aPropertyName ) override;
302 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
303 virtual css::uno::Any SAL_CALL getPropertyDefault(
304 const OUString& aPropertyName ) override;
306 // XIndent
307 virtual void SAL_CALL decrementIndent() override;
308 virtual void SAL_CALL incrementIndent() override;
310 // XChartData
311 virtual void SAL_CALL addChartDataChangeEventListener(
312 const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override;
313 virtual void SAL_CALL removeChartDataChangeEventListener( const css::uno::Reference<
314 css::chart::XChartDataChangeEventListener >& aListener ) override;
315 virtual double SAL_CALL getNotANumber() override;
316 virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) override;
318 // XChartDataArray
319 virtual css::uno::Sequence< css::uno::Sequence< double > > SAL_CALL
320 getData() override;
321 virtual void SAL_CALL setData( const css::uno::Sequence< css::uno::Sequence< double > >& aData ) override;
322 virtual css::uno::Sequence< OUString > SAL_CALL getRowDescriptions() override;
323 virtual void SAL_CALL setRowDescriptions( const css::uno::Sequence< OUString >& aRowDescriptions ) override;
324 virtual css::uno::Sequence< OUString > SAL_CALL getColumnDescriptions() override;
325 virtual void SAL_CALL setColumnDescriptions( const css::uno::Sequence< OUString >& aColumnDescriptions ) override;
327 // XCellRangesQuery
328 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
329 queryVisibleCells() override;
330 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
331 queryEmptyCells() override;
332 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
333 queryContentCells( sal_Int16 nContentFlags ) override;
334 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
335 queryFormulaCells( sal_Int32 nResultFlags ) override;
336 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
337 queryColumnDifferences(
338 const css::table::CellAddress& aCompare ) override;
339 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
340 queryRowDifferences(
341 const css::table::CellAddress& aCompare ) override;
342 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
343 queryIntersection(
344 const css::table::CellRangeAddress& aRange ) override;
346 // XFormulaQuery
347 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
348 queryDependents( sal_Bool bRecursive ) override;
349 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
350 queryPrecedents( sal_Bool bRecursive ) override;
352 // XSearchable
353 virtual css::uno::Reference< css::util::XSearchDescriptor > SAL_CALL
354 createSearchDescriptor() override;
355 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
356 findAll( const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override;
357 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
358 findFirst( const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override;
359 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
360 findNext( const css::uno::Reference< css::uno::XInterface >& xStartAt,
361 const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override;
363 // XReplaceable
364 virtual css::uno::Reference< css::util::XReplaceDescriptor > SAL_CALL
365 createReplaceDescriptor() override;
366 virtual sal_Int32 SAL_CALL replaceAll( const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override;
368 // XModifyBroadcaster
369 virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
370 virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
372 // XServiceInfo
373 virtual OUString SAL_CALL getImplementationName() override;
374 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
375 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
377 // XUnoTunnel
378 UNO3_GETIMPLEMENTATION_DECL(ScCellRangesBase)
381 class SC_DLLPUBLIC ScCellRangesObj final : public ScCellRangesBase,
382 public css::sheet::XSheetCellRangeContainer,
383 public css::container::XNameContainer,
384 public css::container::XEnumerationAccess
386 private:
387 struct Impl;
388 std::unique_ptr<Impl> m_pImpl;
390 ScCellRangeObj* GetObjectByIndex_Impl(sal_Int32 nIndex) const;
392 public:
393 ScCellRangesObj(ScDocShell* pDocSh, const ScRangeList& rR);
394 virtual ~ScCellRangesObj() override;
396 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
397 virtual void SAL_CALL acquire() throw() override;
398 virtual void SAL_CALL release() throw() override;
400 virtual void RefChanged() override;
402 // XSheetCellRanges
403 virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL
404 getCells() override;
405 virtual OUString SAL_CALL getRangeAddressesAsString() override;
406 virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
407 getRangeAddresses() override;
409 // XSheetCellRangeContainer
410 virtual void SAL_CALL addRangeAddress( const css::table::CellRangeAddress& rRange,
411 sal_Bool bMergeRanges ) override;
412 virtual void SAL_CALL removeRangeAddress( const css::table::CellRangeAddress& rRange ) override;
413 virtual void SAL_CALL addRangeAddresses( const css::uno::Sequence<
414 css::table::CellRangeAddress >& rRanges,
415 sal_Bool bMergeRanges ) override;
416 virtual void SAL_CALL removeRangeAddresses( const css::uno::Sequence<
417 css::table::CellRangeAddress >& rRanges ) override;
419 // XNameContainer
420 virtual void SAL_CALL insertByName( const OUString& aName,
421 const css::uno::Any& aElement ) override;
422 virtual void SAL_CALL removeByName( const OUString& Name ) override;
424 // XNameReplace
425 virtual void SAL_CALL replaceByName( const OUString& aName,
426 const css::uno::Any& aElement ) override;
428 // XNameAccess
429 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
430 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
431 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
433 // XIndexAccess
434 virtual sal_Int32 SAL_CALL getCount() override;
435 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
437 // XElementAccess
438 virtual css::uno::Type SAL_CALL getElementType() override;
439 virtual sal_Bool SAL_CALL hasElements() override;
441 // XEnumerationAccess
442 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
443 createEnumeration() override;
445 // XServiceInfo
446 virtual OUString SAL_CALL getImplementationName() override;
447 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
448 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
450 // XTypeProvider
451 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
452 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
455 class SC_DLLPUBLIC ScCellRangeObj : public ScCellRangesBase,
456 public css::sheet::XCellRangeAddressable,
457 public css::sheet::XSheetCellRange,
458 public css::sheet::XArrayFormulaRange,
459 public css::sheet::XArrayFormulaTokens,
460 public css::sheet::XCellRangeData,
461 public css::sheet::XCellRangeFormula,
462 public css::sheet::XMultipleOperation,
463 public css::util::XMergeable,
464 public css::sheet::XCellSeries,
465 public css::table::XAutoFormattable,
466 public css::util::XSortable,
467 public css::sheet::XSheetFilterableEx,
468 public css::sheet::XSubTotalCalculatable,
469 public css::util::XImportable,
470 public css::sheet::XCellFormatRangesSupplier,
471 public css::sheet::XUniqueCellFormatRangesSupplier,
472 public css::table::XColumnRowRange
474 private:
475 const SfxItemPropertySet* pRangePropSet;
476 ScRange aRange;
478 protected:
479 const ScRange& GetRange() const { return aRange; }
480 virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
481 virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
482 css::uno::Any& ) override;
483 virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
484 const css::uno::Any& aValue ) override;
486 /// @throws css::lang::IndexOutOfBoundsException
487 /// @throws css::uno::RuntimeException
488 css::uno::Reference< css::table::XCell >
489 GetCellByPosition_Impl( sal_Int32 nColumn, sal_Int32 nRow );
491 /// @throws css::uno::RuntimeException
492 void SetArrayFormula_Impl( const OUString& rFormula,
493 const formula::FormulaGrammar::Grammar eGrammar );
495 public:
496 ScCellRangeObj(ScDocShell* pDocSh, const ScRange& rR);
497 virtual ~ScCellRangeObj() override;
499 // uses ObjectShell from document, if set (returns NULL otherwise)
500 static css::uno::Reference<css::table::XCellRange>
501 CreateRangeFromDoc( const ScDocument& rDoc, const ScRange& rR );
503 virtual css::uno::Any SAL_CALL queryInterface(
504 const css::uno::Type & rType ) override;
505 virtual void SAL_CALL acquire() throw() override;
506 virtual void SAL_CALL release() throw() override;
508 virtual void RefChanged() override;
510 // XCellRangeAddressable
511 virtual css::table::CellRangeAddress SAL_CALL getRangeAddress() override;
513 // XSheetCellRange
514 virtual css::uno::Reference< css::sheet::XSpreadsheet > SAL_CALL
515 getSpreadsheet() override;
517 // XArrayFormulaRange
518 virtual OUString SAL_CALL getArrayFormula() override;
519 virtual void SAL_CALL setArrayFormula( const OUString& aFormula ) override;
521 // XArrayFormulaTokens
522 virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL getArrayTokens() override;
523 virtual void SAL_CALL setArrayTokens( const css::uno::Sequence<
524 css::sheet::FormulaToken >& aTokens ) override;
526 // XCellRangeData
527 virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getDataArray() override;
528 virtual void SAL_CALL setDataArray( const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aArray ) override;
530 // XCellRangeFormula
531 virtual css::uno::Sequence< css::uno::Sequence<
532 OUString > > SAL_CALL getFormulaArray() override;
533 virtual void SAL_CALL setFormulaArray( const css::uno::Sequence< css::uno::Sequence< OUString > >& aArray ) override;
535 // XMultipleOperation
536 virtual void SAL_CALL setTableOperation(
537 const css::table::CellRangeAddress& aFormulaRange,
538 css::sheet::TableOperationMode nMode,
539 const css::table::CellAddress& aColumnCell,
540 const css::table::CellAddress& aRowCell ) override;
542 // XMergeable
543 virtual void SAL_CALL merge( sal_Bool bMerge ) override;
544 virtual sal_Bool SAL_CALL getIsMerged() override;
546 // XCellSeries
547 virtual void SAL_CALL fillSeries( css::sheet::FillDirection nFillDirection,
548 css::sheet::FillMode nFillMode,
549 css::sheet::FillDateMode nFillDateMode,
550 double fStep, double fEndValue ) override;
551 virtual void SAL_CALL fillAuto( css::sheet::FillDirection nFillDirection,
552 sal_Int32 nSourceCount ) override;
554 // XAutoFormattable
555 virtual void SAL_CALL autoFormat( const OUString& aName ) override;
557 // XSortable
558 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL
559 createSortDescriptor() override;
560 virtual void SAL_CALL sort( const css::uno::Sequence<
561 css::beans::PropertyValue >& xDescriptor ) override;
563 // XSheetFilterableEx
564 virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL
565 createFilterDescriptorByObject( const css::uno::Reference<
566 css::sheet::XSheetFilterable >& xObject ) override;
568 // XSheetFilterable
569 virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL
570 createFilterDescriptor( sal_Bool bEmpty ) override;
571 virtual void SAL_CALL filter( const css::uno::Reference<
572 css::sheet::XSheetFilterDescriptor >& xDescriptor ) override;
574 // XSubTotalCalculatable
575 virtual css::uno::Reference< css::sheet::XSubTotalDescriptor > SAL_CALL
576 createSubTotalDescriptor( sal_Bool bEmpty ) override;
577 virtual void SAL_CALL applySubTotals(const css::uno::Reference< css::sheet::XSubTotalDescriptor >& xDescriptor,
578 sal_Bool bReplace) override;
579 virtual void SAL_CALL removeSubTotals() override;
581 // XImportable
582 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL
583 createImportDescriptor( sal_Bool bEmpty ) override;
584 virtual void SAL_CALL doImport( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor ) override;
586 // XCellFormatRangesSupplier
587 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
588 getCellFormatRanges() override;
590 // XUniqueCellFormatRangesSupplier
591 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
592 getUniqueCellFormatRanges() override;
594 // XColumnRowRange
595 virtual css::uno::Reference< css::table::XTableColumns > SAL_CALL
596 getColumns() override;
597 virtual css::uno::Reference< css::table::XTableRows > SAL_CALL
598 getRows() override;
600 // XCellRange
601 virtual css::uno::Reference< css::table::XCell > SAL_CALL
602 getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) override;
603 virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
604 getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop,
605 sal_Int32 nRight, sal_Int32 nBottom ) override;
606 virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
607 getCellRangeByName( const OUString& aRange ) override;
608 /// @throws css::uno::RuntimeException
609 css::uno::Reference< css::table::XCellRange >
610 getCellRangeByName( const OUString& aRange, const ScAddress::Details& rDetails );
612 // XPropertySet override due to Range-Properties
613 virtual css::uno::Reference< css::beans::XPropertySetInfo >
614 SAL_CALL getPropertySetInfo() override;
616 // XServiceInfo
617 virtual OUString SAL_CALL getImplementationName() override;
618 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
619 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
621 // XTypeProvider
622 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
623 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
626 //! really derive cell from range?
628 class SC_DLLPUBLIC ScCellObj final : public ScCellRangeObj,
629 public css::text::XText,
630 public css::container::XEnumerationAccess,
631 public css::table::XCell2,
632 public css::sheet::XFormulaTokens,
633 public css::sheet::XCellAddressable,
634 public css::sheet::XSheetAnnotationAnchor,
635 public css::text::XTextFieldsSupplier,
636 public css::document::XActionLockable
638 private:
639 rtl::Reference<SvxUnoText> mxUnoText;
640 const SfxItemPropertySet* pCellPropSet;
641 ScAddress aCellPos;
642 sal_Int16 nActionLockCount;
644 private:
645 OUString GetInputString_Impl(bool bEnglish) const;
646 OUString GetOutputString_Impl() const;
647 void SetString_Impl(const OUString& rString, bool bInterpret, bool bEnglish);
648 double GetValue_Impl() const;
649 void SetValue_Impl(double fValue);
650 css::table::CellContentType GetContentType_Impl();
651 sal_Int32 GetResultType_Impl() const;
653 virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
654 virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
655 css::uno::Any& ) override;
656 virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
657 const css::uno::Any& aValue ) override;
659 public:
660 static const SvxItemPropertySet* GetEditPropertySet();
661 static const SfxItemPropertyMap& GetCellPropertyMap();
663 ScCellObj(ScDocShell* pDocSh, const ScAddress& rP);
664 virtual ~ScCellObj() override;
666 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
667 virtual void SAL_CALL acquire() throw() override;
668 virtual void SAL_CALL release() throw() override;
670 virtual void RefChanged() override;
672 SvxUnoText& GetUnoText();
674 // XML import needs to set results at formula cells,
675 // not meant for any other purpose.
676 const ScAddress& GetPosition() const { return aCellPos; }
678 void InputEnglishString( const OUString& rText );
680 // XText
681 virtual void SAL_CALL insertTextContent( const css::uno::Reference< css::text::XTextRange >& xRange,
682 const css::uno::Reference< css::text::XTextContent >& xContent,
683 sal_Bool bAbsorb ) override;
684 virtual void SAL_CALL removeTextContent( const css::uno::Reference< css::text::XTextContent >& xContent ) override;
686 // XSimpleText
687 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
688 createTextCursor() override;
689 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
690 createTextCursorByRange( const css::uno::Reference< css::text::XTextRange >& aTextPosition ) override;
691 virtual void SAL_CALL insertString( const css::uno::Reference< css::text::XTextRange >& xRange,
692 const OUString& aString, sal_Bool bAbsorb ) override;
693 virtual void SAL_CALL insertControlCharacter( const css::uno::Reference< css::text::XTextRange >& xRange,
694 sal_Int16 nControlCharacter, sal_Bool bAbsorb ) override;
696 // XTextRange
697 virtual css::uno::Reference< css::text::XText > SAL_CALL
698 getText() override;
699 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
700 getStart() override;
701 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
702 getEnd() override;
703 virtual OUString SAL_CALL getString() override;
704 virtual void SAL_CALL setString( const OUString& aString ) override;
706 // XEnumerationAccess
707 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
708 createEnumeration() override;
710 // XElementAccess
711 virtual css::uno::Type SAL_CALL getElementType() override;
712 virtual sal_Bool SAL_CALL hasElements() override;
714 // XCell
715 virtual OUString SAL_CALL getFormula() override;
716 virtual void SAL_CALL setFormula( const OUString& aFormula ) override;
717 virtual void SAL_CALL setFormulaResult( double nValue ) override;
718 virtual void SAL_CALL setFormulaString( const OUString& aFormula ) override;
719 virtual double SAL_CALL getValue() override;
720 virtual void SAL_CALL setValue( double nValue ) override;
721 virtual css::table::CellContentType SAL_CALL getType() override;
722 virtual sal_Int32 SAL_CALL getError() override;
724 // XFormulaTokens
725 virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL getTokens() override;
726 virtual void SAL_CALL setTokens( const css::uno::Sequence< css::sheet::FormulaToken >& aTokens ) override;
728 // XCellAddressable
729 virtual css::table::CellAddress SAL_CALL getCellAddress() override;
731 // XSheetAnnotationAnchor
732 virtual css::uno::Reference< css::sheet::XSheetAnnotation > SAL_CALL
733 getAnnotation() override;
735 // XTextFieldsSupplier
736 virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL
737 getTextFields() override;
738 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL
739 getTextFieldMasters() override;
741 // XPropertySet override due to cell properties
742 virtual css::uno::Reference< css::beans::XPropertySetInfo >
743 SAL_CALL getPropertySetInfo() override;
745 // XServiceInfo
746 virtual OUString SAL_CALL getImplementationName() override;
747 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
748 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
750 // XTypeProvider
751 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
752 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
754 // XActionLockable
755 virtual sal_Bool SAL_CALL isActionLocked() override;
756 virtual void SAL_CALL addActionLock() override;
757 virtual void SAL_CALL removeActionLock() override;
758 virtual void SAL_CALL setActionLocks( sal_Int16 nLock ) override;
759 virtual sal_Int16 SAL_CALL resetActionLocks() override;
762 class SAL_DLLPUBLIC_RTTI ScTableSheetObj : public ScCellRangeObj,
763 public css::sheet::XSpreadsheet,
764 public css::container::XNamed,
765 public css::sheet::XSheetPageBreak,
766 public css::sheet::XCellRangeMovement,
767 public css::table::XTableChartsSupplier,
768 public css::table::XTablePivotChartsSupplier,
769 public css::sheet::XDataPilotTablesSupplier,
770 public css::sheet::XScenariosSupplier,
771 public css::sheet::XSheetAnnotationsSupplier,
772 public css::drawing::XDrawPageSupplier,
773 public css::sheet::XPrintAreas,
774 public css::sheet::XSheetLinkable,
775 public css::sheet::XSheetAuditing,
776 public css::sheet::XSheetOutline,
777 public css::util::XProtectable,
778 public css::sheet::XScenario,
779 public css::sheet::XScenarioEnhanced,
780 public css::sheet::XExternalSheetName,
781 public css::document::XEventsSupplier
783 friend class ScTableSheetsObj; // for insertByName()
785 private:
786 const SfxItemPropertySet* pSheetPropSet;
788 SCTAB GetTab_Impl() const;
789 void PrintAreaUndo_Impl( std::unique_ptr<ScPrintRangeSaver> pOldRanges );
791 protected:
792 virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
793 virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
794 css::uno::Any& ) override;
795 virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
796 const css::uno::Any& aValue ) override;
798 public:
799 ScTableSheetObj(ScDocShell* pDocSh, SCTAB nTab);
800 virtual ~ScTableSheetObj() override;
802 void InitInsertSheet(ScDocShell* pDocSh, SCTAB nTab);
804 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
805 virtual void SAL_CALL acquire() throw() override;
806 virtual void SAL_CALL release() throw() override;
808 // XSpreadsheet
809 virtual css::uno::Reference< css::sheet::XSheetCellCursor >
810 SAL_CALL createCursor() override;
811 virtual css::uno::Reference< css::sheet::XSheetCellCursor > SAL_CALL
812 createCursorByRange( const css::uno::Reference<
813 css::sheet::XSheetCellRange >& aRange ) override;
815 // XSheetCellRange
816 virtual css::uno::Reference< css::sheet::XSpreadsheet > SAL_CALL
817 getSpreadsheet() override;
819 // XCellRange
820 virtual css::uno::Reference< css::table::XCell > SAL_CALL
821 getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) override;
822 virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
823 getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop,
824 sal_Int32 nRight, sal_Int32 nBottom ) override;
825 using ScCellRangeObj::getCellRangeByName;
826 virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
827 getCellRangeByName( const OUString& aRange ) override;
829 // XNamed
830 virtual OUString SAL_CALL getName() override;
831 virtual void SAL_CALL setName( const OUString& aName ) override;
833 // XSheetPageBreak
834 virtual css::uno::Sequence< css::sheet::TablePageBreakData > SAL_CALL
835 getColumnPageBreaks() override;
836 virtual css::uno::Sequence< css::sheet::TablePageBreakData > SAL_CALL
837 getRowPageBreaks() override;
838 virtual void SAL_CALL removeAllManualPageBreaks() override;
840 // XCellRangeMovement
841 virtual void SAL_CALL insertCells( const css::table::CellRangeAddress& aRange,
842 css::sheet::CellInsertMode nMode ) override;
843 virtual void SAL_CALL removeRange( const css::table::CellRangeAddress& aRange,
844 css::sheet::CellDeleteMode nMode ) override;
845 virtual void SAL_CALL moveRange( const css::table::CellAddress& aDestination,
846 const css::table::CellRangeAddress& aSource ) override;
847 virtual void SAL_CALL copyRange( const css::table::CellAddress& aDestination,
848 const css::table::CellRangeAddress& aSource ) override;
850 // XTableChartsSupplier
851 virtual css::uno::Reference< css::table::XTableCharts > SAL_CALL
852 getCharts() override;
854 // XTablePivotChartsSupplier
855 virtual css::uno::Reference<css::table::XTablePivotCharts> SAL_CALL
856 getPivotCharts() override;
858 // XDataPilotTablesSupplier
859 virtual css::uno::Reference< css::sheet::XDataPilotTables > SAL_CALL
860 getDataPilotTables() override;
862 // XScenariosSupplier
863 virtual css::uno::Reference< css::sheet::XScenarios > SAL_CALL
864 getScenarios() override;
866 // XSheetAnnotationsSupplier
867 virtual css::uno::Reference< css::sheet::XSheetAnnotations > SAL_CALL
868 getAnnotations() override;
870 // XDrawPageSupplier
871 virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL
872 getDrawPage() override;
874 // XPrintAreas
875 virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
876 getPrintAreas() override;
877 virtual void SAL_CALL setPrintAreas( const css::uno::Sequence<
878 css::table::CellRangeAddress >& aPrintAreas ) override;
879 virtual sal_Bool SAL_CALL getPrintTitleColumns() override;
880 virtual void SAL_CALL setPrintTitleColumns( sal_Bool bPrintTitleColumns ) override;
881 virtual css::table::CellRangeAddress SAL_CALL getTitleColumns() override;
882 virtual void SAL_CALL setTitleColumns(
883 const css::table::CellRangeAddress& aTitleColumns ) override;
884 virtual sal_Bool SAL_CALL getPrintTitleRows() override;
885 virtual void SAL_CALL setPrintTitleRows( sal_Bool bPrintTitleRows ) override;
886 virtual css::table::CellRangeAddress SAL_CALL getTitleRows() override;
887 virtual void SAL_CALL setTitleRows(
888 const css::table::CellRangeAddress& aTitleRows ) override;
890 // XSheetLinkable
891 virtual css::sheet::SheetLinkMode SAL_CALL getLinkMode() override;
892 virtual void SAL_CALL setLinkMode( css::sheet::SheetLinkMode nLinkMode ) override;
893 virtual OUString SAL_CALL getLinkUrl() override;
894 virtual void SAL_CALL setLinkUrl( const OUString& aLinkUrl ) override;
895 virtual OUString SAL_CALL getLinkSheetName() override;
896 virtual void SAL_CALL setLinkSheetName( const OUString& aLinkSheetName ) override;
897 virtual void SAL_CALL link( const OUString& aUrl,
898 const OUString& aSheetName,
899 const OUString& aFilterName,
900 const OUString& aFilterOptions,
901 css::sheet::SheetLinkMode nMode ) override;
903 // XSheetAuditing
904 virtual sal_Bool SAL_CALL hideDependents( const css::table::CellAddress& aPosition ) override;
905 virtual sal_Bool SAL_CALL hidePrecedents( const css::table::CellAddress& aPosition ) override;
906 virtual sal_Bool SAL_CALL showDependents( const css::table::CellAddress& aPosition ) override;
907 virtual sal_Bool SAL_CALL showPrecedents( const css::table::CellAddress& aPosition ) override;
908 virtual sal_Bool SAL_CALL showErrors( const css::table::CellAddress& aPosition ) override;
909 virtual sal_Bool SAL_CALL showInvalid() override;
910 virtual void SAL_CALL clearArrows() override;
912 // XSheetOutline
913 virtual void SAL_CALL group( const css::table::CellRangeAddress& aRange,
914 css::table::TableOrientation nOrientation ) override;
915 virtual void SAL_CALL ungroup( const css::table::CellRangeAddress& aRange,
916 css::table::TableOrientation nOrientation ) override;
917 virtual void SAL_CALL autoOutline( const css::table::CellRangeAddress& aRange ) override;
918 virtual void SAL_CALL clearOutline() override;
919 virtual void SAL_CALL hideDetail( const css::table::CellRangeAddress& aRange ) override;
920 virtual void SAL_CALL showDetail( const css::table::CellRangeAddress& aRange ) override;
921 virtual void SAL_CALL showLevel( sal_Int16 nLevel,
922 css::table::TableOrientation nOrientation ) override;
924 // XProtectable
925 virtual void SAL_CALL protect( const OUString& aPassword ) override;
926 virtual void SAL_CALL unprotect( const OUString& aPassword ) override;
927 virtual sal_Bool SAL_CALL isProtected() override;
929 // XScenario
930 virtual sal_Bool SAL_CALL getIsScenario() override;
931 virtual OUString SAL_CALL getScenarioComment() override;
932 virtual void SAL_CALL setScenarioComment( const OUString& aScenarioComment ) override;
933 virtual void SAL_CALL addRanges( const css::uno::Sequence<
934 css::table::CellRangeAddress >& aRanges ) override;
935 virtual void SAL_CALL apply() override;
936 // XScenarioEnhanced
937 virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
938 getRanges( ) override;
940 // XExternalSheetName
941 virtual void SAL_CALL setExternalName( const OUString& aUrl, const OUString& aSheetName ) override;
943 // XEventsSupplier
944 virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override;
946 // XPropertySet override due to sheet properties
947 virtual css::uno::Reference< css::beans::XPropertySetInfo >
948 SAL_CALL getPropertySetInfo() override;
950 // XServiceInfo
951 virtual OUString SAL_CALL getImplementationName() override;
952 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
953 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
955 // XUnoTunnel
956 UNO3_GETIMPLEMENTATION_DECL(ScTableSheetObj);
958 // XTypeProvider
959 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
960 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
963 class ScTableColumnObj final : public ScCellRangeObj,
964 public css::container::XNamed
966 private:
967 const SfxItemPropertySet* pColPropSet;
969 virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
970 virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
971 css::uno::Any& ) override;
972 virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
973 const css::uno::Any& aValue ) override;
975 public:
976 ScTableColumnObj(ScDocShell* pDocSh, SCCOL nCol, SCTAB nTab);
977 virtual ~ScTableColumnObj() override;
979 virtual css::uno::Any SAL_CALL queryInterface(
980 const css::uno::Type & rType ) override;
981 virtual void SAL_CALL acquire() throw() override;
982 virtual void SAL_CALL release() throw() override;
984 // XNamed
985 virtual OUString SAL_CALL getName() override;
986 virtual void SAL_CALL setName( const OUString& aName ) override;
988 // XPropertySet override due to column properties
989 virtual css::uno::Reference< css::beans::XPropertySetInfo >
990 SAL_CALL getPropertySetInfo() override;
992 // XServiceInfo
993 virtual OUString SAL_CALL getImplementationName() override;
994 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
995 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
997 // XTypeProvider
998 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
999 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
1002 class ScTableRowObj final : public ScCellRangeObj
1004 private:
1005 const SfxItemPropertySet* pRowPropSet;
1007 virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
1008 virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
1009 css::uno::Any& ) override;
1010 virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
1011 const css::uno::Any& aValue ) override;
1013 public:
1014 ScTableRowObj(ScDocShell* pDocSh, SCROW nRow, SCTAB nTab);
1015 virtual ~ScTableRowObj() override;
1017 // XPropertySet override due to row properties
1018 virtual css::uno::Reference< css::beans::XPropertySetInfo >
1019 SAL_CALL getPropertySetInfo() override;
1021 // XServiceInfo
1022 virtual OUString SAL_CALL getImplementationName() override;
1023 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1024 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1027 class ScCellsObj final : public cppu::WeakImplHelper<
1028 css::container::XEnumerationAccess,
1029 css::lang::XServiceInfo >,
1030 public SfxListener
1032 private:
1033 ScDocShell* pDocShell;
1034 ScRangeList aRanges;
1036 public:
1037 ScCellsObj(ScDocShell* pDocSh, const ScRangeList& rR);
1038 virtual ~ScCellsObj() override;
1040 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1042 // XEnumerationAccess
1043 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
1044 createEnumeration() override;
1046 // XElementAccess
1047 virtual css::uno::Type SAL_CALL getElementType() override;
1048 virtual sal_Bool SAL_CALL hasElements() override;
1050 // XServiceInfo
1051 virtual OUString SAL_CALL getImplementationName() override;
1052 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1053 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1056 class ScCellsEnumeration final : public cppu::WeakImplHelper<
1057 css::container::XEnumeration,
1058 css::lang::XServiceInfo >,
1059 public SfxListener
1061 private:
1062 ScDocShell* pDocShell;
1063 ScRangeList aRanges;
1064 ScAddress aPos;
1065 std::unique_ptr<ScMarkData> pMark;
1066 bool bAtEnd;
1068 private:
1069 void Advance_Impl();
1070 void CheckPos_Impl();
1072 public:
1073 ScCellsEnumeration(ScDocShell* pDocSh, const ScRangeList& rR);
1074 virtual ~ScCellsEnumeration() override;
1076 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1078 // XEnumeration
1079 virtual sal_Bool SAL_CALL hasMoreElements() override;
1080 virtual css::uno::Any SAL_CALL nextElement() override;
1082 // XServiceInfo
1083 virtual OUString SAL_CALL getImplementationName() override;
1084 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1085 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1088 class ScCellFormatsObj final : public cppu::WeakImplHelper<
1089 css::container::XIndexAccess,
1090 css::container::XEnumerationAccess,
1091 css::lang::XServiceInfo >,
1092 public SfxListener
1094 private:
1095 ScDocShell* pDocShell;
1096 ScRange aTotalRange;
1098 private:
1099 ScCellRangeObj* GetObjectByIndex_Impl(tools::Long nIndex) const;
1101 public:
1102 ScCellFormatsObj(ScDocShell* pDocSh, const ScRange& rR);
1103 virtual ~ScCellFormatsObj() override;
1105 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1107 // XIndexAccess
1108 virtual sal_Int32 SAL_CALL getCount() override;
1109 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
1111 // XEnumerationAccess
1112 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
1113 createEnumeration() override;
1115 // XElementAccess
1116 virtual css::uno::Type SAL_CALL getElementType() override;
1117 virtual sal_Bool SAL_CALL hasElements() override;
1119 // XServiceInfo
1120 virtual OUString SAL_CALL getImplementationName() override;
1121 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1122 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1125 class ScCellFormatsEnumeration final : public cppu::WeakImplHelper<
1126 css::container::XEnumeration,
1127 css::lang::XServiceInfo >,
1128 public SfxListener
1130 private:
1131 ScDocShell* pDocShell;
1132 SCTAB nTab;
1133 std::unique_ptr<ScAttrRectIterator> pIter;
1134 ScRange aNext;
1135 bool bAtEnd;
1136 bool bDirty;
1138 private:
1139 void Advance_Impl();
1140 ScCellRangeObj* NextObject_Impl();
1142 public:
1143 ScCellFormatsEnumeration(ScDocShell* pDocSh, const ScRange& rR);
1144 virtual ~ScCellFormatsEnumeration() override;
1146 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1148 // XEnumeration
1149 virtual sal_Bool SAL_CALL hasMoreElements() override;
1150 virtual css::uno::Any SAL_CALL nextElement() override;
1152 // XServiceInfo
1153 virtual OUString SAL_CALL getImplementationName() override;
1154 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1155 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1158 class ScUniqueCellFormatsObj final : public cppu::WeakImplHelper<
1159 css::container::XIndexAccess,
1160 css::container::XEnumerationAccess,
1161 css::lang::XServiceInfo >,
1162 public SfxListener
1164 private:
1165 ScDocShell* pDocShell;
1166 std::vector<ScRangeList> aRangeLists;
1168 public:
1169 ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange& rR);
1170 virtual ~ScUniqueCellFormatsObj() override;
1172 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1174 // XIndexAccess
1175 virtual sal_Int32 SAL_CALL getCount() override;
1176 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
1178 // XEnumerationAccess
1179 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
1180 createEnumeration() override;
1182 // XElementAccess
1183 virtual css::uno::Type SAL_CALL getElementType() override;
1184 virtual sal_Bool SAL_CALL hasElements() override;
1186 // XServiceInfo
1187 virtual OUString SAL_CALL getImplementationName() override;
1188 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1189 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1192 class ScUniqueCellFormatsEnumeration final : public cppu::WeakImplHelper<
1193 css::container::XEnumeration,
1194 css::lang::XServiceInfo >,
1195 public SfxListener
1197 private:
1198 std::vector<ScRangeList> aRangeLists;
1199 ScDocShell* pDocShell;
1200 sal_Int32 nCurrentPosition;
1202 public:
1203 ScUniqueCellFormatsEnumeration(ScDocShell* pDocShell, const std::vector<ScRangeList>& rRangeLists);
1204 virtual ~ScUniqueCellFormatsEnumeration() override;
1206 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1208 // XEnumeration
1209 virtual sal_Bool SAL_CALL hasMoreElements() override;
1210 virtual css::uno::Any SAL_CALL nextElement() override;
1212 // XServiceInfo
1213 virtual OUString SAL_CALL getImplementationName() override;
1214 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1215 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1218 #endif
1220 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */