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 #ifndef INCLUDED_SC_SOURCE_UI_INC_PVFUNDLG_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_PVFUNDLG_HXX
22 
23 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
24 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
25 
26 #include <vcl/weld.hxx>
27 #include <pivot.hxx>
28 
29 #include <memory>
30 #include <unordered_map>
31 
32 class ScDPObject;
33 
35 {
36 public:
37  ScDPFunctionListBox(std::unique_ptr<weld::TreeView> xControl);
38 
39  void SetSelection( PivotFunc nFuncMask );
40  PivotFunc GetSelection() const;
41 
42  void set_sensitive(bool sensitive) { m_xControl->set_sensitive(sensitive); }
43  void set_selection_mode(SelectionMode eMode) { m_xControl->set_selection_mode(eMode); }
44  void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { m_xControl->connect_row_activated(rLink); }
45  int get_height_rows(int nRows) const { return m_xControl->get_height_rows(nRows); }
46  void set_size_request(int nWidth, int nHeight) { m_xControl->set_size_request(nWidth, nHeight); }
47 
48 private:
49  std::unique_ptr<weld::TreeView> m_xControl;
50  void FillFunctionNames();
51 };
52 
54 {
55  typedef std::unordered_map< OUString, OUString > NameMapType;
56 public:
57  explicit ScDPFunctionDlg(weld::Widget* pParent, const ScDPLabelDataVector& rLabelVec,
58  const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
59  virtual ~ScDPFunctionDlg() override;
60  PivotFunc GetFuncMask() const;
61  css::sheet::DataPilotFieldReference GetFieldRef() const;
62 
63 private:
64  void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
65 
66  const OUString& GetBaseFieldName(const OUString& rLayoutName) const;
67  const OUString& GetBaseItemName(const OUString& rLayoutName) const;
68 
70  sal_Int32 FindBaseItemPos( std::u16string_view rEntry, sal_Int32 nStartPos ) const;
71 
72  DECL_LINK(SelectHdl, weld::ComboBox&, void);
73  DECL_LINK(DblClickHdl, weld::TreeView&, bool);
74  DECL_LINK(ButtonClicked, weld::Button&, void);
75 
76 private:
77  std::unique_ptr<ScDPFunctionListBox> mxLbFunc;
78  std::unique_ptr<weld::Label> mxFtName;
79  std::unique_ptr<weld::ComboBox> mxLbType;
80  std::unique_ptr<weld::Label> mxFtBaseField;
81  std::unique_ptr<weld::ComboBox> mxLbBaseField;
82  std::unique_ptr<weld::Label> mxFtBaseItem;
83  std::unique_ptr<weld::ComboBox> mxLbBaseItem;
84  std::unique_ptr<weld::Button> mxBtnOk;
85  std::unique_ptr<weld::Button> mxBtnCancel;
86  std::unique_ptr<weld::Expander> mxExpander;
87 
88  NameMapType maBaseFieldNameMap; // cache for base field display -> original name.
89  NameMapType maBaseItemNameMap; // cache for base item display -> original name.
90 
92  bool mbEmptyItem;
93 };
94 
96 {
97 public:
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 
106 private:
107  void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
108 
109  DECL_LINK( DblClickHdl, weld::TreeView&, bool );
110  DECL_LINK( RadioClickHdl, weld::Button&, void );
111  DECL_LINK( ClickHdl, weld::Button&, void );
112  DECL_LINK( ButtonClicked, weld::Button&, void );
113 
114 private:
117 
120 
121  std::unique_ptr<weld::RadioButton> mxRbNone;
122  std::unique_ptr<weld::RadioButton> mxRbAuto;
123  std::unique_ptr<weld::RadioButton> mxRbUser;
124  std::unique_ptr<ScDPFunctionListBox> mxLbFunc;
125  std::unique_ptr<weld::Label> mxFtName;
126  std::unique_ptr<weld::CheckButton> mxCbShowAll;
127  std::unique_ptr<weld::Button> mxBtnOk;
128  std::unique_ptr<weld::Button> mxBtnCancel;
129  std::unique_ptr<weld::Button> mxBtnOptions;
130 };
131 
133 {
134 public:
135  explicit ScDPSubtotalOptDlg(weld::Window* pParent, ScDPObject& rDPObj,
136  const ScDPLabelData& rLabelData, const ScDPNameVec& rDataFields,
137  bool bEnableLayout );
138  virtual ~ScDPSubtotalOptDlg() override;
139  void FillLabelData( ScDPLabelData& rLabelData ) const;
140 
141 private:
142  void Init( const ScDPNameVec& rDataFields, bool bEnableLayout );
143  void InitHideListBox();
144 
145  ScDPName GetFieldName(const OUString& rLayoutName) const;
146 
148  sal_Int32 FindListBoxEntry( const weld::ComboBox& rLBox, std::u16string_view rEntry, sal_Int32 nStartPos ) const;
149 
150  DECL_LINK( RadioClickHdl, weld::Button&, void );
151  DECL_LINK( CheckHdl, weld::Button&, void );
152  DECL_LINK( SelectHdl, weld::ComboBox&, void );
153  DECL_LINK( ButtonClicked, weld::Button&, void );
154 
155 private:
156  std::unique_ptr<weld::ComboBox> m_xLbSortBy;
157  std::unique_ptr<weld::RadioButton> m_xRbSortAsc;
158  std::unique_ptr<weld::RadioButton> m_xRbSortDesc;
159  std::unique_ptr<weld::RadioButton> m_xRbSortMan;
160  std::unique_ptr<weld::Widget> m_xLayoutFrame;
161  std::unique_ptr<weld::ComboBox> m_xLbLayout;
162  std::unique_ptr<weld::CheckButton> m_xCbLayoutEmpty;
163  std::unique_ptr<weld::CheckButton> m_xCbRepeatItemLabels;
164  std::unique_ptr<weld::CheckButton> m_xCbShow;
165  std::unique_ptr<weld::SpinButton> m_xNfShow;
166  std::unique_ptr<weld::Label> m_xFtShow;
167  std::unique_ptr<weld::Label> m_xFtShowFrom;
168  std::unique_ptr<weld::ComboBox> m_xLbShowFrom;
169  std::unique_ptr<weld::Label> m_xFtShowUsing;
170  std::unique_ptr<weld::ComboBox> m_xLbShowUsing;
171  std::unique_ptr<weld::Widget> m_xHideFrame;
172  std::unique_ptr<weld::TreeView> m_xLbHide;
173  std::unique_ptr<weld::Label> m_xFtHierarchy;
174  std::unique_ptr<weld::ComboBox> m_xLbHierarchy;
175  std::unique_ptr<weld::Button> m_xBtnOk;
176  std::unique_ptr<weld::Button> m_xBtnCancel;
177 
180 
181  typedef std::unordered_map<OUString, ScDPName> NameMapType;
182  NameMapType maDataFieldNameMap;
183 };
184 
186 {
187 public:
188  explicit ScDPShowDetailDlg(weld::Window* pParent, ScDPObject& rDPObj,
189  css::sheet::DataPilotFieldOrientation nOrient);
190  virtual ~ScDPShowDetailDlg() override;
191 
192  virtual short run() override;
193 
199  OUString GetDimensionName() const;
200 
201 private:
202  DECL_LINK(DblClickHdl, weld::TreeView&, bool);
203 
204 private:
205  typedef std::unordered_map<OUString, tools::Long> DimNameIndexMap;
206  DimNameIndexMap maNameIndexMap;
208 
209  std::unique_ptr<weld::TreeView> mxLbDims;
210 };
211 
212 #endif
213 
214 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::ComboBox > m_xLbShowUsing
Definition: pvfundlg.hxx:170
void FillLabelData(ScDPLabelData &rLabelData) const
Definition: pvfundlg.cxx:499
std::unique_ptr< weld::Button > mxBtnCancel
Definition: pvfundlg.hxx:85
bool mbEnableLayout
Cache for sub dialog.
Definition: pvfundlg.hxx:119
void Init(const ScDPLabelData &rLabelData, const ScPivotFuncData &rFuncData)
Definition: pvfundlg.cxx:294
std::unique_ptr< ScDPFunctionListBox > mxLbFunc
Definition: pvfundlg.hxx:77
std::unique_ptr< weld::RadioButton > m_xRbSortAsc
Definition: pvfundlg.hxx:157
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:816
std::unique_ptr< weld::ComboBox > mxLbBaseField
Definition: pvfundlg.hxx:81
virtual ~ScDPSubtotalOptDlg() override
Definition: pvfundlg.cxx:665
std::unique_ptr< weld::Label > m_xFtShowUsing
Definition: pvfundlg.hxx:169
const ScDPLabelDataVector & mrLabelVec
Definition: pvfundlg.hxx:91
std::unique_ptr< weld::Expander > mxExpander
Definition: pvfundlg.hxx:86
std::unique_ptr< weld::Button > mxBtnOk
Definition: pvfundlg.hxx:127
ScDPSubtotalOptDlg(weld::Window *pParent, ScDPObject &rDPObj, const ScDPLabelData &rLabelData, const ScDPNameVec &rDataFields, bool bEnableLayout)
Definition: pvfundlg.cxx:629
SelectionMode
virtual ~ScDPShowDetailDlg() override
Definition: pvfundlg.cxx:922
std::unique_ptr< weld::Button > mxBtnCancel
Definition: pvfundlg.hxx:128
std::unique_ptr< weld::ComboBox > mxLbBaseItem
Definition: pvfundlg.hxx:83
void Init(const ScDPNameVec &rDataFields, bool bEnableLayout)
Definition: pvfundlg.cxx:718
ScDPName GetFieldName(const OUString &rLayoutName) const
Definition: pvfundlg.cxx:827
std::unique_ptr< weld::ComboBox > m_xLbShowFrom
Definition: pvfundlg.hxx:168
std::unique_ptr< weld::Button > mxBtnOk
Definition: pvfundlg.hxx:84
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:55
std::unique_ptr< weld::Label > m_xFtShowFrom
Definition: pvfundlg.hxx:167
void Init(const ScDPLabelData &rLabelData, const ScPivotFuncData &rFuncData)
Definition: pvfundlg.cxx:511
void connect_row_activated(const Link< weld::TreeView &, bool > &rLink)
Definition: pvfundlg.hxx:44
ScDPLabelData maLabelData
The list of all data field names.
Definition: pvfundlg.hxx:118
std::unique_ptr< weld::RadioButton > mxRbUser
Definition: pvfundlg.hxx:123
std::unique_ptr< ScDPFunctionListBox > mxLbFunc
Definition: pvfundlg.hxx:124
std::unique_ptr< weld::Label > m_xFtHierarchy
Definition: pvfundlg.hxx:173
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:833
std::unique_ptr< weld::ComboBox > m_xLbLayout
Definition: pvfundlg.hxx:161
PivotFunc
Definition: dpglobal.hxx:25
std::unique_ptr< weld::Label > mxFtBaseField
Definition: pvfundlg.hxx:80
std::vector< ScDPName > ScDPNameVec
Definition: pivot.hxx:173
NameMapType maBaseFieldNameMap
Definition: pvfundlg.hxx:88
std::unique_ptr< weld::ComboBox > m_xLbHierarchy
Definition: pvfundlg.hxx:174
std::unique_ptr< weld::ComboBox > m_xLbSortBy
Definition: pvfundlg.hxx:156
virtual ~ScDPFunctionDlg() override
Definition: pvfundlg.cxx:258
virtual short run() override
Definition: pvfundlg.cxx:926
std::unique_ptr< weld::RadioButton > mxRbAuto
Definition: pvfundlg.hxx:122
ScDPShowDetailDlg(weld::Window *pParent, ScDPObject &rDPObj, css::sheet::DataPilotFieldOrientation nOrient)
Definition: pvfundlg.cxx:888
std::unique_ptr< weld::Label > mxFtName
Definition: pvfundlg.hxx:125
std::vector< std::unique_ptr< ScDPLabelData > > ScDPLabelDataVector
Definition: pivot.hxx:114
std::unique_ptr< weld::Button > mxBtnOptions
Definition: pvfundlg.hxx:129
std::unique_ptr< weld::RadioButton > mxRbNone
true = Enable Layout mode controls.
Definition: pvfundlg.hxx:121
DECL_LINK(DblClickHdl, weld::TreeView &, bool)
std::unique_ptr< weld::Button > m_xBtnCancel
Definition: pvfundlg.hxx:176
std::unique_ptr< weld::Button > m_xBtnOk
Definition: pvfundlg.hxx:175
std::unique_ptr< weld::TreeView > m_xControl
Definition: pvfundlg.hxx:49
ScDPObject & mrDPObj
Definition: pvfundlg.hxx:178
OUString GetDimensionName() const
Definition: pvfundlg.cxx:931
DimNameIndexMap maNameIndexMap
Definition: pvfundlg.hxx:206
std::unique_ptr< weld::CheckButton > mxCbShowAll
Definition: pvfundlg.hxx:126
void SetSelection(PivotFunc nFuncMask)
Definition: pvfundlg.cxx:144
virtual ~ScDPSubtotalDlg() override
Definition: pvfundlg.cxx:483
void set_selection_mode(SelectionMode eMode)
Definition: pvfundlg.hxx:43
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:164
DECL_LINK(SelectHdl, weld::ComboBox &, void)
std::unordered_map< OUString, ScDPName > NameMapType
Cache for members data.
Definition: pvfundlg.hxx:181
std::unique_ptr< weld::SpinButton > m_xNfShow
Definition: pvfundlg.hxx:165
ScDPObject & mrDPObj
Definition: pvfundlg.hxx:207
void FillLabelData(ScDPLabelData &rLabelData) const
Definition: pvfundlg.cxx:669
std::unique_ptr< weld::ComboBox > mxLbType
Definition: pvfundlg.hxx:79
ScDPObject & mrDPObj
Definition: pvfundlg.hxx:115
DECL_LINK(DblClickHdl, weld::TreeView &, bool)
std::unique_ptr< weld::TreeView > m_xLbHide
Definition: pvfundlg.hxx:172
std::unique_ptr< weld::CheckButton > m_xCbRepeatItemLabels
Definition: pvfundlg.hxx:163
std::unique_ptr< weld::Label > mxFtName
Definition: pvfundlg.hxx:78
const ScDPNameVec & mrDataFields
The DataPilot object (for member names).
Definition: pvfundlg.hxx:116
NameMapType maDataFieldNameMap
Definition: pvfundlg.hxx:182
css::sheet::DataPilotFieldReference GetFieldRef() const
Definition: pvfundlg.cxx:267
DECL_LINK(RadioClickHdl, weld::Button &, void)
std::unique_ptr< weld::Label > mxFtBaseItem
Definition: pvfundlg.hxx:82
std::unordered_map< OUString, tools::Long > DimNameIndexMap
Definition: pvfundlg.hxx:205
void set_size_request(int nWidth, int nHeight)
Definition: pvfundlg.hxx:46
NameMapType maBaseItemNameMap
Definition: pvfundlg.hxx:89
void set_sensitive(bool sensitive)
Definition: pvfundlg.hxx:42
std::unique_ptr< weld::Label > m_xFtShow
Definition: pvfundlg.hxx:166
std::unique_ptr< weld::Widget > m_xLayoutFrame
Definition: pvfundlg.hxx:160
std::unique_ptr< weld::TreeView > mxLbDims
Definition: pvfundlg.hxx:209
std::unique_ptr< weld::RadioButton > m_xRbSortMan
Definition: pvfundlg.hxx:159
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:171
PivotFunc GetFuncMask() const
Definition: pvfundlg.cxx:262
std::unique_ptr< weld::RadioButton > m_xRbSortDesc
Definition: pvfundlg.hxx:158
std::unique_ptr< weld::CheckButton > m_xCbLayoutEmpty
Definition: pvfundlg.hxx:162
void FillFunctionNames()
Definition: pvfundlg.cxx:169
PivotFunc GetFuncMask() const
Definition: pvfundlg.cxx:487
bool mbEmptyItem
Data of all labels.
Definition: pvfundlg.hxx:92
int get_height_rows(int nRows) const
Definition: pvfundlg.hxx:45
ScDPLabelData maLabelData
The DataPilot object (for member names).
Definition: pvfundlg.hxx:179