LibreOffice Module sc (master)  1
dpoutput.hxx
Go to the documentation of this file.
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/DataPilotOutputRangeType.hpp>
24 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
25 #include <com/sun/star/uno/Sequence.hxx>
26 
27 #include "address.hxx"
28 
29 #include "dptypes.hxx"
30 
31 #include <memory>
32 #include <vector>
33 
34 namespace com::sun::star::sheet {
35  struct DataPilotFieldFilter;
36  struct DataPilotTablePositionData;
37  struct DataResult;
38  struct MemberResult;
39  class XDimensionsSupplier;
40 }
41 namespace tools { class Rectangle; }
42 class ScDocument;
43 struct ScDPOutLevelData;
44 
46 {
47 private:
49  css::uno::Reference< css::sheet::XDimensionsSupplier> xSource;
51  std::vector<ScDPOutLevelData> pColFields;
52  std::vector<ScDPOutLevelData> pRowFields;
53  std::vector<ScDPOutLevelData> pPageFields;
54  css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult> > aData;
55  OUString aDataDescription;
56 
57  // Number format related parameters
58  std::unique_ptr<sal_uInt32[]>
60  std::unique_ptr<sal_uInt32[]>
64  sal_uInt32 nSingleNumFmt;
65 
66  // Output geometry related parameters
67  long nColCount;
68  long nRowCount;
78  bool bDoFilter:1;
79  bool bResultsError:1;
80  bool bSizesValid:1;
81  bool bSizeOverflow:1;
82  bool mbHeaderLayout:1; // true : grid, false : standard
83 
84  void DataCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
85  const css::sheet::DataResult& rData );
86  void HeaderCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
87  const css::sheet::MemberResult& rData,
88  bool bColHeader, long nLevel );
89 
90  void FieldCell(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScDPOutLevelData& rData, bool bInTable);
91 
92  void CalcSizes();
93 
97  sal_Int32 GetPositionType(const ScAddress& rPos);
98 
99 public:
100  ScDPOutput( ScDocument* pD,
101  const css::uno::Reference< css::sheet::XDimensionsSupplier>& xSrc,
102  const ScAddress& rPos, bool bFilter );
103  ~ScDPOutput();
104 
105  void SetPosition( const ScAddress& rPos );
106 
107  void Output();
108  ScRange GetOutputRange( sal_Int32 nRegionType = css::sheet::DataPilotOutputRangeType::WHOLE );
109  long GetHeaderRows() const;
110  bool HasError(); // range overflow or exception from source
111 
112  void GetPositionData(const ScAddress& rPos, css::sheet::DataPilotTablePositionData& rPosData);
113 
116  bool GetDataResultPositionData(::std::vector< css::sheet::DataPilotFieldFilter >& rFilters, const ScAddress& rPos);
117 
118  long GetHeaderDim( const ScAddress& rPos, css::sheet::DataPilotFieldOrientation& rOrient );
119  bool GetHeaderDrag(
120  const ScAddress& rPos, bool bMouseLeft, bool bMouseTop, long nDragDim,
121  tools::Rectangle& rPosRect, css::sheet::DataPilotFieldOrientation& rOrient, long& rDimPos );
122  bool IsFilterButton( const ScAddress& rPos );
123 
124  void GetMemberResultNames(ScDPUniqueStringSet& rNames, long nDimension);
125 
126  void SetHeaderLayout(bool bUseGrid);
127  bool GetHeaderLayout() const { return mbHeaderLayout;}
128 
129  static void GetDataDimensionNames(
130  OUString& rSourceName, OUString& rGivenName,
131  const css::uno::Reference< css::uno::XInterface>& xDim );
132 };
133 
134 #endif
135 
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void CalcSizes()
Definition: dpoutput.cxx:832
bool GetHeaderDrag(const ScAddress &rPos, bool bMouseLeft, bool bMouseTop, long nDragDim, tools::Rectangle &rPosRect, css::sheet::DataPilotFieldOrientation &rOrient, long &rDimPos)
Definition: dpoutput.cxx:1594
ScDocument * pDoc
Definition: dpoutput.hxx:48
void Output()
Definition: dpoutput.cxx:928
SCROW nDataStartRow
Definition: dpoutput.hxx:75
void HeaderCell(SCCOL nCol, SCROW nRow, SCTAB nTab, const css::sheet::MemberResult &rData, bool bColHeader, long nLevel)
Definition: dpoutput.cxx:741
static void GetDataDimensionNames(OUString &rSourceName, OUString &rGivenName, const css::uno::Reference< css::uno::XInterface > &xDim)
Definition: dpoutput.cxx:1515
bool bSizesValid
Definition: dpoutput.hxx:80
bool mbHeaderLayout
Definition: dpoutput.hxx:82
css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult > > aData
Definition: dpoutput.hxx:54
sal_Int32 GetPositionType(const ScAddress &rPos)
Query which sub-area of the table the cell is in.
Definition: dpoutput.cxx:885
bool GetDataResultPositionData(::std::vector< css::sheet::DataPilotFieldFilter > &rFilters, const ScAddress &rPos)
Get filtering criteria based on the position of the cell within data field region.
Definition: dpoutput.cxx:1390
SCCOL nDataStartCol
Definition: dpoutput.hxx:74
std::unique_ptr< sal_uInt32[]> pRowNumFmt
Definition: dpoutput.hxx:61
SCCOL nTabStartCol
Definition: dpoutput.hxx:70
std::vector< ScDPOutLevelData > pPageFields
Definition: dpoutput.hxx:53
long nHeaderSize
Definition: dpoutput.hxx:69
ScRange GetOutputRange(sal_Int32 nRegionType=css::sheet::DataPilotOutputRangeType::WHOLE)
Refresh?
Definition: dpoutput.cxx:1123
long nRowFmtCount
Definition: dpoutput.hxx:63
long nColCount
Definition: dpoutput.hxx:67
void GetMemberResultNames(ScDPUniqueStringSet &rNames, long nDimension)
Definition: dpoutput.cxx:1167
css::uno::Reference< css::sheet::XDimensionsSupplier > xSource
Definition: dpoutput.hxx:49
std::vector< ScDPOutLevelData > pRowFields
Definition: dpoutput.hxx:52
long GetHeaderRows() const
Definition: dpoutput.cxx:1150
ScDPOutput(ScDocument *pD, const css::uno::Reference< css::sheet::XDimensionsSupplier > &xSrc, const ScAddress &rPos, bool bFilter)
Definition: dpoutput.cxx:502
void SetHeaderLayout(bool bUseGrid)
Definition: dpoutput.cxx:1193
sal_Int16 SCCOL
Definition: types.hxx:22
std::vector< ScDPOutLevelData > pColFields
Definition: dpoutput.hxx:51
bool HasError()
Definition: dpoutput.cxx:1143
SCCOL nMemberStartCol
Definition: dpoutput.hxx:72
void GetPositionData(const ScAddress &rPos, css::sheet::DataPilotTablePositionData &rPosData)
Definition: dpoutput.cxx:1283
void FieldCell(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScDPOutLevelData &rData, bool bInTable)
Definition: dpoutput.cxx:791
bool bSizeOverflow
Definition: dpoutput.hxx:81
long GetHeaderDim(const ScAddress &rPos, css::sheet::DataPilotFieldOrientation &rOrient)
Definition: dpoutput.cxx:1548
sal_Int32 SCROW
Definition: types.hxx:18
bool bResultsError
Definition: dpoutput.hxx:79
long nRowCount
Definition: dpoutput.hxx:68
bool bDoFilter
Definition: dpoutput.hxx:78
void SetPosition(const ScAddress &rPos)
Definition: dpoutput.cxx:683
std::unordered_set< OUString > ScDPUniqueStringSet
Definition: dptypes.hxx:17
SCROW nTabEndRow
Definition: dpoutput.hxx:77
ScAddress aStartPos
Definition: dpoutput.hxx:50
void DataCell(SCCOL nCol, SCROW nRow, SCTAB nTab, const css::sheet::DataResult &rData)
Definition: dpoutput.cxx:689
OUString aDataDescription
Definition: dpoutput.hxx:55
sal_uInt32 nSingleNumFmt
Definition: dpoutput.hxx:64
bool GetHeaderLayout() const
Definition: dpoutput.hxx:127
SCROW nTabStartRow
Definition: dpoutput.hxx:71
SCCOL nTabEndCol
Definition: dpoutput.hxx:76
SCROW nMemberStartRow
Definition: dpoutput.hxx:73
bool IsFilterButton(const ScAddress &rPos)
Definition: dpoutput.cxx:1536
long nColFmtCount
Definition: dpoutput.hxx:62
sal_Int16 SCTAB
Definition: types.hxx:23
std::unique_ptr< sal_uInt32[]> pColNumFmt
Definition: dpoutput.hxx:59