LibreOffice Module sc (master) 1
pvfundlg.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/DataPilotFieldReference.hpp>
23#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
24
25#include <vcl/weld.hxx>
26#include <pivot.hxx>
27
28#include <memory>
29#include <unordered_map>
30
31class ScDPObject;
32
34{
35public:
36 ScDPFunctionListBox(std::unique_ptr<weld::TreeView> xControl);
37
38 void SetSelection( PivotFunc nFuncMask );
39 PivotFunc GetSelection() const;
40
41 void set_sensitive(bool sensitive) { m_xControl->set_sensitive(sensitive); }
42 void set_selection_mode(SelectionMode eMode) { m_xControl->set_selection_mode(eMode); }
43 void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { m_xControl->connect_row_activated(rLink); }
44 int get_height_rows(int nRows) const { return m_xControl->get_height_rows(nRows); }
45 void set_size_request(int nWidth, int nHeight) { m_xControl->set_size_request(nWidth, nHeight); }
46
47private:
48 std::unique_ptr<weld::TreeView> m_xControl;
49 void FillFunctionNames();
50};
51
53{
54 typedef std::unordered_map< OUString, OUString > NameMapType;
55public:
56 explicit ScDPFunctionDlg(weld::Widget* pParent, const ScDPLabelDataVector& rLabelVec,
57 const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
58 virtual ~ScDPFunctionDlg() override;
59 PivotFunc GetFuncMask() const;
60 css::sheet::DataPilotFieldReference GetFieldRef() const;
61
62private:
63 void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
64
65 const OUString& GetBaseFieldName(const OUString& rLayoutName) const;
66 const OUString& GetBaseItemName(const OUString& rLayoutName) const;
67
69 sal_Int32 FindBaseItemPos( std::u16string_view rEntry, sal_Int32 nStartPos ) const;
70
71 DECL_LINK(SelectHdl, weld::ComboBox&, void);
72 DECL_LINK(DblClickHdl, weld::TreeView&, bool);
73 DECL_LINK(ButtonClicked, weld::Button&, void);
74
75private:
76 std::unique_ptr<ScDPFunctionListBox> mxLbFunc;
77 std::unique_ptr<weld::Label> mxFtName;
78 std::unique_ptr<weld::ComboBox> mxLbType;
79 std::unique_ptr<weld::Label> mxFtBaseField;
80 std::unique_ptr<weld::ComboBox> mxLbBaseField;
81 std::unique_ptr<weld::Label> mxFtBaseItem;
82 std::unique_ptr<weld::ComboBox> mxLbBaseItem;
83 std::unique_ptr<weld::Button> mxBtnOk;
84 std::unique_ptr<weld::Button> mxBtnCancel;
85
86 NameMapType maBaseFieldNameMap; // cache for base field display -> original name.
87 NameMapType maBaseItemNameMap; // cache for base item display -> original name.
88
91};
92
94
96{
97public:
98 explicit ScDPSubtotalDlg(weld::Widget* pParent, ScDPObject& rDPObj,
99 const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData,
100 const ScDPNameVec& rDataFields, bool bEnableLayout);
101 virtual ~ScDPSubtotalDlg() override;
102 PivotFunc GetFuncMask() const;
103
104 void FillLabelData( ScDPLabelData& rLabelData ) const;
105
106private:
107 void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
108 void CloseSubdialog();
109
110 DECL_LINK( DblClickHdl, weld::TreeView&, bool );
111 DECL_LINK( RadioClickHdl, weld::Toggleable&, void );
112 DECL_LINK( ClickHdl, weld::Button&, void );
113 DECL_LINK( ButtonClicked, weld::Button&, void );
114
115private:
118
121
122 std::unique_ptr<weld::RadioButton> mxRbNone;
123 std::unique_ptr<weld::RadioButton> mxRbAuto;
124 std::unique_ptr<weld::RadioButton> mxRbUser;
125 std::unique_ptr<ScDPFunctionListBox> mxLbFunc;
126 std::unique_ptr<weld::Label> mxFtName;
127 std::unique_ptr<weld::CheckButton> mxCbShowAll;
128 std::unique_ptr<weld::Button> mxBtnOk;
129 std::unique_ptr<weld::Button> mxBtnCancel;
130 std::unique_ptr<weld::Button> mxBtnOptions;
131
132 std::shared_ptr<ScDPSubtotalOptDlg> mxOptionsDlg;
133};
134
136{
137public:
138 explicit ScDPSubtotalOptDlg(weld::Window* pParent, ScDPObject& rDPObj,
139 const ScDPLabelData& rLabelData, const ScDPNameVec& rDataFields,
140 bool bEnableLayout );
141 virtual ~ScDPSubtotalOptDlg() override;
142 void FillLabelData( ScDPLabelData& rLabelData ) const;
143
144private:
145 void Init( const ScDPNameVec& rDataFields, bool bEnableLayout );
146 void InitHideListBox();
147
148 ScDPName GetFieldName(const OUString& rLayoutName) const;
149
151 sal_Int32 FindListBoxEntry( const weld::ComboBox& rLBox, std::u16string_view rEntry, sal_Int32 nStartPos ) const;
152
153 DECL_LINK( RadioClickHdl, weld::Toggleable&, void );
154 DECL_LINK( CheckHdl, weld::Toggleable&, void );
155 DECL_LINK( SelectHdl, weld::ComboBox&, void );
156 DECL_LINK( ButtonClicked, weld::Button&, void );
157
158private:
159 std::unique_ptr<weld::ComboBox> m_xLbSortBy;
160 std::unique_ptr<weld::RadioButton> m_xRbSortAsc;
161 std::unique_ptr<weld::RadioButton> m_xRbSortDesc;
162 std::unique_ptr<weld::RadioButton> m_xRbSortMan;
163 std::unique_ptr<weld::Widget> m_xLayoutFrame;
164 std::unique_ptr<weld::ComboBox> m_xLbLayout;
165 std::unique_ptr<weld::CheckButton> m_xCbLayoutEmpty;
166 std::unique_ptr<weld::CheckButton> m_xCbRepeatItemLabels;
167 std::unique_ptr<weld::CheckButton> m_xCbShow;
168 std::unique_ptr<weld::SpinButton> m_xNfShow;
169 std::unique_ptr<weld::Label> m_xFtShow;
170 std::unique_ptr<weld::Label> m_xFtShowFrom;
171 std::unique_ptr<weld::ComboBox> m_xLbShowFrom;
172 std::unique_ptr<weld::Label> m_xFtShowUsing;
173 std::unique_ptr<weld::ComboBox> m_xLbShowUsing;
174 std::unique_ptr<weld::Widget> m_xHideFrame;
175 std::unique_ptr<weld::TreeView> m_xLbHide;
176 std::unique_ptr<weld::Label> m_xFtHierarchy;
177 std::unique_ptr<weld::ComboBox> m_xLbHierarchy;
178 std::unique_ptr<weld::Button> m_xBtnOk;
179 std::unique_ptr<weld::Button> m_xBtnCancel;
180
183
184 typedef std::unordered_map<OUString, ScDPName> NameMapType;
186};
187
189{
190public:
191 explicit ScDPShowDetailDlg(weld::Window* pParent, ScDPObject& rDPObj,
192 css::sheet::DataPilotFieldOrientation nOrient);
193 virtual ~ScDPShowDetailDlg() override;
194
195 virtual short run() override;
196
202 OUString GetDimensionName() const;
203
204private:
205 DECL_LINK(DblClickHdl, weld::TreeView&, bool);
206
207private:
208 typedef std::unordered_map<OUString, tools::Long> DimNameIndexMap;
211
212 std::unique_ptr<weld::TreeView> mxLbDims;
213};
214
215/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
NameMapType maBaseItemNameMap
Definition: pvfundlg.hxx:87
std::unique_ptr< weld::Button > mxBtnOk
Definition: pvfundlg.hxx:83
PivotFunc GetFuncMask() const
Definition: pvfundlg.cxx:261
std::unique_ptr< weld::Button > mxBtnCancel
Definition: pvfundlg.hxx:84
bool mbEmptyItem
Data of all labels.
Definition: pvfundlg.hxx:90
std::unordered_map< OUString, OUString > NameMapType
Definition: pvfundlg.hxx:54
std::unique_ptr< weld::ComboBox > mxLbBaseField
Definition: pvfundlg.hxx:80
sal_Int32 FindBaseItemPos(std::u16string_view rEntry, sal_Int32 nStartPos) const
Searches for a listbox entry, starts search at specified position.
Definition: pvfundlg.cxx:370
DECL_LINK(SelectHdl, weld::ComboBox &, void)
std::unique_ptr< ScDPFunctionListBox > mxLbFunc
Definition: pvfundlg.hxx:76
const OUString & GetBaseFieldName(const OUString &rLayoutName) const
Definition: pvfundlg.cxx:358
std::unique_ptr< weld::Label > mxFtBaseField
Definition: pvfundlg.hxx:79
ScDPFunctionDlg(weld::Widget *pParent, const ScDPLabelDataVector &rLabelVec, const ScDPLabelData &rLabelData, const ScPivotFuncData &rFuncData)
Definition: pvfundlg.cxx:236
std::unique_ptr< weld::Label > mxFtBaseItem
Definition: pvfundlg.hxx:81
css::sheet::DataPilotFieldReference GetFieldRef() const
Definition: pvfundlg.cxx:266
const ScDPLabelDataVector & mrLabelVec
Definition: pvfundlg.hxx:89
DECL_LINK(DblClickHdl, weld::TreeView &, bool)
std::unique_ptr< weld::Label > mxFtName
Definition: pvfundlg.hxx:77
NameMapType maBaseFieldNameMap
Definition: pvfundlg.hxx:86
const OUString & GetBaseItemName(const OUString &rLayoutName) const
Definition: pvfundlg.cxx:364
void Init(const ScDPLabelData &rLabelData, const ScPivotFuncData &rFuncData)
Definition: pvfundlg.cxx:293
DECL_LINK(ButtonClicked, weld::Button &, void)
std::unique_ptr< weld::ComboBox > mxLbType
Definition: pvfundlg.hxx:78
std::unique_ptr< weld::ComboBox > mxLbBaseItem
Definition: pvfundlg.hxx:82
virtual ~ScDPFunctionDlg() override
Definition: pvfundlg.cxx:257
int get_height_rows(int nRows) const
Definition: pvfundlg.hxx:44
std::unique_ptr< weld::TreeView > m_xControl
Definition: pvfundlg.hxx:48
void set_sensitive(bool sensitive)
Definition: pvfundlg.hxx:41
void SetSelection(PivotFunc nFuncMask)
Definition: pvfundlg.cxx:144
ScDPFunctionListBox(std::unique_ptr< weld::TreeView > xControl)
Definition: pvfundlg.cxx:138
void set_size_request(int nWidth, int nHeight)
Definition: pvfundlg.hxx:45
PivotFunc GetSelection() const
Definition: pvfundlg.cxx:160
void set_selection_mode(SelectionMode eMode)
Definition: pvfundlg.hxx:42
void connect_row_activated(const Link< weld::TreeView &, bool > &rLink)
Definition: pvfundlg.hxx:43
void FillFunctionNames()
Definition: pvfundlg.cxx:169
ScDPShowDetailDlg(weld::Window *pParent, ScDPObject &rDPObj, css::sheet::DataPilotFieldOrientation nOrient)
Definition: pvfundlg.cxx:912
virtual ~ScDPShowDetailDlg() override
Definition: pvfundlg.cxx:946
std::unique_ptr< weld::TreeView > mxLbDims
Definition: pvfundlg.hxx:212
DimNameIndexMap maNameIndexMap
Definition: pvfundlg.hxx:209
DECL_LINK(DblClickHdl, weld::TreeView &, bool)
virtual short run() override
Definition: pvfundlg.cxx:950
OUString GetDimensionName() const
Definition: pvfundlg.cxx:955
std::unordered_map< OUString, tools::Long > DimNameIndexMap
Definition: pvfundlg.hxx:208
ScDPObject & mrDPObj
Definition: pvfundlg.hxx:210
std::unique_ptr< weld::Label > mxFtName
Definition: pvfundlg.hxx:126
DECL_LINK(ButtonClicked, weld::Button &, void)
void FillLabelData(ScDPLabelData &rLabelData) const
Definition: pvfundlg.cxx:508
std::unique_ptr< weld::RadioButton > mxRbAuto
Definition: pvfundlg.hxx:123
PivotFunc GetFuncMask() const
Definition: pvfundlg.cxx:496
std::shared_ptr< ScDPSubtotalOptDlg > mxOptionsDlg
Definition: pvfundlg.hxx:132
DECL_LINK(DblClickHdl, weld::TreeView &, bool)
ScDPObject & mrDPObj
Definition: pvfundlg.hxx:116
ScDPSubtotalDlg(weld::Widget *pParent, ScDPObject &rDPObj, const ScDPLabelData &rLabelData, const ScPivotFuncData &rFuncData, const ScDPNameVec &rDataFields, bool bEnableLayout)
Definition: pvfundlg.cxx:459
std::unique_ptr< weld::RadioButton > mxRbUser
Definition: pvfundlg.hxx:124
DECL_LINK(ClickHdl, weld::Button &, void)
DECL_LINK(RadioClickHdl, weld::Toggleable &, void)
std::unique_ptr< weld::RadioButton > mxRbNone
true = Enable Layout mode controls.
Definition: pvfundlg.hxx:122
void CloseSubdialog()
Definition: pvfundlg.cxx:487
std::unique_ptr< weld::Button > mxBtnOptions
Definition: pvfundlg.hxx:130
std::unique_ptr< weld::CheckButton > mxCbShowAll
Definition: pvfundlg.hxx:127
bool mbEnableLayout
Cache for sub dialog.
Definition: pvfundlg.hxx:120
std::unique_ptr< weld::Button > mxBtnOk
Definition: pvfundlg.hxx:128
ScDPLabelData maLabelData
The list of all data field names.
Definition: pvfundlg.hxx:119
const ScDPNameVec & mrDataFields
The DataPilot object (for member names).
Definition: pvfundlg.hxx:117
std::unique_ptr< weld::Button > mxBtnCancel
Definition: pvfundlg.hxx:129
void Init(const ScDPLabelData &rLabelData, const ScPivotFuncData &rFuncData)
Definition: pvfundlg.cxx:520
virtual ~ScDPSubtotalDlg() override
Definition: pvfundlg.cxx:482
std::unique_ptr< ScDPFunctionListBox > mxLbFunc
Definition: pvfundlg.hxx:125
std::unique_ptr< weld::ComboBox > m_xLbShowUsing
Definition: pvfundlg.hxx:173
std::unique_ptr< weld::Button > m_xBtnCancel
Definition: pvfundlg.hxx:179
void InitHideListBox()
Definition: pvfundlg.cxx:837
std::unique_ptr< weld::ComboBox > m_xLbShowFrom
Definition: pvfundlg.hxx:171
ScDPName GetFieldName(const OUString &rLayoutName) const
Definition: pvfundlg.cxx:848
NameMapType maDataFieldNameMap
Definition: pvfundlg.hxx:185
void Init(const ScDPNameVec &rDataFields, bool bEnableLayout)
Definition: pvfundlg.cxx:739
ScDPObject & mrDPObj
Definition: pvfundlg.hxx:181
std::unique_ptr< weld::ComboBox > m_xLbLayout
Definition: pvfundlg.hxx:164
std::unique_ptr< weld::SpinButton > m_xNfShow
Definition: pvfundlg.hxx:168
std::unique_ptr< weld::RadioButton > m_xRbSortAsc
Definition: pvfundlg.hxx:160
std::unique_ptr< weld::Label > m_xFtShowFrom
Definition: pvfundlg.hxx:170
ScDPLabelData maLabelData
The DataPilot object (for member names).
Definition: pvfundlg.hxx:182
ScDPSubtotalOptDlg(weld::Window *pParent, ScDPObject &rDPObj, const ScDPLabelData &rLabelData, const ScDPNameVec &rDataFields, bool bEnableLayout)
Definition: pvfundlg.cxx:650
std::unique_ptr< weld::ComboBox > m_xLbSortBy
Definition: pvfundlg.hxx:159
std::unordered_map< OUString, ScDPName > NameMapType
Cache for members data.
Definition: pvfundlg.hxx:184
std::unique_ptr< weld::CheckButton > m_xCbRepeatItemLabels
Definition: pvfundlg.hxx:166
std::unique_ptr< weld::ComboBox > m_xLbHierarchy
Definition: pvfundlg.hxx:177
std::unique_ptr< weld::Label > m_xFtHierarchy
Definition: pvfundlg.hxx:176
void FillLabelData(ScDPLabelData &rLabelData) const
Definition: pvfundlg.cxx:690
DECL_LINK(ButtonClicked, weld::Button &, void)
sal_Int32 FindListBoxEntry(const weld::ComboBox &rLBox, std::u16string_view rEntry, sal_Int32 nStartPos) const
Searches for a listbox entry, starts search at specified position.
Definition: pvfundlg.cxx:854
virtual ~ScDPSubtotalOptDlg() override
Definition: pvfundlg.cxx:686
DECL_LINK(CheckHdl, weld::Toggleable &, void)
std::unique_ptr< weld::Label > m_xFtShow
Definition: pvfundlg.hxx:169
std::unique_ptr< weld::RadioButton > m_xRbSortMan
Definition: pvfundlg.hxx:162
std::unique_ptr< weld::Button > m_xBtnOk
Definition: pvfundlg.hxx:178
DECL_LINK(RadioClickHdl, weld::Toggleable &, void)
std::unique_ptr< weld::Widget > m_xLayoutFrame
Definition: pvfundlg.hxx:163
std::unique_ptr< weld::Label > m_xFtShowUsing
Definition: pvfundlg.hxx:172
std::unique_ptr< weld::TreeView > m_xLbHide
Definition: pvfundlg.hxx:175
std::unique_ptr< weld::CheckButton > m_xCbShow
Definition: pvfundlg.hxx:167
std::unique_ptr< weld::CheckButton > m_xCbLayoutEmpty
Definition: pvfundlg.hxx:165
std::unique_ptr< weld::RadioButton > m_xRbSortDesc
Definition: pvfundlg.hxx:161
std::unique_ptr< weld::Widget > m_xHideFrame
Definition: pvfundlg.hxx:174
DECL_LINK(SelectHdl, weld::ComboBox &, void)
PivotFunc
Definition: dpglobal.hxx:24
Mode eMode
std::vector< ScDPName > ScDPNameVec
Definition: pivot.hxx:172
std::vector< std::unique_ptr< ScDPLabelData > > ScDPLabelDataVector
Definition: pivot.hxx:113
SelectionMode