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 : #ifndef _SVX_OPTJAVA_HXX
20 : #define _SVX_OPTJAVA_HXX
21 :
22 : #include <vector>
23 : #include <ucbhelper/content.hxx>
24 : #include <vcl/button.hxx>
25 : #include <vcl/fixed.hxx>
26 : #include <vcl/timer.hxx>
27 : #include <sfx2/tabdlg.hxx>
28 : #include <svx/simptabl.hxx>
29 : #include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
30 : #include <svtools/dialogclosedlistener.hxx>
31 : #include "radiobtnbox.hxx"
32 :
33 : // forward ---------------------------------------------------------------
34 :
35 : typedef struct _JavaInfo JavaInfo;
36 :
37 : class SvxJavaParameterDlg;
38 : class SvxJavaClassPathDlg;
39 :
40 : // class SvxJavaOptionsPage ----------------------------------------------
41 :
42 : class SvxJavaOptionsPage : public SfxTabPage
43 : {
44 : private:
45 : FixedLine m_aJavaLine;
46 : CheckBox m_aJavaEnableCB;
47 : FixedText m_aJavaFoundLabel;
48 : SvxSimpleTableContainer m_aJavaListContainer;
49 : svx::SvxRadioButtonListBox m_aJavaList;
50 : FixedText m_aJavaPathText;
51 : PushButton m_aAddBtn;
52 : PushButton m_aParameterBtn;
53 : PushButton m_aClassPathBtn;
54 :
55 : SvxJavaParameterDlg* m_pParamDlg;
56 : SvxJavaClassPathDlg* m_pPathDlg;
57 :
58 : JavaInfo** m_parJavaInfo;
59 : rtl_uString** m_parParameters;
60 : rtl_uString* m_pClassPath;
61 : sal_Int32 m_nInfoSize;
62 : sal_Int32 m_nParamSize;
63 : String m_sInstallText;
64 : String m_sAccessibilityText;
65 : String m_sAddDialogText;
66 : Timer m_aResetTimer;
67 :
68 : FixedLine m_aExperimental;
69 : CheckBox m_aExperimentalCB;
70 : CheckBox m_aMacroCB;
71 :
72 : ::std::vector< JavaInfo* >
73 : m_aAddedInfos;
74 :
75 : ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener;
76 : ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker2 > xFolderPicker;
77 :
78 : DECL_LINK(EnableHdl_Impl, void *);
79 : DECL_LINK( CheckHdl_Impl, SvxSimpleTable * );
80 : DECL_LINK(SelectHdl_Impl, void *);
81 : DECL_LINK(AddHdl_Impl, void *);
82 : DECL_LINK(ParameterHdl_Impl, void *);
83 : DECL_LINK(ClassPathHdl_Impl, void *);
84 : DECL_LINK(ResetHdl_Impl, void *);
85 :
86 : DECL_LINK( StartFolderPickerHdl, void * );
87 : DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* );
88 :
89 : void ClearJavaInfo();
90 : void ClearJavaList();
91 : void LoadJREs();
92 : void AddJRE( JavaInfo* _pInfo );
93 : void HandleCheckEntry( SvTreeListEntry* _pEntry );
94 : void AddFolder( const ::rtl::OUString& _rFolder );
95 :
96 : public:
97 : SvxJavaOptionsPage( Window* pParent, const SfxItemSet& rSet );
98 : ~SvxJavaOptionsPage();
99 :
100 : static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
101 :
102 : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
103 : virtual void Reset( const SfxItemSet& rSet );
104 : virtual void FillUserData();
105 : };
106 :
107 : // class SvxJavaParameterDlg ---------------------------------------------
108 :
109 : class SvxJavaParameterDlg : public ModalDialog
110 : {
111 : private:
112 : FixedText m_aParameterLabel;
113 : Edit m_aParameterEdit;
114 : PushButton m_aAssignBtn;
115 :
116 : FixedText m_aAssignedLabel;
117 : ListBox m_aAssignedList;
118 : FixedText m_aExampleText;
119 : PushButton m_aRemoveBtn;
120 :
121 : FixedLine m_aButtonsLine;
122 : OKButton m_aOKBtn;
123 : CancelButton m_aCancelBtn;
124 : HelpButton m_aHelpBtn;
125 :
126 : DECL_LINK(ModifyHdl_Impl, void *);
127 : DECL_LINK(AssignHdl_Impl, void *);
128 : DECL_LINK(SelectHdl_Impl, void *);
129 : DECL_LINK(DblClickHdl_Impl, void *);
130 : DECL_LINK(RemoveHdl_Impl, void *);
131 :
132 0 : inline void EnableRemoveButton()
133 : { m_aRemoveBtn.Enable(
134 0 : m_aAssignedList.GetSelectEntryPos()
135 0 : != LISTBOX_ENTRY_NOTFOUND ); }
136 :
137 :
138 : public:
139 : SvxJavaParameterDlg( Window* pParent );
140 : ~SvxJavaParameterDlg();
141 :
142 : virtual short Execute();
143 :
144 : ::com::sun::star::uno::Sequence< ::rtl::OUString > GetParameters() const;
145 : void SetParameters( ::com::sun::star::uno::Sequence< ::rtl::OUString >& rParams );
146 : };
147 :
148 : // class SvxJavaClassPathDlg ---------------------------------------------
149 :
150 : class SvxJavaClassPathDlg : public ModalDialog
151 : {
152 : private:
153 : FixedText m_aPathLabel;
154 : ListBox m_aPathList;
155 : PushButton m_aAddArchiveBtn;
156 : PushButton m_aAddPathBtn;
157 : PushButton m_aRemoveBtn;
158 :
159 : FixedLine m_aButtonsLine;
160 : OKButton m_aOKBtn;
161 : CancelButton m_aCancelBtn;
162 : HelpButton m_aHelpBtn;
163 :
164 : String m_sOldPath;
165 :
166 : DECL_LINK(AddArchiveHdl_Impl, void *);
167 : DECL_LINK(AddPathHdl_Impl, void *);
168 : DECL_LINK(RemoveHdl_Impl, void *);
169 : DECL_LINK(SelectHdl_Impl, void *);
170 :
171 : bool IsPathDuplicate( const String& _rPath );
172 0 : inline void EnableRemoveButton()
173 : { m_aRemoveBtn.Enable(
174 0 : m_aPathList.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ); }
175 :
176 : public:
177 : SvxJavaClassPathDlg( Window* pParent );
178 : ~SvxJavaClassPathDlg();
179 :
180 0 : inline const String& GetOldPath() const { return m_sOldPath; }
181 0 : inline void SetFocus() { m_aPathList.GrabFocus(); }
182 :
183 : String GetClassPath() const;
184 : void SetClassPath( const String& _rPath );
185 : };
186 :
187 : #endif // #ifndef _SVX_OPTJAVA_HXX
188 :
189 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|