1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_INC_DPSHTTAB_HXX
21 #define INCLUDED_SC_INC_DPSHTTAB_HXX
23 #include "dptabdat.hxx"
24 #include "address.hxx"
26 #include "queryparam.hxx"
28 #include <unordered_set>
31 class ScDPDimensionSaveData
;
34 * This class contains authoritative information on the internal reference
35 * used as the data source for datapilot table. <i>The range name takes
36 * precedence over the source range when it's non-empty.</i> When the range
37 * name is empty, the source range gets used.
39 class ScSheetSourceDesc
42 ScSheetSourceDesc() = delete;
44 SC_DLLPUBLIC
ScSheetSourceDesc(ScDocument
* pDoc
);
46 SC_DLLPUBLIC
void SetSourceRange(const ScRange
& rRange
);
49 * Get the range that contains the source data. In case the source data
50 * is referred to via a range name, it returns the range that the range
53 * <i>Note that currently only a single range is supported; if the
54 * range name contains multiple ranges, only the first range is used.</i>
56 * @return source range.
58 SC_DLLPUBLIC
const ScRange
& GetSourceRange() const;
59 SC_DLLPUBLIC
void SetRangeName(const OUString
& rName
);
60 const OUString
& GetRangeName() const { return maRangeName
;}
61 bool HasRangeName() const;
62 void SetQueryParam(const ScQueryParam
& rParam
);
63 const ScQueryParam
& GetQueryParam() const { return maQueryParam
;}
65 bool operator== ( const ScSheetSourceDesc
& rOther
) const;
66 SC_DLLPUBLIC
const ScDPCache
* CreateCache(const ScDPDimensionSaveData
* pDimData
) const;
69 * Check the sanity of the data source range.
71 * @return nullptr if the source range is sane, otherwise an error message ID is
74 const char* CheckSourceRange() const;
77 mutable ScRange maSourceRange
;
79 ScQueryParam maQueryParam
;
84 * Implementation of ScDPTableData with sheet data.
86 class SC_DLLPUBLIC ScSheetDPData final
: public ScDPTableData
90 bool bIgnoreEmptyRows
;
93 ScDPFilteredCache aCacheTable
;
96 ScSheetDPData(const ScDocument
* pD
, const ScSheetSourceDesc
& rDesc
, const ScDPCache
& rCache
);
97 virtual ~ScSheetDPData() override
;
99 virtual long GetColumnCount() override
;
100 virtual OUString
getDimensionName(long nColumn
) override
;
101 virtual bool getIsDataLayoutDimension(long nColumn
) override
;
102 virtual bool IsDateDimension(long nDim
) override
;
103 virtual sal_uInt32
GetNumberFormat(long nDim
) override
;
104 virtual void DisposeData() override
;
105 virtual void SetEmptyFlags( bool bIgnoreEmptyRows
, bool bRepeatIfEmpty
) override
;
107 virtual bool IsRepeatIfEmpty() override
;
109 virtual void CreateCacheTable() override
;
110 virtual void FilterCacheTable(const std::vector
<ScDPFilteredCache::Criterion
>& rCriteria
, const std::unordered_set
<sal_Int32
>& rCatDims
) override
;
111 virtual void GetDrillDownData(const std::vector
<ScDPFilteredCache::Criterion
>& rCriteria
,
112 const std::unordered_set
<sal_Int32
>& rCatDims
,
113 css::uno::Sequence
< css::uno::Sequence
< css::uno::Any
> >& rData
) override
;
114 virtual void CalcResults(CalcInfo
& rInfo
, bool bAutoShow
) override
;
115 virtual const ScDPFilteredCache
& GetCacheTable() const override
;
116 virtual void ReloadCacheTable() override
;
119 virtual void Dump() const override
;
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */