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