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
35namespace com::sun::star::sheet {
36 struct DataPilotFieldFilter;
37 struct DataPilotTablePositionData;
38 struct DataResult;
39 struct MemberResult;
40 class XDimensionsSupplier;
41}
42namespace tools { class Rectangle; }
43class ScDocument;
44struct ScDPOutLevelData;
45
47{
48private:
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;
57
58 // Number format related parameters
59 std::unique_ptr<sal_uInt32[]>
61 std::unique_ptr<sal_uInt32[]>
63 std::vector<bool> aRowCompactFlags;
64 sal_Int32 nColFmtCount;
65 sal_Int32 nRowFmtCount;
66 sal_uInt32 nSingleNumFmt;
67 size_t nRowDims; // Including empty ones.
68
69 // Output geometry related parameters
70 sal_Int32 nColCount;
71 sal_Int32 nRowCount;
72 sal_Int32 nHeaderSize;
81 bool bDoFilter:1;
85 bool mbHeaderLayout:1; // true : grid, false : standard
86 bool mbHasCompactRowField:1; // true: at least one of the row fields has compact layout.
87 bool mbExpandCollapse:1; // true: show expand/collapse buttons
88
89 void DataCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
90 const css::sheet::DataResult& rData );
91 void HeaderCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
92 const css::sheet::MemberResult& rData,
93 bool bColHeader, tools::Long nLevel );
94
95 void FieldCell(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScDPOutLevelData& rData, bool bInTable);
96 void MultiFieldCell(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bRowField);
97
100 void CalcSizes();
101
105 sal_Int32 GetPositionType(const ScAddress& rPos);
107 void GetRowFieldRange(SCCOL nCol, sal_Int32& nRowFieldStart, sal_Int32& nRowFieldEnd) const;
109 sal_Int32 GetRowFieldCompact(SCCOL nColQuery, SCROW nRowQuery) const;
110
111public:
113 css::uno::Reference< css::sheet::XDimensionsSupplier> xSrc,
114 const ScAddress& rPos, bool bFilter, bool bExpandCollapse );
115 ~ScDPOutput();
116
117 void SetPosition( const ScAddress& rPos );
118
119 void Output();
120 ScRange GetOutputRange( sal_Int32 nRegionType = css::sheet::DataPilotOutputRangeType::WHOLE );
121 sal_Int32 GetHeaderRows() const;
122 bool HasError(); // range overflow or exception from source
123
124 void GetPositionData(const ScAddress& rPos, css::sheet::DataPilotTablePositionData& rPosData);
125
128 bool GetDataResultPositionData(::std::vector< css::sheet::DataPilotFieldFilter >& rFilters, const ScAddress& rPos);
129
130 tools::Long GetHeaderDim( const ScAddress& rPos, css::sheet::DataPilotFieldOrientation& rOrient );
131 bool GetHeaderDrag(
132 const ScAddress& rPos, bool bMouseLeft, bool bMouseTop, tools::Long nDragDim,
133 tools::Rectangle& rPosRect, css::sheet::DataPilotFieldOrientation& rOrient, tools::Long& rDimPos );
134 bool IsFilterButton( const ScAddress& rPos );
135
136 void GetMemberResultNames(ScDPUniqueStringSet& rNames, tools::Long nDimension);
137
138 void SetHeaderLayout(bool bUseGrid);
139 bool GetHeaderLayout() const { return mbHeaderLayout;}
140
141 static void GetDataDimensionNames(
142 OUString& rSourceName, OUString& rGivenName,
143 const css::uno::Reference< css::uno::XInterface>& xDim );
144};
145
146/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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:1777
SCROW nTabStartRow
Definition: dpoutput.hxx:74
bool bResultsError
Definition: dpoutput.hxx:82
void HeaderCell(SCCOL nCol, SCROW nRow, SCTAB nTab, const css::sheet::MemberResult &rData, bool bColHeader, tools::Long nLevel)
Definition: dpoutput.cxx:769
void CalcSizes()
Definition: dpoutput.cxx:896
void Output()
Definition: dpoutput.cxx:992
bool bDoFilter
Definition: dpoutput.hxx:81
sal_Int32 nRowFmtCount
Definition: dpoutput.hxx:65
SCCOL nTabEndCol
Definition: dpoutput.hxx:79
bool GetHeaderLayout() const
Definition: dpoutput.hxx:139
SCROW nTabEndRow
Definition: dpoutput.hxx:80
SCCOL nMemberStartCol
Definition: dpoutput.hxx:75
ScRange GetOutputRange(sal_Int32 nRegionType=css::sheet::DataPilotOutputRangeType::WHOLE)
Refresh?
Definition: dpoutput.cxx:1229
void MultiFieldCell(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bRowField)
Definition: dpoutput.cxx:819
sal_Int32 nRowCount
Definition: dpoutput.hxx:71
bool mbHasCompactRowField
Definition: dpoutput.hxx:86
std::unique_ptr< sal_uInt32[]> pRowNumFmt
Definition: dpoutput.hxx:62
SCROW nMemberStartRow
Definition: dpoutput.hxx:76
SCCOL GetColumnsForRowFields() const
Computes number of columns needed to write row fields.
Definition: dpoutput.cxx:880
void GetPositionData(const ScAddress &rPos, css::sheet::DataPilotTablePositionData &rPosData)
Definition: dpoutput.cxx:1466
void GetMemberResultNames(ScDPUniqueStringSet &rNames, tools::Long nDimension)
Definition: dpoutput.cxx:1273
css::uno::Sequence< css::uno::Sequence< css::sheet::DataResult > > aData
Definition: dpoutput.hxx:55
sal_Int32 nHeaderSize
Definition: dpoutput.hxx:72
ScAddress aStartPos
Definition: dpoutput.hxx:51
void SetPosition(const ScAddress &rPos)
Definition: dpoutput.cxx:711
css::uno::Reference< css::sheet::XDimensionsSupplier > xSource
Definition: dpoutput.hxx:50
bool mbHeaderLayout
Definition: dpoutput.hxx:85
bool bSizesValid
Definition: dpoutput.hxx:83
ScDocument * pDoc
Definition: dpoutput.hxx:49
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:1573
void FieldCell(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScDPOutLevelData &rData, bool bInTable)
Definition: dpoutput.cxx:839
sal_Int32 GetRowFieldCompact(SCCOL nColQuery, SCROW nRowQuery) const
Find row field index from row position in case of compact layout.
Definition: dpoutput.cxx:1436
tools::Long GetHeaderDim(const ScAddress &rPos, css::sheet::DataPilotFieldOrientation &rOrient)
Definition: dpoutput.cxx:1731
std::vector< ScDPOutLevelData > pColFields
Definition: dpoutput.hxx:52
sal_Int32 nColFmtCount
Definition: dpoutput.hxx:64
SCROW nDataStartRow
Definition: dpoutput.hxx:78
bool IsFilterButton(const ScAddress &rPos)
Definition: dpoutput.cxx:1719
bool HasError()
Definition: dpoutput.cxx:1249
bool mbExpandCollapse
Definition: dpoutput.hxx:87
std::vector< bool > aRowCompactFlags
Definition: dpoutput.hxx:63
sal_uInt32 nSingleNumFmt
Definition: dpoutput.hxx:66
ScDPOutput(ScDocument *pD, css::uno::Reference< css::sheet::XDimensionsSupplier > xSrc, const ScAddress &rPos, bool bFilter, bool bExpandCollapse)
Definition: dpoutput.cxx:509
std::vector< ScDPOutLevelData > pPageFields
Definition: dpoutput.hxx:54
SCCOL nTabStartCol
Definition: dpoutput.hxx:73
static void GetDataDimensionNames(OUString &rSourceName, OUString &rGivenName, const css::uno::Reference< css::uno::XInterface > &xDim)
Definition: dpoutput.cxx:1698
OUString aDataDescription
Definition: dpoutput.hxx:56
bool bSizeOverflow
Definition: dpoutput.hxx:84
size_t nRowDims
Definition: dpoutput.hxx:67
std::unique_ptr< sal_uInt32[]> pColNumFmt
Definition: dpoutput.hxx:60
void GetRowFieldRange(SCCOL nCol, sal_Int32 &nRowFieldStart, sal_Int32 &nRowFieldEnd) const
Returns the range of row fields that are contained by table's row fields column nCol.
Definition: dpoutput.cxx:1389
std::vector< ScDPOutLevelData > pRowFields
Definition: dpoutput.hxx:53
sal_Int32 GetHeaderRows() const
Definition: dpoutput.cxx:1256
void SetHeaderLayout(bool bUseGrid)
Definition: dpoutput.cxx:1299
SCCOL nDataStartCol
Definition: dpoutput.hxx:77
void DataCell(SCCOL nCol, SCROW nRow, SCTAB nTab, const css::sheet::DataResult &rData)
Definition: dpoutput.cxx:717
sal_Int32 nColCount
Definition: dpoutput.hxx:70
sal_Int32 GetPositionType(const ScAddress &rPos)
Query which sub-area of the table the cell is in.
Definition: dpoutput.cxx:949
std::unordered_set< OUString > ScDPUniqueStringSet
Definition: dptypes.hxx:16
long Long
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17