1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef SC_PVFUNDLG_HXX 25 #define SC_PVFUNDLG_HXX 26 27 #include <com/sun/star/sheet/DataPilotFieldReference.hpp> 28 #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp> 29 30 #include <vcl/fixed.hxx> 31 #include <vcl/lstbox.hxx> 32 #include <vcl/dialog.hxx> 33 #include <vcl/button.hxx> 34 #include <vcl/morebtn.hxx> 35 #include <vcl/field.hxx> 36 #include <svtools/stdctrl.hxx> 37 #include <svx/checklbx.hxx> 38 #include <sfx2/itemconnect.hxx> 39 #include "pivot.hxx" 40 41 #include <hash_map> 42 43 // ============================================================================ 44 45 typedef sfx::ListBoxWrapper< sal_Int32 > ScDPListBoxWrapper; 46 47 class ScDPObject; 48 49 // ============================================================================ 50 51 class ScDPFunctionListBox : public MultiListBox 52 { 53 public: 54 explicit ScDPFunctionListBox( Window* pParent, const ResId& rResId ); 55 56 void SetSelection( sal_uInt16 nFuncMask ); 57 sal_uInt16 GetSelection() const; 58 59 private: 60 void FillFunctionNames(); 61 }; 62 63 // ============================================================================ 64 65 class ScDPFunctionDlg : public ModalDialog 66 { 67 public: 68 explicit ScDPFunctionDlg( Window* pParent, const ScDPLabelDataVector& rLabelVec, 69 const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ); 70 71 sal_uInt16 GetFuncMask() const; 72 ::com::sun::star::sheet::DataPilotFieldReference GetFieldRef() const; 73 74 private: 75 void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ); 76 77 DECL_LINK( SelectHdl, ListBox* ); 78 DECL_LINK( DblClickHdl, MultiListBox* ); 79 80 private: 81 FixedLine maFlFunc; 82 ScDPFunctionListBox maLbFunc; 83 FixedText maFtNameLabel; 84 FixedInfo maFtName; 85 FixedLine maFlDisplay; 86 FixedText maFtType; 87 ListBox maLbType; 88 FixedText maFtBaseField; 89 ListBox maLbBaseField; 90 FixedText maFtBaseItem; 91 ListBox maLbBaseItem; 92 OKButton maBtnOk; 93 CancelButton maBtnCancel; 94 HelpButton maBtnHelp; 95 MoreButton maBtnMore; 96 97 ScDPListBoxWrapper maLbTypeWrp; /// Wrapper for direct usage of API constants. 98 99 const ScDPLabelDataVector& mrLabelVec; /// Data of all labels. 100 bool mbEmptyItem; /// true = Empty base item in listbox. 101 }; 102 103 // ============================================================================ 104 105 class ScDPSubtotalDlg : public ModalDialog 106 { 107 public: 108 explicit ScDPSubtotalDlg( Window* pParent, ScDPObject& rDPObj, 109 const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData, 110 const ScDPNameVec& rDataFields, bool bEnableLayout ); 111 112 sal_uInt16 GetFuncMask() const; 113 114 void FillLabelData( ScDPLabelData& rLabelData ) const; 115 116 private: 117 void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ); 118 119 DECL_LINK( DblClickHdl, MultiListBox* ); 120 DECL_LINK( RadioClickHdl, RadioButton* ); 121 DECL_LINK( ClickHdl, PushButton* ); 122 123 private: 124 FixedLine maFlSubt; 125 RadioButton maRbNone; 126 RadioButton maRbAuto; 127 RadioButton maRbUser; 128 ScDPFunctionListBox maLbFunc; 129 FixedText maFtNameLabel; 130 FixedInfo maFtName; 131 CheckBox maCbShowAll; 132 OKButton maBtnOk; 133 CancelButton maBtnCancel; 134 HelpButton maBtnHelp; 135 PushButton maBtnOptions; 136 137 ScDPObject& mrDPObj; /// The DataPilot object (for member names). 138 const ScDPNameVec& mrDataFields; /// The list of all data field names. 139 140 ScDPLabelData maLabelData; /// Cache for sub dialog. 141 bool mbEnableLayout; /// true = Enable Layout mode controls. 142 }; 143 144 // ============================================================================ 145 146 class ScDPSubtotalOptDlg : public ModalDialog 147 { 148 public: 149 explicit ScDPSubtotalOptDlg( Window* pParent, ScDPObject& rDPObj, 150 const ScDPLabelData& rLabelData, const ScDPNameVec& rDataFields, 151 bool bEnableLayout ); 152 153 void FillLabelData( ScDPLabelData& rLabelData ) const; 154 155 private: 156 void Init( const ScDPNameVec& rDataFields, bool bEnableLayout ); 157 void InitHideListBox(); 158 159 DECL_LINK( RadioClickHdl, RadioButton* ); 160 DECL_LINK( CheckHdl, CheckBox* ); 161 DECL_LINK( SelectHdl, ListBox* ); 162 163 private: 164 FixedLine maFlSortBy; 165 ListBox maLbSortBy; 166 RadioButton maRbSortAsc; 167 RadioButton maRbSortDesc; 168 RadioButton maRbSortMan; 169 FixedLine maFlLayout; 170 FixedText maFtLayout; 171 ListBox maLbLayout; 172 CheckBox maCbLayoutEmpty; 173 FixedLine maFlAutoShow; 174 CheckBox maCbShow; 175 NumericField maNfShow; 176 FixedText maFtShow; 177 FixedText maFtShowFrom; 178 ListBox maLbShowFrom; 179 FixedText maFtShowUsing; 180 ListBox maLbShowUsing; 181 FixedLine maFlHide; 182 SvxCheckListBox maLbHide; 183 FixedText maFtHierarchy; 184 ListBox maLbHierarchy; 185 OKButton maBtnOk; 186 CancelButton maBtnCancel; 187 HelpButton maBtnHelp; 188 189 ScDPListBoxWrapper maLbLayoutWrp; /// Wrapper for direct usage of API constants. 190 ScDPListBoxWrapper maLbShowFromWrp; /// Wrapper for direct usage of API constants. 191 192 ScDPObject& mrDPObj; /// The DataPilot object (for member names). 193 ScDPLabelData maLabelData; /// Cache for members data. 194 }; 195 196 // ============================================================================ 197 198 class ScDPShowDetailDlg : public ModalDialog 199 { 200 public: 201 explicit ScDPShowDetailDlg( Window* pParent, ScDPObject& rDPObj, sal_uInt16 nOrient ); 202 203 virtual short Execute(); 204 205 /** 206 * @return String internal name of the selected field. Note that this may 207 * be different from the name displayed in the dialog if the field 208 * has a layout name. 209 */ 210 String GetDimensionName() const; 211 212 private: 213 DECL_LINK( DblClickHdl, ListBox* ); 214 215 private: 216 FixedText maFtDims; 217 ListBox maLbDims; 218 OKButton maBtnOk; 219 CancelButton maBtnCancel; 220 HelpButton maBtnHelp; 221 222 typedef ::std::hash_map<String, long, ScStringHashCode> DimNameIndexMap; 223 DimNameIndexMap maNameIndexMap; 224 ScDPObject& mrDPObj; 225 }; 226 227 // ============================================================================ 228 229 #endif 230 231