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 <tools/long.hxx>
28 
29 #include "address.hxx"
30 
31 #include "dptypes.hxx"
32 
33 #include <memory>
34 #include <vector>
35 
36 namespace com::sun::star::sheet {
37  struct DataPilotFieldFilter;
38  struct DataPilotTablePositionData;
39  struct DataResult;
40  struct MemberResult;
41  class XDimensionsSupplier;
42 }
43 namespace tools { class Rectangle; }
44 class ScDocument;
45 struct ScDPOutLevelData;
46 
48 {
49 private:
51  css::uno::Reference< css::sheet::XDimensionsSupplier> xSource;
53  std::vector<ScDPOutLevelData> pColFields;
54  std::vector<ScDPOutLevelData> pRowFields;
55  std::vector<ScDPOutLevelData> pPageFields;
56  css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult> > aData;
57  OUString aDataDescription;
58 
59  // Number format related parameters
60  std::unique_ptr<sal_uInt32[]>
62  std::unique_ptr<sal_uInt32[]>
64  sal_Int32 nColFmtCount;
65  sal_Int32 nRowFmtCount;
66  sal_uInt32 nSingleNumFmt;
67 
68  // Output geometry related parameters
69  sal_Int32 nColCount;
70  sal_Int32 nRowCount;
71  sal_Int32 nHeaderSize;
80  bool bDoFilter:1;
81  bool bResultsError:1;
82  bool bSizesValid:1;
83  bool bSizeOverflow:1;
84  bool mbHeaderLayout:1; // true : grid, false : standard
85 
86  void DataCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
87  const css::sheet::DataResult& rData );
88  void HeaderCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
89  const css::sheet::MemberResult& rData,
90  bool bColHeader, tools::Long nLevel );
91 
92  void FieldCell(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScDPOutLevelData& rData, bool bInTable);
93 
94  void CalcSizes();
95 
99  sal_Int32 GetPositionType(const ScAddress& rPos);
100 
101 public:
102  ScDPOutput( ScDocument* pD,
103  const css::uno::Reference< css::sheet::XDimensionsSupplier>& xSrc,
104  const ScAddress& rPos, bool bFilter );
105  ~ScDPOutput();
106 
107  void SetPosition( const ScAddress& rPos );
108 
109  void Output();
110  ScRange GetOutputRange( sal_Int32 nRegionType = css::sheet::DataPilotOutputRangeType::WHOLE );
111  sal_Int32 GetHeaderRows() const;
112  bool HasError(); // range overflow or exception from source
113 
114  void GetPositionData(const ScAddress& rPos, css::sheet::DataPilotTablePositionData& rPosData);
115 
118  bool GetDataResultPositionData(::std::vector< css::sheet::DataPilotFieldFilter >& rFilters, const ScAddress& rPos);
119 
120  tools::Long GetHeaderDim( const ScAddress& rPos, css::sheet::DataPilotFieldOrientation& rOrient );
121  bool GetHeaderDrag(
122  const ScAddress& rPos, bool bMouseLeft, bool bMouseTop, tools::Long nDragDim,
123  tools::Rectangle& rPosRect, css::sheet::DataPilotFieldOrientation& rOrient, tools::Long& rDimPos );
124  bool IsFilterButton( const ScAddress& rPos );
125 
126  void GetMemberResultNames(ScDPUniqueStringSet& rNames, tools::Long nDimension);
127 
128  void SetHeaderLayout(bool bUseGrid);
129  bool GetHeaderLayout() const { return mbHeaderLayout;}
130 
131  static void GetDataDimensionNames(
132  OUString& rSourceName, OUString& rGivenName,
133  const css::uno::Reference< css::uno::XInterface>& xDim );
134 };
135 
136 #endif
137 
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void CalcSizes()
Definition: dpoutput.cxx:834
ScDocument * pDoc
Definition: dpoutput.hxx:50
void Output()
Definition: dpoutput.cxx:930
SCROW nDataStartRow
Definition: dpoutput.hxx:77
static void GetDataDimensionNames(OUString &rSourceName, OUString &rGivenName, const css::uno::Reference< css::uno::XInterface > &xDim)
Definition: dpoutput.cxx:1517
long Long
void GetMemberResultNames(ScDPUniqueStringSet &rNames, tools::Long nDimension)
Definition: dpoutput.cxx:1169
bool bSizesValid
Definition: dpoutput.hxx:82
bool mbHeaderLayout
Definition: dpoutput.hxx:84
css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult > > aData
Definition: dpoutput.hxx:56
sal_Int32 nHeaderSize
Definition: dpoutput.hxx:71
sal_Int32 GetPositionType(const ScAddress &rPos)
Query which sub-area of the table the cell is in.
Definition: dpoutput.cxx:887
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:1392
SCCOL nDataStartCol
Definition: dpoutput.hxx:76
std::unique_ptr< sal_uInt32[]> pRowNumFmt
Definition: dpoutput.hxx:63
SCCOL nTabStartCol
Definition: dpoutput.hxx:72
std::vector< ScDPOutLevelData > pPageFields
Definition: dpoutput.hxx:55
bool GetHeaderDrag(const ScAddress &rPos, bool bMouseLeft, bool bMouseTop, tools::Long nDragDim, tools::Rectangle &rPosRect, css::sheet::DataPilotFieldOrientation &rOrient, tools::Long &rDimPos)
Definition: dpoutput.cxx:1596
sal_Int32 nRowCount
Definition: dpoutput.hxx:70
ScRange GetOutputRange(sal_Int32 nRegionType=css::sheet::DataPilotOutputRangeType::WHOLE)
Refresh?
Definition: dpoutput.cxx:1125
css::uno::Reference< css::sheet::XDimensionsSupplier > xSource
Definition: dpoutput.hxx:51
tools::Long GetHeaderDim(const ScAddress &rPos, css::sheet::DataPilotFieldOrientation &rOrient)
Definition: dpoutput.cxx:1550
std::vector< ScDPOutLevelData > pRowFields
Definition: dpoutput.hxx:54
ScDPOutput(ScDocument *pD, const css::uno::Reference< css::sheet::XDimensionsSupplier > &xSrc, const ScAddress &rPos, bool bFilter)
Definition: dpoutput.cxx:504
void HeaderCell(SCCOL nCol, SCROW nRow, SCTAB nTab, const css::sheet::MemberResult &rData, bool bColHeader, tools::Long nLevel)
Definition: dpoutput.cxx:743
void SetHeaderLayout(bool bUseGrid)
Definition: dpoutput.cxx:1195
sal_Int16 SCCOL
Definition: types.hxx:22
sal_Int32 GetHeaderRows() const
Definition: dpoutput.cxx:1152
std::vector< ScDPOutLevelData > pColFields
Definition: dpoutput.hxx:53
bool HasError()
Definition: dpoutput.cxx:1145
SCCOL nMemberStartCol
Definition: dpoutput.hxx:74
void GetPositionData(const ScAddress &rPos, css::sheet::DataPilotTablePositionData &rPosData)
Definition: dpoutput.cxx:1285
void FieldCell(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScDPOutLevelData &rData, bool bInTable)
Definition: dpoutput.cxx:793
bool bSizeOverflow
Definition: dpoutput.hxx:83
sal_Int32 nColCount
Definition: dpoutput.hxx:69
sal_Int32 SCROW
Definition: types.hxx:18
bool bResultsError
Definition: dpoutput.hxx:81
bool bDoFilter
Definition: dpoutput.hxx:80
void SetPosition(const ScAddress &rPos)
Definition: dpoutput.cxx:685
std::unordered_set< OUString > ScDPUniqueStringSet
Definition: dptypes.hxx:17
SCROW nTabEndRow
Definition: dpoutput.hxx:79
ScAddress aStartPos
Definition: dpoutput.hxx:52
void DataCell(SCCOL nCol, SCROW nRow, SCTAB nTab, const css::sheet::DataResult &rData)
Definition: dpoutput.cxx:691
sal_Int32 nColFmtCount
Definition: dpoutput.hxx:64
OUString aDataDescription
Definition: dpoutput.hxx:57
sal_uInt32 nSingleNumFmt
Definition: dpoutput.hxx:66
bool GetHeaderLayout() const
Definition: dpoutput.hxx:129
sal_Int32 nRowFmtCount
Definition: dpoutput.hxx:65
SCROW nTabStartRow
Definition: dpoutput.hxx:73
SCCOL nTabEndCol
Definition: dpoutput.hxx:78
SCROW nMemberStartRow
Definition: dpoutput.hxx:75
bool IsFilterButton(const ScAddress &rPos)
Definition: dpoutput.cxx:1538
sal_Int16 SCTAB
Definition: types.hxx:23
std::unique_ptr< sal_uInt32[]> pColNumFmt
Definition: dpoutput.hxx:61