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