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 
31 class ScDPObject;
32 
34 {
35 public:
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 
47 private:
48  std::unique_ptr<weld::TreeView> m_xControl;
49  void FillFunctionNames();
50 };
51 
53 {
54  typedef std::unordered_map< OUString, OUString > NameMapType;
55 public:
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 
62 private:
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 
75 private:
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  std::unique_ptr<weld::Expander> mxExpander;
86 
87  NameMapType maBaseFieldNameMap; // cache for base field display -> original name.
88  NameMapType maBaseItemNameMap; // cache for base item display -> original name.
89 
91  bool mbEmptyItem;
92 };
93 
94 class ScDPSubtotalOptDlg;
95 
97 {
98 public:
99  explicit ScDPSubtotalDlg(weld::Widget* pParent, ScDPObject& rDPObj,
100  const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData,
101  const ScDPNameVec& rDataFields, bool bEnableLayout);
102  virtual ~ScDPSubtotalDlg() override;
103  PivotFunc GetFuncMask() const;
104 
105  void FillLabelData( ScDPLabelData& rLabelData ) const;
106 
107 private:
108  void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
109  void CloseSubdialog();
110 
111  DECL_LINK( DblClickHdl, weld::TreeView&, bool );
112  DECL_LINK( RadioClickHdl, weld::Toggleable&, void );
113  DECL_LINK( ClickHdl, weld::Button&, void );
114  DECL_LINK( ButtonClicked, weld::Button&, void );
115 
116 private:
119 
122 
123  std::unique_ptr<weld::RadioButton> mxRbNone;
124  std::unique_ptr<weld::RadioButton> mxRbAuto;
125  std::unique_ptr<weld::RadioButton> mxRbUser;
126  std::unique_ptr<ScDPFunctionListBox> mxLbFunc;
127  std::unique_ptr<weld::Label> mxFtName;
128  std::unique_ptr<weld::CheckButton> mxCbShowAll;
129  std::unique_ptr<weld::Button> mxBtnOk;
130  std::unique_ptr<weld::Button> mxBtnCancel;
131  std::unique_ptr<weld::Button> mxBtnOptions;
132 
133  std::shared_ptr<ScDPSubtotalOptDlg> mxOptionsDlg;
134 };
135 
137 {
138 public:
139  explicit ScDPSubtotalOptDlg(weld::Window* pParent, ScDPObject& rDPObj,
140  const ScDPLabelData& rLabelData, const ScDPNameVec& rDataFields,
141  bool bEnableLayout );
142  virtual ~ScDPSubtotalOptDlg() override;
143  void FillLabelData( ScDPLabelData& rLabelData ) const;
144 
145 private:
146  void Init( const ScDPNameVec& rDataFields, bool bEnableLayout );
147  void InitHideListBox();
148 
149  ScDPName GetFieldName(const OUString& rLayoutName) const;
150 
152  sal_Int32 FindListBoxEntry( const weld::ComboBox& rLBox, std::u16string_view rEntry, sal_Int32 nStartPos ) const;
153 
154  DECL_LINK( RadioClickHdl, weld::Toggleable&, void );
155  DECL_LINK( CheckHdl, weld::Toggleable&, void );
156  DECL_LINK( SelectHdl, weld::ComboBox&, void );
157  DECL_LINK( ButtonClicked, weld::Button&, void );
158 
159 private:
160  std::unique_ptr<weld::ComboBox> m_xLbSortBy;
161  std::unique_ptr<weld::RadioButton> m_xRbSortAsc;
162  std::unique_ptr<weld::RadioButton> m_xRbSortDesc;
163  std::unique_ptr<weld::RadioButton> m_xRbSortMan;
164  std::unique_ptr<weld::Widget> m_xLayoutFrame;
165  std::unique_ptr<weld::ComboBox> m_xLbLayout;
166  std::unique_ptr<weld::CheckButton> m_xCbLayoutEmpty;
167  std::unique_ptr<weld::CheckButton> m_xCbRepeatItemLabels;
168  std::unique_ptr<weld::CheckButton> m_xCbShow;
169  std::unique_ptr<weld::SpinButton> m_xNfShow;
170  std::unique_ptr<weld::Label> m_xFtShow;
171  std::unique_ptr<weld::Label> m_xFtShowFrom;
172  std::unique_ptr<weld::ComboBox> m_xLbShowFrom;
173  std::unique_ptr<weld::Label> m_xFtShowUsing;
174  std::unique_ptr<weld::ComboBox> m_xLbShowUsing;
175  std::unique_ptr<weld::Widget> m_xHideFrame;
176  std::unique_ptr<weld::TreeView> m_xLbHide;
177  std::unique_ptr<weld::Label> m_xFtHierarchy;
178  std::unique_ptr<weld::ComboBox> m_xLbHierarchy;
179  std::unique_ptr<weld::Button> m_xBtnOk;
180  std::unique_ptr<weld::Button> m_xBtnCancel;
181 
184 
185  typedef std::unordered_map<OUString, ScDPName> NameMapType;
186  NameMapType maDataFieldNameMap;
187 };
188 
190 {
191 public:
192  explicit ScDPShowDetailDlg(weld::Window* pParent, ScDPObject& rDPObj,
193  css::sheet::DataPilotFieldOrientation nOrient);
194  virtual ~ScDPShowDetailDlg() override;
195 
196  virtual short run() override;
197 
203  OUString GetDimensionName() const;
204 
205 private:
206  DECL_LINK(DblClickHdl, weld::TreeView&, bool);
207 
208 private:
209  typedef std::unordered_map<OUString, tools::Long> DimNameIndexMap;
210  DimNameIndexMap maNameIndexMap;
212 
213  std::unique_ptr<weld::TreeView> mxLbDims;
214 };
215 
216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::ComboBox > m_xLbShowUsing
Definition: pvfundlg.hxx:174
void FillLabelData(ScDPLabelData &rLabelData) const
Definition: pvfundlg.cxx:509
std::unique_ptr< weld::Button > mxBtnCancel
Definition: pvfundlg.hxx:84
bool mbEnableLayout
Cache for sub dialog.
Definition: pvfundlg.hxx:121
std::shared_ptr< ScDPSubtotalOptDlg > mxOptionsDlg
Definition: pvfundlg.hxx:133
void Init(const ScDPLabelData &rLabelData, const ScPivotFuncData &rFuncData)
Definition: pvfundlg.cxx:294
std::unique_ptr< ScDPFunctionListBox > mxLbFunc
Definition: pvfundlg.hxx:76
std::unique_ptr< weld::RadioButton > m_xRbSortAsc
Definition: pvfundlg.hxx:161
sal_Int32 FindBaseItemPos(std::u16string_view rEntry, sal_Int32 nStartPos) const
Searches for a listbox entry, starts search at specified position.
Definition: pvfundlg.cxx:371
void InitHideListBox()
Definition: pvfundlg.cxx:834
std::unique_ptr< weld::ComboBox > mxLbBaseField
Definition: pvfundlg.hxx:80
virtual ~ScDPSubtotalOptDlg() override
Definition: pvfundlg.cxx:683
std::unique_ptr< weld::Label > m_xFtShowUsing
Definition: pvfundlg.hxx:173
const ScDPLabelDataVector & mrLabelVec
Definition: pvfundlg.hxx:90
std::unique_ptr< weld::Expander > mxExpander
Definition: pvfundlg.hxx:85
std::unique_ptr< weld::Button > mxBtnOk
Definition: pvfundlg.hxx:129
ScDPSubtotalOptDlg(weld::Window *pParent, ScDPObject &rDPObj, const ScDPLabelData &rLabelData, const ScDPNameVec &rDataFields, bool bEnableLayout)
Definition: pvfundlg.cxx:647
SelectionMode
virtual ~ScDPShowDetailDlg() override
Definition: pvfundlg.cxx:943
std::unique_ptr< weld::Button > mxBtnCancel
Definition: pvfundlg.hxx:130
std::unique_ptr< weld::ComboBox > mxLbBaseItem
Definition: pvfundlg.hxx:82
void Init(const ScDPNameVec &rDataFields, bool bEnableLayout)
Definition: pvfundlg.cxx:736
ScDPName GetFieldName(const OUString &rLayoutName) const
Definition: pvfundlg.cxx:845
std::unique_ptr< weld::ComboBox > m_xLbShowFrom
Definition: pvfundlg.hxx:172
std::unique_ptr< weld::Button > mxBtnOk
Definition: pvfundlg.hxx:83
ScDPSubtotalDlg(weld::Widget *pParent, ScDPObject &rDPObj, const ScDPLabelData &rLabelData, const ScPivotFuncData &rFuncData, const ScDPNameVec &rDataFields, bool bEnableLayout)
Definition: pvfundlg.cxx:460
std::unordered_map< OUString, OUString > NameMapType
Definition: pvfundlg.hxx:54
std::unique_ptr< weld::Label > m_xFtShowFrom
Definition: pvfundlg.hxx:171
void Init(const ScDPLabelData &rLabelData, const ScPivotFuncData &rFuncData)
Definition: pvfundlg.cxx:521
void connect_row_activated(const Link< weld::TreeView &, bool > &rLink)
Definition: pvfundlg.hxx:43
ScDPLabelData maLabelData
The list of all data field names.
Definition: pvfundlg.hxx:120
std::unique_ptr< weld::RadioButton > mxRbUser
Definition: pvfundlg.hxx:125
std::unique_ptr< ScDPFunctionListBox > mxLbFunc
Definition: pvfundlg.hxx:126
std::unique_ptr< weld::Label > m_xFtHierarchy
Definition: pvfundlg.hxx:177
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:851
std::unique_ptr< weld::ComboBox > m_xLbLayout
Definition: pvfundlg.hxx:165
PivotFunc
Definition: dpglobal.hxx:24
std::unique_ptr< weld::Label > mxFtBaseField
Definition: pvfundlg.hxx:79
std::vector< ScDPName > ScDPNameVec
Definition: pivot.hxx:172
NameMapType maBaseFieldNameMap
Definition: pvfundlg.hxx:87
std::unique_ptr< weld::ComboBox > m_xLbHierarchy
Definition: pvfundlg.hxx:178
std::unique_ptr< weld::ComboBox > m_xLbSortBy
Definition: pvfundlg.hxx:160
virtual ~ScDPFunctionDlg() override
Definition: pvfundlg.cxx:258
virtual short run() override
Definition: pvfundlg.cxx:947
std::unique_ptr< weld::RadioButton > mxRbAuto
Definition: pvfundlg.hxx:124
ScDPShowDetailDlg(weld::Window *pParent, ScDPObject &rDPObj, css::sheet::DataPilotFieldOrientation nOrient)
Definition: pvfundlg.cxx:909
std::unique_ptr< weld::Label > mxFtName
Definition: pvfundlg.hxx:127
std::vector< std::unique_ptr< ScDPLabelData > > ScDPLabelDataVector
Definition: pivot.hxx:113
std::unique_ptr< weld::Button > mxBtnOptions
Definition: pvfundlg.hxx:131
std::unique_ptr< weld::RadioButton > mxRbNone
true = Enable Layout mode controls.
Definition: pvfundlg.hxx:123
DECL_LINK(DblClickHdl, weld::TreeView &, bool)
std::unique_ptr< weld::Button > m_xBtnCancel
Definition: pvfundlg.hxx:180
std::unique_ptr< weld::Button > m_xBtnOk
Definition: pvfundlg.hxx:179
std::unique_ptr< weld::TreeView > m_xControl
Definition: pvfundlg.hxx:48
ScDPObject & mrDPObj
Definition: pvfundlg.hxx:182
OUString GetDimensionName() const
Definition: pvfundlg.cxx:952
DimNameIndexMap maNameIndexMap
Definition: pvfundlg.hxx:210
std::unique_ptr< weld::CheckButton > mxCbShowAll
Definition: pvfundlg.hxx:128
void SetSelection(PivotFunc nFuncMask)
Definition: pvfundlg.cxx:144
virtual ~ScDPSubtotalDlg() override
Definition: pvfundlg.cxx:483
void set_selection_mode(SelectionMode eMode)
Definition: pvfundlg.hxx:42
const OUString & GetBaseItemName(const OUString &rLayoutName) const
Definition: pvfundlg.cxx:365
const OUString & GetBaseFieldName(const OUString &rLayoutName) const
Definition: pvfundlg.cxx:359
ScDPFunctionListBox(std::unique_ptr< weld::TreeView > xControl)
Definition: pvfundlg.cxx:138
std::unique_ptr< weld::CheckButton > m_xCbShow
Definition: pvfundlg.hxx:168
DECL_LINK(SelectHdl, weld::ComboBox &, void)
std::unordered_map< OUString, ScDPName > NameMapType
Cache for members data.
Definition: pvfundlg.hxx:185
std::unique_ptr< weld::SpinButton > m_xNfShow
Definition: pvfundlg.hxx:169
ScDPObject & mrDPObj
Definition: pvfundlg.hxx:211
void FillLabelData(ScDPLabelData &rLabelData) const
Definition: pvfundlg.cxx:687
std::unique_ptr< weld::ComboBox > mxLbType
Definition: pvfundlg.hxx:78
ScDPObject & mrDPObj
Definition: pvfundlg.hxx:117
DECL_LINK(DblClickHdl, weld::TreeView &, bool)
std::unique_ptr< weld::TreeView > m_xLbHide
Definition: pvfundlg.hxx:176
std::unique_ptr< weld::CheckButton > m_xCbRepeatItemLabels
Definition: pvfundlg.hxx:167
std::unique_ptr< weld::Label > mxFtName
Definition: pvfundlg.hxx:77
const ScDPNameVec & mrDataFields
The DataPilot object (for member names).
Definition: pvfundlg.hxx:118
NameMapType maDataFieldNameMap
Definition: pvfundlg.hxx:186
css::sheet::DataPilotFieldReference GetFieldRef() const
Definition: pvfundlg.cxx:267
std::unique_ptr< weld::Label > mxFtBaseItem
Definition: pvfundlg.hxx:81
std::unordered_map< OUString, tools::Long > DimNameIndexMap
Definition: pvfundlg.hxx:209
DECL_LINK(RadioClickHdl, weld::Toggleable &, void)
void set_size_request(int nWidth, int nHeight)
Definition: pvfundlg.hxx:45
NameMapType maBaseItemNameMap
Definition: pvfundlg.hxx:88
void set_sensitive(bool sensitive)
Definition: pvfundlg.hxx:41
void CloseSubdialog()
Definition: pvfundlg.cxx:488
std::unique_ptr< weld::Label > m_xFtShow
Definition: pvfundlg.hxx:170
std::unique_ptr< weld::Widget > m_xLayoutFrame
Definition: pvfundlg.hxx:164
std::unique_ptr< weld::TreeView > mxLbDims
Definition: pvfundlg.hxx:213
std::unique_ptr< weld::RadioButton > m_xRbSortMan
Definition: pvfundlg.hxx:163
ScDPFunctionDlg(weld::Widget *pParent, const ScDPLabelDataVector &rLabelVec, const ScDPLabelData &rLabelData, const ScPivotFuncData &rFuncData)
Definition: pvfundlg.cxx:236
PivotFunc GetSelection() const
Definition: pvfundlg.cxx:160
std::unique_ptr< weld::Widget > m_xHideFrame
Definition: pvfundlg.hxx:175
PivotFunc GetFuncMask() const
Definition: pvfundlg.cxx:262
std::unique_ptr< weld::RadioButton > m_xRbSortDesc
Definition: pvfundlg.hxx:162
std::unique_ptr< weld::CheckButton > m_xCbLayoutEmpty
Definition: pvfundlg.hxx:166
void FillFunctionNames()
Definition: pvfundlg.cxx:169
PivotFunc GetFuncMask() const
Definition: pvfundlg.cxx:497
bool mbEmptyItem
Data of all labels.
Definition: pvfundlg.hxx:91
int get_height_rows(int nRows) const
Definition: pvfundlg.hxx:44
ScDPLabelData maLabelData
The DataPilot object (for member names).
Definition: pvfundlg.hxx:183