Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2008 by Sun Microsystems, Inc.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #undef SC_DLLIMPLEMENTATION
31 : :
32 : : //------------------------------------------------------------------------
33 : :
34 : : #include "textimportoptions.hxx"
35 : : #include "textimportoptions.hrc"
36 : :
37 : : #include "scresid.hxx"
38 : : #include "vcl/window.hxx"
39 : : #include "vcl/msgbox.hxx"
40 : : #include "vcl/svapp.hxx"
41 : :
42 : 0 : ScTextImportOptionsDlg::ScTextImportOptionsDlg(Window* pParent) :
43 : : ModalDialog(pParent, ScResId(RID_SCDLG_TEXT_IMPORT_OPTIONS)),
44 : :
45 : : maBtnOk(this, ScResId(BTN_OK)),
46 : : maBtnCancel(this, ScResId(BTN_CANCEL)),
47 : : maBtnHelp(this, ScResId(BTN_HELP)),
48 : : maFlChooseLang(this, ScResId(FL_CHOOSE_LANG)),
49 : : maRbAutomatic(this, ScResId(RB_AUTOMATIC)),
50 : : maRbCustom(this, ScResId(RB_CUSTOM)),
51 : : maLbCustomLang(this, ScResId(LB_CUSTOM_LANG)),
52 : : maFlOption(this, ScResId(FL_OPTION)),
53 : 0 : maBtnConvertDate(this, ScResId(BTN_CONVERT_DATE))
54 : : {
55 : 0 : FreeResource();
56 : 0 : init();
57 : 0 : }
58 : :
59 : 0 : ScTextImportOptionsDlg::~ScTextImportOptionsDlg()
60 : : {
61 : 0 : }
62 : :
63 : 0 : short ScTextImportOptionsDlg::Execute()
64 : : {
65 : 0 : return ModalDialog::Execute();
66 : : }
67 : :
68 : 0 : LanguageType ScTextImportOptionsDlg::getLanguageType() const
69 : : {
70 : 0 : if (maRbAutomatic.IsChecked())
71 : 0 : return LANGUAGE_SYSTEM;
72 : :
73 : 0 : return maLbCustomLang.GetSelectLanguage();
74 : : }
75 : :
76 : 0 : bool ScTextImportOptionsDlg::isDateConversionSet() const
77 : : {
78 : 0 : return maBtnConvertDate.IsChecked();
79 : : }
80 : :
81 : 0 : void ScTextImportOptionsDlg::init()
82 : : {
83 : 0 : Link aLink = LINK( this, ScTextImportOptionsDlg, OKHdl );
84 : 0 : maBtnOk.SetClickHdl(aLink);
85 : 0 : aLink = LINK( this, ScTextImportOptionsDlg, RadioHdl );
86 : 0 : maRbAutomatic.SetClickHdl(aLink);
87 : 0 : maRbCustom.SetClickHdl(aLink);
88 : :
89 : 0 : maRbAutomatic.Check(true);
90 : :
91 : : maLbCustomLang.SetLanguageList(
92 : 0 : LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, false, false);
93 : :
94 : 0 : LanguageType eLang = Application::GetSettings().GetLanguage();
95 : 0 : maLbCustomLang.SelectLanguage(eLang);
96 : 0 : maLbCustomLang.Disable();
97 : 0 : }
98 : :
99 : 0 : IMPL_LINK_NOARG(ScTextImportOptionsDlg, OKHdl)
100 : : {
101 : 0 : EndDialog(RET_OK);
102 : 0 : return 0;
103 : : }
104 : :
105 : 0 : IMPL_LINK( ScTextImportOptionsDlg, RadioHdl, RadioButton*, pBtn )
106 : : {
107 : 0 : if (pBtn == &maRbAutomatic)
108 : : {
109 : 0 : maLbCustomLang.Disable();
110 : : }
111 : 0 : else if (pBtn == &maRbCustom)
112 : : {
113 : 0 : maLbCustomLang.Enable();
114 : : }
115 : 0 : return 0;
116 : : }
117 : :
118 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|