tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / pvfundlg.hxx
blob564f5d42622579628a8a5d91eb884107a1264224
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
23 #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
25 #include <vcl/weld.hxx>
26 #include <pivot.hxx>
28 #include <memory>
29 #include <unordered_map>
31 class ScDPObject;
33 class ScDPFunctionListBox
35 public:
36 ScDPFunctionListBox(std::unique_ptr<weld::TreeView> xControl);
38 void SetSelection( PivotFunc nFuncMask );
39 PivotFunc GetSelection() const;
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); }
47 private:
48 std::unique_ptr<weld::TreeView> m_xControl;
49 void FillFunctionNames();
52 class ScDPFunctionDlg : public weld::GenericDialogController
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;
62 private:
63 void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
65 const OUString& GetBaseFieldName(const OUString& rLayoutName) const;
66 const OUString& GetBaseItemName(const OUString& rLayoutName) const;
68 /** Searches for a listbox entry, starts search at specified position. */
69 sal_Int32 FindBaseItemPos( std::u16string_view rEntry, sal_Int32 nStartPos ) const;
71 DECL_LINK(SelectHdl, weld::ComboBox&, void);
72 DECL_LINK(DblClickHdl, weld::TreeView&, bool);
73 DECL_LINK(ButtonClicked, weld::Button&, void);
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;
87 NameMapType maBaseFieldNameMap; // cache for base field display -> original name.
88 NameMapType maBaseItemNameMap; // cache for base item display -> original name.
90 const ScDPLabelDataVector& mrLabelVec; /// Data of all labels.
91 bool mbEmptyItem; /// true = Empty base item in listbox.
94 class ScDPSubtotalOptDlg;
96 class ScDPSubtotalDlg : public weld::GenericDialogController
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;
105 void FillLabelData( ScDPLabelData& rLabelData ) const;
107 private:
108 void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
109 void CloseSubdialog();
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 );
116 private:
117 ScDPObject& mrDPObj; /// The DataPilot object (for member names).
118 const ScDPNameVec& mrDataFields; /// The list of all data field names.
120 ScDPLabelData maLabelData; /// Cache for sub dialog.
121 bool mbEnableLayout; /// true = Enable Layout mode controls.
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;
133 std::shared_ptr<ScDPSubtotalOptDlg> mxOptionsDlg;
136 class ScDPSubtotalOptDlg : public weld::GenericDialogController
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;
145 private:
146 void Init( const ScDPNameVec& rDataFields, bool bEnableLayout );
147 void InitHideListBox();
149 ScDPName GetFieldName(const OUString& rLayoutName) const;
151 /** Searches for a listbox entry, starts search at specified position. */
152 sal_Int32 FindListBoxEntry( const weld::ComboBox& rLBox, std::u16string_view rEntry, sal_Int32 nStartPos ) const;
154 DECL_LINK( CheckHdl, weld::Toggleable&, void );
155 DECL_LINK( SelectHdl, weld::ComboBox&, void );
156 DECL_LINK( ButtonClicked, weld::Button&, void );
158 private:
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;
181 ScDPObject& mrDPObj; /// The DataPilot object (for member names).
182 ScDPLabelData maLabelData; /// Cache for members data.
184 typedef std::unordered_map<OUString, ScDPName> NameMapType;
185 NameMapType maDataFieldNameMap; /// Cache for displayed name to field name mapping.
188 class ScDPShowDetailDlg : public weld::GenericDialogController
190 public:
191 explicit ScDPShowDetailDlg(weld::Window* pParent, ScDPObject& rDPObj,
192 css::sheet::DataPilotFieldOrientation nOrient);
193 virtual ~ScDPShowDetailDlg() override;
195 virtual short run() override;
198 * @return String internal name of the selected field. Note that this may
199 * be different from the name displayed in the dialog if the field
200 * has a layout name.
202 OUString GetDimensionName() const;
204 private:
205 DECL_LINK(DblClickHdl, weld::TreeView&, bool);
207 private:
208 typedef std::unordered_map<OUString, tools::Long> DimNameIndexMap;
209 DimNameIndexMap maNameIndexMap;
210 ScDPObject& mrDPObj;
212 std::unique_ptr<weld::TreeView> mxLbDims;
215 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */