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