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