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