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 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_scui.hxx" 26 27 28 //------------------------------------------------------------------------ 29 30 #include "textimportoptions.hxx" 31 #include "textimportoptions.hrc" 32 33 #include "scresid.hxx" 34 #include "vcl/window.hxx" 35 #include "vcl/msgbox.hxx" 36 #include "vcl/svapp.hxx" 37 38 ScTextImportOptionsDlg::ScTextImportOptionsDlg(Window* pParent) : 39 ModalDialog(pParent, ScResId(RID_SCDLG_TEXT_IMPORT_OPTIONS)), 40 41 maBtnOk(this, ScResId(BTN_OK)), 42 maBtnCancel(this, ScResId(BTN_CANCEL)), 43 maBtnHelp(this, ScResId(BTN_HELP)), 44 maFlChooseLang(this, ScResId(FL_CHOOSE_LANG)), 45 maRbAutomatic(this, ScResId(RB_AUTOMATIC)), 46 maRbCustom(this, ScResId(RB_CUSTOM)), 47 maLbCustomLang(this, ScResId(LB_CUSTOM_LANG)), 48 maFlOption(this, ScResId(FL_OPTION)), 49 maBtnConvertDate(this, ScResId(BTN_CONVERT_DATE)) 50 { 51 FreeResource(); 52 init(); 53 } 54 55 ScTextImportOptionsDlg::~ScTextImportOptionsDlg() 56 { 57 } 58 59 short ScTextImportOptionsDlg::Execute() 60 { 61 return ModalDialog::Execute(); 62 } 63 64 LanguageType ScTextImportOptionsDlg::getLanguageType() const 65 { 66 if (maRbAutomatic.IsChecked()) 67 return LANGUAGE_SYSTEM; 68 69 return maLbCustomLang.GetSelectLanguage(); 70 } 71 72 bool ScTextImportOptionsDlg::isDateConversionSet() const 73 { 74 return maBtnConvertDate.IsChecked(); 75 } 76 77 void ScTextImportOptionsDlg::init() 78 { 79 Link aLink = LINK( this, ScTextImportOptionsDlg, OKHdl ); 80 maBtnOk.SetClickHdl(aLink); 81 aLink = LINK( this, ScTextImportOptionsDlg, RadioHdl ); 82 maRbAutomatic.SetClickHdl(aLink); 83 maRbCustom.SetClickHdl(aLink); 84 85 maRbAutomatic.Check(true); 86 87 maLbCustomLang.SetLanguageList( 88 LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, false, false); 89 90 LanguageType eLang = Application::GetSettings().GetLanguage(); 91 maLbCustomLang.SelectLanguage(eLang); 92 maLbCustomLang.Disable(); 93 } 94 95 IMPL_LINK( ScTextImportOptionsDlg, OKHdl, OKButton*, EMPTYARG ) 96 { 97 EndDialog(RET_OK); 98 return 0; 99 } 100 101 IMPL_LINK( ScTextImportOptionsDlg, RadioHdl, RadioButton*, pBtn ) 102 { 103 if (pBtn == &maRbAutomatic) 104 { 105 maLbCustomLang.Disable(); 106 } 107 else if (pBtn == &maRbCustom) 108 { 109 maLbCustomLang.Enable(); 110 } 111 return 0; 112 } 113