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_DPOUTPUT_HXX
21 : #define SC_DPOUTPUT_HXX
22 :
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/GeneralFunction.hpp>
27 : #include <com/sun/star/sheet/DataPilotOutputRangeType.hpp>
28 :
29 : #include "global.hxx"
30 : #include "address.hxx"
31 :
32 : #include "dpfilteredcache.hxx"
33 : #include "dptypes.hxx"
34 :
35 : #include <vector>
36 :
37 : namespace com { namespace sun { namespace star { namespace sheet {
38 : struct DataPilotFieldFilter;
39 : struct DataPilotTablePositionData;
40 : }}}}
41 :
42 : class Rectangle;
43 : class ScDocument;
44 :
45 : struct ScDPOutLevelData;
46 :
47 :
48 0 : struct ScDPGetPivotDataField
49 : {
50 : OUString maFieldName;
51 : com::sun::star::sheet::GeneralFunction meFunction;
52 :
53 : bool mbValIsStr;
54 : OUString maValStr;
55 : double mnValNum;
56 :
57 0 : ScDPGetPivotDataField() :
58 : meFunction( com::sun::star::sheet::GeneralFunction_NONE ),
59 : mbValIsStr( false ),
60 0 : mnValNum( 0.0 )
61 : {
62 0 : }
63 : };
64 :
65 :
66 :
67 : class ScDPOutput
68 : {
69 : private:
70 : ScDocument* pDoc;
71 : com::sun::star::uno::Reference<
72 : com::sun::star::sheet::XDimensionsSupplier> xSource;
73 : ScAddress aStartPos;
74 : ScDPOutLevelData* pColFields;
75 : ScDPOutLevelData* pRowFields;
76 : ScDPOutLevelData* pPageFields;
77 : long nColFieldCount;
78 : long nRowFieldCount;
79 : long nPageFieldCount;
80 : com::sun::star::uno::Sequence<
81 : com::sun::star::uno::Sequence<
82 : com::sun::star::sheet::DataResult> > aData;
83 : OUString aDataDescription;
84 :
85 : // Number format related parameters
86 : sal_uInt32* pColNumFmt;
87 : sal_uInt32* pRowNumFmt;
88 : long nColFmtCount;
89 : long nRowFmtCount;
90 : sal_uInt32 nSingleNumFmt;
91 :
92 : // Output geometry related parameters
93 : long nColCount;
94 : long nRowCount;
95 : long nHeaderSize;
96 : SCCOL nTabStartCol;
97 : SCROW nTabStartRow;
98 : SCCOL nMemberStartCol;
99 : SCROW nMemberStartRow;
100 : SCCOL nDataStartCol;
101 : SCROW nDataStartRow;
102 : SCCOL nTabEndCol;
103 : SCROW nTabEndRow;
104 : bool bDoFilter:1;
105 : bool bResultsError:1;
106 : bool mbHasDataLayout:1;
107 : bool bSizesValid:1;
108 : bool bSizeOverflow:1;
109 : bool mbHeaderLayout:1; // true : grid, false : standard
110 :
111 : void DataCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
112 : const com::sun::star::sheet::DataResult& rData );
113 : void HeaderCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
114 : const com::sun::star::sheet::MemberResult& rData,
115 : bool bColHeader, long nLevel );
116 :
117 : void FieldCell(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScDPOutLevelData& rData, bool bInTable);
118 :
119 : void CalcSizes();
120 :
121 : /** Query which sub-area of the table the cell is in. See
122 : css.sheet.DataPilotTablePositionType for the interpretation of the
123 : return value. */
124 : sal_Int32 GetPositionType(const ScAddress& rPos);
125 :
126 : public:
127 : ScDPOutput( ScDocument* pD,
128 : const com::sun::star::uno::Reference<
129 : com::sun::star::sheet::XDimensionsSupplier>& xSrc,
130 : const ScAddress& rPos, bool bFilter );
131 : ~ScDPOutput();
132 :
133 : void SetPosition( const ScAddress& rPos );
134 :
135 : void Output(); //! Refresh?
136 : ScRange GetOutputRange( sal_Int32 nRegionType = ::com::sun::star::sheet::DataPilotOutputRangeType::WHOLE );
137 : long GetHeaderRows();
138 : bool HasError(); // range overflow or exception from source
139 :
140 : void GetPositionData(const ScAddress& rPos, ::com::sun::star::sheet::DataPilotTablePositionData& rPosData);
141 :
142 : /** Get filtering criteria based on the position of the cell within data
143 : field region. */
144 : bool GetDataResultPositionData(::std::vector< ::com::sun::star::sheet::DataPilotFieldFilter >& rFilters, const ScAddress& rPos);
145 :
146 : long GetHeaderDim( const ScAddress& rPos, sal_uInt16& rOrient );
147 : bool GetHeaderDrag(
148 : const ScAddress& rPos, bool bMouseLeft, bool bMouseTop, long nDragDim,
149 : Rectangle& rPosRect, sal_uInt16& rOrient, long& rDimPos );
150 : bool IsFilterButton( const ScAddress& rPos );
151 :
152 : void GetMemberResultNames(ScDPUniqueStringSet& rNames, long nDimension);
153 :
154 : void SetHeaderLayout(bool bUseGrid);
155 : bool GetHeaderLayout() const;
156 :
157 : static void GetDataDimensionNames(
158 : OUString& rSourceName, OUString& rGivenName,
159 : const com::sun::star::uno::Reference<
160 : com::sun::star::uno::XInterface>& xDim );
161 : };
162 :
163 :
164 : #endif
165 :
166 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|