Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_DPOUTPUT_HXX
30 : : #define SC_DPOUTPUT_HXX
31 : :
32 : : #include <com/sun/star/sheet/XDimensionsSupplier.hpp>
33 : : #include <com/sun/star/sheet/DataResult.hpp>
34 : : #include <com/sun/star/sheet/MemberResult.hpp>
35 : : #include <com/sun/star/sheet/GeneralFunction.hpp>
36 : : #include <com/sun/star/sheet/DataPilotOutputRangeType.hpp>
37 : :
38 : : #include "global.hxx"
39 : : #include "address.hxx"
40 : :
41 : : #include "dpcachetable.hxx"
42 : : #include "dptypes.hxx"
43 : :
44 : : #include <vector>
45 : :
46 : : namespace com { namespace sun { namespace star { namespace sheet {
47 : : struct DataPilotFieldFilter;
48 : : struct DataPilotTablePositionData;
49 : : }}}}
50 : :
51 : : class Rectangle;
52 : : class ScDocument;
53 : :
54 : : struct ScDPOutLevelData;
55 : :
56 : :
57 : 0 : struct ScDPGetPivotDataField
58 : : {
59 : : rtl::OUString maFieldName;
60 : : com::sun::star::sheet::GeneralFunction meFunction;
61 : :
62 : : bool mbValIsStr;
63 : : rtl::OUString maValStr;
64 : : double mnValNum;
65 : :
66 : 0 : ScDPGetPivotDataField() :
67 : : meFunction( com::sun::star::sheet::GeneralFunction_NONE ),
68 : : mbValIsStr( false ),
69 : 0 : mnValNum( 0.0 )
70 : : {
71 : 0 : }
72 : : };
73 : :
74 : :
75 : :
76 : : class ScDPOutput
77 : : {
78 : : private:
79 : : ScDocument* pDoc;
80 : : com::sun::star::uno::Reference<
81 : : com::sun::star::sheet::XDimensionsSupplier> xSource;
82 : : ScAddress aStartPos;
83 : : ScDPOutLevelData* pColFields;
84 : : ScDPOutLevelData* pRowFields;
85 : : ScDPOutLevelData* pPageFields;
86 : : long nColFieldCount;
87 : : long nRowFieldCount;
88 : : long nPageFieldCount;
89 : : com::sun::star::uno::Sequence<
90 : : com::sun::star::uno::Sequence<
91 : : com::sun::star::sheet::DataResult> > aData;
92 : : rtl::OUString aDataDescription;
93 : :
94 : : // Number format related parameters
95 : : sal_uInt32* pColNumFmt;
96 : : sal_uInt32* pRowNumFmt;
97 : : long nColFmtCount;
98 : : long nRowFmtCount;
99 : : sal_uInt32 nSingleNumFmt;
100 : :
101 : : // Output geometry related parameters
102 : : long nColCount;
103 : : long nRowCount;
104 : : long nHeaderSize;
105 : : SCCOL nTabStartCol;
106 : : SCROW nTabStartRow;
107 : : SCCOL nMemberStartCol;
108 : : SCROW nMemberStartRow;
109 : : SCCOL nDataStartCol;
110 : : SCROW nDataStartRow;
111 : : SCCOL nTabEndCol;
112 : : SCROW nTabEndRow;
113 : : bool bDoFilter:1;
114 : : bool bResultsError:1;
115 : : bool mbHasDataLayout:1;
116 : : bool bSizesValid:1;
117 : : bool bSizeOverflow:1;
118 : : bool mbHeaderLayout:1; // true : grid, false : standard
119 : :
120 : : void DataCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
121 : : const com::sun::star::sheet::DataResult& rData );
122 : : void HeaderCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
123 : : const com::sun::star::sheet::MemberResult& rData,
124 : : bool bColHeader, long nLevel );
125 : :
126 : : void FieldCell(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScDPOutLevelData& rData, bool bInTable);
127 : :
128 : : void CalcSizes();
129 : :
130 : : /** Query which sub-area of the table the cell is in. See
131 : : css.sheet.DataPilotTablePositionType for the interpretation of the
132 : : return value. */
133 : : sal_Int32 GetPositionType(const ScAddress& rPos);
134 : :
135 : : public:
136 : : ScDPOutput( ScDocument* pD,
137 : : const com::sun::star::uno::Reference<
138 : : com::sun::star::sheet::XDimensionsSupplier>& xSrc,
139 : : const ScAddress& rPos, bool bFilter );
140 : : ~ScDPOutput();
141 : :
142 : : void SetPosition( const ScAddress& rPos );
143 : :
144 : : void Output(); //! Refresh?
145 : : ScRange GetOutputRange( sal_Int32 nRegionType = ::com::sun::star::sheet::DataPilotOutputRangeType::WHOLE );
146 : : long GetHeaderRows();
147 : : bool HasError(); // range overflow or exception from source
148 : :
149 : : void GetPositionData(const ScAddress& rPos, ::com::sun::star::sheet::DataPilotTablePositionData& rPosData);
150 : :
151 : : /** Get filtering criteria based on the position of the cell within data
152 : : field region. */
153 : : bool GetDataResultPositionData(::std::vector< ::com::sun::star::sheet::DataPilotFieldFilter >& rFilters, const ScAddress& rPos);
154 : :
155 : : /**
156 : : * @return true on success and stores the result in rTarget, or false if
157 : : * rFilters or rTarget describe something that is not visible.
158 : : */
159 : : bool GetPivotData( ScDPGetPivotDataField& rTarget,
160 : : const std::vector< ScDPGetPivotDataField >& rFilters );
161 : : long GetHeaderDim( const ScAddress& rPos, sal_uInt16& rOrient );
162 : : bool GetHeaderDrag(
163 : : const ScAddress& rPos, bool bMouseLeft, bool bMouseTop, long nDragDim,
164 : : Rectangle& rPosRect, sal_uInt16& rOrient, long& rDimPos );
165 : : bool IsFilterButton( const ScAddress& rPos );
166 : :
167 : : void GetMemberResultNames(ScDPUniqueStringSet& rNames, long nDimension);
168 : :
169 : : void SetHeaderLayout(bool bUseGrid);
170 : : bool GetHeaderLayout() const;
171 : :
172 : : static void GetDataDimensionNames(
173 : : rtl::OUString& rSourceName, rtl::OUString& rGivenName,
174 : : const com::sun::star::uno::Reference<
175 : : com::sun::star::uno::XInterface>& xDim );
176 : : };
177 : :
178 : :
179 : : #endif
180 : :
181 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|