Line data Source code
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 SC_PVFUNDLG_HXX
21 : #define SC_PVFUNDLG_HXX
22 :
23 : #include <boost/scoped_ptr.hpp>
24 :
25 : #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
26 : #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
27 :
28 : #include <vcl/fixed.hxx>
29 : #include <vcl/layout.hxx>
30 : #include <vcl/lstbox.hxx>
31 : #include <vcl/dialog.hxx>
32 : #include <vcl/button.hxx>
33 : #include <vcl/morebtn.hxx>
34 : #include <vcl/field.hxx>
35 : #include <svtools/stdctrl.hxx>
36 : #include <svx/checklbx.hxx>
37 : #include <sfx2/itemconnect.hxx>
38 : #include "pivot.hxx"
39 :
40 : #include <boost/scoped_ptr.hpp>
41 : #include <boost/unordered_map.hpp>
42 :
43 : typedef sfx::ListBoxWrapper< sal_Int32 > ScDPListBoxWrapper;
44 :
45 : class ScDPObject;
46 :
47 0 : class ScDPFunctionListBox : public ListBox
48 : {
49 : public:
50 : ScDPFunctionListBox(Window* pParent, WinBits nStyle);
51 :
52 : void SetSelection( sal_uInt16 nFuncMask );
53 : sal_uInt16 GetSelection() const;
54 :
55 : private:
56 : void FillFunctionNames();
57 : };
58 :
59 0 : class ScDPFunctionDlg : public ModalDialog
60 : {
61 : typedef ::boost::unordered_map< OUString, OUString, OUStringHash > NameMapType;
62 : public:
63 : explicit ScDPFunctionDlg( Window* pParent, const ScDPLabelDataVector& rLabelVec,
64 : const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
65 :
66 : sal_uInt16 GetFuncMask() const;
67 : ::com::sun::star::sheet::DataPilotFieldReference GetFieldRef() const;
68 :
69 : private:
70 : void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
71 :
72 : const OUString& GetBaseFieldName(const OUString& rLayoutName) const;
73 : const OUString& GetBaseItemName(const OUString& rLayoutName) const;
74 :
75 : /** Searches for a listbox entry, starts search at specified position. */
76 : sal_Int32 FindBaseItemPos( const OUString& rEntry, sal_Int32 nStartPos ) const;
77 :
78 : DECL_LINK( SelectHdl, ListBox* );
79 : DECL_LINK( DblClickHdl, void* );
80 :
81 : private:
82 : ScDPFunctionListBox* mpLbFunc;
83 : FixedText* mpFtName;
84 : ListBox* mpLbType;
85 : FixedText* mpFtBaseField;
86 : ListBox* mpLbBaseField;
87 : FixedText* mpFtBaseItem;
88 : ListBox* mpLbBaseItem;
89 : OKButton* mpBtnOk;
90 :
91 : NameMapType maBaseFieldNameMap; // cache for base field display -> original name.
92 : NameMapType maBaseItemNameMap; // cache for base item display -> original name.
93 :
94 : boost::scoped_ptr<ScDPListBoxWrapper> mxLbTypeWrp; /// Wrapper for direct usage of API constants.
95 :
96 : const ScDPLabelDataVector& mrLabelVec; /// Data of all labels.
97 : bool mbEmptyItem; /// true = Empty base item in listbox.
98 : };
99 :
100 0 : class ScDPSubtotalDlg : public ModalDialog
101 : {
102 : public:
103 : explicit ScDPSubtotalDlg( Window* pParent, ScDPObject& rDPObj,
104 : const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData,
105 : const ScDPNameVec& rDataFields, bool bEnableLayout );
106 :
107 : sal_uInt16 GetFuncMask() const;
108 :
109 : void FillLabelData( ScDPLabelData& rLabelData ) const;
110 :
111 : private:
112 : void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
113 :
114 : DECL_LINK(DblClickHdl, void *);
115 : DECL_LINK( RadioClickHdl, RadioButton* );
116 : DECL_LINK( ClickHdl, PushButton* );
117 :
118 : private:
119 : RadioButton* mpRbNone;
120 : RadioButton* mpRbAuto;
121 : RadioButton* mpRbUser;
122 : ScDPFunctionListBox* mpLbFunc;
123 : FixedText* mpFtName;
124 : CheckBox* mpCbShowAll;
125 : OKButton* mpBtnOk;
126 : PushButton* mpBtnOptions;
127 :
128 : ScDPObject& mrDPObj; /// The DataPilot object (for member names).
129 : const ScDPNameVec& mrDataFields; /// The list of all data field names.
130 :
131 : ScDPLabelData maLabelData; /// Cache for sub dialog.
132 : bool mbEnableLayout; /// true = Enable Layout mode controls.
133 : };
134 :
135 0 : class ScDPSubtotalOptDlg : public ModalDialog
136 : {
137 : public:
138 : explicit ScDPSubtotalOptDlg( Window* pParent, ScDPObject& rDPObj,
139 : const ScDPLabelData& rLabelData, const ScDPNameVec& rDataFields,
140 : bool bEnableLayout );
141 :
142 : void FillLabelData( ScDPLabelData& rLabelData ) const;
143 :
144 : private:
145 : void Init( const ScDPNameVec& rDataFields, bool bEnableLayout );
146 : void InitHideListBox();
147 :
148 : ScDPName GetFieldName(const OUString& rLayoutName) const;
149 :
150 : /** Searches for a listbox entry, starts search at specified position. */
151 : sal_Int32 FindListBoxEntry( const ListBox& rLBox, const OUString& rEntry, sal_Int32 nStartPos ) const;
152 :
153 : DECL_LINK( RadioClickHdl, RadioButton* );
154 : DECL_LINK( CheckHdl, CheckBox* );
155 : DECL_LINK( SelectHdl, ListBox* );
156 :
157 : private:
158 : ListBox* m_pLbSortBy;
159 : RadioButton* m_pRbSortAsc;
160 : RadioButton* m_pRbSortDesc;
161 : RadioButton* m_pRbSortMan;
162 : VclContainer* m_pLayoutFrame;
163 : ListBox* m_pLbLayout;
164 : CheckBox* m_pCbLayoutEmpty;
165 : CheckBox* m_pCbShow;
166 : NumericField* m_pNfShow;
167 : FixedText* m_pFtShow;
168 : FixedText* m_pFtShowFrom;
169 : ListBox* m_pLbShowFrom;
170 : FixedText* m_pFtShowUsing;
171 : ListBox* m_pLbShowUsing;
172 : VclContainer* m_pHideFrame;
173 : SvxCheckListBox* m_pLbHide;
174 : FixedText* m_pFtHierarchy;
175 : ListBox* m_pLbHierarchy;
176 :
177 : boost::scoped_ptr<ScDPListBoxWrapper> m_xLbLayoutWrp; /// Wrapper for direct usage of API constants.
178 : boost::scoped_ptr<ScDPListBoxWrapper> m_xLbShowFromWrp; /// Wrapper for direct usage of API constants.
179 :
180 : ScDPObject& mrDPObj; /// The DataPilot object (for member names).
181 : ScDPLabelData maLabelData; /// Cache for members data.
182 :
183 : typedef ::boost::unordered_map<OUString, ScDPName, OUStringHash> NameMapType;
184 : NameMapType maDataFieldNameMap; /// Cache for displayed name to field name mapping.
185 : };
186 :
187 0 : class ScDPShowDetailDlg : public ModalDialog
188 : {
189 : public:
190 : explicit ScDPShowDetailDlg( Window* pParent, ScDPObject& rDPObj, sal_uInt16 nOrient );
191 :
192 : virtual short Execute() SAL_OVERRIDE;
193 :
194 : /**
195 : * @return String internal name of the selected field. Note that this may
196 : * be different from the name displayed in the dialog if the field
197 : * has a layout name.
198 : */
199 : OUString GetDimensionName() const;
200 :
201 : private:
202 : DECL_LINK( DblClickHdl, ListBox* );
203 :
204 : private:
205 : FixedText maFtDims;
206 : ListBox maLbDims;
207 : OKButton maBtnOk;
208 : CancelButton maBtnCancel;
209 : HelpButton maBtnHelp;
210 :
211 : typedef ::boost::unordered_map<OUString, long, OUStringHash> DimNameIndexMap;
212 : DimNameIndexMap maNameIndexMap;
213 : ScDPObject& mrDPObj;
214 : };
215 :
216 : #endif
217 :
218 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|