Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sc/inc/cellsuno.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#pragma once
21
22
#include <config_options.h>
23
#include "address.hxx"
24
#include "rangelst.hxx"
25
26
#include <formula/grammar.hxx>
27
#include <rtl/ref.hxx>
28
#include <sal/types.h>
29
#include <tools/link.hxx>
30
#include <svl/itemset.hxx>
31
#include <svl/lstner.hxx>
32
#include <svl/listener.hxx>
33
#include <com/sun/star/table/XTableChartsSupplier.hpp>
34
#include <com/sun/star/table/XTablePivotChartsSupplier.hpp>
35
#include <com/sun/star/chart/XChartDataArray.hpp>
36
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
37
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
38
#include <com/sun/star/sheet/XSheetCellRange.hpp>
39
#include <com/sun/star/sheet/XFormulaQuery.hpp>
40
#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
41
#include <com/sun/star/sheet/XSheetOperation.hpp>
42
#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
43
#include <com/sun/star/sheet/XCellFormatRangesSupplier.hpp>
44
#include <com/sun/star/sheet/XUniqueCellFormatRangesSupplier.hpp>
45
#include <com/sun/star/sheet/XCellRangesQuery.hpp>
46
#include <com/sun/star/sheet/XSheetFilterableEx.hpp>
47
#include <com/sun/star/sheet/XSpreadsheet.hpp>
48
#include <com/sun/star/sheet/XSheetPageBreak.hpp>
49
#include <com/sun/star/sheet/XCellRangeMovement.hpp>
50
#include <com/sun/star/text/XText.hpp>
51
#include <com/sun/star/sheet/XPrintAreas.hpp>
52
#include <com/sun/star/sheet/XSheetLinkable.hpp>
53
#include <com/sun/star/sheet/XSubTotalCalculatable.hpp>
54
#include <com/sun/star/sheet/XArrayFormulaRange.hpp>
55
#include <com/sun/star/sheet/XCellRangeData.hpp>
56
#include <com/sun/star/sheet/XCellRangeFormula.hpp>
57
#include <com/sun/star/sheet/XCellSeries.hpp>
58
#include <com/sun/star/sheet/XMultipleOperation.hpp>
59
#include <com/sun/star/sheet/XFormulaTokens.hpp>
60
#include <com/sun/star/sheet/XArrayFormulaTokens.hpp>
61
#include <com/sun/star/sheet/XCellAddressable.hpp>
62
#include <com/sun/star/util/XReplaceable.hpp>
63
#include <com/sun/star/util/XIndent.hpp>
64
#include <com/sun/star/lang/XServiceInfo.hpp>
65
#include <com/sun/star/container/XNameContainer.hpp>
66
#include <com/sun/star/util/XMergeable.hpp>
67
#include <com/sun/star/table/XAutoFormattable.hpp>
68
#include <com/sun/star/util/XSortable.hpp>
69
#include <com/sun/star/util/XImportable.hpp>
70
#include <com/sun/star/table/XColumnRowRange.hpp>
71
#include <com/sun/star/table/XCell2.hpp>
72
#include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
73
#include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
74
#include <com/sun/star/sheet/XScenariosSupplier.hpp>
75
#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
76
#include <com/sun/star/sheet/XSheetAuditing.hpp>
77
#include <com/sun/star/sheet/XSheetOutline.hpp>
78
#include <com/sun/star/util/XProtectable.hpp>
79
#include <com/sun/star/sheet/XScenario.hpp>
80
#include <com/sun/star/sheet/XScenarioEnhanced.hpp>
81
#include <com/sun/star/util/XModifyBroadcaster.hpp>
82
#include <com/sun/star/beans/XPropertyState.hpp>
83
#include <com/sun/star/beans/XMultiPropertySet.hpp>
84
#include <com/sun/star/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>
88
#include <cppuhelper/implbase.hxx>
89
90
#include <memory>
91
#include <optional>
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 SfxHint;
112
class SfxItemPropertyMap;
113
class SfxItemPropertySet;
114
struct SfxItemPropertyMapEntry;
115
class ScTableRowsObj;
116
class ScTableValidationObj;
117
class ScCellObj;
118
class SolarMutexGuard;
119
class SvxUnoTextRangeBase;
120
121
namespace editeng { class SvxBorderLine; }
122
123
class ScLinkListener final : public SvtListener
124
{
125
    Link<const SfxHint&,void>  aLink;
126
public:
127
0
                    ScLinkListener(const Link<const SfxHint&,void>& rL) : aLink(rL) {}
128
    virtual         ~ScLinkListener() override;
129
    virtual void Notify( const SfxHint& rHint ) override;
130
};
131
132
typedef std::vector< css::uno::Reference< css::util::XModifyListener > > XModifyListenerArr_Impl;
133
134
//  ScCellRangesBase - base class for ScCellRangesObj (with access by index)
135
//                                and ScCellRangeObj  (without access by index)
136
137
//  XServiceInfo is implemented in derived classes
138
139
class ScHelperFunctions
140
{
141
public:
142
    static const ::editeng::SvxBorderLine* GetBorderLine( ::editeng::SvxBorderLine& rLine, const css::table::BorderLine& rStruct );
143
    static const ::editeng::SvxBorderLine* GetBorderLine( ::editeng::SvxBorderLine& rLine, const css::table::BorderLine2& rStruct );
144
    static void FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const css::table::TableBorder& rBorder );
145
    static void FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const css::table::TableBorder2& rBorder );
146
    static void FillBorderLine( css::table::BorderLine& rStruct, const ::editeng::SvxBorderLine* pLine );
147
    static void FillBorderLine( css::table::BorderLine2& rStruct, const ::editeng::SvxBorderLine* pLine );
148
    static void AssignTableBorderToAny( css::uno::Any& rAny,
149
            const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner, bool bInvalidateHorVerDist = false );
150
    static void AssignTableBorder2ToAny( css::uno::Any& rAny,
151
            const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner, bool bInvalidateHorVerDist = false );
152
    static void ApplyBorder( ScDocShell* pDocShell, const ScRangeList& rRanges,
153
                        const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner );
154
};
155
156
namespace ooo::vba::excel {
157
    class ScVbaCellRangeAccess;  // Vba Helper class
158
}
159
160
class SAL_DLLPUBLIC_RTTI SAL_LOPLUGIN_ANNOTATE("crosscast") ScCellRangesBase :
161
                         public cppu::WeakImplHelper<
162
                            css::beans::XPropertySet,
163
                             css::beans::XMultiPropertySet,
164
                             css::beans::XPropertyState,
165
                             css::sheet::XSheetOperation,
166
                             css::chart::XChartDataArray,
167
                             css::util::XIndent,
168
                             css::sheet::XCellRangesQuery,
169
                             css::sheet::XFormulaQuery,
170
                             css::util::XReplaceable,
171
                             css::util::XModifyBroadcaster,
172
                             css::lang::XServiceInfo,
173
                             css::beans::XTolerantMultiPropertySet>,
174
                         public SfxListener
175
{
176
    friend class ScTabViewObj;      // for select()
177
    friend class ScTableSheetObj;   // for createCursorByRange()
178
    friend class ooo::vba::excel::ScVbaCellRangeAccess;
179
180
private:
181
    const SfxItemPropertySet* pPropSet;
182
    ScDocShell*             pDocShell;
183
    std::unique_ptr<ScLinkListener> pValueListener;
184
    std::unique_ptr<ScPatternAttr>  pCurrentFlat;
185
    std::unique_ptr<ScPatternAttr>  pCurrentDeep;
186
    std::optional<SfxItemSet>       moCurrentDataSet;
187
    std::optional<SfxItemSet>       moNoDfltCurrentDataSet;
188
    std::unique_ptr<ScMarkData>     pMarkData;
189
    ScRangeList             aRanges;
190
    sal_Int64               nObjectId;
191
    bool                    bChartColAsHdr;
192
    bool                    bChartRowAsHdr;
193
    bool                    bCursorOnly;
194
    bool                    bGotDataChangedHint;
195
    XModifyListenerArr_Impl aValueListeners;
196
197
    DECL_LINK( ValueListenerHdl, const SfxHint&, void );
198
199
private:
200
    void            PaintGridRanges_Impl();
201
    ScRangeListRef  GetLimitedChartRanges_Impl( sal_Int32 nDataColumns, sal_Int32 nDataRows ) const;
202
    void            ForceChartListener_Impl();
203
    std::unique_ptr<ScMemChart> CreateMemChart_Impl() const;
204
205
    const ScPatternAttr*    GetCurrentAttrsFlat();
206
    const ScPatternAttr*    GetCurrentAttrsDeep();
207
    SC_DLLPUBLIC 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
    SC_DLLPUBLIC virtual const SfxItemPropertyMap& GetItemPropertyMap();
223
    css::beans::PropertyState GetOnePropertyState(
224
                                sal_uInt16 nItemWhich, const SfxItemPropertyMapEntry* pEntry );
225
    /// @throws css::uno::RuntimeException
226
    SC_DLLPUBLIC virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
227
                                css::uno::Any& );
228
    /// @throws css::lang::IllegalArgumentException
229
    /// @throws css::uno::RuntimeException
230
    SC_DLLPUBLIC virtual void SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
231
                                                const css::uno::Any& aValue );
232
233
0
    ScRangeList& AccessRanges() { return aRanges; }
234
    SC_DLLPUBLIC virtual void AdjustUpdatedRanges(UpdateRefMode mode);
235
236
public:
237
                            ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR);
238
                            ScCellRangesBase(ScDocShell* pDocSh, ScRangeList aR);
239
    virtual                 ~ScCellRangesBase() override;
240
241
    SC_DLLPUBLIC virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
242
    virtual void            RefChanged();
243
244
                            // from derived classes and by getImplementation
245
156k
    ScDocShell*             GetDocShell() const     { return pDocShell; }
246
    ScDocument*             GetDocument() const;
247
65.9k
    const ScRangeList&      GetRangeList() const    { return aRanges; }
248
    void                    AddRange(const ScRange& rRange, const bool bMergeRanges);
249
250
                            // arouse object created via service:
251
    void                    InitInsertRange(ScDocShell* pDocSh, const ScRange& rR);
252
253
    void                    SetNewRange(const ScRange& rNew);   // for cursor
254
    void                    SetNewRanges(const ScRangeList& rNew);
255
256
    void                    SetCursorOnly(bool bSet);
257
0
    bool                    IsCursorOnly() const            { return bCursorOnly; }
258
259
    SC_DLLPUBLIC rtl::Reference<ScTableValidationObj> getValidation();
260
    SC_DLLPUBLIC void setValidation(const rtl::Reference<ScTableValidationObj>&);
261
262
                            // XSheetOperation
263
    virtual double SAL_CALL computeFunction( css::sheet::GeneralFunction nFunction ) override;
264
    virtual void SAL_CALL   clearContents( sal_Int32 nContentFlags ) override;
265
266
                            // XPropertySet
267
    virtual css::uno::Reference< css::beans::XPropertySetInfo >
268
                            SAL_CALL getPropertySetInfo() override;
269
    virtual void SAL_CALL   setPropertyValue( const OUString& aPropertyName,
270
                                    const css::uno::Any& aValue ) override;
271
    virtual css::uno::Any SAL_CALL getPropertyValue(
272
                                    const OUString& PropertyName ) override;
