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