Bump version to 6.4-15
[LibreOffice.git] / sc / inc / cellsuno.hxx
blob96d7000cef67e88490661b29f8f6ae66f02e250c
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 <tools/link.hxx>
29 #include <svl/lstner.hxx>
30 #include <svl/listener.hxx>
31 #include <com/sun/star/table/XTableChartsSupplier.hpp>
32 #include <com/sun/star/table/XTablePivotChartsSupplier.hpp>
33 #include <com/sun/star/chart/XChartDataArray.hpp>
34 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
35 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
36 #include <com/sun/star/sheet/XSheetCellRange.hpp>
37 #include <com/sun/star/sheet/XFormulaQuery.hpp>
38 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
39 #include <com/sun/star/sheet/XSheetOperation.hpp>
40 #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
41 #include <com/sun/star/sheet/XCellFormatRangesSupplier.hpp>
42 #include <com/sun/star/sheet/XUniqueCellFormatRangesSupplier.hpp>
43 #include <com/sun/star/sheet/XCellRangesQuery.hpp>
44 #include <com/sun/star/sheet/XSheetFilterableEx.hpp>
45 #include <com/sun/star/sheet/XSpreadsheet.hpp>
46 #include <com/sun/star/sheet/XSheetPageBreak.hpp>
47 #include <com/sun/star/sheet/XCellRangeMovement.hpp>
48 #include <com/sun/star/text/XText.hpp>
49 #include <com/sun/star/sheet/XPrintAreas.hpp>
50 #include <com/sun/star/sheet/XSheetLinkable.hpp>
51 #include <com/sun/star/sheet/XSubTotalCalculatable.hpp>
52 #include <com/sun/star/sheet/XArrayFormulaRange.hpp>
53 #include <com/sun/star/sheet/XCellRangeData.hpp>
54 #include <com/sun/star/sheet/XCellRangeFormula.hpp>
55 #include <com/sun/star/sheet/XCellSeries.hpp>
56 #include <com/sun/star/sheet/XMultipleOperation.hpp>
57 #include <com/sun/star/sheet/XFormulaTokens.hpp>
58 #include <com/sun/star/sheet/XArrayFormulaTokens.hpp>
59 #include <com/sun/star/sheet/XCellAddressable.hpp>
60 #include <com/sun/star/util/XReplaceable.hpp>
61 #include <com/sun/star/util/XIndent.hpp>
62 #include <com/sun/star/lang/XServiceInfo.hpp>
63 #include <com/sun/star/container/XNameContainer.hpp>
64 #include <com/sun/star/util/XMergeable.hpp>
65 #include <com/sun/star/table/XAutoFormattable.hpp>
66 #include <com/sun/star/util/XSortable.hpp>
67 #include <com/sun/star/util/XImportable.hpp>
68 #include <com/sun/star/table/XColumnRowRange.hpp>
69 #include <com/sun/star/table/XCell2.hpp>
70 #include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
71 #include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
72 #include <com/sun/star/sheet/XScenariosSupplier.hpp>
73 #include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
74 #include <com/sun/star/sheet/XSheetAuditing.hpp>
75 #include <com/sun/star/sheet/XSheetOutline.hpp>
76 #include <com/sun/star/util/XProtectable.hpp>
77 #include <com/sun/star/sheet/XScenario.hpp>
78 #include <com/sun/star/sheet/XScenarioEnhanced.hpp>
79 #include <com/sun/star/util/XModifyBroadcaster.hpp>
80 #include <com/sun/star/beans/XPropertyState.hpp>
81 #include <com/sun/star/beans/XMultiPropertySet.hpp>
82 #include <com/sun/star/lang/XUnoTunnel.hpp>
83 #include <com/sun/star/document/XActionLockable.hpp>
84 #include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
85 #include <com/sun/star/sheet/XExternalSheetName.hpp>
86 #include <com/sun/star/document/XEventsSupplier.hpp>
87 #include <comphelper/servicehelper.hxx>
88 #include <cppuhelper/implbase.hxx>
89 #include <cppuhelper/weakref.hxx>
91 #include <memory>
92 #include <vector>
94 namespace com { namespace sun { namespace star { namespace table { struct BorderLine2; } } } }
95 namespace com { namespace sun { namespace star { namespace table { struct BorderLine; } } } }
96 namespace com { namespace sun { namespace star { namespace table { struct TableBorder2; } } } }
97 namespace com { namespace sun { namespace star { namespace table { struct TableBorder; } } } }
99 class ScDocShell;
100 class ScMarkData;
101 class ScMemChart;
102 class ScPrintRangeSaver;
103 class ScAttrRectIterator;
104 class ScCellRangeObj;
105 class ScPatternAttr;
106 class SvxBoxItem;
107 class SvxBoxInfoItem;
108 class SvxItemPropertySet;
109 class SvxUnoText;
110 class ScDocument;
111 class SfxBroadcaster;
112 class SfxHint;
113 class SfxItemPropertyMap;
114 class SfxItemPropertySet;
115 class SfxItemSet;
116 struct SfxItemPropertySimpleEntry;
118 namespace editeng { class SvxBorderLine; }
120 class ScLinkListener final : public SvtListener
122 Link<const SfxHint&,void> const 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
155 namespace vba {
156 namespace excel {
157 class ScVbaCellRangeAccess; // Vba Helper class
162 class SC_DLLPUBLIC ScCellRangesBase :
163 public cppu::WeakImplHelper<
164 css::beans::XPropertySet,
165 css::beans::XMultiPropertySet,
166 css::beans::XPropertyState,
167 css::sheet::XSheetOperation,
168 css::chart::XChartDataArray,
169 css::util::XIndent,
170 css::sheet::XCellRangesQuery,
171 css::sheet::XFormulaQuery,
172 css::util::XReplaceable,
173 css::util::XModifyBroadcaster,
174 css::lang::XServiceInfo,
175 css::lang::XUnoTunnel,
176 css::beans::XTolerantMultiPropertySet>,
177 public SfxListener
179 friend class ScTabViewObj; // for select()
180 friend class ScTableSheetObj; // for createCursorByRange()
181 friend class ooo::vba::excel::ScVbaCellRangeAccess;
183 private:
184 css::uno::WeakReference<css::uno::XInterface> m_wThis;
185 const SfxItemPropertySet* pPropSet;
186 ScDocShell* pDocShell;
187 std::unique_ptr<ScLinkListener> pValueListener;
188 std::unique_ptr<ScPatternAttr> pCurrentFlat;
189 std::unique_ptr<ScPatternAttr> pCurrentDeep;
190 std::unique_ptr<SfxItemSet> pCurrentDataSet;
191 std::unique_ptr<SfxItemSet> pNoDfltCurrentDataSet;
192 std::unique_ptr<ScMarkData> pMarkData;
193 ScRangeList aRanges;
194 sal_Int64 nObjectId;
195 bool bChartColAsHdr;
196 bool bChartRowAsHdr;
197 bool bCursorOnly;
198 bool bGotDataChangedHint;
199 XModifyListenerArr_Impl aValueListeners;
201 DECL_LINK( ValueListenerHdl, const SfxHint&, void );
203 private:
204 void PaintGridRanges_Impl();
205 ScRangeListRef GetLimitedChartRanges_Impl( long nDataColumns, long nDataRows ) const;
206 void ForceChartListener_Impl();
207 std::unique_ptr<ScMemChart> CreateMemChart_Impl() const;
209 const ScPatternAttr* GetCurrentAttrsFlat();
210 const ScPatternAttr* GetCurrentAttrsDeep();
211 SfxItemSet* GetCurrentDataSet(bool bNoDflt = false);
212 void ForgetMarkData();
213 void ForgetCurrentAttrs();
215 css::uno::Reference<css::sheet::XSheetCellRanges>
216 QueryDifferences_Impl(const css::table::CellAddress& aCompare,
217 bool bColumnDiff);
218 css::uno::Reference<css::uno::XInterface>
219 Find_Impl(const css::uno::Reference<css::util::XSearchDescriptor>& xDesc,
220 const ScAddress* pLastPos);
222 protected:
223 const ScMarkData* GetMarkData();
225 // GetItemPropertyMap for derived classes must contain all entries, including base class
226 virtual const SfxItemPropertyMap& GetItemPropertyMap();
227 css::beans::PropertyState GetOnePropertyState(
228 sal_uInt16 nItemWhich, const SfxItemPropertySimpleEntry* pEntry );
229 /// @throws css::uno::RuntimeException
230 virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
231 css::uno::Any& );
232 /// @throws css::lang::IllegalArgumentException
233 /// @throws css::uno::RuntimeException
234 virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
235 const css::uno::Any& aValue );
237 public:
238 ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR);
239 ScCellRangesBase(ScDocShell* pDocSh, const ScRangeList& rR);
240 virtual ~ScCellRangesBase() override;
242 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
243 virtual void RefChanged();
245 // from derived classes and by getImplementation
246 ScDocShell* GetDocShell() const { return pDocShell; }
247 ScDocument* GetDocument() const;
248 const ScRangeList& GetRangeList() const { return aRanges; }
249 void AddRange(const ScRange& rRange, const bool bMergeRanges);
251 // arouse object created via service:
252 void InitInsertRange(ScDocShell* pDocSh, const ScRange& rR);
254 void SetNewRange(const ScRange& rNew); // for cursor
255 void SetNewRanges(const ScRangeList& rNew);
257 void SetCursorOnly(bool bSet);
258 bool IsCursorOnly() const { return bCursorOnly; }
260 // XSheetOperation
261 virtual double SAL_CALL computeFunction( css::sheet::GeneralFunction nFunction ) override;
262 virtual void SAL_CALL clearContents( sal_Int32 nContentFlags ) override;
264 // XPropertySet
265 virtual css::uno::Reference< css::beans::XPropertySetInfo >
266 SAL_CALL getPropertySetInfo() override;
267 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
268 const css::uno::Any& aValue ) override;
269 virtual css::uno::Any SAL_CALL getPropertyValue(
270 const OUString& PropertyName ) override;
271 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
272 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
273 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
274 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
275 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
276 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
277 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
278 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
280 // XMultiPropertySet
281 virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames,
282 const css::uno::Sequence< css::uno::Any >& aValues ) override;
283 virtual css::uno::Sequence< css::uno::Any > SAL_CALL
284 getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
285 virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames,
286 const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
287 virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
288 virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames,
289 const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
291 // XTolerantMultiPropertySet
292 virtual css::uno::Sequence< css::beans::SetPropertyTolerantFailed > SAL_CALL
293 setPropertyValuesTolerant( const css::uno::Sequence< OUString >& aPropertyNames,
294 const css::uno::Sequence< css::uno::Any >& aValues ) override;
295 virtual css::uno::Sequence< css::beans::GetPropertyTolerantResult > SAL_CALL
296 getPropertyValuesTolerant( const css::uno::Sequence< OUString >& aPropertyNames ) override;
297 virtual css::uno::Sequence< css::beans::GetDirectPropertyTolerantResult > SAL_CALL
298 getDirectPropertyValuesTolerant( const css::uno::Sequence< OUString >& aPropertyNames ) override;
300 // XPropertyState
301 virtual css::beans::PropertyState SAL_CALL getPropertyState(
302 const OUString& PropertyName ) override;
303 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL
304 getPropertyStates( const css::uno::Sequence<
305 OUString >& aPropertyName ) override;
306 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
307 virtual css::uno::Any SAL_CALL getPropertyDefault(
308 const OUString& aPropertyName ) override;
310 // XIndent
311 virtual void SAL_CALL decrementIndent() override;
312 virtual void SAL_CALL incrementIndent() override;
314 // XChartData
315 virtual void SAL_CALL addChartDataChangeEventListener(
316 const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override;
317 virtual void SAL_CALL removeChartDataChangeEventListener( const css::uno::Reference<
318 css::chart::XChartDataChangeEventListener >& aListener ) override;
319 virtual double SAL_CALL getNotANumber() override;
320 virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) override;
322 // XChartDataArray
323 virtual css::uno::Sequence< css::uno::Sequence< double > > SAL_CALL
324 getData() override;
325 virtual void SAL_CALL setData( const css::uno::Sequence< css::uno::Sequence< double > >& aData ) override;
326 virtual css::uno::Sequence< OUString > SAL_CALL getRowDescriptions() override;
327 virtual void SAL_CALL setRowDescriptions( const css::uno::Sequence< OUString >& aRowDescriptions ) override;
328 virtual css::uno::Sequence< OUString > SAL_CALL getColumnDescriptions() override;
329 virtual void SAL_CALL setColumnDescriptions( const css::uno::Sequence< OUString >& aColumnDescriptions ) override;
331 // XCellRangesQuery
332 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
333 queryVisibleCells() override;
334 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
335 queryEmptyCells() override;
336 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
337 queryContentCells( sal_Int16 nContentFlags ) override;
338 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
339 queryFormulaCells( sal_Int32 nResultFlags ) override;
340 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
341 queryColumnDifferences(
342 const css::table::CellAddress& aCompare ) override;
343 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
344 queryRowDifferences(
345 const css::table::CellAddress& aCompare ) override;
346 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
347 queryIntersection(
348 const css::table::CellRangeAddress& aRange ) override;
350 // XFormulaQuery
351 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
352 queryDependents( sal_Bool bRecursive ) override;
353 virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
354 queryPrecedents( sal_Bool bRecursive ) override;
356 // XSearchable
357 virtual css::uno::Reference< css::util::XSearchDescriptor > SAL_CALL
358 createSearchDescriptor() override;
359 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
360 findAll( const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override;
361 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
362 findFirst( const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override;
363 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
364 findNext( const css::uno::Reference< css::uno::XInterface >& xStartAt,
365 const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override;
367 // XReplaceable
368 virtual css::uno::Reference< css::util::XReplaceDescriptor > SAL_CALL
369 createReplaceDescriptor() override;
370 virtual sal_Int32 SAL_CALL replaceAll( const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override;
372 // XModifyBroadcaster
373 virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
374 virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
376 // XServiceInfo
377 virtual OUString SAL_CALL getImplementationName() override;
378 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
379 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
381 // XUnoTunnel
382 UNO3_GETIMPLEMENTATION_DECL(ScCellRangesBase)
385 class SC_DLLPUBLIC ScCellRangesObj final : public ScCellRangesBase,
386 public css::sheet::XSheetCellRangeContainer,
387 public css::container::XNameContainer,
388 public css::container::XEnumerationAccess
390 private:
391 struct Impl;
392 std::unique_ptr<Impl> m_pImpl;
394 ScCellRangeObj* GetObjectByIndex_Impl(sal_Int32 nIndex) const;
396 public:
397 ScCellRangesObj(ScDocShell* pDocSh, const ScRangeList& rR);
398 virtual ~ScCellRangesObj() override;
400 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
401 virtual void SAL_CALL acquire() throw() override;
402 virtual void SAL_CALL release() throw() override;
404 virtual void RefChanged() override;
406 // XSheetCellRanges
407 virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL
408 getCells() override;
409 virtual OUString SAL_CALL getRangeAddressesAsString() override;
410 virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
411 getRangeAddresses() override;
413 // XSheetCellRangeContainer
414 virtual void SAL_CALL addRangeAddress( const css::table::CellRangeAddress& rRange,
415 sal_Bool bMergeRanges ) override;
416 virtual void SAL_CALL removeRangeAddress( const css::table::CellRangeAddress& rRange ) override;
417 virtual void SAL_CALL addRangeAddresses( const css::uno::Sequence<
418 css::table::CellRangeAddress >& rRanges,
419 sal_Bool bMergeRanges ) override;
420 virtual void SAL_CALL removeRangeAddresses( const css::uno::Sequence<
421 css::table::CellRangeAddress >& rRanges ) override;
423 // XNameContainer
424 virtual void SAL_CALL insertByName( const OUString& aName,
425 const css::uno::Any& aElement ) override;
426 virtual void SAL_CALL removeByName( const OUString& Name ) override;
428 // XNameReplace
429 virtual void SAL_CALL replaceByName( const OUString& aName,
430 const css::uno::Any& aElement ) override;
432 // XNameAccess
433 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
434 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
435 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
437 // XIndexAccess
438 virtual sal_Int32 SAL_CALL getCount() override;
439 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
441 // XElementAccess
442 virtual css::uno::Type SAL_CALL getElementType() override;
443 virtual sal_Bool SAL_CALL hasElements() override;
445 // XEnumerationAccess
446 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
447 createEnumeration() override;
449 // XServiceInfo
450 virtual OUString SAL_CALL getImplementationName() override;
451 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
452 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
454 // XTypeProvider
455 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
456 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
459 class SC_DLLPUBLIC ScCellRangeObj : public ScCellRangesBase,
460 public css::sheet::XCellRangeAddressable,
461 public css::sheet::XSheetCellRange,
462 public css::sheet::XArrayFormulaRange,
463 public css::sheet::XArrayFormulaTokens,
464 public css::sheet::XCellRangeData,
465 public css::sheet::XCellRangeFormula,
466 public css::sheet::XMultipleOperation,
467 public css::util::XMergeable,
468 public css::sheet::XCellSeries,
469 public css::table::XAutoFormattable,
470 public css::util::XSortable,
471 public css::sheet::XSheetFilterableEx,
472 public css::sheet::XSubTotalCalculatable,
473 public css::util::XImportable,
474 public css::sheet::XCellFormatRangesSupplier,
475 public css::sheet::XUniqueCellFormatRangesSupplier,
476 public css::table::XColumnRowRange
478 private:
479 const SfxItemPropertySet* pRangePropSet;
480 ScRange aRange;
482 protected:
483 const ScRange& GetRange() const { return aRange; }
484 virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
485 virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
486 css::uno::Any& ) override;
487 virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
488 const css::uno::Any& aValue ) override;
490 /// @throws css::lang::IndexOutOfBoundsException
491 /// @throws css::uno::RuntimeException
492 css::uno::Reference< css::table::XCell >
493 GetCellByPosition_Impl( sal_Int32 nColumn, sal_Int32 nRow );
495 /// @throws css::uno::RuntimeException
496 void SetArrayFormula_Impl( const OUString& rFormula,
497 const formula::FormulaGrammar::Grammar eGrammar );
499 public:
500 ScCellRangeObj(ScDocShell* pDocSh, const ScRange& rR);
501 virtual ~ScCellRangeObj() override;
503 // uses ObjectShell from document, if set (returns NULL otherwise)
504 static css::uno::Reference<css::table::XCellRange>
505 CreateRangeFromDoc( const ScDocument* pDoc, const ScRange& rR );
507 virtual css::uno::Any SAL_CALL queryInterface(
508 const css::uno::Type & rType ) override;
509 virtual void SAL_CALL acquire() throw() override;
510 virtual void SAL_CALL release() throw() override;
512 virtual void RefChanged() override;
514 // XCellRangeAddressable
515 virtual css::table::CellRangeAddress SAL_CALL getRangeAddress() override;
517 // XSheetCellRange
518 virtual css::uno::Reference< css::sheet::XSpreadsheet > SAL_CALL
519 getSpreadsheet() override;
521 // XArrayFormulaRange
522 virtual OUString SAL_CALL getArrayFormula() override;
523 virtual void SAL_CALL setArrayFormula( const OUString& aFormula ) override;
525 // XArrayFormulaTokens
526 virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL getArrayTokens() override;
527 virtual void SAL_CALL setArrayTokens( const css::uno::Sequence<
528 css::sheet::FormulaToken >& aTokens ) override;
530 // XCellRangeData
531 virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getDataArray() override;
532 virtual void SAL_CALL setDataArray( const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aArray ) override;
534 // XCellRangeFormula
535 virtual css::uno::Sequence< css::uno::Sequence<
536 OUString > > SAL_CALL getFormulaArray() override;
537 virtual void SAL_CALL setFormulaArray( const css::uno::Sequence< css::uno::Sequence< OUString > >& aArray ) override;
539 // XMultipleOperation
540 virtual void SAL_CALL setTableOperation(
541 const css::table::CellRangeAddress& aFormulaRange,
542 css::sheet::TableOperationMode nMode,
543 const css::table::CellAddress& aColumnCell,
544 const css::table::CellAddress& aRowCell ) override;
546 // XMergeable
547 virtual void SAL_CALL merge( sal_Bool bMerge ) override;
548 virtual sal_Bool SAL_CALL getIsMerged() override;
550 // XCellSeries
551 virtual void SAL_CALL fillSeries( css::sheet::FillDirection nFillDirection,
552 css::sheet::FillMode nFillMode,
553 css::sheet::FillDateMode nFillDateMode,
554 double fStep, double fEndValue ) override;
555 virtual void SAL_CALL fillAuto( css::sheet::FillDirection nFillDirection,
556 sal_Int32 nSourceCount ) override;
558 // XAutoFormattable
559 virtual void SAL_CALL autoFormat( const OUString& aName ) override;
561 // XSortable
562 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL
563 createSortDescriptor() override;
564 virtual void SAL_CALL sort( const css::uno::Sequence<
565 css::beans::PropertyValue >& xDescriptor ) override;
567 // XSheetFilterableEx
568 virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL
569 createFilterDescriptorByObject( const css::uno::Reference<
570 css::sheet::XSheetFilterable >& xObject ) override;
572 // XSheetFilterable
573 virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL
574 createFilterDescriptor( sal_Bool bEmpty ) override;
575 virtual void SAL_CALL filter( const css::uno::Reference<
576 css::sheet::XSheetFilterDescriptor >& xDescriptor ) override;
578 // XSubTotalCalculatable
579 virtual css::uno::Reference< css::sheet::XSubTotalDescriptor > SAL_CALL
580 createSubTotalDescriptor( sal_Bool bEmpty ) override;
581 virtual void SAL_CALL applySubTotals(const css::uno::Reference< css::sheet::XSubTotalDescriptor >& xDescriptor,
582 sal_Bool bReplace) override;
583 virtual void SAL_CALL removeSubTotals() override;
585 // XImportable
586 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL
587 createImportDescriptor( sal_Bool bEmpty ) override;
588 virtual void SAL_CALL doImport( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor ) override;
590 // XCellFormatRangesSupplier
591 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
592 getCellFormatRanges() override;
594 // XUniqueCellFormatRangesSupplier
595 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
596 getUniqueCellFormatRanges() override;
598 // XColumnRowRange
599 virtual css::uno::Reference< css::table::XTableColumns > SAL_CALL
600 getColumns() override;
601 virtual css::uno::Reference< css::table::XTableRows > SAL_CALL
602 getRows() override;
604 // XCellRange
605 virtual css::uno::Reference< css::table::XCell > SAL_CALL
606 getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) override;
607 virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
608 getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop,
609 sal_Int32 nRight, sal_Int32 nBottom ) override;
610 virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
611 getCellRangeByName( const OUString& aRange ) override;
612 /// @throws css::uno::RuntimeException
613 css::uno::Reference< css::table::XCellRange >
614 getCellRangeByName( const OUString& aRange, const ScAddress::Details& rDetails );
616 // XPropertySet override due to Range-Properties
617 virtual css::uno::Reference< css::beans::XPropertySetInfo >
618 SAL_CALL getPropertySetInfo() override;
620 // XServiceInfo
621 virtual OUString SAL_CALL getImplementationName() override;
622 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
623 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
625 // XTypeProvider
626 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
627 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
630 //! really derive cell from range?
632 class SC_DLLPUBLIC ScCellObj final : public ScCellRangeObj,
633 public css::text::XText,
634 public css::container::XEnumerationAccess,
635 public css::table::XCell2,
636 public css::sheet::XFormulaTokens,
637 public css::sheet::XCellAddressable,
638 public css::sheet::XSheetAnnotationAnchor,
639 public css::text::XTextFieldsSupplier,
640 public css::document::XActionLockable
642 private:
643 rtl::Reference<SvxUnoText> mxUnoText;
644 const SfxItemPropertySet* pCellPropSet;
645 ScAddress aCellPos;
646 sal_Int16 nActionLockCount;
648 private:
649 OUString GetInputString_Impl(bool bEnglish) const;
650 OUString GetOutputString_Impl() const;
651 void SetString_Impl(const OUString& rString, bool bInterpret, bool bEnglish);
652 double GetValue_Impl() const;
653 void SetValue_Impl(double fValue);
654 css::table::CellContentType GetContentType_Impl();
655 sal_Int32 GetResultType_Impl() const;
657 virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
658 virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
659 css::uno::Any& ) override;
660 virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
661 const css::uno::Any& aValue ) override;
663 public:
664 static const SvxItemPropertySet* GetEditPropertySet();
665 static const SfxItemPropertyMap& GetCellPropertyMap();
667 ScCellObj(ScDocShell* pDocSh, const ScAddress& rP);
668 virtual ~ScCellObj() override;
670 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
671 virtual void SAL_CALL acquire() throw() override;
672 virtual void SAL_CALL release() throw() override;
674 virtual void RefChanged() override;
676 SvxUnoText& GetUnoText();
678 // XML import needs to set results at formula cells,
679 // not meant for any other purpose.
680 const ScAddress& GetPosition() const { return aCellPos; }
682 void InputEnglishString( const OUString& rText );
684 // XText
685 virtual void SAL_CALL insertTextContent( const css::uno::Reference< css::text::XTextRange >& xRange,
686 const css::uno::Reference< css::text::XTextContent >& xContent,
687 sal_Bool bAbsorb ) override;
688 virtual void SAL_CALL removeTextContent( const css::uno::Reference< css::text::XTextContent >& xContent ) override;
690 // XSimpleText
691 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
692 createTextCursor() override;
693 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
694 createTextCursorByRange( const css::uno::Reference< css::text::XTextRange >& aTextPosition ) override;
695 virtual void SAL_CALL insertString( const css::uno::Reference< css::text::XTextRange >& xRange,
696 const OUString& aString, sal_Bool bAbsorb ) override;
697 virtual void SAL_CALL insertControlCharacter( const css::uno::Reference< css::text::XTextRange >& xRange,
698 sal_Int16 nControlCharacter, sal_Bool bAbsorb ) override;
700 // XTextRange
701 virtual css::uno::Reference< css::text::XText > SAL_CALL
702 getText() override;
703 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
704 getStart() override;
705 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
706 getEnd() override;
707 virtual OUString SAL_CALL getString() override;
708 virtual void SAL_CALL setString( const OUString& aString ) override;
710 // XEnumerationAccess
711 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
712 createEnumeration() override;
714 // XElementAccess
715 virtual css::uno::Type SAL_CALL getElementType() override;
716 virtual sal_Bool SAL_CALL hasElements() override;
718 // XCell
719 virtual OUString SAL_CALL getFormula() override;
720 virtual void SAL_CALL setFormula( const OUString& aFormula ) override;
721 virtual void SAL_CALL setFormulaResult( double nValue ) override;
722 virtual void SAL_CALL setFormulaString( const OUString& aFormula ) override;
723 virtual double SAL_CALL getValue() override;
724 virtual void SAL_CALL setValue( double nValue ) override;
725 virtual css::table::CellContentType SAL_CALL getType() override;
726 virtual sal_Int32 SAL_CALL getError() override;
728 // XFormulaTokens
729 virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL getTokens() override;
730 virtual void SAL_CALL setTokens( const css::uno::Sequence< css::sheet::FormulaToken >& aTokens ) override;
732 // XCellAddressable
733 virtual css::table::CellAddress SAL_CALL getCellAddress() override;
735 // XSheetAnnotationAnchor
736 virtual css::uno::Reference< css::sheet::XSheetAnnotation > SAL_CALL
737 getAnnotation() override;
739 // XTextFieldsSupplier
740 virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL
741 getTextFields() override;
742 virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL
743 getTextFieldMasters() override;
745 // XPropertySet override due to cell properties
746 virtual css::uno::Reference< css::beans::XPropertySetInfo >
747 SAL_CALL getPropertySetInfo() override;
749 // XServiceInfo
750 virtual OUString SAL_CALL getImplementationName() override;
751 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
752 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
754 // XTypeProvider
755 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
756 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
758 // XActionLockable
759 virtual sal_Bool SAL_CALL isActionLocked() override;
760 virtual void SAL_CALL addActionLock() override;
761 virtual void SAL_CALL removeActionLock() override;
762 virtual void SAL_CALL setActionLocks( sal_Int16 nLock ) override;
763 virtual sal_Int16 SAL_CALL resetActionLocks() override;
766 class ScTableSheetObj : public ScCellRangeObj,
767 public css::sheet::XSpreadsheet,
768 public css::container::XNamed,
769 public css::sheet::XSheetPageBreak,
770 public css::sheet::XCellRangeMovement,
771 public css::table::XTableChartsSupplier,
772 public css::table::XTablePivotChartsSupplier,
773 public css::sheet::XDataPilotTablesSupplier,
774 public css::sheet::XScenariosSupplier,
775 public css::sheet::XSheetAnnotationsSupplier,
776 public css::drawing::XDrawPageSupplier,
777 public css::sheet::XPrintAreas,
778 public css::sheet::XSheetLinkable,
779 public css::sheet::XSheetAuditing,
780 public css::sheet::XSheetOutline,
781 public css::util::XProtectable,
782 public css::sheet::XScenario,
783 public css::sheet::XScenarioEnhanced,
784 public css::sheet::XExternalSheetName,
785 public css::document::XEventsSupplier
787 friend class ScTableSheetsObj; // for insertByName()
789 private:
790 const SfxItemPropertySet* pSheetPropSet;
792 SCTAB GetTab_Impl() const;
793 void PrintAreaUndo_Impl( std::unique_ptr<ScPrintRangeSaver> pOldRanges );
795 protected:
796 virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
797 virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
798 css::uno::Any& ) override;
799 virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
800 const css::uno::Any& aValue ) override;
802 public:
803 ScTableSheetObj(ScDocShell* pDocSh, SCTAB nTab);
804 virtual ~ScTableSheetObj() override;
806 void InitInsertSheet(ScDocShell* pDocSh, SCTAB nTab);
808 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
809 virtual void SAL_CALL acquire() throw() override;
810 virtual void SAL_CALL release() throw() override;
812 // XSpreadsheet
813 virtual css::uno::Reference< css::sheet::XSheetCellCursor >
814 SAL_CALL createCursor() override;
815 virtual css::uno::Reference< css::sheet::XSheetCellCursor > SAL_CALL
816 createCursorByRange( const css::uno::Reference<
817 css::sheet::XSheetCellRange >& aRange ) override;
819 // XSheetCellRange
820 virtual css::uno::Reference< css::sheet::XSpreadsheet > SAL_CALL
821 getSpreadsheet() override;
823 // XCellRange
824 virtual css::uno::Reference< css::table::XCell > SAL_CALL
825 getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) override;
826 virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
827 getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop,
828 sal_Int32 nRight, sal_Int32 nBottom ) override;
829 using ScCellRangeObj::getCellRangeByName;
830 virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
831 getCellRangeByName( const OUString& aRange ) override;
833 // XNamed
834 virtual OUString SAL_CALL getName() override;
835 virtual void SAL_CALL setName( const OUString& aName ) override;
837 // XSheetPageBreak
838 virtual css::uno::Sequence< css::sheet::TablePageBreakData > SAL_CALL
839 getColumnPageBreaks() override;
840 virtual css::uno::Sequence< css::sheet::TablePageBreakData > SAL_CALL
841 getRowPageBreaks() override;
842 virtual void SAL_CALL removeAllManualPageBreaks() override;
844 // XCellRangeMovement
845 virtual void SAL_CALL insertCells( const css::table::CellRangeAddress& aRange,
846 css::sheet::CellInsertMode nMode ) override;
847 virtual void SAL_CALL removeRange( const css::table::CellRangeAddress& aRange,
848 css::sheet::CellDeleteMode nMode ) override;
849 virtual void SAL_CALL moveRange( const css::table::CellAddress& aDestination,
850 const css::table::CellRangeAddress& aSource ) override;
851 virtual void SAL_CALL copyRange( const css::table::CellAddress& aDestination,
852 const css::table::CellRangeAddress& aSource ) override;
854 // XTableChartsSupplier
855 virtual css::uno::Reference< css::table::XTableCharts > SAL_CALL
856 getCharts() override;
858 // XTablePivotChartsSupplier
859 virtual css::uno::Reference<css::table::XTablePivotCharts> SAL_CALL
860 getPivotCharts() override;
862 // XDataPilotTablesSupplier
863 virtual css::uno::Reference< css::sheet::XDataPilotTables > SAL_CALL
864 getDataPilotTables() override;
866 // XScenariosSupplier
867 virtual css::uno::Reference< css::sheet::XScenarios > SAL_CALL
868 getScenarios() override;
870 // XSheetAnnotationsSupplier
871 virtual css::uno::Reference< css::sheet::XSheetAnnotations > SAL_CALL
872 getAnnotations() override;
874 // XDrawPageSupplier
875 virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL
876 getDrawPage() override;
878 // XPrintAreas
879 virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
880 getPrintAreas() override;
881 virtual void SAL_CALL setPrintAreas( const css::uno::Sequence<
882 css::table::CellRangeAddress >& aPrintAreas ) override;
883 virtual sal_Bool SAL_CALL getPrintTitleColumns() override;
884 virtual void SAL_CALL setPrintTitleColumns( sal_Bool bPrintTitleColumns ) override;
885 virtual css::table::CellRangeAddress SAL_CALL getTitleColumns() override;
886 virtual void SAL_CALL setTitleColumns(
887 const css::table::CellRangeAddress& aTitleColumns ) override;
888 virtual sal_Bool SAL_CALL getPrintTitleRows() override;
889 virtual void SAL_CALL setPrintTitleRows( sal_Bool bPrintTitleRows ) override;
890 virtual css::table::CellRangeAddress SAL_CALL getTitleRows() override;
891 virtual void SAL_CALL setTitleRows(
892 const css::table::CellRangeAddress& aTitleRows ) override;
894 // XSheetLinkable
895 virtual css::sheet::SheetLinkMode SAL_CALL getLinkMode() override;
896 virtual void SAL_CALL setLinkMode( css::sheet::SheetLinkMode nLinkMode ) override;
897 virtual OUString SAL_CALL getLinkUrl() override;
898 virtual void SAL_CALL setLinkUrl( const OUString& aLinkUrl ) override;
899 virtual OUString SAL_CALL getLinkSheetName() override;
900 virtual void SAL_CALL setLinkSheetName( const OUString& aLinkSheetName ) override;
901 virtual void SAL_CALL link( const OUString& aUrl,
902 const OUString& aSheetName,
903 const OUString& aFilterName,
904 const OUString& aFilterOptions,
905 css::sheet::SheetLinkMode nMode ) override;
907 // XSheetAuditing
908 virtual sal_Bool SAL_CALL hideDependents( const css::table::CellAddress& aPosition ) override;
909 virtual sal_Bool SAL_CALL hidePrecedents( const css::table::CellAddress& aPosition ) override;
910 virtual sal_Bool SAL_CALL showDependents( const css::table::CellAddress& aPosition ) override;
911 virtual sal_Bool SAL_CALL showPrecedents( const css::table::CellAddress& aPosition ) override;
912 virtual sal_Bool SAL_CALL showErrors( const css::table::CellAddress& aPosition ) override;
913 virtual sal_Bool SAL_CALL showInvalid() override;
914 virtual void SAL_CALL clearArrows() override;
916 // XSheetOutline
917 virtual void SAL_CALL group( const css::table::CellRangeAddress& aRange,
918 css::table::TableOrientation nOrientation ) override;
919 virtual void SAL_CALL ungroup( const css::table::CellRangeAddress& aRange,
920 css::table::TableOrientation nOrientation ) override;
921 virtual void SAL_CALL autoOutline( const css::table::CellRangeAddress& aRange ) override;
922 virtual void SAL_CALL clearOutline() override;
923 virtual void SAL_CALL hideDetail( const css::table::CellRangeAddress& aRange ) override;
924 virtual void SAL_CALL showDetail( const css::table::CellRangeAddress& aRange ) override;
925 virtual void SAL_CALL showLevel( sal_Int16 nLevel,
926 css::table::TableOrientation nOrientation ) override;
928 // XProtectable
929 virtual void SAL_CALL protect( const OUString& aPassword ) override;
930 virtual void SAL_CALL unprotect( const OUString& aPassword ) override;
931 virtual sal_Bool SAL_CALL isProtected() override;
933 // XScenario
934 virtual sal_Bool SAL_CALL getIsScenario() override;
935 virtual OUString SAL_CALL getScenarioComment() override;
936 virtual void SAL_CALL setScenarioComment( const OUString& aScenarioComment ) override;
937 virtual void SAL_CALL addRanges( const css::uno::Sequence<
938 css::table::CellRangeAddress >& aRanges ) override;
939 virtual void SAL_CALL apply() override;
940 // XScenarioEnhanced
941 virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
942 getRanges( ) override;
944 // XExternalSheetName
945 virtual void SAL_CALL setExternalName( const OUString& aUrl, const OUString& aSheetName ) override;
947 // XEventsSupplier
948 virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override;
950 // XPropertySet override due to sheet properties
951 virtual css::uno::Reference< css::beans::XPropertySetInfo >
952 SAL_CALL getPropertySetInfo() override;
954 // XServiceInfo
955 virtual OUString SAL_CALL getImplementationName() override;
956 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
957 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
959 // XUnoTunnel
960 UNO3_GETIMPLEMENTATION_DECL(ScTableSheetObj);
962 // XTypeProvider
963 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
964 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
967 class ScTableColumnObj final : public ScCellRangeObj,
968 public css::container::XNamed
970 private:
971 const SfxItemPropertySet* pColPropSet;
973 virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
974 virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
975 css::uno::Any& ) override;
976 virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
977 const css::uno::Any& aValue ) override;
979 public:
980 ScTableColumnObj(ScDocShell* pDocSh, SCCOL nCol, SCTAB nTab);
981 virtual ~ScTableColumnObj() override;
983 virtual css::uno::Any SAL_CALL queryInterface(
984 const css::uno::Type & rType ) override;
985 virtual void SAL_CALL acquire() throw() override;
986 virtual void SAL_CALL release() throw() override;
988 // XNamed
989 virtual OUString SAL_CALL getName() override;
990 virtual void SAL_CALL setName( const OUString& aName ) override;
992 // XPropertySet override due to column properties
993 virtual css::uno::Reference< css::beans::XPropertySetInfo >
994 SAL_CALL getPropertySetInfo() override;
996 // XServiceInfo
997 virtual OUString SAL_CALL getImplementationName() override;
998 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
999 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1001 // XTypeProvider
1002 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
1003 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
1006 class ScTableRowObj final : public ScCellRangeObj
1008 private:
1009 const SfxItemPropertySet* pRowPropSet;
1011 virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
1012 virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
1013 css::uno::Any& ) override;
1014 virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry,
1015 const css::uno::Any& aValue ) override;
1017 public:
1018 ScTableRowObj(ScDocShell* pDocSh, SCROW nRow, SCTAB nTab);
1019 virtual ~ScTableRowObj() override;
1021 // XPropertySet override due to row properties
1022 virtual css::uno::Reference< css::beans::XPropertySetInfo >
1023 SAL_CALL getPropertySetInfo() override;
1025 // XServiceInfo
1026 virtual OUString SAL_CALL getImplementationName() override;
1027 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1028 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1031 class ScCellsObj final : public cppu::WeakImplHelper<
1032 css::container::XEnumerationAccess,
1033 css::lang::XServiceInfo >,
1034 public SfxListener
1036 private:
1037 ScDocShell* pDocShell;
1038 ScRangeList aRanges;
1040 public:
1041 ScCellsObj(ScDocShell* pDocSh, const ScRangeList& rR);
1042 virtual ~ScCellsObj() override;
1044 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1046 // XEnumerationAccess
1047 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
1048 createEnumeration() override;
1050 // XElementAccess
1051 virtual css::uno::Type SAL_CALL getElementType() override;
1052 virtual sal_Bool SAL_CALL hasElements() override;
1054 // XServiceInfo
1055 virtual OUString SAL_CALL getImplementationName() override;
1056 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1057 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1060 class ScCellsEnumeration final : public cppu::WeakImplHelper<
1061 css::container::XEnumeration,
1062 css::lang::XServiceInfo >,
1063 public SfxListener
1065 private:
1066 ScDocShell* pDocShell;
1067 ScRangeList aRanges;
1068 ScAddress aPos;
1069 std::unique_ptr<ScMarkData> pMark;
1070 bool bAtEnd;
1072 private:
1073 void Advance_Impl();
1074 void CheckPos_Impl();
1076 public:
1077 ScCellsEnumeration(ScDocShell* pDocSh, const ScRangeList& rR);
1078 virtual ~ScCellsEnumeration() override;
1080 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1082 // XEnumeration
1083 virtual sal_Bool SAL_CALL hasMoreElements() override;
1084 virtual css::uno::Any SAL_CALL nextElement() override;
1086 // XServiceInfo
1087 virtual OUString SAL_CALL getImplementationName() override;
1088 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1089 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1092 class ScCellFormatsObj final : public cppu::WeakImplHelper<
1093 css::container::XIndexAccess,
1094 css::container::XEnumerationAccess,
1095 css::lang::XServiceInfo >,
1096 public SfxListener
1098 private:
1099 ScDocShell* pDocShell;
1100 ScRange const aTotalRange;
1102 private:
1103 ScCellRangeObj* GetObjectByIndex_Impl(long nIndex) const;
1105 public:
1106 ScCellFormatsObj(ScDocShell* pDocSh, const ScRange& rR);
1107 virtual ~ScCellFormatsObj() override;
1109 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1111 // XIndexAccess
1112 virtual sal_Int32 SAL_CALL getCount() override;
1113 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
1115 // XEnumerationAccess
1116 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
1117 createEnumeration() override;
1119 // XElementAccess
1120 virtual css::uno::Type SAL_CALL getElementType() override;
1121 virtual sal_Bool SAL_CALL hasElements() override;
1123 // XServiceInfo
1124 virtual OUString SAL_CALL getImplementationName() override;
1125 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1126 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1129 class ScCellFormatsEnumeration final : public cppu::WeakImplHelper<
1130 css::container::XEnumeration,
1131 css::lang::XServiceInfo >,
1132 public SfxListener
1134 private:
1135 ScDocShell* pDocShell;
1136 SCTAB const nTab;
1137 std::unique_ptr<ScAttrRectIterator> pIter;
1138 ScRange aNext;
1139 bool bAtEnd;
1140 bool bDirty;
1142 private:
1143 void Advance_Impl();
1144 ScCellRangeObj* NextObject_Impl();
1146 public:
1147 ScCellFormatsEnumeration(ScDocShell* pDocSh, const ScRange& rR);
1148 virtual ~ScCellFormatsEnumeration() override;
1150 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1152 // XEnumeration
1153 virtual sal_Bool SAL_CALL hasMoreElements() override;
1154 virtual css::uno::Any SAL_CALL nextElement() override;
1156 // XServiceInfo
1157 virtual OUString SAL_CALL getImplementationName() override;
1158 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1159 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1162 typedef std::vector< ScRangeList > ScMyRangeLists;
1164 class ScUniqueCellFormatsObj final : public cppu::WeakImplHelper<
1165 css::container::XIndexAccess,
1166 css::container::XEnumerationAccess,
1167 css::lang::XServiceInfo >,
1168 public SfxListener
1170 private:
1171 ScDocShell* pDocShell;
1172 ScRange const aTotalRange;
1173 ScMyRangeLists aRangeLists;
1175 public:
1176 ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange& rR);
1177 virtual ~ScUniqueCellFormatsObj() override;
1179 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1181 // XIndexAccess
1182 virtual sal_Int32 SAL_CALL getCount() override;
1183 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
1185 // XEnumerationAccess
1186 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
1187 createEnumeration() override;
1189 // XElementAccess
1190 virtual css::uno::Type SAL_CALL getElementType() override;
1191 virtual sal_Bool SAL_CALL hasElements() override;
1193 // XServiceInfo
1194 virtual OUString SAL_CALL getImplementationName() override;
1195 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1196 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1199 class ScUniqueCellFormatsEnumeration final : public cppu::WeakImplHelper<
1200 css::container::XEnumeration,
1201 css::lang::XServiceInfo >,
1202 public SfxListener
1204 private:
1205 ScMyRangeLists aRangeLists;
1206 ScDocShell* pDocShell;
1207 sal_Int32 nCurrentPosition;
1209 public:
1210 ScUniqueCellFormatsEnumeration(ScDocShell* pDocShell, const ScMyRangeLists& rRangeLists);
1211 virtual ~ScUniqueCellFormatsEnumeration() override;
1213 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1215 // XEnumeration
1216 virtual sal_Bool SAL_CALL hasMoreElements() override;
1217 virtual css::uno::Any SAL_CALL nextElement() override;
1219 // XServiceInfo
1220 virtual OUString SAL_CALL getImplementationName() override;
1221 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1222 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1225 #endif
1227 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */