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