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