LibreOffice Module sc (master)  1
cellsuno.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #pragma once
21 
22 #include <config_options.h>
23 #include "address.hxx"
24 #include "rangelst.hxx"
25 
26 #include <formula/grammar.hxx>
27 #include <rtl/ref.hxx>
28 #include <sal/types.h>
29 #include <tools/link.hxx>
30 #include <svl/itemset.hxx>
31 #include <svl/lstner.hxx>
32 #include <svl/listener.hxx>
33 #include <com/sun/star/table/XTableChartsSupplier.hpp>
34 #include <com/sun/star/table/XTablePivotChartsSupplier.hpp>
35 #include <com/sun/star/chart/XChartDataArray.hpp>
36 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
37 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
38 #include <com/sun/star/sheet/XSheetCellRange.hpp>
39 #include <com/sun/star/sheet/XFormulaQuery.hpp>
40 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
41 #include <com/sun/star/sheet/XSheetOperation.hpp>
42 #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
43 #include <com/sun/star/sheet/XCellFormatRangesSupplier.hpp>
44 #include <com/sun/star/sheet/XUniqueCellFormatRangesSupplier.hpp>
45 #include <com/sun/star/sheet/XCellRangesQuery.hpp>
46 #include <com/sun/star/sheet/XSheetFilterableEx.hpp>
47 #include <com/sun/star/sheet/XSpreadsheet.hpp>
48 #include <com/sun/star/sheet/XSheetPageBreak.hpp>
49 #include <com/sun/star/sheet/XCellRangeMovement.hpp>
50 #include <com/sun/star/text/XText.hpp>
51 #include <com/sun/star/sheet/XPrintAreas.hpp>
52 #include <com/sun/star/sheet/XSheetLinkable.hpp>
53 #include <com/sun/star/sheet/XSubTotalCalculatable.hpp>
54 #include <com/sun/star/sheet/XArrayFormulaRange.hpp>
55 #include <com/sun/star/sheet/XCellRangeData.hpp>
56 #include <com/sun/star/sheet/XCellRangeFormula.hpp>
57 #include <com/sun/star/sheet/XCellSeries.hpp>
58 #include <com/sun/star/sheet/XMultipleOperation.hpp>
59 #include <com/sun/star/sheet/XFormulaTokens.hpp>
60 #include <com/sun/star/sheet/XArrayFormulaTokens.hpp>
61 #include <com/sun/star/sheet/XCellAddressable.hpp>
62 #include <com/sun/star/util/XReplaceable.hpp>
63 #include <com/sun/star/util/XIndent.hpp>
64 #include <com/sun/star/lang/XServiceInfo.hpp>
65 #include <com/sun/star/container/XNameContainer.hpp>
66 #include <com/sun/star/util/XMergeable.hpp>
67 #include <com/sun/star/table/XAutoFormattable.hpp>
68 #include <com/sun/star/util/XSortable.hpp>
69 #include <com/sun/star/util/XImportable.hpp>
70 #include <com/sun/star/table/XColumnRowRange.hpp>
71 #include <com/sun/star/table/XCell2.hpp>
72 #include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
73 #include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
74 #include <com/sun/star/sheet/XScenariosSupplier.hpp>
75 #include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
76 #include <com/sun/star/sheet/XSheetAuditing.hpp>
77 #include <com/sun/star/sheet/XSheetOutline.hpp>
78 #include <com/sun/star/util/XProtectable.hpp>
79 #include <com/sun/star/sheet/XScenario.hpp>
80 #include <com/sun/star/sheet/XScenarioEnhanced.hpp>
81 #include <com/sun/star/util/XModifyBroadcaster.hpp>
82 #include <com/sun/star/beans/XPropertyState.hpp>
83 #include <com/sun/star/beans/XMultiPropertySet.hpp>
84 #include <com/sun/star/lang/XUnoTunnel.hpp>
85 #include <com/sun/star/document/XActionLockable.hpp>
86 #include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
87 #include <com/sun/star/sheet/XExternalSheetName.hpp>
88 #include <com/sun/star/document/XEventsSupplier.hpp>
90 #include <cppuhelper/implbase.hxx>
91 #include <cppuhelper/weakref.hxx>
92 
93 #include <memory>
94 #include <optional>
95 #include <vector>
96 
97 namespace com::sun::star::table { struct BorderLine2; }
98 namespace com::sun::star::table { struct BorderLine; }
99 namespace com::sun::star::table { struct TableBorder2; }
100 namespace com::sun::star::table { struct TableBorder; }
101 
102 class ScDocShell;
103 class ScMarkData;
104 class ScMemChart;
105 class ScPrintRangeSaver;
106 class ScAttrRectIterator;
107 class ScCellRangeObj;
108 class ScPatternAttr;
109 class SvxBoxItem;
110 class SvxBoxInfoItem;
111 class SvxItemPropertySet;
112 class SvxUnoText;
113 class ScDocument;
114 class SfxBroadcaster;
115 class SfxHint;
116 class SfxItemPropertyMap;
117 class SfxItemPropertySet;
119 
120 namespace editeng { class SvxBorderLine; }
121 
122 class ScLinkListener final : public SvtListener
123 {
125 public:
126  ScLinkListener(const Link<const SfxHint&,void>& rL) : aLink(rL) {}
127  virtual ~ScLinkListener() override;
128  virtual void Notify( const SfxHint& rHint ) override;
129 };
130 
131 typedef std::vector< css::uno::Reference< css::util::XModifyListener > > XModifyListenerArr_Impl;
132 
133 // ScCellRangesBase - base class for ScCellRangesObj (with access by index)
134 // and ScCellRangeObj (without access by index)
135 
136 // XServiceInfo is implemented in derived classes
137 
139 {
140 public:
141  static const ::editeng::SvxBorderLine* GetBorderLine( ::editeng::SvxBorderLine& rLine, const css::table::BorderLine& rStruct );
142  static const ::editeng::SvxBorderLine* GetBorderLine( ::editeng::SvxBorderLine& rLine, const css::table::BorderLine2& rStruct );
143  static void FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const css::table::TableBorder& rBorder );
144  static void FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const css::table::TableBorder2& rBorder );
145  static void FillBorderLine( css::table::BorderLine& rStruct, const ::editeng::SvxBorderLine* pLine );
146  static void FillBorderLine( css::table::BorderLine2& rStruct, const ::editeng::SvxBorderLine* pLine );
147  static void AssignTableBorderToAny( css::uno::Any& rAny,
148  const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner, bool bInvalidateHorVerDist = false );
149  static void AssignTableBorder2ToAny( css::uno::Any& rAny,
150  const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner, bool bInvalidateHorVerDist = false );
151  static void ApplyBorder( ScDocShell* pDocShell, const ScRangeList& rRanges,
152  const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner );
153 };
154 
155 namespace ooo::vba::excel {
156  class ScVbaCellRangeAccess; // Vba Helper class
157 }
158 
160  public cppu::WeakImplHelper<
161  css::beans::XPropertySet,
162  css::beans::XMultiPropertySet,
163  css::beans::XPropertyState,
164  css::sheet::XSheetOperation,
165  css::chart::XChartDataArray,
166  css::util::XIndent,
167  css::sheet::XCellRangesQuery,
168  css::sheet::XFormulaQuery,
169  css::util::XReplaceable,
170  css::util::XModifyBroadcaster,
171  css::lang::XServiceInfo,
172  css::lang::XUnoTunnel,
173  css::beans::XTolerantMultiPropertySet>,
174  public SfxListener
175 {
176  friend class ScTabViewObj; // for select()
177  friend class ScTableSheetObj; // for createCursorByRange()
179 
180 private:
183  std::unique_ptr<ScLinkListener> pValueListener;
184  std::unique_ptr<ScPatternAttr> pCurrentFlat;
185  std::unique_ptr<ScPatternAttr> pCurrentDeep;
186  std::optional<SfxItemSet> moCurrentDataSet;
187  std::optional<SfxItemSet> moNoDfltCurrentDataSet;
188  std::unique_ptr<ScMarkData> pMarkData;
190  sal_Int64 nObjectId;
196 
197  DECL_DLLPRIVATE_LINK( ValueListenerHdl, const SfxHint&, void );
198 
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;
204 
205  const ScPatternAttr* GetCurrentAttrsFlat();
206  const ScPatternAttr* GetCurrentAttrsDeep();
207  SfxItemSet* GetCurrentDataSet(bool bNoDflt = false);
208  void ForgetMarkData();
209  void ForgetCurrentAttrs();
210 
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);
217 
218 protected:
219  const ScMarkData* GetMarkData();
220 
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 SfxItemPropertyMapEntry* pEntry );
226  virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
227  css::uno::Any& );
230  virtual void SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
231  const css::uno::Any& aValue );
232 
233 public:
234  ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR);
235  ScCellRangesBase(ScDocShell* pDocSh, const ScRangeList& rR);
236  virtual ~ScCellRangesBase() override;
237 
238  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
239  virtual void RefChanged();
240 
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);
246 
247  // arouse object created via service:
248  void InitInsertRange(ScDocShell* pDocSh, const ScRange& rR);
249 
250  void SetNewRange(const ScRange& rNew); // for cursor
251  void SetNewRanges(const ScRangeList& rNew);
252 
253  void SetCursorOnly(bool bSet);
254  bool IsCursorOnly() const { return bCursorOnly; }
255 
256  // XSheetOperation
257  virtual double SAL_CALL computeFunction( css::sheet::GeneralFunction nFunction ) override;
258  virtual void SAL_CALL clearContents( sal_Int32 nContentFlags ) override;
259 
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;
275 
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;
286 
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;
295 
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;
305 
306  // XIndent
307  virtual void SAL_CALL decrementIndent() override;
308  virtual void SAL_CALL incrementIndent() override;
309 
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;
317 
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;
326 
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;
345 
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;
351 
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;
362 
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;
367 
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;
371 
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;
376 
377  // XUnoTunnel
379 };
380 
381 class UNLESS_MERGELIBS(SC_DLLPUBLIC) ScCellRangesObj final : public ScCellRangesBase,
382  public css::sheet::XSheetCellRangeContainer,
383  public css::container::XNameContainer,
384  public css::container::XEnumerationAccess
385 {
386 public:
387  struct ScNamedEntry
388  {
389  OUString aName;
390  ScRange aRange;
391  const OUString& GetName() const { return aName; }
392  const ScRange& GetRange() const { return aRange; }
393  };
394 private:
395  std::vector<ScNamedEntry> m_aNamedEntries;
396 
397  rtl::Reference<ScCellRangeObj> GetObjectByIndex_Impl(sal_Int32 nIndex) const;
398 
399 public:
400  IF_MERGELIBS(SC_DLLPUBLIC)
401  ScCellRangesObj(ScDocShell* pDocSh, const ScRangeList& rR);
402  virtual ~ScCellRangesObj() override;
403 
404  virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
405  IF_MERGELIBS(SC_DLLPUBLIC)
406  virtual void SAL_CALL acquire() noexcept override;
407  virtual void SAL_CALL release() noexcept override;
408 
409  virtual void RefChanged() override;
410 
411  // XSheetCellRanges
412  virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL
413  getCells() override;
414  virtual OUString SAL_CALL getRangeAddressesAsString() override;
415  virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
416  getRangeAddresses() override;
417 
418  // XSheetCellRangeContainer
419  virtual void SAL_CALL addRangeAddress( const css::table::CellRangeAddress& rRange,
420  sal_Bool bMergeRanges ) override;
421  virtual void SAL_CALL removeRangeAddress( const css::table::CellRangeAddress& rRange ) override;
422  virtual void SAL_CALL addRangeAddresses( const css::uno::Sequence<
423  css::table::CellRangeAddress >& rRanges,
424  sal_Bool bMergeRanges ) override;
425  virtual void SAL_CALL removeRangeAddresses( const css::uno::Sequence<
426  css::table::CellRangeAddress >& rRanges ) override;
427 
428  // XNameContainer
429  virtual void SAL_CALL insertByName( const OUString& aName,
430  const css::uno::Any& aElement ) override;
431  virtual void SAL_CALL removeByName( const OUString& Name ) override;
432 
433  // XNameReplace
434  virtual void SAL_CALL replaceByName( const OUString& aName,
435  const css::uno::Any& aElement ) override;
436 
437  // XNameAccess
438  virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
439  virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
440  virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
441 
442  // XIndexAccess
443  virtual sal_Int32 SAL_CALL getCount() override;
444  virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
445 
446  // XElementAccess
447  virtual css::uno::Type SAL_CALL getElementType() override;
448  virtual sal_Bool SAL_CALL hasElements() override;
449 
450  // XEnumerationAccess
451  virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
452  createEnumeration() override;
453 
454  // XServiceInfo
455  virtual OUString SAL_CALL getImplementationName() override;
456  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
457  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
458 
459  // XTypeProvider
460  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
461  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
462 };
463 
465  public css::sheet::XCellRangeAddressable,
466  public css::sheet::XSheetCellRange,
467  public css::sheet::XArrayFormulaRange,
468  public css::sheet::XArrayFormulaTokens,
469  public css::sheet::XCellRangeData,
470  public css::sheet::XCellRangeFormula,
471  public css::sheet::XMultipleOperation,
472  public css::util::XMergeable,
473  public css::sheet::XCellSeries,
474  public css::table::XAutoFormattable,
475  public css::util::XSortable,
476  public css::sheet::XSheetFilterableEx,
477  public css::sheet::XSubTotalCalculatable,
478  public css::util::XImportable,
479  public css::sheet::XCellFormatRangesSupplier,
480  public css::sheet::XUniqueCellFormatRangesSupplier,
481  public css::table::XColumnRowRange
482 {
483 private:
486 
487 protected:
488  const ScRange& GetRange() const { return aRange; }
489  virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
490  virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
491  css::uno::Any& ) override;
492  virtual void SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
493  const css::uno::Any& aValue ) override;
494 
497  css::uno::Reference< css::table::XCell >
498  GetCellByPosition_Impl( sal_Int32 nColumn, sal_Int32 nRow );
499 
501  void SetArrayFormula_Impl( const OUString& rFormula,
502  const formula::FormulaGrammar::Grammar eGrammar );
503 
504 public:
505  ScCellRangeObj(ScDocShell* pDocSh, const ScRange& rR);
506  virtual ~ScCellRangeObj() override;
507 
508  // uses ObjectShell from document, if set (returns NULL otherwise)
509  static css::uno::Reference<css::table::XCellRange>
510  CreateRangeFromDoc( const ScDocument& rDoc, const ScRange& rR );
511 
512  virtual css::uno::Any SAL_CALL queryInterface(
513  const css::uno::Type & rType ) override;
514  virtual void SAL_CALL acquire() noexcept override;
515  virtual void SAL_CALL release() noexcept override;
516 
517  virtual void RefChanged() override;
518 
519  // XCellRangeAddressable
520  virtual css::table::CellRangeAddress SAL_CALL getRangeAddress() override;
521 
522  // XSheetCellRange
523  virtual css::uno::Reference< css::sheet::XSpreadsheet > SAL_CALL
524  getSpreadsheet() override;
525 
526  // XArrayFormulaRange
527  virtual OUString SAL_CALL getArrayFormula() override;
528  virtual void SAL_CALL setArrayFormula( const OUString& aFormula ) override;
529 
530  // XArrayFormulaTokens
531  virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL getArrayTokens() override;
532  virtual void SAL_CALL setArrayTokens( const css::uno::Sequence<
533  css::sheet::FormulaToken >& aTokens ) override;
534 
535  // XCellRangeData
536  virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getDataArray() override;
537  virtual void SAL_CALL setDataArray( const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aArray ) override;
538 
539  // XCellRangeFormula
540  virtual css::uno::Sequence< css::uno::Sequence<
541  OUString > > SAL_CALL getFormulaArray() override;
542  virtual void SAL_CALL setFormulaArray( const css::uno::Sequence< css::uno::Sequence< OUString > >& aArray ) override;
543 
544  // XMultipleOperation
545  virtual void SAL_CALL setTableOperation(
546  const css::table::CellRangeAddress& aFormulaRange,
547  css::sheet::TableOperationMode nMode,
548  const css::table::CellAddress& aColumnCell,
549  const css::table::CellAddress& aRowCell ) override;
550 
551  // XMergeable
552  virtual void SAL_CALL merge( sal_Bool bMerge ) override;
553  virtual sal_Bool SAL_CALL getIsMerged() override;
554 
555  // XCellSeries
556  virtual void SAL_CALL fillSeries( css::sheet::FillDirection nFillDirection,
557  css::sheet::FillMode nFillMode,
558  css::sheet::FillDateMode nFillDateMode,
559  double fStep, double fEndValue ) override;
560  virtual void SAL_CALL fillAuto( css::sheet::FillDirection nFillDirection,
561  sal_Int32 nSourceCount ) override;
562 
563  // XAutoFormattable
564  virtual void SAL_CALL autoFormat( const OUString& aName ) override;
565 
566  // XSortable
567  virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL
568  createSortDescriptor() override;
569  virtual void SAL_CALL sort( const css::uno::Sequence<
570  css::beans::PropertyValue >& xDescriptor ) override;
571 
572  // XSheetFilterableEx
573  virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL
574  createFilterDescriptorByObject( const css::uno::Reference<
575  css::sheet::XSheetFilterable >& xObject ) override;
576 
577  // XSheetFilterable
578  virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL
579  createFilterDescriptor( sal_Bool bEmpty ) override;
580  virtual void SAL_CALL filter( const css::uno::Reference<
581  css::sheet::XSheetFilterDescriptor >& xDescriptor ) override;
582 
583  // XSubTotalCalculatable
584  virtual css::uno::Reference< css::sheet::XSubTotalDescriptor > SAL_CALL
585  createSubTotalDescriptor( sal_Bool bEmpty ) override;
586  virtual void SAL_CALL applySubTotals(const css::uno::Reference< css::sheet::XSubTotalDescriptor >& xDescriptor,
587  sal_Bool bReplace) override;
588  virtual void SAL_CALL removeSubTotals() override;
589 
590  // XImportable
591  virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL
592  createImportDescriptor( sal_Bool bEmpty ) override;
593  virtual void SAL_CALL doImport( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor ) override;
594 
595  // XCellFormatRangesSupplier
596  virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
597  getCellFormatRanges() override;
598 
599  // XUniqueCellFormatRangesSupplier
600  virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
601  getUniqueCellFormatRanges() override;
602 
603  // XColumnRowRange
604  virtual css::uno::Reference< css::table::XTableColumns > SAL_CALL
605  getColumns() override;
606  virtual css::uno::Reference< css::table::XTableRows > SAL_CALL
607  getRows() override;
608 
609  // XCellRange
610  virtual css::uno::Reference< css::table::XCell > SAL_CALL
611  getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) override;
612  virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
613  getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop,
614  sal_Int32 nRight, sal_Int32 nBottom ) override;
615  virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
616  getCellRangeByName( const OUString& aRange ) override;
618  css::uno::Reference< css::table::XCellRange >
619  getCellRangeByName( const OUString& aRange, const ScAddress::Details& rDetails );
620 
621  // XPropertySet override due to Range-Properties
622  virtual css::uno::Reference< css::beans::XPropertySetInfo >
623  SAL_CALL getPropertySetInfo() override;
624 
625  // XServiceInfo
626  virtual OUString SAL_CALL getImplementationName() override;
627  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
628  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
629 
630  // XTypeProvider
631  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
632  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
633 };
634 
636 
637 class SC_DLLPUBLIC ScCellObj final : public ScCellRangeObj,
638  public css::text::XText,
639  public css::container::XEnumerationAccess,
640  public css::table::XCell2,
641  public css::sheet::XFormulaTokens,
642  public css::sheet::XCellAddressable,
643  public css::sheet::XSheetAnnotationAnchor,
644  public css::text::XTextFieldsSupplier,
645  public css::document::XActionLockable
646 {
647 private:
651  sal_Int16 nActionLockCount;
652 
653 private:
654  OUString GetInputString_Impl(bool bEnglish) const;
655  OUString GetOutputString_Impl() const;
656  void SetString_Impl(const OUString& rString, bool bInterpret, bool bEnglish);
657  double GetValue_Impl() const;
658  void SetValue_Impl(double fValue);
659  css::table::CellContentType GetContentType_Impl();
660  sal_Int32 GetResultType_Impl() const;
661 
662  virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
663  virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
664  css::uno::Any& ) override;
665  virtual void SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
666  const css::uno::Any& aValue ) override;
667 
668 public:
669  static const SvxItemPropertySet* GetEditPropertySet();
670  static const SfxItemPropertyMap& GetCellPropertyMap();
671 
672  ScCellObj(ScDocShell* pDocSh, const ScAddress& rP);
673  virtual ~ScCellObj() override;
674 
675  virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
676  virtual void SAL_CALL acquire() noexcept override;
677  virtual void SAL_CALL release() noexcept override;
678 
679  virtual void RefChanged() override;
680 
681  SvxUnoText& GetUnoText();
682 
683  // XML import needs to set results at formula cells,
684  // not meant for any other purpose.
685  const ScAddress& GetPosition() const { return aCellPos; }
686 
687  void InputEnglishString( const OUString& rText );
688 
689  // XText
690  virtual void SAL_CALL insertTextContent( const css::uno::Reference< css::text::XTextRange >& xRange,
691  const css::uno::Reference< css::text::XTextContent >& xContent,
692  sal_Bool bAbsorb ) override;
693  virtual void SAL_CALL removeTextContent( const css::uno::Reference< css::text::XTextContent >& xContent ) override;
694 
695  // XSimpleText
696  virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
697  createTextCursor() override;
698  virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
699  createTextCursorByRange( const css::uno::Reference< css::text::XTextRange >& aTextPosition ) override;
700  virtual void SAL_CALL insertString( const css::uno::Reference< css::text::XTextRange >& xRange,
701  const OUString& aString, sal_Bool bAbsorb ) override;
702  virtual void SAL_CALL insertControlCharacter( const css::uno::Reference< css::text::XTextRange >& xRange,
703  sal_Int16 nControlCharacter, sal_Bool bAbsorb ) override;
704 
705  // XTextRange
706  virtual css::uno::Reference< css::text::XText > SAL_CALL
707  getText() override;
708  virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
709  getStart() override;
710  virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
711  getEnd() override;
712  virtual OUString SAL_CALL getString() override;
713  virtual void SAL_CALL setString( const OUString& aString ) override;
714 
715  // XEnumerationAccess
716  virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
717  createEnumeration() override;
718 
719  // XElementAccess
720  virtual css::uno::Type SAL_CALL getElementType() override;
721  virtual sal_Bool SAL_CALL hasElements() override;
722 
723  // XCell
724  virtual OUString SAL_CALL getFormula() override;
725  virtual void SAL_CALL setFormula( const OUString& aFormula ) override;
726  virtual void SAL_CALL setFormulaResult( double nValue ) override;
727  virtual void SAL_CALL setFormulaString( const OUString& aFormula ) override;
728  virtual double SAL_CALL getValue() override;
729  virtual void SAL_CALL setValue( double nValue ) override;
730  virtual css::table::CellContentType SAL_CALL getType() override;
731  virtual sal_Int32 SAL_CALL getError() override;
732 
733  // XFormulaTokens
734  virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL getTokens() override;
735  virtual void SAL_CALL setTokens( const css::uno::Sequence< css::sheet::FormulaToken >& aTokens ) override;
736 
737  // XCellAddressable
738  virtual css::table::CellAddress SAL_CALL getCellAddress() override;
739 
740  // XSheetAnnotationAnchor
741  virtual css::uno::Reference< css::sheet::XSheetAnnotation > SAL_CALL
742  getAnnotation() override;
743 
744  // XTextFieldsSupplier
745  virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL
746  getTextFields() override;
747  virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL
748  getTextFieldMasters() override;
749 
750  // XPropertySet override due to cell properties
751  virtual css::uno::Reference< css::beans::XPropertySetInfo >
752  SAL_CALL getPropertySetInfo() override;
753 
754  // XServiceInfo
755  virtual OUString SAL_CALL getImplementationName() override;
756  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
757  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
758 
759  // XTypeProvider
760  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
761  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
762 
763  // XActionLockable
764  virtual sal_Bool SAL_CALL isActionLocked() override;
765  virtual void SAL_CALL addActionLock() override;
766  virtual void SAL_CALL removeActionLock() override;
767  virtual void SAL_CALL setActionLocks( sal_Int16 nLock ) override;
768  virtual sal_Int16 SAL_CALL resetActionLocks() override;
769 };
770 
772  public css::sheet::XSpreadsheet,
773  public css::container::XNamed,
774  public css::sheet::XSheetPageBreak,
775  public css::sheet::XCellRangeMovement,
776  public css::table::XTableChartsSupplier,
777  public css::table::XTablePivotChartsSupplier,
778  public css::sheet::XDataPilotTablesSupplier,
779  public css::sheet::XScenariosSupplier,
780  public css::sheet::XSheetAnnotationsSupplier,
781  public css::drawing::XDrawPageSupplier,
782  public css::sheet::XPrintAreas,
783  public css::sheet::XSheetLinkable,
784  public css::sheet::XSheetAuditing,
785  public css::sheet::XSheetOutline,
786  public css::util::XProtectable,
787  public css::sheet::XScenario,
788  public css::sheet::XScenarioEnhanced,
789  public css::sheet::XExternalSheetName,
790  public css::document::XEventsSupplier
791 {
792  friend class ScTableSheetsObj; // for insertByName()
793 
794 private:
796 
797  SCTAB GetTab_Impl() const;
798  void PrintAreaUndo_Impl( std::unique_ptr<ScPrintRangeSaver> pOldRanges );
799 
800  virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
801  virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
802  css::uno::Any& ) override;
803  virtual void SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
804  const css::uno::Any& aValue ) override;
805 
806 public:
807  ScTableSheetObj(ScDocShell* pDocSh, SCTAB nTab);
808  virtual ~ScTableSheetObj() override;
809 
810  void InitInsertSheet(ScDocShell* pDocSh, SCTAB nTab);
811 
812  virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
813  virtual void SAL_CALL acquire() noexcept override;
814  virtual void SAL_CALL release() noexcept override;
815 
816  // XSpreadsheet
817  virtual css::uno::Reference< css::sheet::XSheetCellCursor >
818  SAL_CALL createCursor() override;
819  virtual css::uno::Reference< css::sheet::XSheetCellCursor > SAL_CALL
820  createCursorByRange( const css::uno::Reference<
821  css::sheet::XSheetCellRange >& aRange ) override;
822 
823  // XSheetCellRange
824  virtual css::uno::Reference< css::sheet::XSpreadsheet > SAL_CALL
825  getSpreadsheet() override;
826 
827  // XCellRange
828  virtual css::uno::Reference< css::table::XCell > SAL_CALL
829  getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) override;
830  virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
831  getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop,
832  sal_Int32 nRight, sal_Int32 nBottom ) override;
833  using ScCellRangeObj::getCellRangeByName;
834  virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
835  getCellRangeByName( const OUString& aRange ) override;
836 
837  // XNamed
838  virtual OUString SAL_CALL getName() override;
839  virtual void SAL_CALL setName( const OUString& aName ) override;
840 
841  // XSheetPageBreak
842  virtual css::uno::Sequence< css::sheet::TablePageBreakData > SAL_CALL
843  getColumnPageBreaks() override;
844  virtual css::uno::Sequence< css::sheet::TablePageBreakData > SAL_CALL
845  getRowPageBreaks() override;
846  virtual void SAL_CALL removeAllManualPageBreaks() override;
847 
848  // XCellRangeMovement
849  virtual void SAL_CALL insertCells( const css::table::CellRangeAddress& aRange,
850  css::sheet::CellInsertMode nMode ) override;
851  virtual void SAL_CALL removeRange( const css::table::CellRangeAddress& aRange,
852  css::sheet::CellDeleteMode nMode ) override;
853  virtual void SAL_CALL moveRange( const css::table::CellAddress& aDestination,
854  const css::table::CellRangeAddress& aSource ) override;
855  virtual void SAL_CALL copyRange( const css::table::CellAddress& aDestination,
856  const css::table::CellRangeAddress& aSource ) override;
857 
858  // XTableChartsSupplier
859  virtual css::uno::Reference< css::table::XTableCharts > SAL_CALL
860  getCharts() override;
861 
862  // XTablePivotChartsSupplier
863  virtual css::uno::Reference<css::table::XTablePivotCharts> SAL_CALL
864  getPivotCharts() override;
865 
866  // XDataPilotTablesSupplier
867  virtual css::uno::Reference< css::sheet::XDataPilotTables > SAL_CALL
868  getDataPilotTables() override;
869 
870  // XScenariosSupplier
871  virtual css::uno::Reference< css::sheet::XScenarios > SAL_CALL
872  getScenarios() override;
873 
874  // XSheetAnnotationsSupplier
875  virtual css::uno::Reference< css::sheet::XSheetAnnotations > SAL_CALL
876  getAnnotations() override;
877 
878  // XDrawPageSupplier
879  virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL
880  getDrawPage() override;
881 
882  // XPrintAreas
883  virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
884  getPrintAreas() override;
885  virtual void SAL_CALL setPrintAreas( const css::uno::Sequence<
886  css::table::CellRangeAddress >& aPrintAreas ) override;
887  virtual sal_Bool SAL_CALL getPrintTitleColumns() override;
888  virtual void SAL_CALL setPrintTitleColumns( sal_Bool bPrintTitleColumns ) override;
889  virtual css::table::CellRangeAddress SAL_CALL getTitleColumns() override;
890  virtual void SAL_CALL setTitleColumns(
891  const css::table::CellRangeAddress& aTitleColumns ) override;
892  virtual sal_Bool SAL_CALL getPrintTitleRows() override;
893  virtual void SAL_CALL setPrintTitleRows( sal_Bool bPrintTitleRows ) override;
894  virtual css::table::CellRangeAddress SAL_CALL getTitleRows() override;
895  virtual void SAL_CALL setTitleRows(
896  const css::table::CellRangeAddress& aTitleRows ) override;
897 
898  // XSheetLinkable
899  virtual css::sheet::SheetLinkMode SAL_CALL getLinkMode() override;
900  virtual void SAL_CALL setLinkMode( css::sheet::SheetLinkMode nLinkMode ) override;
901  virtual OUString SAL_CALL getLinkUrl() override;
902  virtual void SAL_CALL setLinkUrl( const OUString& aLinkUrl ) override;
903  virtual OUString SAL_CALL getLinkSheetName() override;
904  virtual void SAL_CALL setLinkSheetName( const OUString& aLinkSheetName ) override;
905  virtual void SAL_CALL link( const OUString& aUrl,
906  const OUString& aSheetName,
907  const OUString& aFilterName,
908  const OUString& aFilterOptions,
909  css::sheet::SheetLinkMode nMode ) override;
910 
911  // XSheetAuditing
912  virtual sal_Bool SAL_CALL hideDependents( const css::table::CellAddress& aPosition ) override;
913  virtual sal_Bool SAL_CALL hidePrecedents( const css::table::CellAddress& aPosition ) override;
914  virtual sal_Bool SAL_CALL showDependents( const css::table::CellAddress& aPosition ) override;
915  virtual sal_Bool SAL_CALL showPrecedents( const css::table::CellAddress& aPosition ) override;
916  virtual sal_Bool SAL_CALL showErrors( const css::table::CellAddress& aPosition ) override;
917  virtual sal_Bool SAL_CALL showInvalid() override;
918  virtual void SAL_CALL clearArrows() override;
919 
920  // XSheetOutline
921  virtual void SAL_CALL group( const css::table::CellRangeAddress& aRange,
922  css::table::TableOrientation nOrientation ) override;
923  virtual void SAL_CALL ungroup( const css::table::CellRangeAddress& aRange,
924  css::table::TableOrientation nOrientation ) override;
925  virtual void SAL_CALL autoOutline( const css::table::CellRangeAddress& aRange ) override;
926  virtual void SAL_CALL clearOutline() override;
927  virtual void SAL_CALL hideDetail( const css::table::CellRangeAddress& aRange ) override;
928  virtual void SAL_CALL showDetail( const css::table::CellRangeAddress& aRange ) override;
929  virtual void SAL_CALL showLevel( sal_Int16 nLevel,
930  css::table::TableOrientation nOrientation ) override;
931 
932  // XProtectable
933  virtual void SAL_CALL protect( const OUString& aPassword ) override;
934  virtual void SAL_CALL unprotect( const OUString& aPassword ) override;
935  virtual sal_Bool SAL_CALL isProtected() override;
936 
937  // XScenario
938  virtual sal_Bool SAL_CALL getIsScenario() override;
939  virtual OUString SAL_CALL getScenarioComment() override;
940  virtual void SAL_CALL setScenarioComment( const OUString& aScenarioComment ) override;
941  virtual void SAL_CALL addRanges( const css::uno::Sequence<
942  css::table::CellRangeAddress >& aRanges ) override;
943  virtual void SAL_CALL apply() override;
944  // XScenarioEnhanced
945  virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
946  getRanges( ) override;
947 
948  // XExternalSheetName
949  virtual void SAL_CALL setExternalName( const OUString& aUrl, const OUString& aSheetName ) override;
950 
951  // XEventsSupplier
952  virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override;
953 
954  // XPropertySet override due to sheet properties
955  virtual css::uno::Reference< css::beans::XPropertySetInfo >
956  SAL_CALL getPropertySetInfo() override;
957 
958  // XServiceInfo
959  virtual OUString SAL_CALL getImplementationName() override;
960  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
961  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
962 
963  // XUnoTunnel
964  UNO3_GETIMPLEMENTATION_DECL(ScTableSheetObj);
965 
966  // XTypeProvider
967  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
968  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
969 };
970 
971 class ScTableColumnObj final : public ScCellRangeObj,
972  public css::container::XNamed
973 {
974 private:
976 
977  virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
978  virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
979  css::uno::Any& ) override;
980  virtual void SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
981  const css::uno::Any& aValue ) override;
982 
983 public:
984  ScTableColumnObj(ScDocShell* pDocSh, SCCOL nCol, SCTAB nTab);
985  virtual ~ScTableColumnObj() override;
986 
987  virtual css::uno::Any SAL_CALL queryInterface(
988  const css::uno::Type & rType ) override;
989  virtual void SAL_CALL acquire() noexcept override;
990  virtual void SAL_CALL release() noexcept override;
991 
992  // XNamed
993  virtual OUString SAL_CALL getName() override;
994  virtual void SAL_CALL setName( const OUString& aName ) override;
995 
996  // XPropertySet override due to column properties
997  virtual css::uno::Reference< css::beans::XPropertySetInfo >
998  SAL_CALL getPropertySetInfo() override;
999 
1000  // XServiceInfo
1001  virtual OUString SAL_CALL getImplementationName() override;
1002  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1003  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1004 
1005  // XTypeProvider
1006  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
1007  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
1008 };
1009 
1010 class ScTableRowObj final : public ScCellRangeObj
1011 {
1012 private:
1014 
1015  virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
1016  virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
1017  css::uno::Any& ) override;
1018  virtual void SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
1019  const css::uno::Any& aValue ) override;
1020 
1021 public:
1022  ScTableRowObj(ScDocShell* pDocSh, SCROW nRow, SCTAB nTab);
1023  virtual ~ScTableRowObj() override;
1024 
1025  // XPropertySet override due to row properties
1026  virtual css::uno::Reference< css::beans::XPropertySetInfo >
1027  SAL_CALL getPropertySetInfo() override;
1028 
1029  // XServiceInfo
1030  virtual OUString SAL_CALL getImplementationName() override;
1031  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1032  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1033 };
1034 
1035 class ScCellsObj final : public cppu::WeakImplHelper<
1036  css::container::XEnumerationAccess,
1037  css::lang::XServiceInfo >,
1038  public SfxListener
1039 {
1040 private:
1043 
1044 public:
1045  ScCellsObj(ScDocShell* pDocSh, const ScRangeList& rR);
1046  virtual ~ScCellsObj() override;
1047 
1048  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1049 
1050  // XEnumerationAccess
1051  virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
1052  createEnumeration() override;
1053 
1054  // XElementAccess
1055  virtual css::uno::Type SAL_CALL getElementType() override;
1056  virtual sal_Bool SAL_CALL hasElements() override;
1057 
1058  // XServiceInfo
1059  virtual OUString SAL_CALL getImplementationName() override;
1060  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1061  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1062 };
1063 
1064 class ScCellsEnumeration final : public cppu::WeakImplHelper<
1065  css::container::XEnumeration,
1066  css::lang::XServiceInfo >,
1067  public SfxListener
1068 {
1069 private:
1073  std::unique_ptr<ScMarkData> pMark;
1074  bool bAtEnd;
1075 
1076 private:
1077  void Advance_Impl();
1078  void CheckPos_Impl();
1079 
1080 public:
1081  ScCellsEnumeration(ScDocShell* pDocSh, const ScRangeList& rR);
1082  virtual ~ScCellsEnumeration() override;
1083 
1084  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1085 
1086  // XEnumeration
1087  virtual sal_Bool SAL_CALL hasMoreElements() override;
1088  virtual css::uno::Any SAL_CALL nextElement() override;
1089 
1090  // XServiceInfo
1091  virtual OUString SAL_CALL getImplementationName() override;
1092  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1093  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1094 };
1095 
1096 class ScCellFormatsObj final : public cppu::WeakImplHelper<
1097  css::container::XIndexAccess,
1098  css::container::XEnumerationAccess,
1099  css::lang::XServiceInfo >,
1100  public SfxListener
1101 {
1102 private:
1105 
1106 private:
1107  rtl::Reference<ScCellRangeObj> GetObjectByIndex_Impl(tools::Long nIndex) const;
1108 
1109 public:
1110  ScCellFormatsObj(ScDocShell* pDocSh, const ScRange& rR);
1111  virtual ~ScCellFormatsObj() override;
1112 
1113  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1114 
1115  // XIndexAccess
1116  virtual sal_Int32 SAL_CALL getCount() override;
1117  virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
1118 
1119  // XEnumerationAccess
1120  virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
1121  createEnumeration() override;
1122 
1123  // XElementAccess
1124  virtual css::uno::Type SAL_CALL getElementType() override;
1125  virtual sal_Bool SAL_CALL hasElements() override;
1126 
1127  // XServiceInfo
1128  virtual OUString SAL_CALL getImplementationName() override;
1129  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1130  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1131 };
1132 
1133 class ScCellFormatsEnumeration final : public cppu::WeakImplHelper<
1134  css::container::XEnumeration,
1135  css::lang::XServiceInfo >,
1136  public SfxListener
1137 {
1138 private:
1141  std::unique_ptr<ScAttrRectIterator> pIter;
1143  bool bAtEnd;
1144  bool bDirty;
1145 
1146 private:
1147  void Advance_Impl();
1148  rtl::Reference<ScCellRangeObj> NextObject_Impl();
1149 
1150 public:
1151  ScCellFormatsEnumeration(ScDocShell* pDocSh, const ScRange& rR);
1152  virtual ~ScCellFormatsEnumeration() override;
1153 
1154  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1155 
1156  // XEnumeration
1157  virtual sal_Bool SAL_CALL hasMoreElements() override;
1158  virtual css::uno::Any SAL_CALL nextElement() override;
1159 
1160  // XServiceInfo
1161  virtual OUString SAL_CALL getImplementationName() override;
1162  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1163  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1164 };
1165 
1166 class ScUniqueCellFormatsObj final : public cppu::WeakImplHelper<
1167  css::container::XIndexAccess,
1168  css::container::XEnumerationAccess,
1169  css::lang::XServiceInfo >,
1170  public SfxListener
1171 {
1172 private:
1174  std::vector<ScRangeList> aRangeLists;
1175 
1176 public:
1177  ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange& rR);
1178  virtual ~ScUniqueCellFormatsObj() override;
1179 
1180  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1181 
1182  // XIndexAccess
1183  virtual sal_Int32 SAL_CALL getCount() override;
1184  virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
1185 
1186  // XEnumerationAccess
1187  virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
1188  createEnumeration() override;
1189 
1190  // XElementAccess
1191  virtual css::uno::Type SAL_CALL getElementType() override;
1192  virtual sal_Bool SAL_CALL hasElements() override;
1193 
1194  // XServiceInfo
1195  virtual OUString SAL_CALL getImplementationName() override;
1196  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1197  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1198 };
1199 
1200 class ScUniqueCellFormatsEnumeration final : public cppu::WeakImplHelper<
1201  css::container::XEnumeration,
1202  css::lang::XServiceInfo >,
1203  public SfxListener
1204 {
1205 private:
1206  std::vector<ScRangeList> aRangeLists;
1208  sal_Int32 nCurrentPosition;
1209 
1210 public:
1211  ScUniqueCellFormatsEnumeration(ScDocShell* pDocShell, std::vector<ScRangeList>&& rRangeLists);
1212  virtual ~ScUniqueCellFormatsEnumeration() override;
1213 
1214  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
1215 
1216  // XEnumeration
1217  virtual sal_Bool SAL_CALL hasMoreElements() override;
1218  virtual css::uno::Any SAL_CALL nextElement() override;
1219 
1220  // XServiceInfo
1221  virtual OUString SAL_CALL getImplementationName() override;
1222  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1223  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1224 };
1225 
1226 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey, rtl_uString *keyName, RegValueType valueType, RegValue pData, sal_uInt32 valueSize)
Type
ScRangeList aRanges
Definition: cellsuno.hxx:1071
const SfxItemPropertySet * pRangePropSet
Definition: cellsuno.hxx:484
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:42
ScRangeList aRanges
Definition: cellsuno.hxx:1042
virtual const SfxItemPropertyMap & GetItemPropertyMap()
Definition: cellsuno.cxx:1742
ScDocShell * GetDocShell() const
Definition: cellsuno.hxx:242
bool getType(BSTR name, Type &type)
signed char sal_Int8
uno::Any getPropertyValue(const uno::Sequence< beans::PropertyValue > &aProp, const OUString &aName)
long Long
const SfxItemPropertySet * pSheetPropSet
Definition: cellsuno.hxx:795
ScDocShell * pDocShell
Definition: cellsuno.hxx:1041
ScDocShell * pDocShell
Definition: cellsuno.hxx:1103
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
static void FillBoxItems(SvxBoxItem &rOuter, SvxBoxInfoItem &rInner, const css::table::TableBorder &rBorder)
virtual OUString SAL_CALL getImplementationName() override
XServiceInfo.
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
#define UNO3_GETIMPLEMENTATION_DECL(classname)
std::vector< ScRangeList > aRangeLists
Definition: cellsuno.hxx:1174
const ScRangeList & GetRangeList() const
Definition: cellsuno.hxx:244
static void AssignTableBorder2ToAny(css::uno::Any &rAny, const SvxBoxItem &rOuter, const SvxBoxInfoItem &rInner, bool bInvalidateHorVerDist=false)
Definition: cellsuno.cxx:1025
static void AssignTableBorderToAny(css::uno::Any &rAny, const SvxBoxItem &rOuter, const SvxBoxInfoItem &rInner, bool bInvalidateHorVerDist=false)
Definition: cellsuno.cxx:1017
std::optional< SfxItemSet > moCurrentDataSet
Definition: cellsuno.hxx:186
std::unique_ptr< ScMarkData > pMarkData
Definition: cellsuno.hxx:188
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: cellsuno.cxx:2007
virtual void SetOnePropertyValue(const SfxItemPropertyMapEntry *pEntry, const css::uno::Any &aValue)
Definition: cellsuno.cxx:2140
std::vector< css::uno::Reference< css::util::XModifyListener > > XModifyListenerArr_Impl
Definition: cellsuno.hxx:131
XModifyListenerArr_Impl aValueListeners
Definition: cellsuno.hxx:195
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
bool bGotDataChangedHint
Definition: cellsuno.hxx:194
virtual css::uno::Reference< css::table::XCell > SAL_CALL getCellByPosition(sal_Int32 nColumn, sal_Int32 nRow, sal_Int32 nSheet) override
XCellRangesAccess.
Definition: docuno.cxx:3815
std::unique_ptr< ScLinkListener > pValueListener
Definition: cellsuno.hxx:183
ScLinkListener(const Link< const SfxHint &, void > &rL)
Definition: cellsuno.hxx:126
std::optional< SfxItemSet > moNoDfltCurrentDataSet
Definition: cellsuno.hxx:187
virtual OUString GetName() const override
ScDocShell * pDocShell
Definition: cellsuno.hxx:1070
const SfxItemPropertySet * pPropSet
Definition: cellsuno.hxx:181
virtual ~ScLinkListener() override
move ScLinkListener into another file !!!
Definition: cellsuno.cxx:879
sal_Int64 nObjectId
Definition: cellsuno.hxx:190
static void ApplyBorder(ScDocShell *pDocShell, const ScRangeList &rRanges, const SvxBoxItem &rOuter, const SvxBoxInfoItem &rInner)
move lcl_ApplyBorder to docfunc !
Definition: cellsuno.cxx:1035
void Notify(ScModelObj &rModelObj, const ScRangeList &rChangeRanges, const OUString &rType=OUString("cell-change"), const css::uno::Sequence< css::beans::PropertyValue > &rProperties=css::uno::Sequence< css::beans::PropertyValue >())
Definition: docsh.hxx:483
sal_Int16 SCCOL
Definition: types.hxx:21
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
unsigned char sal_Bool
ScDocShell * pDocShell
Definition: cellsuno.hxx:1173
ScRange aTotalRange
Definition: cellsuno.hxx:1104
virtual void GetOnePropertyValue(const SfxItemPropertyMapEntry *pEntry, css::uno::Any &)
Definition: cellsuno.cxx:2354
css::beans::Optional< css::uno::Any > getValue(std::u16string_view id)
bool setPropertyValue(uno::Sequence< beans::PropertyValue > &aProp, const OUString &aName, const uno::Any &aValue)
ScRange aRange
Definition: cellsuno.hxx:485
const ScRange & GetRange() const
Definition: cellsuno.hxx:488
ScRangeList aRanges
Definition: cellsuno.hxx:189
virtual void Notify(const SfxHint &rHint) override
Definition: cellsuno.cxx:883
static void FillBorderLine(css::table::BorderLine &rStruct, const ::editeng::SvxBorderLine *pLine)
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint)
std::unique_ptr< ScPatternAttr > pCurrentDeep
Definition: cellsuno.hxx:185
sal_Int32 SCROW
Definition: types.hxx:17
ScDocShell * pDocShell
Definition: cellsuno.hxx:182
bool IsCursorOnly() const
Definition: cellsuno.hxx:254
ScAddress aCellPos
Definition: cellsuno.hxx:650
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
std::unique_ptr< ScMarkData > pMark
Definition: cellsuno.hxx:1073
OUString aName
std::unique_ptr< ScPatternAttr > pCurrentFlat
Definition: cellsuno.hxx:184
really derive cell from range?
Definition: cellsuno.hxx:637
rtl::Reference< SvxUnoText > mxUnoText
Definition: cellsuno.hxx:648
std::vector< ScRangeList > aRangeLists
Definition: cellsuno.hxx:1206
static const ::editeng::SvxBorderLine * GetBorderLine(::editeng::SvxBorderLine &rLine, const css::table::BorderLine &rStruct)
const SfxItemPropertySet * pCellPropSet
Definition: cellsuno.hxx:649
const SfxItemPropertySet * pColPropSet
Definition: cellsuno.hxx:975
virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByPosition(sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom, sal_Int32 nSheet) override
Definition: docuno.cxx:3825
OUString getString(const Any &_rAny)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Link< const SfxHint &, void > aLink
Definition: cellsuno.hxx:124
sal_Int16 nActionLockCount
Definition: cellsuno.hxx:651
struct _ADOIndex Index
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
const SfxItemPropertySet * pRowPropSet
Definition: cellsuno.hxx:1013
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
sal_Int16 SCTAB
Definition: types.hxx:22
std::unique_ptr< ScAttrRectIterator > pIter
Definition: cellsuno.hxx:1141