273
    virtual void SAL_CALL   addPropertyChangeListener( const OUString& aPropertyName,
274
                                    const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
275
    virtual void SAL_CALL   removePropertyChangeListener( const OUString& aPropertyName,
276
                                    const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
277
    virtual void SAL_CALL   addVetoableChangeListener( const OUString& PropertyName,
278
                                    const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
279
    virtual void SAL_CALL   removeVetoableChangeListener( const OUString& PropertyName,
280
                                    const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
281
282
                            // XMultiPropertySet
283
    virtual void SAL_CALL   setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames,
284
                                    const css::uno::Sequence< css::uno::Any >& aValues ) override;
285
    virtual css::uno::Sequence< css::uno::Any > SAL_CALL
286
                            getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
287
    virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames,
288
                                    const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
289
    virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
290
    virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames,
291
                                    const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
292
293
                            // XTolerantMultiPropertySet
294
    virtual css::uno::Sequence< css::beans::SetPropertyTolerantFailed > SAL_CALL
295
        setPropertyValuesTolerant( const css::uno::Sequence< OUString >& aPropertyNames,
296
                                    const css::uno::Sequence< css::uno::Any >& aValues ) override;
297
    virtual css::uno::Sequence< css::beans::GetPropertyTolerantResult > SAL_CALL
298
        getPropertyValuesTolerant( const css::uno::Sequence< OUString >& aPropertyNames ) override;
299
    virtual css::uno::Sequence< css::beans::GetDirectPropertyTolerantResult > SAL_CALL
300
        getDirectPropertyValuesTolerant( const css::uno::Sequence< OUString >& aPropertyNames ) override;
301
302
                            // XPropertyState
303
    virtual css::beans::PropertyState SAL_CALL getPropertyState(
304
                                    const OUString& PropertyName ) override;
305
    virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL
306
                            getPropertyStates( const css::uno::Sequence<
307
                                        OUString >& aPropertyName ) override;
308
    virtual void SAL_CALL   setPropertyToDefault( const OUString& PropertyName ) override;
309
    virtual css::uno::Any SAL_CALL getPropertyDefault(
310
                                    const OUString& aPropertyName ) override;
311
312
                            // XIndent
313
    virtual void SAL_CALL   decrementIndent() override;
314
    virtual void SAL_CALL   incrementIndent() override;
315
316
                            // XChartData
317
    virtual void SAL_CALL   addChartDataChangeEventListener(
318
                                const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override;
319
    virtual void SAL_CALL   removeChartDataChangeEventListener( const css::uno::Reference<
320
                                    css::chart::XChartDataChangeEventListener >& aListener ) override;
321
    virtual double SAL_CALL getNotANumber() override;
322
    virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) override;
323
324
                            // XChartDataArray
325
    virtual css::uno::Sequence< css::uno::Sequence< double > > SAL_CALL
326
                            getData() override;
327
    virtual void SAL_CALL   setData( const css::uno::Sequence< css::uno::Sequence< double > >& aData ) override;
328
    virtual css::uno::Sequence< OUString > SAL_CALL getRowDescriptions() override;
329
    virtual void SAL_CALL setRowDescriptions( const css::uno::Sequence< OUString >& aRowDescriptions ) override;
330
    virtual css::uno::Sequence< OUString > SAL_CALL getColumnDescriptions() override;
331
    virtual void SAL_CALL   setColumnDescriptions( const css::uno::Sequence< OUString >& aColumnDescriptions ) override;
332
333
                            // XCellRangesQuery
334
    virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
335
                            queryVisibleCells() override;
336
    virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
337
                            queryEmptyCells() override;
338
    virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
339
                            queryContentCells( sal_Int16 nContentFlags ) override;
340
    virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
341
                            queryFormulaCells( sal_Int32 nResultFlags ) override;
342
    virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
343
                            queryColumnDifferences(
344
                                const css::table::CellAddress& aCompare ) override;
345
    virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
346
                            queryRowDifferences(
347
                                const css::table::CellAddress& aCompare ) override;
348
    virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
349
                            queryIntersection(
350
                                const css::table::CellRangeAddress& aRange ) override;
351
352
                            // XFormulaQuery
353
    virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
354
                            queryDependents( sal_Bool bRecursive ) override;
355
    virtual css::uno::Reference< css::sheet::XSheetCellRanges > SAL_CALL
356
                            queryPrecedents( sal_Bool bRecursive ) override;
357
358
                            // XSearchable
359
    virtual css::uno::Reference< css::util::XSearchDescriptor > SAL_CALL
360
                            createSearchDescriptor() override;
361
    virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
362
                            findAll( const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override;
363
    virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
364
                            findFirst( const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override;
365
    virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
366
                            findNext( const css::uno::Reference< css::uno::XInterface >& xStartAt,
367
                                      const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override;
368
369
                            // XReplaceable
370
    virtual css::uno::Reference< css::util::XReplaceDescriptor > SAL_CALL
371
                            createReplaceDescriptor() override;
372
    virtual sal_Int32 SAL_CALL replaceAll( const css::uno::Reference< css::util::XSearchDescriptor >& xDesc ) override;
373
374
                            // XModifyBroadcaster
375
    virtual void SAL_CALL   addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
376
    virtual void SAL_CALL   removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
377
378
                            // XServiceInfo
379
    virtual OUString SAL_CALL getImplementationName() override;
380
    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
381
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
382
};
383
384
using ScCellRangesObj_BASE = cppu::ImplInheritanceHelper<ScCellRangesBase,
385
                                                         css::sheet::XSheetCellRangeContainer,
386
                                                         css::container::XNameContainer,
387
                                                         css::container::XEnumerationAccess>;
388
class SC_DLLPUBLIC ScCellRangesObj final : public ScCellRangesObj_BASE
389
{
390
public:
391
    struct ScNamedEntry
392
    {
393
        OUString  aName;
394
        ScRange   aRange;
395
0
        const OUString& GetName() const { return aName; }
396
0
        const ScRange& GetRange() const { return aRange; }
397
    };
398
private:
399
    std::vector<ScNamedEntry> m_aNamedEntries;
400
401
    rtl::Reference<ScCellRangeObj> GetObjectByIndex_Impl(sal_Int32 nIndex) const;
402
403
public:
404
                            ScCellRangesObj(ScDocShell* pDocSh, const ScRangeList& rR);
405
    virtual                 ~ScCellRangesObj() override;
406
407
    virtual void            RefChanged() override;
408
409
                            // XSheetCellRanges
410
    virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL
411
                            getCells() override;
412
    virtual OUString SAL_CALL getRangeAddressesAsString() override;
413
    virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
414
                            getRangeAddresses() override;
415
416
                            // XSheetCellRangeContainer
417
    virtual void SAL_CALL   addRangeAddress( const css::table::CellRangeAddress& rRange,
418
                                        sal_Bool bMergeRanges ) override;
419
    virtual void SAL_CALL   removeRangeAddress( const css::table::CellRangeAddress& rRange ) override;
420
    virtual void SAL_CALL   addRangeAddresses( const css::uno::Sequence<
421
                                        css::table::CellRangeAddress >& rRanges,
422
                                        sal_Bool bMergeRanges ) override;
423
    virtual void SAL_CALL   removeRangeAddresses( const css::uno::Sequence<
424
                                        css::table::CellRangeAddress >& rRanges ) override;
425
426
                            // XNameContainer
427
    virtual void SAL_CALL   insertByName( const OUString& aName,
428
                                const css::uno::Any& aElement ) override;
429
    virtual void SAL_CALL   removeByName( const OUString& Name ) override;
430
431
                            // XNameReplace
432
    virtual void SAL_CALL   replaceByName( const OUString& aName,
433
                                const css::uno::Any& aElement ) override;
434
435
                            // XNameAccess
436
    virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
437
    virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
438
    virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
439
440
                            // XIndexAccess
441
    virtual sal_Int32 SAL_CALL getCount() override;
442
    virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
443
444
                            // XElementAccess
445
    virtual css::uno::Type SAL_CALL getElementType() override;
446
    virtual sal_Bool SAL_CALL hasElements() override;
447
448
                            // XEnumerationAccess
449
    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
450
                            createEnumeration() override;
451
452
                            // XServiceInfo
453
    virtual OUString SAL_CALL getImplementationName() override;
454
    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
455
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
456
457
    void addRangeAddresses( const ScRangeList& rRanges, bool bMergeRanges );
458
};
459
460
using ScCellRangeObj_BASE = cppu::ImplInheritanceHelper<ScCellRangesBase,
461
                                                        css::sheet::XCellRangeAddressable,
462
                                                        css::sheet::XSheetCellRange,
463
                                                        css::sheet::XArrayFormulaRange,
464
                                                        css::sheet::XArrayFormulaTokens,
465
                                                        css::sheet::XCellRangeData,
466
                                                        css::sheet::XCellRangeFormula,
467
                                                        css::sheet::XMultipleOperation,
468
                                                        css::util::XMergeable,
469
                                                        css::sheet::XCellSeries,
470
                                                        css::table::XAutoFormattable,
471
                                                        css::util::XSortable,
472
                                                        css::sheet::XSheetFilterableEx,
473
                                                        css::sheet::XSubTotalCalculatable,
474
                                                        css::util::XImportable,
475
                                                        css::sheet::XCellFormatRangesSupplier,
476
                                                        css::sheet::XUniqueCellFormatRangesSupplier,
477
                                                        css::table::XColumnRowRange>;
478
class SAL_DLLPUBLIC_RTTI ScCellRangeObj : public ScCellRangeObj_BASE
479
{
480
private:
481
    const SfxItemPropertySet*       pRangePropSet;
482
    ScRange                 aRange;
483
484
protected:
485
120
    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
492
    /// @throws css::lang::IndexOutOfBoundsException
493
    /// @throws css::uno::RuntimeException
494
    rtl::Reference< ScCellObj >
495
                            GetCellByPosition_Impl( sal_Int32 nColumn, sal_Int32 nRow );
496
497
            /// @throws css::uno::RuntimeException
498
            void            SetArrayFormula_Impl( const OUString& rFormula,
499
                                const formula::FormulaGrammar::Grammar eGrammar );
500
501
public:
502
    SC_DLLPUBLIC            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 void            RefChanged() override;
510
511
                            // XCellRangeAddressable
512
    virtual css::table::CellRangeAddress SAL_CALL getRangeAddress() override;
513
514
                            // XSheetCellRange
515
    virtual css::uno::Reference< css::sheet::XSpreadsheet > SAL_CALL
516
                            getSpreadsheet() override;
517
518
                            // XArrayFormulaRange
519
    virtual OUString SAL_CALL getArrayFormula() override;
520
    virtual void SAL_CALL   setArrayFormula( const OUString& aFormula ) override;
521
522
                            // XArrayFormulaTokens
523
    virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL getArrayTokens() override;
524
    SC_DLLPUBLIC virtual void SAL_CALL   setArrayTokens( const css::uno::Sequence<
525
                                    css::sheet::FormulaToken >& aTokens ) override;
526
527
                            // XCellRangeData
528
    virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getDataArray() override;
529
    virtual void SAL_CALL   setDataArray( const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aArray ) override;
530
531
                            // XCellRangeFormula
532
    virtual css::uno::Sequence< css::uno::Sequence<
533
                            OUString > > SAL_CALL getFormulaArray() override;
534
    virtual void SAL_CALL   setFormulaArray( const css::uno::Sequence< css::uno::Sequence< OUString > >& aArray ) override;
535
536
                            // XMultipleOperation
537
    virtual void SAL_CALL   setTableOperation(
538
                                const css::table::CellRangeAddress& aFormulaRange,
539
                                css::sheet::TableOperationMode nMode,
540
                                const css::table::CellAddress& aColumnCell,
541
                                const css::table::CellAddress& aRowCell ) override;
542
543
                            // XMergeable
544
    virtual void SAL_CALL   merge( sal_Bool bMerge ) override;
545
    virtual sal_Bool SAL_CALL getIsMerged() override;
546
547
                            // XCellSeries
548
    virtual void SAL_CALL   fillSeries( css::sheet::FillDirection nFillDirection,
549
                                css::sheet::FillMode nFillMode,
550
                                css::sheet::FillDateMode nFillDateMode,
551
                                double fStep, double fEndValue ) override;
552
    virtual void SAL_CALL   fillAuto( css::sheet::FillDirection nFillDirection,
553
                                sal_Int32 nSourceCount ) override;
554
555
                            // XAutoFormattable
556
    virtual void SAL_CALL   autoFormat( const OUString& aName ) override;
557
558
                            // XSortable
559
    virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL
560
                            createSortDescriptor() override;
561
    virtual void SAL_CALL   sort( const css::uno::Sequence<
562
                                css::beans::PropertyValue >& xDescriptor ) override;
563
564
                            // XSheetFilterableEx
565
    virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL
566
                            createFilterDescriptorByObject( const css::uno::Reference<
567
                                css::sheet::XSheetFilterable >& xObject ) override;
568
569
                            // XSheetFilterable
570
    virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL
571
                            createFilterDescriptor( sal_Bool bEmpty ) override;
572
    virtual void SAL_CALL   filter( const css::uno::Reference<
573
                                css::sheet::XSheetFilterDescriptor >& xDescriptor ) override;
574
575
                            // XSubTotalCalculatable
576
    virtual css::uno::Reference< css::sheet::XSubTotalDescriptor > SAL_CALL
577
                            createSubTotalDescriptor( sal_Bool bEmpty ) override;
578
    virtual void SAL_CALL   applySubTotals(const css::uno::Reference< css::sheet::XSubTotalDescriptor >& xDescriptor,
579
                                sal_Bool bReplace) override;
580
    virtual void SAL_CALL   removeSubTotals() override;
581
582
                            // XImportable
583
    virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL
584
                            createImportDescriptor( sal_Bool bEmpty ) override;
585
    virtual void SAL_CALL   doImport( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor ) override;
586
587
                            // XCellFormatRangesSupplier
588
    virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
589
                            getCellFormatRanges() override;
590
591
                            // XUniqueCellFormatRangesSupplier
592
    virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL
593
                            getUniqueCellFormatRanges() override;
594
595
                            // XColumnRowRange
596
    virtual css::uno::Reference< css::table::XTableColumns > SAL_CALL
597
                            getColumns() override;
598
    virtual css::uno::Reference< css::table::XTableRows > SAL_CALL
599
                            getRows() override;
600
601
                            // XCellRange
602
    virtual css::uno::Reference< css::table::XCell > SAL_CALL
603
                            getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) override;
604
    virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
605
                            getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop,
606
                                sal_Int32 nRight, sal_Int32 nBottom ) override;
607
    virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
608
                            getCellRangeByName( const OUString& aRange ) override;
609
    /// @throws css::uno::RuntimeException
610
    css::uno::Reference< css::table::XCellRange >
611
                            getCellRangeByName( const OUString& aRange,  const ScAddress::Details& rDetails );
612
613
                            // XPropertySet override due to Range-Properties
614
    virtual css::uno::Reference< css::beans::XPropertySetInfo >
615
                            SAL_CALL getPropertySetInfo() override;
616
617
                            // XServiceInfo
618
    virtual OUString SAL_CALL getImplementationName() override;
619
    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
620
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
621
622
    rtl::Reference< ScCellRangeObj >
623
                            getScCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop,
624
                                sal_Int32 nRight, sal_Int32 nBottom );
625
    SC_DLLPUBLIC rtl::Reference< ScCellRangeObj >
626
                            getScCellRangeByName( const OUString& aRange );
627
    rtl::Reference< ScCellRangeObj >
628
                            getScCellRangeByName( const OUString& aRange, const ScAddress::Details& rDetails );
629
    rtl::Reference< ScTableRowsObj >
630
                            getScRowsByPosition( SolarMutexGuard& rGuard, sal_Int32 nLeft, sal_Int32 nTop,
631
                                sal_Int32 nRight, sal_Int32 nBottom );
632
    rtl::Reference< ScTableRowsObj > getScRows();
633
    SC_DLLPUBLIC rtl::Reference< ScCellObj >
634
                            getScCellByPosition( sal_Int32 nColumn, sal_Int32 nRow );
635
};
636
637
//! really derive cell from range?
638
639
using ScCellObj_BASE = cppu::ImplInheritanceHelper<ScCellRangeObj,
640
                                                   css::text::XText,
641
                                                   css::container::XEnumerationAccess,
642
                                                   css::table::XCell2,
643
                                                   css::sheet::XFormulaTokens,
644
                                                   css::sheet::XCellAddressable,
645
                                                   css::sheet::XSheetAnnotationAnchor,
646
                                                   css::text::XTextFieldsSupplier,
647
                                                   css::document::XActionLockable>;
648
class SAL_DLLPUBLIC_RTTI ScCellObj final : public ScCellObj_BASE
649
{
650
private:
651
    rtl::Reference<SvxUnoText> mxUnoText;
652
    const SfxItemPropertySet*   pCellPropSet;
653
    ScAddress               aCellPos;
654
    sal_Int16               nActionLockCount;
655
656
private:
657
    OUString    GetInputString_Impl(bool bEnglish) const;
658
    OUString    GetOutputString_Impl() const;
659
    void        SetString_Impl(const OUString& rString, bool bInterpret, bool bEnglish);
660
    double      GetValue_Impl() const;
661
    void        SetValue_Impl(double fValue);
662
    css::table::CellContentType GetContentType_Impl();
663
    sal_Int32 GetResultType_Impl() const;
664
665
    virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
666
    virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
667
                                css::uno::Any& ) override;
668
    virtual void            SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
669
                                                const css::uno::Any& aValue ) override;
670
671
    SvxUnoTextRangeBase*
672
    getSvxUnoTextRange(const css::uno::Reference<css::text::XTextRange>& xRange);
673
    bool insertScEditFieldObj(const css::uno::Reference<css::text::XTextRange>& xRange,
674
                              const css::uno::Reference<css::text::XTextContent>& xContent,
675
                              bool bAbsorb);
676
677
public:
678
    static const SvxItemPropertySet* GetEditPropertySet();
679
    static const SfxItemPropertyMap& GetCellPropertyMap();
680
681
                            ScCellObj(ScDocShell* pDocSh, const ScAddress& rP);
682
    SC_DLLPUBLIC virtual    ~ScCellObj() override;
683
684
    virtual void            RefChanged() override;
685
686
    SvxUnoText&             GetUnoText();
687
688
                            // XML import needs to set results at formula cells,
689
                            // not meant for any other purpose.
690
0
    const ScAddress&        GetPosition() const { return aCellPos; }
691
692
    SC_DLLPUBLIC void       InputEnglishString( const OUString& rText );
693
694
                            // XText
695
    virtual void SAL_CALL   insertTextContent( const css::uno::Reference< css::text::XTextRange >& xRange,
696
                                const css::uno::Reference< css::text::XTextContent >& xContent,
697
                                sal_Bool bAbsorb ) override;
698
    virtual void SAL_CALL   removeTextContent( const css::uno::Reference< css::text::XTextContent >& xContent ) override;
699
700
                            // XSimpleText
701
    virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
702
                            createTextCursor() override;
703
    virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
704
                            createTextCursorByRange( const css::uno::Reference< css::text::XTextRange >& aTextPosition ) override;
705
    virtual void SAL_CALL   insertString( const css::uno::Reference< css::text::XTextRange >& xRange,
706
                                        const OUString& aString, sal_Bool bAbsorb ) override;
707
    virtual void SAL_CALL   insertControlCharacter( const css::uno::Reference< css::text::XTextRange >& xRange,
708
                                        sal_Int16 nControlCharacter, sal_Bool bAbsorb ) override;
709
710
                            // XTextRange
711
    virtual css::uno::Reference< css::text::XText > SAL_CALL
712
                            getText() override;
713
    virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
714
                            getStart() override;
715
    virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
716
                            getEnd() override;
717
    virtual OUString SAL_CALL getString() override;
718
    virtual void SAL_CALL   setString( const OUString& aString ) override;
719
720
                            // XEnumerationAccess
721
    virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
722
                            createEnumeration() override;
723
724
                            // XElementAccess
725
    virtual css::uno::Type SAL_CALL getElementType() override;
726
    virtual sal_Bool SAL_CALL hasElements() override;
727
728
                            // XCell
729
    virtual OUString SAL_CALL getFormula() override;
730
    virtual void SAL_CALL   setFormula( const OUString& aFormula ) override;
731
    virtual void SAL_CALL   setFormulaResult( double nValue ) override;
732
    virtual void SAL_CALL   setFormulaString( const OUString& aFormula ) override;
733
    virtual double SAL_CALL getValue() override;
734
    virtual void SAL_CALL   setValue( double nValue ) override;
735
    virtual css::table::CellContentType SAL_CALL getType() override;
736
    virtual sal_Int32 SAL_CALL getError() override;
737
738
                            // XFormulaTokens
739
    virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL getTokens() override;
740
    virtual void SAL_CALL   setTokens( const css::uno::Sequence< css::sheet::FormulaToken >& aTokens ) override;
741
742
                            // XCellAddressable
743
    SC_DLLPUBLIC virtual css::table::CellAddress SAL_CALL getCellAddress() override;
744
745
                            // XSheetAnnotationAnchor
746
    virtual css::uno::Reference< css::sheet::XSheetAnnotation > SAL_CALL
747
                            getAnnotation() override;
748
749
                            // XTextFieldsSupplier
750
    virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL
751
                            getTextFields() override;
752
    virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL
753
                            getTextFieldMasters() override;
754
755
                            // XPropertySet override due to cell properties
756
    virtual css::uno::Reference< css::beans::XPropertySetInfo >
757
                            SAL_CALL getPropertySetInfo() override;
758
759
                            // XServiceInfo
760
    virtual OUString SAL_CALL getImplementationName() override;
761
    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
762
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
763
764
                            // XActionLockable
765
    virtual sal_Bool SAL_CALL isActionLocked() override;
766
    virtual void SAL_CALL   addActionLock() override;
767
    virtual void SAL_CALL   removeActionLock() override;
768
    virtual void SAL_CALL   setActionLocks( sal_Int16 nLock ) override;
769
    virtual sal_Int16 SAL_CALL resetActionLocks() override;
770
};
771
772
using ScTableSheetObj_BASE = cppu::ImplInheritanceHelper<ScCellRangeObj,
773
                                                         css::sheet::XSpreadsheet,
