Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_PVFUNDLG_HXX
30 : : #define SC_PVFUNDLG_HXX
31 : :
32 : : #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
33 : : #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
34 : :
35 : : #include <vcl/fixed.hxx>
36 : : #include <vcl/lstbox.hxx>
37 : : #include <vcl/dialog.hxx>
38 : : #include <vcl/button.hxx>
39 : : #include <vcl/morebtn.hxx>
40 : : #include <vcl/field.hxx>
41 : : #include <svtools/stdctrl.hxx>
42 : : #include <svx/checklbx.hxx>
43 : : #include <sfx2/itemconnect.hxx>
44 : : #include "pivot.hxx"
45 : :
46 : : #include <boost/unordered_map.hpp>
47 : :
48 : : // ============================================================================
49 : :
50 : : typedef sfx::ListBoxWrapper< sal_Int32 > ScDPListBoxWrapper;
51 : :
52 : : class ScDPObject;
53 : :
54 : : // ============================================================================
55 : :
56 : 0 : class ScDPFunctionListBox : public MultiListBox
57 : : {
58 : : public:
59 : : explicit ScDPFunctionListBox( Window* pParent, const ResId& rResId );
60 : :
61 : : void SetSelection( sal_uInt16 nFuncMask );
62 : : sal_uInt16 GetSelection() const;
63 : :
64 : : private:
65 : : void FillFunctionNames();
66 : : };
67 : :
68 : : // ============================================================================
69 : :
70 : 0 : class ScDPFunctionDlg : public ModalDialog
71 : : {
72 : : typedef ::boost::unordered_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > NameMapType;
73 : : public:
74 : : explicit ScDPFunctionDlg( Window* pParent, const ScDPLabelDataVec& rLabelVec,
75 : : const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData );
76 : :
77 : : sal_uInt16 GetFuncMask() const;
78 : : ::com::sun::star::sheet::DataPilotFieldReference GetFieldRef() const;
79 : :
80 : : private:
81 : : void Init( const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData );
82 : :
83 : : const ::rtl::OUString& GetBaseFieldName(const ::rtl::OUString& rLayoutName) const;
84 : : const ::rtl::OUString& GetBaseItemName(const ::rtl::OUString& rLayoutName) const;
85 : :
86 : : /** Searches for a listbox entry, starts search at specified position. */
87 : : sal_uInt16 FindBaseItemPos( const String& rEntry, sal_uInt16 nStartPos ) const;
88 : :
89 : : DECL_LINK( SelectHdl, ListBox* );
90 : : DECL_LINK( DblClickHdl, void* );
91 : :
92 : : private:
93 : : FixedLine maFlFunc;
94 : : ScDPFunctionListBox maLbFunc;
95 : : FixedText maFtNameLabel;
96 : : FixedInfo maFtName;
97 : : FixedLine maFlDisplay;
98 : : FixedText maFtType;
99 : : ListBox maLbType;
100 : : FixedText maFtBaseField;
101 : : ListBox maLbBaseField;
102 : : FixedText maFtBaseItem;
103 : : ListBox maLbBaseItem;
104 : : OKButton maBtnOk;
105 : : CancelButton maBtnCancel;
106 : : HelpButton maBtnHelp;
107 : : MoreButton maBtnMore;
108 : :
109 : : NameMapType maBaseFieldNameMap; // cache for base field display -> original name.
110 : : NameMapType maBaseItemNameMap; // cache for base item display -> original name.
111 : :
112 : : ScDPListBoxWrapper maLbTypeWrp; /// Wrapper for direct usage of API constants.
113 : :
114 : : const ScDPLabelDataVec& mrLabelVec; /// Data of all labels.
115 : : bool mbEmptyItem; /// true = Empty base item in listbox.
116 : : };
117 : :
118 : : // ============================================================================
119 : :
120 : 0 : class ScDPSubtotalDlg : public ModalDialog
121 : : {
122 : : public:
123 : : explicit ScDPSubtotalDlg( Window* pParent, ScDPObject& rDPObj,
124 : : const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData,
125 : : const ScDPNameVec& rDataFields, bool bEnableLayout );
126 : :
127 : : sal_uInt16 GetFuncMask() const;
128 : :
129 : : void FillLabelData( ScDPLabelData& rLabelData ) const;
130 : :
131 : : private:
132 : : void Init( const ScDPLabelData& rLabelData, const ScDPFuncData& rFuncData );
133 : :
134 : : DECL_LINK(DblClickHdl, void *);
135 : : DECL_LINK( RadioClickHdl, RadioButton* );
136 : : DECL_LINK( ClickHdl, PushButton* );
137 : :
138 : : private:
139 : : FixedLine maFlSubt;
140 : : RadioButton maRbNone;
141 : : RadioButton maRbAuto;
142 : : RadioButton maRbUser;
143 : : ScDPFunctionListBox maLbFunc;
144 : : FixedText maFtNameLabel;
145 : : FixedInfo maFtName;
146 : : CheckBox maCbShowAll;
147 : : OKButton maBtnOk;
148 : : CancelButton maBtnCancel;
149 : : HelpButton maBtnHelp;
150 : : PushButton maBtnOptions;
151 : :
152 : : ScDPObject& mrDPObj; /// The DataPilot object (for member names).
153 : : const ScDPNameVec& mrDataFields; /// The list of all data field names.
154 : :
155 : : ScDPLabelData maLabelData; /// Cache for sub dialog.
156 : : bool mbEnableLayout; /// true = Enable Layout mode controls.
157 : : };
158 : :
159 : : // ============================================================================
160 : :
161 : 0 : class ScDPSubtotalOptDlg : public ModalDialog
162 : : {
163 : : public:
164 : : explicit ScDPSubtotalOptDlg( Window* pParent, ScDPObject& rDPObj,
165 : : const ScDPLabelData& rLabelData, const ScDPNameVec& rDataFields,
166 : : bool bEnableLayout );
167 : :
168 : : void FillLabelData( ScDPLabelData& rLabelData ) const;
169 : :
170 : : private:
171 : : void Init( const ScDPNameVec& rDataFields, bool bEnableLayout );
172 : : void InitHideListBox();
173 : :
174 : : const ::rtl::OUString& GetFieldName(const ::rtl::OUString& rLayoutName) const;
175 : :
176 : : /** Searches for a listbox entry, starts search at specified position. */
177 : : sal_uInt16 FindListBoxEntry( const ListBox& rLBox, const String& rEntry, sal_uInt16 nStartPos ) const;
178 : :
179 : : DECL_LINK( RadioClickHdl, RadioButton* );
180 : : DECL_LINK( CheckHdl, CheckBox* );
181 : : DECL_LINK( SelectHdl, ListBox* );
182 : :
183 : : private:
184 : : FixedLine maFlSortBy;
185 : : ListBox maLbSortBy;
186 : : RadioButton maRbSortAsc;
187 : : RadioButton maRbSortDesc;
188 : : RadioButton maRbSortMan;
189 : : FixedLine maFlLayout;
190 : : FixedText maFtLayout;
191 : : ListBox maLbLayout;
192 : : CheckBox maCbLayoutEmpty;
193 : : FixedLine maFlAutoShow;
194 : : CheckBox maCbShow;
195 : : NumericField maNfShow;
196 : : FixedText maFtShow;
197 : : FixedText maFtShowFrom;
198 : : ListBox maLbShowFrom;
199 : : FixedText maFtShowUsing;
200 : : ListBox maLbShowUsing;
201 : : FixedLine maFlHide;
202 : : SvxCheckListBox maLbHide;
203 : : FixedText maFtHierarchy;
204 : : ListBox maLbHierarchy;
205 : : OKButton maBtnOk;
206 : : CancelButton maBtnCancel;
207 : : HelpButton maBtnHelp;
208 : :
209 : : ScDPListBoxWrapper maLbLayoutWrp; /// Wrapper for direct usage of API constants.
210 : : ScDPListBoxWrapper maLbShowFromWrp; /// Wrapper for direct usage of API constants.
211 : :
212 : : ScDPObject& mrDPObj; /// The DataPilot object (for member names).
213 : : ScDPLabelData maLabelData; /// Cache for members data.
214 : :
215 : : typedef ::boost::unordered_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > NameMapType;
216 : : NameMapType maDataFieldNameMap; /// Cache for displayed name to field name mapping.
217 : : };
218 : :
219 : : // ============================================================================
220 : :
221 : 0 : class ScDPShowDetailDlg : public ModalDialog
222 : : {
223 : : public:
224 : : explicit ScDPShowDetailDlg( Window* pParent, ScDPObject& rDPObj, sal_uInt16 nOrient );
225 : :
226 : : virtual short Execute();
227 : :
228 : : /**
229 : : * @return String internal name of the selected field. Note that this may
230 : : * be different from the name displayed in the dialog if the field
231 : : * has a layout name.
232 : : */
233 : : ::rtl::OUString GetDimensionName() const;
234 : :
235 : : private:
236 : : DECL_LINK( DblClickHdl, ListBox* );
237 : :
238 : : private:
239 : : FixedText maFtDims;
240 : : ListBox maLbDims;
241 : : OKButton maBtnOk;
242 : : CancelButton maBtnCancel;
243 : : HelpButton maBtnHelp;
244 : :
245 : : typedef ::boost::unordered_map<String, long, ScStringHashCode> DimNameIndexMap;
246 : : DimNameIndexMap maNameIndexMap;
247 : : ScDPObject& mrDPObj;
248 : : };
249 : :
250 : : // ============================================================================
251 : :
252 : : #endif
253 : :
254 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|