Line data Source code
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 SC_DPSHTTAB_HXX
21 : #define SC_DPSHTTAB_HXX
22 :
23 : #include "dptabdat.hxx"
24 : #include "global.hxx"
25 : #include "address.hxx"
26 : #include "scdllapi.h"
27 : #include "queryparam.hxx"
28 :
29 : #include <boost/unordered_set.hpp>
30 : #include <vector>
31 :
32 : namespace com { namespace sun { namespace star { namespace sheet {
33 : struct DataPilotFieldFilter;
34 : }}}}
35 :
36 : class ScDPDimensionSaveData;
37 :
38 : /**
39 : * This class contains authoritative information on the internal reference
40 : * used as the data source for datapilot table. <i>The range name takes
41 : * precedence over the source range when it's non-empty.</i> When the range
42 : * name is empty, the source range gets used.
43 : */
44 51 : class ScSheetSourceDesc
45 : {
46 : ScSheetSourceDesc(); // disabled
47 :
48 : public:
49 : SC_DLLPUBLIC ScSheetSourceDesc(ScDocument* pDoc);
50 :
51 : SC_DLLPUBLIC void SetSourceRange(const ScRange& rRange);
52 :
53 : /**
54 : * Get the range that contains the source data. In case the source data
55 : * is referred to via a range name, it returns the range that the range
56 : * name points to.
57 : *
58 : * <i>Note that currently only a single range is supported; if the
59 : * range name contains multiple ranges, only the first range is used.</i>
60 : *
61 : * @return source range.
62 : */
63 : SC_DLLPUBLIC const ScRange& GetSourceRange() const;
64 : SC_DLLPUBLIC void SetRangeName(const ::rtl::OUString& rName);
65 : SC_DLLPUBLIC const ::rtl::OUString& GetRangeName() const;
66 : bool HasRangeName() const;
67 : void SetQueryParam(const ScQueryParam& rParam);
68 : const ScQueryParam& GetQueryParam() const;
69 :
70 : bool operator== ( const ScSheetSourceDesc& rOther ) const;
71 : SC_DLLPUBLIC const ScDPCache* CreateCache(const ScDPDimensionSaveData* pDimData) const;
72 :
73 : /**
74 : * Check the sanity of the data source range.
75 : *
76 : * @return 0 if the source range is sane, otherwise an error message ID is
77 : * returned.
78 : */
79 : sal_uLong CheckSourceRange() const;
80 :
81 : private:
82 : mutable ScRange maSourceRange;
83 : ::rtl::OUString maRangeName;
84 : ScQueryParam maQueryParam;
85 : ScDocument* mpDoc;
86 : };
87 :
88 : /**
89 : * Implementation of ScDPTableData with sheet data.
90 : */
91 : class SC_DLLPUBLIC ScSheetDPData : public ScDPTableData
92 : {
93 : private:
94 : ScQueryParam aQuery;
95 : bool bIgnoreEmptyRows;
96 : bool bRepeatIfEmpty;
97 :
98 : ScDPFilteredCache aCacheTable;
99 :
100 : public:
101 : ScSheetDPData(ScDocument* pD, const ScSheetSourceDesc& rDesc, const ScDPCache& rCache);
102 : virtual ~ScSheetDPData();
103 :
104 : virtual long GetColumnCount();
105 : virtual rtl::OUString getDimensionName(long nColumn);
106 : virtual sal_Bool getIsDataLayoutDimension(long nColumn);
107 : virtual sal_Bool IsDateDimension(long nDim);
108 : virtual sal_uLong GetNumberFormat(long nDim);
109 : virtual void DisposeData();
110 : virtual void SetEmptyFlags( sal_Bool bIgnoreEmptyRows, sal_Bool bRepeatIfEmpty );
111 :
112 : virtual bool IsRepeatIfEmpty();
113 :
114 : virtual void CreateCacheTable();
115 : virtual void FilterCacheTable(const ::std::vector<ScDPFilteredCache::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rCatDims);
116 : virtual void GetDrillDownData(const ::std::vector<ScDPFilteredCache::Criterion>& rCriteria,
117 : const ::boost::unordered_set<sal_Int32>& rCatDims,
118 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData);
119 : virtual void CalcResults(CalcInfo& rInfo, bool bAutoShow);
120 : virtual const ScDPFilteredCache& GetCacheTable() const;
121 : virtual void ReloadCacheTable();
122 : };
123 :
124 :
125 :
126 : #endif
127 :
128 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|