774
                                                         css::container::XNamed,
775
                                                         css::sheet::XSheetPageBreak,
776
                                                         css::sheet::XCellRangeMovement,
777
                                                         css::table::XTableChartsSupplier,
778
                                                         css::table::XTablePivotChartsSupplier,
779
                                                         css::sheet::XDataPilotTablesSupplier,
780
                                                         css::sheet::XScenariosSupplier,
781
                                                         css::sheet::XSheetAnnotationsSupplier,
782
                                                         css::drawing::XDrawPageSupplier,
783
                                                         css::sheet::XPrintAreas,
784
                                                         css::sheet::XSheetLinkable,
785
                                                         css::sheet::XSheetAuditing,
786
                                                         css::sheet::XSheetOutline,
787
                                                         css::util::XProtectable,
788
                                                         css::sheet::XScenario,
789
                                                         css::sheet::XScenarioEnhanced,
790
                                                         css::sheet::XExternalSheetName,
791
                                                         css::document::XEventsSupplier>;
792
class SC_DLLPUBLIC ScTableSheetObj final : public ScTableSheetObj_BASE
793
{
794
    friend class ScTableSheetsObj;      // for insertByName()
795
796
private:
797
    const SfxItemPropertySet*       pSheetPropSet;
798
799
    SCTAB                   GetTab_Impl() const;
800
    void                    PrintAreaUndo_Impl( std::unique_ptr<ScPrintRangeSaver> pOldRanges );
801
802
    virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
803
    virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
804
                                css::uno::Any& ) override;
