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