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