805
    virtual void            SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
806
                                                const css::uno::Any& aValue ) override;
807
808
public:
809
                            ScTableSheetObj(ScDocShell* pDocSh, SCTAB nTab);
810
    virtual                 ~ScTableSheetObj() override;
811
812
    void                    InitInsertSheet(ScDocShell* pDocSh, SCTAB nTab);
813
814
                            // XSpreadsheet
815
    virtual css::uno::Reference< css::sheet::XSheetCellCursor >
816
                            SAL_CALL createCursor() override;
817
    virtual css::uno::Reference< css::sheet::XSheetCellCursor > SAL_CALL
818
                            createCursorByRange( const css::uno::Reference<
819
                                css::sheet::XSheetCellRange >& aRange ) override;
820
821
                            // XSheetCellRange
822
    virtual css::uno::Reference< css::sheet::XSpreadsheet > SAL_CALL
823
                            getSpreadsheet() override;
824
825
                            // XCellRange
826
    virtual css::uno::Reference< css::table::XCell > SAL_CALL
827
                            getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) override;
828
    virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
829
                            getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop,
830
                                sal_Int32 nRight, sal_Int32 nBottom ) override;
831
    using ScCellRangeObj::getCellRangeByName;
832
    virtual css::uno::Reference< css::table::XCellRange > SAL_CALL
833
                            getCellRangeByName( const OUString& aRange ) override;
834
835
                            // XNamed
836
    virtual OUString SAL_CALL getName() override;
837
    virtual void SAL_CALL   setName( const OUString& aName ) override;
838
839
                            // XSheetPageBreak
840
    virtual css::uno::Sequence< css::sheet::TablePageBreakData > SAL_CALL
841
                            getColumnPageBreaks() override;
842
    virtual css::uno::Sequence< css::sheet::TablePageBreakData > SAL_CALL
843
                            getRowPageBreaks() override;
844
    virtual void SAL_CALL   removeAllManualPageBreaks() override;
845
846
                            // XCellRangeMovement
847
    virtual void SAL_CALL   insertCells( const css::table::CellRangeAddress& aRange,
848
                                css::sheet::CellInsertMode nMode ) override;
849
    virtual void SAL_CALL   removeRange( const css::table::CellRangeAddress& aRange,
850
                                css::sheet::CellDeleteMode nMode ) override;
851
    virtual void SAL_CALL   moveRange( const css::table::CellAddress& aDestination,
852
                                const css::table::CellRangeAddress& aSource ) override;
853
    virtual void SAL_CALL   copyRange( const css::table::CellAddress& aDestination,
854
                                const css::table::CellRangeAddress& aSource ) override;
855
856
                            // XTableChartsSupplier
857
    virtual css::uno::Reference< css::table::XTableCharts > SAL_CALL
858
                            getCharts() override;
859
860
                            // XTablePivotChartsSupplier
861
    virtual css::uno::Reference<css::table::XTablePivotCharts> SAL_CALL
862
                            getPivotCharts() override;
863
864
                            // XDataPilotTablesSupplier
865
    virtual css::uno::Reference< css::sheet::XDataPilotTables > SAL_CALL
866
                            getDataPilotTables() override;
867
868
                            // XScenariosSupplier
869
    virtual css::uno::Reference< css::sheet::XScenarios > SAL_CALL
870
                            getScenarios() override;
871
872
                            // XSheetAnnotationsSupplier
873
    virtual css::uno::Reference< css::sheet::XSheetAnnotations > SAL_CALL
874
                            getAnnotations() override;
875
876
                            // XDrawPageSupplier
877
    virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL
878
                            getDrawPage() override;
879
880
                            // XPrintAreas
881
    virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
882
                            getPrintAreas() override;
883
    virtual void SAL_CALL setPrintAreas( const css::uno::Sequence<
884
                                css::table::CellRangeAddress >& aPrintAreas ) override;
885
    virtual sal_Bool SAL_CALL getPrintTitleColumns() override;
886
    virtual void SAL_CALL   setPrintTitleColumns( sal_Bool bPrintTitleColumns ) override;
887
    virtual css::table::CellRangeAddress SAL_CALL getTitleColumns() override;
888
    virtual void SAL_CALL   setTitleColumns(
889
                                const css::table::CellRangeAddress& aTitleColumns ) override;
890
    virtual sal_Bool SAL_CALL getPrintTitleRows() override;
891
    virtual void SAL_CALL   setPrintTitleRows( sal_Bool bPrintTitleRows ) override;
892
    virtual css::table::CellRangeAddress SAL_CALL getTitleRows() override;
893
    virtual void SAL_CALL   setTitleRows(
894
                                const css::table::CellRangeAddress& aTitleRows ) override;
895
896
                            // XSheetLinkable
897
    virtual css::sheet::SheetLinkMode SAL_CALL getLinkMode() override;
898
    virtual void SAL_CALL   setLinkMode( css::sheet::SheetLinkMode nLinkMode ) override;
899
    virtual OUString SAL_CALL getLinkUrl() override;
900
    virtual void SAL_CALL   setLinkUrl( const OUString& aLinkUrl ) override;
901
    virtual OUString SAL_CALL getLinkSheetName() override;
902
    virtual void SAL_CALL   setLinkSheetName( const OUString& aLinkSheetName ) override;
903
    virtual void SAL_CALL   link( const OUString& aUrl,
904
                                const OUString& aSheetName,
905
                                const OUString& aFilterName,
906
                                const OUString& aFilterOptions,
907
                                css::sheet::SheetLinkMode nMode ) override;
908
909
                            // XSheetAuditing
910
    virtual sal_Bool SAL_CALL hideDependents( const css::table::CellAddress& aPosition ) override;
911
    virtual sal_Bool SAL_CALL hidePrecedents( const css::table::CellAddress& aPosition ) override;
912
    virtual sal_Bool SAL_CALL showDependents( const css::table::CellAddress& aPosition ) override;
913
    virtual sal_Bool SAL_CALL showPrecedents( const css::table::CellAddress& aPosition ) override;
914
    virtual sal_Bool SAL_CALL showErrors( const css::table::CellAddress& aPosition ) override;
915
    virtual sal_Bool SAL_CALL showInvalid() override;
916
    virtual void SAL_CALL   clearArrows() override;
917
918
                            // XSheetOutline
919
    virtual void SAL_CALL   group( const css::table::CellRangeAddress& aRange,
920
                                css::table::TableOrientation nOrientation ) override;
921
    virtual void SAL_CALL   ungroup( const css::table::CellRangeAddress& aRange,
922
                                css::table::TableOrientation nOrientation ) override;
923
    virtual void SAL_CALL   autoOutline( const css::table::CellRangeAddress& aRange ) override;
924
    virtual void SAL_CALL   clearOutline() override;
925
    virtual void SAL_CALL   hideDetail( const css::table::CellRangeAddress& aRange ) override;
926
    virtual void SAL_CALL   showDetail( const css::table::CellRangeAddress& aRange ) override;
927
    virtual void SAL_CALL   showLevel( sal_Int16 nLevel,
928
                                css::table::TableOrientation nOrientation ) override;
929
930
                            // XProtectable
931
    virtual void SAL_CALL   protect( const OUString& aPassword ) override;
932
    virtual void SAL_CALL   unprotect( const OUString& aPassword ) override;
933
    virtual sal_Bool SAL_CALL isProtected() override;
934
935
                            // XScenario
936
    virtual sal_Bool SAL_CALL getIsScenario() override;
937
    virtual OUString SAL_CALL getScenarioComment() override;
938
    virtual void SAL_CALL   setScenarioComment( const OUString& aScenarioComment ) override;
939
    virtual void SAL_CALL   addRanges( const css::uno::Sequence<
940
                                css::table::CellRangeAddress >& aRanges ) override;
941
    virtual void SAL_CALL   apply() override;
942
                            // XScenarioEnhanced
943
    virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
944
                            getRanges(  ) override;
945
946
                            // XExternalSheetName
947
    virtual void SAL_CALL   setExternalName( const OUString& aUrl, const OUString& aSheetName ) override;
948
949
                            // XEventsSupplier
950
    virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override;
951
952
                            // XPropertySet override due to sheet properties
953
    virtual css::uno::Reference< css::beans::XPropertySetInfo >
954
                            SAL_CALL getPropertySetInfo() override;
955
956
                            // XServiceInfo
957
    virtual OUString SAL_CALL getImplementationName() override;
958
    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
959
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
960
961
protected:
962
    void AdjustUpdatedRanges(UpdateRefMode mode) override;
963
};
964
965
using ScTableColumnObj_BASE = cppu::ImplInheritanceHelper<ScCellRangeObj,
966
                                                          css::container::XNamed>;
967
class ScTableColumnObj final : public ScTableColumnObj_BASE
968
{
969
private:
970
    const SfxItemPropertySet*       pColPropSet;
971
972
    virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
973
    virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
974
                                css::uno::Any& ) override;
975
    virtual void            SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
976
                                                const css::uno::Any& aValue ) override;
977
978
public:
979
                            ScTableColumnObj(ScDocShell* pDocSh, SCCOL nCol, SCTAB nTab);
980
    virtual                 ~ScTableColumnObj() override;
981
982
                            // XNamed
983
    virtual OUString SAL_CALL getName() override;
984
    virtual void SAL_CALL   setName( const OUString& aName ) override;
985
986
                            // XPropertySet override due to column properties
987
    virtual css::uno::Reference< css::beans::XPropertySetInfo >
988
                            SAL_CALL getPropertySetInfo() override;
989
990
                            // XServiceInfo
991
    virtual OUString SAL_CALL getImplementationName() override;
992
    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
993
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
994
995
protected:
996
    void AdjustUpdatedRanges(UpdateRefMode mode) override;
997
};
998
999
class ScTableRowObj final : public ScCellRangeObj
1000
{
1001
private:
1002
    const SfxItemPropertySet*       pRowPropSet;
1003
1004
    virtual const SfxItemPropertyMap& GetItemPropertyMap() override;
1005
    virtual void GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
1006
                                css::uno::Any& ) override;
1007
    virtual void            SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry,
1008
                                                const css::uno::Any& aValue ) override;
1009
1010
public:
1011
                            ScTableRowObj(ScDocShell* pDocSh, SCROW nRow, SCTAB nTab);
1012
    virtual                 ~ScTableRowObj() override;
1013
1014
                            // XPropertySet override due to row properties
1015
    virtual css::uno::Reference< css::beans::XPropertySetInfo >
1016
                            SAL_CALL getPropertySetInfo() override;
1017
1018
                            // XServiceInfo
1019
    virtual OUString SAL_CALL getImplementationName() override;
1020
    virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
1021
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
1022
1023
protected:
1024
    void AdjustUpdatedRanges(UpdateRefMode mode) override;
1025
};
1026
1027
class ScCellsObj final : public cppu::WeakImplHelper<
1028
                            css::container::XEnumerationAccess,
1029
                            css::lang::XServiceInfo >,
1030
                        public SfxListener
1031
{
1032
private:
1033
    ScDocShell*             pDocShell;
1034
    ScRangeList             aRanges;
1035
1036
public:
1037
                            ScCellsObj(ScDocShell* pDocSh, ScRangeList aR);
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:
1062
    ScDocShell*             pDocShell;
1063
    ScRangeList             aRanges;
1064
    ScAddress               aPos;
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, ScRangeList aR);
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:
1095
    ScDocShell*             pDocShell;
1096
    ScRange                 aTotalRange;
1097
1098
private:
1099
    rtl::Reference<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:
1131
    ScDocShell*             pDocShell;
1132
    SCTAB                   nTab;
1133
    std::unique_ptr<ScAttrRectIterator> pIter;
1134
    ScRange                 aNext;
1135
    bool                    bAtEnd;
1136
    bool                    bDirty;
1137
1138
private:
1139
    void                    Advance_Impl();
1140
    rtl::Reference<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:
1165
    ScDocShell*                     pDocShell;
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;
1199
    ScDocShell*                     pDocShell;
1200
    sal_Int32                       nCurrentPosition;
1201
1202
public:
1203
                            ScUniqueCellFormatsEnumeration(ScDocShell* pDocShell, 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
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */