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 INCLUDED_CUI_SOURCE_OPTIONS_OPTJAVA_HXX
20 : #define INCLUDED_CUI_SOURCE_OPTIONS_OPTJAVA_HXX
21 :
22 : #include <config_features.h>
23 :
24 : #include <vector>
25 : #include <ucbhelper/content.hxx>
26 : #include <vcl/button.hxx>
27 : #include <vcl/fixed.hxx>
28 : #include <vcl/lstbox.hxx>
29 : #include <vcl/timer.hxx>
30 : #include <vcl/idle.hxx>
31 : #include <sfx2/tabdlg.hxx>
32 : #include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
33 : #include <svtools/dialogclosedlistener.hxx>
34 : #include <svtools/simptabl.hxx>
35 : #include "radiobtnbox.hxx"
36 :
37 : // forward ---------------------------------------------------------------
38 :
39 : #if HAVE_FEATURE_JAVA
40 : typedef struct _JavaInfo JavaInfo;
41 : #else
42 : typedef void* JavaInfo;
43 : #endif
44 :
45 : class SvxJavaParameterDlg;
46 : class SvxJavaClassPathDlg;
47 : class SvxJavaListBox;
48 :
49 : // class SvxJavaOptionsPage ----------------------------------------------
50 :
51 : class SvxJavaOptionsPage : public SfxTabPage
52 : {
53 : private:
54 : VclPtr<CheckBox> m_pJavaEnableCB;
55 : VclPtr<VclContainer> m_pJavaBox;
56 : VclPtr<SvxJavaListBox> m_pJavaList;
57 : VclPtr<FixedText> m_pJavaPathText;
58 : VclPtr<PushButton> m_pAddBtn;
59 : VclPtr<PushButton> m_pParameterBtn;
60 : VclPtr<PushButton> m_pClassPathBtn;
61 : VclPtr<PushButton> m_pExpertConfigBtn;
62 :
63 : VclPtr<SvxJavaParameterDlg> m_pParamDlg;
64 : VclPtr<SvxJavaClassPathDlg> m_pPathDlg;
65 :
66 : #if HAVE_FEATURE_JAVA
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 : #endif
73 : OUString m_sInstallText;
74 : OUString m_sAccessibilityText;
75 : OUString m_sAddDialogText;
76 : Idle m_aResetIdle;
77 :
78 : VclPtr<CheckBox> m_pExperimentalCB;
79 : VclPtr<CheckBox> m_pMacroCB;
80 :
81 : ::std::vector< JavaInfo* >
82 : m_aAddedInfos;
83 :
84 : ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener;
85 : ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker2 > xFolderPicker;
86 :
87 : DECL_LINK(EnableHdl_Impl, void *);
88 : DECL_LINK( CheckHdl_Impl, SvSimpleTable * );
89 : DECL_LINK(SelectHdl_Impl, void *);
90 : DECL_LINK(AddHdl_Impl, void *);
91 : DECL_LINK(ParameterHdl_Impl, void *);
92 : DECL_LINK(ClassPathHdl_Impl, void *);
93 : DECL_LINK_TYPED(ResetHdl_Impl, Idle *, void);
94 :
95 : DECL_LINK( StartFolderPickerHdl, void * );
96 : DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* );
97 :
98 : DECL_LINK(ExpertConfigHdl_Impl, void *);
99 :
100 : void ClearJavaInfo();
101 : void ClearJavaList();
102 : void LoadJREs();
103 : void AddJRE( JavaInfo* _pInfo );
104 : void HandleCheckEntry( SvTreeListEntry* _pEntry );
105 : void AddFolder( const OUString& _rFolder );
106 :
107 : public:
108 : SvxJavaOptionsPage( vcl::Window* pParent, const SfxItemSet& rSet );
109 : virtual ~SvxJavaOptionsPage();
110 : virtual void dispose() SAL_OVERRIDE;
111 :
112 : static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
113 :
114 : virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
115 : virtual void Reset( const SfxItemSet* rSet ) SAL_OVERRIDE;
116 : virtual void FillUserData() SAL_OVERRIDE;
117 : };
118 :
119 : // class SvxJavaParameterDlg ---------------------------------------------
120 :
121 : class SvxJavaParameterDlg : public ModalDialog
122 : {
123 : private:
124 : VclPtr<Edit> m_pParameterEdit;
125 : VclPtr<PushButton> m_pAssignBtn;
126 :
127 : VclPtr<ListBox> m_pAssignedList;
128 : VclPtr<PushButton> m_pRemoveBtn;
129 :
130 : DECL_LINK(ModifyHdl_Impl, void *);
131 : DECL_LINK(AssignHdl_Impl, void *);
132 : DECL_LINK(SelectHdl_Impl, void *);
133 : DECL_LINK(DblClickHdl_Impl, void *);
134 : DECL_LINK(RemoveHdl_Impl, void *);
135 :
136 0 : inline void EnableRemoveButton()
137 0 : { m_pRemoveBtn->Enable(
138 0 : m_pAssignedList->GetSelectEntryPos()
139 0 : != LISTBOX_ENTRY_NOTFOUND ); }
140 :
141 :
142 : public:
143 : SvxJavaParameterDlg( vcl::Window* pParent );
144 : virtual ~SvxJavaParameterDlg();
145 : virtual void dispose() SAL_OVERRIDE;
146 :
147 : virtual short Execute() SAL_OVERRIDE;
148 :
149 : ::com::sun::star::uno::Sequence< OUString > GetParameters() const;
150 : void SetParameters( ::com::sun::star::uno::Sequence< OUString >& rParams );
151 : };
152 :
153 : // class SvxJavaClassPathDlg ---------------------------------------------
154 :
155 : class SvxJavaClassPathDlg : public ModalDialog
156 : {
157 : private:
158 : VclPtr<ListBox> m_pPathList;
159 : VclPtr<PushButton> m_pAddArchiveBtn;
160 : VclPtr<PushButton> m_pAddPathBtn;
161 : VclPtr<PushButton> m_pRemoveBtn;
162 :
163 : OUString m_sOldPath;
164 :
165 : DECL_LINK(AddArchiveHdl_Impl, void *);
166 : DECL_LINK(AddPathHdl_Impl, void *);
167 : DECL_LINK(RemoveHdl_Impl, void *);
168 : DECL_LINK(SelectHdl_Impl, void *);
169 :
170 : bool IsPathDuplicate( const OUString& _rPath );
171 0 : inline void EnableRemoveButton()
172 0 : { m_pRemoveBtn->Enable(
173 0 : m_pPathList->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ); }
174 :
175 : public:
176 : SvxJavaClassPathDlg( vcl::Window* pParent );
177 : virtual ~SvxJavaClassPathDlg();
178 : virtual void dispose() SAL_OVERRIDE;
179 :
180 0 : inline const OUString& GetOldPath() const { return m_sOldPath; }
181 0 : inline void SetFocus() { m_pPathList->GrabFocus(); }
182 :
183 : OUString GetClassPath() const;
184 : void SetClassPath( const OUString& _rPath );
185 : };
186 :
187 : #endif // INCLUDED_CUI_SOURCE_OPTIONS_OPTJAVA_HXX
188 :
189 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|