Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / pvfundlg.hxx
bloba89ab3882ad76c11f7b509089873881aa69a1dff
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 #ifndef SC_PVFUNDLG_HXX
21 #define SC_PVFUNDLG_HXX
23 #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
24 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
26 #include <vcl/fixed.hxx>
27 #include <vcl/lstbox.hxx>
28 #include <vcl/dialog.hxx>
29 #include <vcl/button.hxx>
30 #include <vcl/morebtn.hxx>
31 #include <vcl/field.hxx>
32 #include <svtools/stdctrl.hxx>
33 #include <svx/checklbx.hxx>
34 #include <sfx2/itemconnect.hxx>
35 #include "pivot.hxx"
37 #include <boost/unordered_map.hpp>
39 // ============================================================================
41 typedef sfx::ListBoxWrapper< sal_Int32 > ScDPListBoxWrapper;
43 class ScDPObject;
45 // ============================================================================
47 class ScDPFunctionListBox : public MultiListBox
49 public:
50 explicit ScDPFunctionListBox( Window* pParent, const ResId& rResId );
52 void SetSelection( sal_uInt16 nFuncMask );
53 sal_uInt16 GetSelection() const;
55 private:
56 void FillFunctionNames();
59 // ============================================================================
61 class ScDPFunctionDlg : public ModalDialog
63 typedef ::boost::unordered_map< OUString, OUString, OUStringHash > NameMapType;
64 public:
65 explicit ScDPFunctionDlg( Window* pParent, const ScDPLabelDataVector& rLabelVec,
66 const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
68 sal_uInt16 GetFuncMask() const;
69 ::com::sun::star::sheet::DataPilotFieldReference GetFieldRef() const;
71 private:
72 void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
74 const OUString& GetBaseFieldName(const OUString& rLayoutName) const;
75 const OUString& GetBaseItemName(const OUString& rLayoutName) const;
77 /** Searches for a listbox entry, starts search at specified position. */
78 sal_uInt16 FindBaseItemPos( const OUString& rEntry, sal_uInt16 nStartPos ) const;
80 DECL_LINK( SelectHdl, ListBox* );
81 DECL_LINK( DblClickHdl, void* );
83 private:
84 FixedLine maFlFunc;
85 ScDPFunctionListBox maLbFunc;
86 FixedText maFtNameLabel;
87 FixedInfo maFtName;
88 FixedLine maFlDisplay;
89 FixedText maFtType;
90 ListBox maLbType;
91 FixedText maFtBaseField;
92 ListBox maLbBaseField;
93 FixedText maFtBaseItem;
94 ListBox maLbBaseItem;
95 OKButton maBtnOk;
96 CancelButton maBtnCancel;
97 HelpButton maBtnHelp;
98 MoreButton maBtnMore;
100 NameMapType maBaseFieldNameMap; // cache for base field display -> original name.
101 NameMapType maBaseItemNameMap; // cache for base item display -> original name.
103 ScDPListBoxWrapper maLbTypeWrp; /// Wrapper for direct usage of API constants.
105 const ScDPLabelDataVector& mrLabelVec; /// Data of all labels.
106 bool mbEmptyItem; /// true = Empty base item in listbox.
109 // ============================================================================
111 class ScDPSubtotalDlg : public ModalDialog
113 public:
114 explicit ScDPSubtotalDlg( Window* pParent, ScDPObject& rDPObj,
115 const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData,
116 const ScDPNameVec& rDataFields, bool bEnableLayout );
118 sal_uInt16 GetFuncMask() const;
120 void FillLabelData( ScDPLabelData& rLabelData ) const;
122 private:
123 void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
125 DECL_LINK(DblClickHdl, void *);
126 DECL_LINK( RadioClickHdl, RadioButton* );
127 DECL_LINK( ClickHdl, PushButton* );
129 private:
130 FixedLine maFlSubt;
131 RadioButton maRbNone;
132 RadioButton maRbAuto;
133 RadioButton maRbUser;
134 ScDPFunctionListBox maLbFunc;
135 FixedText maFtNameLabel;
136 FixedInfo maFtName;
137 CheckBox maCbShowAll;
138 OKButton maBtnOk;
139 CancelButton maBtnCancel;
140 HelpButton maBtnHelp;
141 PushButton maBtnOptions;
143 ScDPObject& mrDPObj; /// The DataPilot object (for member names).
144 const ScDPNameVec& mrDataFields; /// The list of all data field names.
146 ScDPLabelData maLabelData; /// Cache for sub dialog.
147 bool mbEnableLayout; /// true = Enable Layout mode controls.
150 // ============================================================================
152 class ScDPSubtotalOptDlg : public ModalDialog
154 public:
155 explicit ScDPSubtotalOptDlg( Window* pParent, ScDPObject& rDPObj,
156 const ScDPLabelData& rLabelData, const ScDPNameVec& rDataFields,
157 bool bEnableLayout );
159 void FillLabelData( ScDPLabelData& rLabelData ) const;
161 private:
162 void Init( const ScDPNameVec& rDataFields, bool bEnableLayout );
163 void InitHideListBox();
165 ScDPName GetFieldName(const OUString& rLayoutName) const;
167 /** Searches for a listbox entry, starts search at specified position. */
168 sal_uInt16 FindListBoxEntry( const ListBox& rLBox, const OUString& rEntry, sal_uInt16 nStartPos ) const;
170 DECL_LINK( RadioClickHdl, RadioButton* );
171 DECL_LINK( CheckHdl, CheckBox* );
172 DECL_LINK( SelectHdl, ListBox* );
174 private:
175 FixedLine maFlSortBy;
176 ListBox maLbSortBy;
177 RadioButton maRbSortAsc;
178 RadioButton maRbSortDesc;
179 RadioButton maRbSortMan;
180 FixedLine maFlLayout;
181 FixedText maFtLayout;
182 ListBox maLbLayout;
183 CheckBox maCbLayoutEmpty;
184 FixedLine maFlAutoShow;
185 CheckBox maCbShow;
186 NumericField maNfShow;
187 FixedText maFtShow;
188 FixedText maFtShowFrom;
189 ListBox maLbShowFrom;
190 FixedText maFtShowUsing;
191 ListBox maLbShowUsing;
192 FixedLine maFlHide;
193 SvxCheckListBox maLbHide;
194 FixedText maFtHierarchy;
195 ListBox maLbHierarchy;
196 OKButton maBtnOk;
197 CancelButton maBtnCancel;
198 HelpButton maBtnHelp;
200 ScDPListBoxWrapper maLbLayoutWrp; /// Wrapper for direct usage of API constants.
201 ScDPListBoxWrapper maLbShowFromWrp; /// Wrapper for direct usage of API constants.
203 ScDPObject& mrDPObj; /// The DataPilot object (for member names).
204 ScDPLabelData maLabelData; /// Cache for members data.
206 typedef ::boost::unordered_map<OUString, ScDPName, OUStringHash> NameMapType;
207 NameMapType maDataFieldNameMap; /// Cache for displayed name to field name mapping.
210 // ============================================================================
212 class ScDPShowDetailDlg : public ModalDialog
214 public:
215 explicit ScDPShowDetailDlg( Window* pParent, ScDPObject& rDPObj, sal_uInt16 nOrient );
217 virtual short Execute();
220 * @return String internal name of the selected field. Note that this may
221 * be different from the name displayed in the dialog if the field
222 * has a layout name.
224 OUString GetDimensionName() const;
226 private:
227 DECL_LINK( DblClickHdl, ListBox* );
229 private:
230 FixedText maFtDims;
231 ListBox maLbDims;
232 OKButton maBtnOk;
233 CancelButton maBtnCancel;
234 HelpButton maBtnHelp;
236 typedef ::boost::unordered_map<OUString, long, OUStringHash> DimNameIndexMap;
237 DimNameIndexMap maNameIndexMap;
238 ScDPObject& mrDPObj;
241 // ============================================================================
243 #endif
245 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */