Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / dpoutput.hxx
blob0a4309ca9dcdad35348f0f6ad643d3ab25437e2e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_DPOUTPUT_HXX
21 #define INCLUDED_SC_INC_DPOUTPUT_HXX
23 #include <com/sun/star/sheet/XDimensionsSupplier.hpp>
24 #include <com/sun/star/sheet/DataResult.hpp>
25 #include <com/sun/star/sheet/MemberResult.hpp>
26 #include <com/sun/star/sheet/DataPilotOutputRangeType.hpp>
27 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
29 #include "address.hxx"
31 #include "dpfilteredcache.hxx"
32 #include "dptypes.hxx"
34 #include <memory>
35 #include <vector>
37 namespace com { namespace sun { namespace star { namespace sheet {
38 struct DataPilotFieldFilter;
39 struct DataPilotTablePositionData;
40 }}}}
42 namespace tools { class Rectangle; }
43 class ScDocument;
44 struct ScDPOutLevelData;
46 class ScDPOutput
48 private:
49 ScDocument* pDoc;
50 css::uno::Reference< css::sheet::XDimensionsSupplier> xSource;
51 ScAddress aStartPos;
52 std::vector<ScDPOutLevelData> pColFields;
53 std::vector<ScDPOutLevelData> pRowFields;
54 std::vector<ScDPOutLevelData> pPageFields;
55 css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult> > aData;
56 OUString aDataDescription;
58 // Number format related parameters
59 std::unique_ptr<sal_uInt32[]>
60 pColNumFmt;
61 std::unique_ptr<sal_uInt32[]>
62 pRowNumFmt;
63 long nColFmtCount;
64 long nRowFmtCount;
65 sal_uInt32 nSingleNumFmt;
67 // Output geometry related parameters
68 long nColCount;
69 long nRowCount;
70 long nHeaderSize;
71 SCCOL nTabStartCol;
72 SCROW nTabStartRow;
73 SCCOL nMemberStartCol;
74 SCROW nMemberStartRow;
75 SCCOL nDataStartCol;
76 SCROW nDataStartRow;
77 SCCOL nTabEndCol;
78 SCROW nTabEndRow;
79 bool bDoFilter:1;
80 bool bResultsError:1;
81 bool bSizesValid:1;
82 bool bSizeOverflow:1;
83 bool mbHeaderLayout:1; // true : grid, false : standard
85 void DataCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
86 const css::sheet::DataResult& rData );
87 void HeaderCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
88 const css::sheet::MemberResult& rData,
89 bool bColHeader, long nLevel );
91 void FieldCell(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScDPOutLevelData& rData, bool bInTable);
93 void CalcSizes();
95 /** Query which sub-area of the table the cell is in. See
96 css.sheet.DataPilotTablePositionType for the interpretation of the
97 return value. */
98 sal_Int32 GetPositionType(const ScAddress& rPos);
100 public:
101 ScDPOutput( ScDocument* pD,
102 const css::uno::Reference< css::sheet::XDimensionsSupplier>& xSrc,
103 const ScAddress& rPos, bool bFilter );
104 ~ScDPOutput();
106 void SetPosition( const ScAddress& rPos );
108 void Output(); //! Refresh?
109 ScRange GetOutputRange( sal_Int32 nRegionType = css::sheet::DataPilotOutputRangeType::WHOLE );
110 long GetHeaderRows();
111 bool HasError(); // range overflow or exception from source
113 void GetPositionData(const ScAddress& rPos, css::sheet::DataPilotTablePositionData& rPosData);
115 /** Get filtering criteria based on the position of the cell within data
116 field region. */
117 bool GetDataResultPositionData(::std::vector< css::sheet::DataPilotFieldFilter >& rFilters, const ScAddress& rPos);
119 long GetHeaderDim( const ScAddress& rPos, css::sheet::DataPilotFieldOrientation& rOrient );
120 bool GetHeaderDrag(
121 const ScAddress& rPos, bool bMouseLeft, bool bMouseTop, long nDragDim,
122 tools::Rectangle& rPosRect, css::sheet::DataPilotFieldOrientation& rOrient, long& rDimPos );
123 bool IsFilterButton( const ScAddress& rPos );
125 void GetMemberResultNames(ScDPUniqueStringSet& rNames, long nDimension);
127 void SetHeaderLayout(bool bUseGrid);
128 bool GetHeaderLayout() const { return mbHeaderLayout;}
130 static void GetDataDimensionNames(
131 OUString& rSourceName, OUString& rGivenName,
132 const css::uno::Reference< css::uno::XInterface>& xDim );
135 #endif
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */