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"
25 #include "address.hxx"
27 #include "queryparam.hxx"
29 #include <boost/unordered_set.hpp>
32 namespace com
{ namespace sun
{ namespace star
{ namespace sheet
{
33 struct DataPilotFieldFilter
;
36 class ScDPDimensionSaveData
;
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.
44 class ScSheetSourceDesc
46 ScSheetSourceDesc(); // disabled
49 SC_DLLPUBLIC
ScSheetSourceDesc(ScDocument
* pDoc
);
51 SC_DLLPUBLIC
void SetSourceRange(const ScRange
& rRange
);
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
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>
61 * @return source range.
63 SC_DLLPUBLIC
const ScRange
& GetSourceRange() const;
64 SC_DLLPUBLIC
void SetRangeName(const OUString
& rName
);
65 SC_DLLPUBLIC
const OUString
& GetRangeName() const;
66 bool HasRangeName() const;
67 void SetQueryParam(const ScQueryParam
& rParam
);
68 const ScQueryParam
& GetQueryParam() const;
70 bool operator== ( const ScSheetSourceDesc
& rOther
) const;
71 SC_DLLPUBLIC
const ScDPCache
* CreateCache(const ScDPDimensionSaveData
* pDimData
) const;
74 * Check the sanity of the data source range.
76 * @return 0 if the source range is sane, otherwise an error message ID is
79 sal_uLong
CheckSourceRange() const;
82 mutable ScRange maSourceRange
;
84 ScQueryParam maQueryParam
;
89 * Implementation of ScDPTableData with sheet data.
91 class SC_DLLPUBLIC ScSheetDPData
: public ScDPTableData
95 bool bIgnoreEmptyRows
;
98 ScDPFilteredCache aCacheTable
;
101 ScSheetDPData(ScDocument
* pD
, const ScSheetSourceDesc
& rDesc
, const ScDPCache
& rCache
);
102 virtual ~ScSheetDPData();
104 virtual long GetColumnCount() SAL_OVERRIDE
;
105 virtual OUString
getDimensionName(long nColumn
) SAL_OVERRIDE
;
106 virtual bool getIsDataLayoutDimension(long nColumn
) SAL_OVERRIDE
;
107 virtual bool IsDateDimension(long nDim
) SAL_OVERRIDE
;
108 virtual sal_uLong
GetNumberFormat(long nDim
) SAL_OVERRIDE
;
109 virtual void DisposeData() SAL_OVERRIDE
;
110 virtual void SetEmptyFlags( bool bIgnoreEmptyRows
, bool bRepeatIfEmpty
) SAL_OVERRIDE
;
112 virtual bool IsRepeatIfEmpty() SAL_OVERRIDE
;
114 virtual void CreateCacheTable() SAL_OVERRIDE
;
115 virtual void FilterCacheTable(const ::std::vector
<ScDPFilteredCache::Criterion
>& rCriteria
, const ::boost::unordered_set
<sal_Int32
>& rCatDims
) SAL_OVERRIDE
;
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
) SAL_OVERRIDE
;
119 virtual void CalcResults(CalcInfo
& rInfo
, bool bAutoShow
) SAL_OVERRIDE
;
120 virtual const ScDPFilteredCache
& GetCacheTable() const SAL_OVERRIDE
;
121 virtual void ReloadCacheTable() SAL_OVERRIDE
;
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */