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