/src/libreoffice/sc/inc/dpshttab.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 "dptabdat.hxx" |
23 | | #include "address.hxx" |
24 | | #include "scdllapi.h" |
25 | | #include "queryparam.hxx" |
26 | | #include <unotools/resmgr.hxx> |
27 | | |
28 | | #include <unordered_set> |
29 | | #include <vector> |
30 | | |
31 | | class ScDPDimensionSaveData; |
32 | | |
33 | | /** |
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. |
38 | | */ |
39 | | class ScSheetSourceDesc |
40 | | { |
41 | | public: |
42 | | ScSheetSourceDesc() = delete; |
43 | | |
44 | | SC_DLLPUBLIC ScSheetSourceDesc(ScDocument* pDoc); |
45 | | |
46 | | SC_DLLPUBLIC void SetSourceRange(const ScRange& rRange); |
47 | | |
48 | | /** |
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 |
51 | | * name points to. |
52 | | * |
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> |
55 | | * |
56 | | * @return source range. |
57 | | */ |
58 | | SC_DLLPUBLIC const ScRange& GetSourceRange() const; |
59 | | SC_DLLPUBLIC void SetRangeName(const OUString& rName); |
60 | 0 | const OUString& GetRangeName() const { return maRangeName;} |
61 | | bool HasRangeName() const; |
62 | | void SetQueryParam(const ScQueryParam& rParam); |
63 | 1.40k | const ScQueryParam& GetQueryParam() const { return maQueryParam;} |
64 | | |
65 | | bool operator== ( const ScSheetSourceDesc& rOther ) const; |
66 | | SC_DLLPUBLIC const ScDPCache* CreateCache(const ScDPDimensionSaveData* pDimData) const; |
67 | | |
68 | | /** |
69 | | * Check the sanity of the data source range. |
70 | | * |
71 | | * @return nullptr if the source range is sane, otherwise an error message ID is |
72 | | * returned. |
73 | | */ |
74 | | TranslateId CheckSourceRange() const; |
75 | | |
76 | | private: |
77 | | mutable ScRange maSourceRange; |
78 | | OUString maRangeName; |
79 | | ScQueryParam maQueryParam; |
80 | | ScDocument* mpDoc; |
81 | | }; |
82 | | |
83 | | /** |
84 | | * Implementation of ScDPTableData with sheet data. |
85 | | */ |
86 | | class SAL_DLLPUBLIC_RTTI ScSheetDPData final : public ScDPTableData |
87 | | { |
88 | | private: |
89 | | ScQueryParam aQuery; |
90 | | bool bIgnoreEmptyRows; |
91 | | bool bRepeatIfEmpty; |
92 | | |
93 | | ScDPFilteredCache aCacheTable; |
94 | | |
95 | | public: |
96 | | SC_DLLPUBLIC ScSheetDPData(const ScDocument* pD, const ScSheetSourceDesc& rDesc, const ScDPCache& rCache); |
97 | | SC_DLLPUBLIC virtual ~ScSheetDPData() override; |
98 | | |
99 | | virtual sal_Int32 GetColumnCount() override; |
100 | | virtual OUString getDimensionName(sal_Int32 nColumn) override; |
101 | | virtual bool getIsDataLayoutDimension(sal_Int32 nColumn) override; |
102 | | virtual bool IsDateDimension(sal_Int32 nDim) override; |
103 | | virtual sal_uInt32 GetNumberFormat(sal_Int32 nDim) override; |
104 | | virtual void DisposeData() override; |
105 | | virtual void SetEmptyFlags( bool bIgnoreEmptyRows, bool bRepeatIfEmpty ) override; |
106 | | |
107 | | virtual bool IsRepeatIfEmpty() override; |
108 | | |
109 | | virtual void CreateCacheTable() override; |
110 | | virtual void FilterCacheTable(std::vector<ScDPFilteredCache::Criterion>&& rCriteria, std::unordered_set<sal_Int32>&& rCatDims) override; |
111 | | virtual void GetDrillDownData(std::vector<ScDPFilteredCache::Criterion>&& rCriteria, |
112 | | 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; |
117 | | |
118 | | virtual void dumpAsXml(tools::XmlWriter& rWriter) const override; |
119 | | |
120 | | #if DUMP_PIVOT_TABLE |
121 | | virtual void Dump() const override; |
122 | | #endif |
123 | | }; |
124 | | |
125 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |