xref: /aoo41x/main/sc/inc/dpoutput.hxx (revision 38d50f7b)
1*38d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*38d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*38d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*38d50f7bSAndrew Rist  * distributed with this work for additional information
6*38d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*38d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*38d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
9*38d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*38d50f7bSAndrew Rist  *
11*38d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*38d50f7bSAndrew Rist  *
13*38d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*38d50f7bSAndrew Rist  * software distributed under the License is distributed on an
15*38d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*38d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*38d50f7bSAndrew Rist  * specific language governing permissions and limitations
18*38d50f7bSAndrew Rist  * under the License.
19*38d50f7bSAndrew Rist  *
20*38d50f7bSAndrew Rist  *************************************************************/
21*38d50f7bSAndrew Rist 
22*38d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SC_DPOUTPUT_HXX
25cdf0e10cSrcweir #define SC_DPOUTPUT_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/sheet/XDimensionsSupplier.hpp>
28cdf0e10cSrcweir #include <com/sun/star/sheet/DataResult.hpp>
29cdf0e10cSrcweir #include <com/sun/star/sheet/MemberResult.hpp>
30cdf0e10cSrcweir #include <com/sun/star/sheet/GeneralFunction.hpp>
31cdf0e10cSrcweir #include <com/sun/star/sheet/DataPilotOutputRangeType.hpp>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include "global.hxx"
34cdf0e10cSrcweir #include "address.hxx"
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include "dpcachetable.hxx"
37cdf0e10cSrcweir #include <vector>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace sheet {
40cdf0e10cSrcweir     struct DataPilotFieldFilter;
41cdf0e10cSrcweir     struct DataPilotTablePositionData;
42cdf0e10cSrcweir }}}}
43cdf0e10cSrcweir 
44cdf0e10cSrcweir class Rectangle;
45cdf0e10cSrcweir class SvStream;
46cdf0e10cSrcweir class ScDocument;
47cdf0e10cSrcweir class ScStrCollection;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir struct ScDPOutLevelData;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 
52cdf0e10cSrcweir struct ScDPGetPivotDataField
53cdf0e10cSrcweir {
54cdf0e10cSrcweir     String maFieldName;
55cdf0e10cSrcweir     com::sun::star::sheet::GeneralFunction meFunction;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     bool   mbValIsStr;
58cdf0e10cSrcweir     String maValStr;
59cdf0e10cSrcweir     double mnValNum;
60cdf0e10cSrcweir 
ScDPGetPivotDataFieldScDPGetPivotDataField61cdf0e10cSrcweir         ScDPGetPivotDataField() :
62cdf0e10cSrcweir             meFunction( com::sun::star::sheet::GeneralFunction_NONE ),
63cdf0e10cSrcweir             mbValIsStr( false ),
64cdf0e10cSrcweir             mnValNum( 0.0 )
65cdf0e10cSrcweir         {
66cdf0e10cSrcweir         }
67cdf0e10cSrcweir };
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 
71cdf0e10cSrcweir class ScDPOutput			//! name???
72cdf0e10cSrcweir {
73cdf0e10cSrcweir private:
74cdf0e10cSrcweir 	//!	use impl-object?
75cdf0e10cSrcweir 	ScDocument*				pDoc;
76cdf0e10cSrcweir 	com::sun::star::uno::Reference<
77cdf0e10cSrcweir 		com::sun::star::sheet::XDimensionsSupplier> xSource;
78cdf0e10cSrcweir 	ScAddress				aStartPos;
79cdf0e10cSrcweir 	sal_Bool					bDoFilter;
80cdf0e10cSrcweir 	ScDPOutLevelData*		pColFields;
81cdf0e10cSrcweir 	ScDPOutLevelData*		pRowFields;
82cdf0e10cSrcweir 	ScDPOutLevelData*		pPageFields;
83cdf0e10cSrcweir 	long					nColFieldCount;
84cdf0e10cSrcweir 	long					nRowFieldCount;
85cdf0e10cSrcweir 	long					nPageFieldCount;
86cdf0e10cSrcweir 	com::sun::star::uno::Sequence<
87cdf0e10cSrcweir 		com::sun::star::uno::Sequence<
88cdf0e10cSrcweir 			com::sun::star::sheet::DataResult> > aData;
89cdf0e10cSrcweir 	sal_Bool					bResultsError;
90cdf0e10cSrcweir     bool                    mbHasDataLayout;
91cdf0e10cSrcweir 	String					aDataDescription;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     // Number format related parameters
94cdf0e10cSrcweir 	sal_uInt32*					pColNumFmt;
95cdf0e10cSrcweir 	sal_uInt32*					pRowNumFmt;
96cdf0e10cSrcweir 	long					nColFmtCount;
97cdf0e10cSrcweir 	long					nRowFmtCount;
98cdf0e10cSrcweir     sal_uInt32                  nSingleNumFmt;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     // Output geometry related parameters
101cdf0e10cSrcweir 	sal_Bool					bSizesValid;
102cdf0e10cSrcweir 	sal_Bool					bSizeOverflow;
103cdf0e10cSrcweir 	long					nColCount;
104cdf0e10cSrcweir 	long					nRowCount;
105cdf0e10cSrcweir 	long					nHeaderSize;
106cdf0e10cSrcweir     bool                    mbHeaderLayout;  // sal_True : grid, sal_False : standard
107cdf0e10cSrcweir 	SCCOL					nTabStartCol;
108cdf0e10cSrcweir 	SCROW					nTabStartRow;
109cdf0e10cSrcweir 	SCCOL					nMemberStartCol;
110cdf0e10cSrcweir 	SCROW					nMemberStartRow;
111cdf0e10cSrcweir 	SCCOL					nDataStartCol;
112cdf0e10cSrcweir 	SCROW					nDataStartRow;
113cdf0e10cSrcweir 	SCCOL					nTabEndCol;
114cdf0e10cSrcweir 	SCROW					nTabEndRow;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	void			DataCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
117cdf0e10cSrcweir 								const com::sun::star::sheet::DataResult& rData );
118cdf0e10cSrcweir 	void			HeaderCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
119cdf0e10cSrcweir 								const com::sun::star::sheet::MemberResult& rData,
120cdf0e10cSrcweir 								sal_Bool bColHeader, long nLevel );
121cdf0e10cSrcweir     void            FieldCell( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rCaption,
122cdf0e10cSrcweir                                bool bInTable, bool bPopup, bool bHasHiddenMember );
123cdf0e10cSrcweir 	void			CalcSizes();
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     /** Query which sub-area of the table the cell is in. See
126cdf0e10cSrcweir         css.sheet.DataPilotTablePositionType for the interpretation of the
127cdf0e10cSrcweir         return value. */
128cdf0e10cSrcweir     sal_Int32       GetPositionType(const ScAddress& rPos);
129cdf0e10cSrcweir 
130cdf0e10cSrcweir public:
131cdf0e10cSrcweir 					ScDPOutput( ScDocument* pD,
132cdf0e10cSrcweir 								const com::sun::star::uno::Reference<
133cdf0e10cSrcweir 									com::sun::star::sheet::XDimensionsSupplier>& xSrc,
134cdf0e10cSrcweir 								const ScAddress& rPos, sal_Bool bFilter );
135cdf0e10cSrcweir 					~ScDPOutput();
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 	void			SetPosition( const ScAddress& rPos );
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 	void			Output();			//! Refresh?
140cdf0e10cSrcweir     ScRange			GetOutputRange( sal_Int32 nRegionType = ::com::sun::star::sheet::DataPilotOutputRangeType::WHOLE );
141cdf0e10cSrcweir 	long			GetHeaderRows();
142cdf0e10cSrcweir 	sal_Bool			HasError();			// range overflow or exception from source
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     void            GetPositionData(const ScAddress& rPos, ::com::sun::star::sheet::DataPilotTablePositionData& rPosData);
145cdf0e10cSrcweir 
146cdf0e10cSrcweir     /** Get filtering criteria based on the position of the cell within data
147cdf0e10cSrcweir         field region. */
148cdf0e10cSrcweir     bool            GetDataResultPositionData(::std::vector< ::com::sun::star::sheet::DataPilotFieldFilter >& rFilters, const ScAddress& rPos);
149cdf0e10cSrcweir 
150cdf0e10cSrcweir     sal_Bool            GetPivotData( ScDPGetPivotDataField& rTarget, /* returns result */
151cdf0e10cSrcweir                                   const std::vector< ScDPGetPivotDataField >& rFilters );
152cdf0e10cSrcweir 	long			GetHeaderDim( const ScAddress& rPos, sal_uInt16& rOrient );
153cdf0e10cSrcweir 	sal_Bool			GetHeaderDrag( const ScAddress& rPos, sal_Bool bMouseLeft, sal_Bool bMouseTop,
154cdf0e10cSrcweir 									long nDragDim,
155cdf0e10cSrcweir 									Rectangle& rPosRect, sal_uInt16& rOrient, long& rDimPos );
156cdf0e10cSrcweir 	sal_Bool			IsFilterButton( const ScAddress& rPos );
157cdf0e10cSrcweir 
158cdf0e10cSrcweir     void            GetMemberResultNames( ScStrCollection& rNames, long nDimension );
159cdf0e10cSrcweir 
160cdf0e10cSrcweir     void            SetHeaderLayout(bool bUseGrid);
161cdf0e10cSrcweir     bool            GetHeaderLayout() const;
162cdf0e10cSrcweir 
163cdf0e10cSrcweir     static void     GetDataDimensionNames( String& rSourceName, String& rGivenName,
164cdf0e10cSrcweir                                            const com::sun::star::uno::Reference<
165cdf0e10cSrcweir                                                com::sun::star::uno::XInterface>& xDim );
166cdf0e10cSrcweir };
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 
169cdf0e10cSrcweir #endif
170cdf0e10cSrcweir 
171