xref: /AOO41X/main/cui/source/options/optjava.hxx (revision c4eee24dc018e70cce741d2c2ecfc43b06c69c41)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SVX_OPTJAVA_HXX
24 #define _SVX_OPTJAVA_HXX
25 
26 // include ---------------------------------------------------------------
27 
28 #include <vector>
29 #include <ucbhelper/content.hxx>
30 #include <vcl/button.hxx>
31 #include <vcl/fixed.hxx>
32 #include <vcl/timer.hxx>
33 #include <sfx2/tabdlg.hxx>
34 #include <svx/simptabl.hxx>
35 #include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
36 #include <svtools/dialogclosedlistener.hxx>
37 #include "radiobtnbox.hxx"
38 
39 // forward ---------------------------------------------------------------
40 
41 typedef struct _JavaInfo JavaInfo;
42 
43 class   SvxJavaParameterDlg;
44 class   SvxJavaClassPathDlg;
45 
46 // class SvxJavaOptionsPage ----------------------------------------------
47 
48 class SvxJavaOptionsPage : public SfxTabPage
49 {
50 private:
51     FixedLine                   m_aJavaLine;
52     CheckBox                    m_aJavaEnableCB;
53     FixedText                   m_aJavaFoundLabel;
54     svx::SvxRadioButtonListBox  m_aJavaList;
55     FixedText                   m_aJavaPathText;
56     PushButton                  m_aAddBtn;
57     PushButton                  m_aParameterBtn;
58     PushButton                  m_aClassPathBtn;
59 
60     SvxJavaParameterDlg*    m_pParamDlg;
61     SvxJavaClassPathDlg*    m_pPathDlg;
62 
63     JavaInfo**              m_parJavaInfo;
64     rtl_uString**           m_parParameters;
65     rtl_uString*            m_pClassPath;
66     sal_Int32               m_nInfoSize;
67     sal_Int32               m_nParamSize;
68     String                  m_sInstallText;
69     String                  m_sAccessibilityText;
70     String                  m_sAddDialogText;
71     Timer                   m_aResetTimer;
72 
73     ::std::vector< JavaInfo* >
74                             m_aAddedInfos;
75 
76     ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener;
77     ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker > xFolderPicker;
78 
79     DECL_LINK(              EnableHdl_Impl, CheckBox * );
80     DECL_LINK(              CheckHdl_Impl, SvxSimpleTable * );
81     DECL_LINK(              SelectHdl_Impl, SvxSimpleTable * );
82     DECL_LINK(              AddHdl_Impl, PushButton * );
83     DECL_LINK(              ParameterHdl_Impl, PushButton * );
84     DECL_LINK(              ClassPathHdl_Impl, PushButton * );
85     DECL_LINK(              ResetHdl_Impl, Timer * );
86 
87     DECL_LINK(              StartFolderPickerHdl, void * );
88     DECL_LINK(              DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* );
89 
90     void                    ClearJavaInfo();
91     void                    ClearJavaList();
92     void                    LoadJREs();
93     void                    AddJRE( JavaInfo* _pInfo );
94     void                    HandleCheckEntry( SvLBoxEntry* _pEntry );
95     void                    AddFolder( const ::rtl::OUString& _rFolder );
96 
97 public:
98     SvxJavaOptionsPage( Window* pParent, const SfxItemSet& rSet );
99     ~SvxJavaOptionsPage();
100 
101     static SfxTabPage*      Create( Window* pParent, const SfxItemSet& rSet );
102 
103     virtual sal_Bool            FillItemSet( SfxItemSet& rSet );
104     virtual void            Reset( const SfxItemSet& rSet );
105     virtual void            FillUserData();
106 };
107 
108 // class SvxJavaParameterDlg ---------------------------------------------
109 
110 class SvxJavaParameterDlg : public ModalDialog
111 {
112 private:
113     FixedText               m_aParameterLabel;
114     Edit                    m_aParameterEdit;
115     PushButton              m_aAssignBtn;
116 
117     FixedText               m_aAssignedLabel;
118     ListBox                 m_aAssignedList;
119     FixedText               m_aExampleText;
120     PushButton              m_aRemoveBtn;
121 
122     FixedLine               m_aButtonsLine;
123     OKButton                m_aOKBtn;
124     CancelButton            m_aCancelBtn;
125     HelpButton              m_aHelpBtn;
126 
127     DECL_LINK(              ModifyHdl_Impl, Edit * );
128     DECL_LINK(              AssignHdl_Impl, PushButton * );
129     DECL_LINK(              SelectHdl_Impl, ListBox * );
130     DECL_LINK(              DblClickHdl_Impl, ListBox * );
131     DECL_LINK(              RemoveHdl_Impl, PushButton * );
132 
EnableRemoveButton()133     inline void             EnableRemoveButton()
134                                 { m_aRemoveBtn.Enable(
135                                     m_aAssignedList.GetSelectEntryPos()
136                                     != LISTBOX_ENTRY_NOTFOUND ); }
137 
138 
139 public:
140     SvxJavaParameterDlg( Window* pParent );
141     ~SvxJavaParameterDlg();
142 
143     virtual short           Execute();
144 
145     ::com::sun::star::uno::Sequence< ::rtl::OUString > GetParameters() const;
146     void SetParameters( ::com::sun::star::uno::Sequence< ::rtl::OUString >& rParams );
147 };
148 
149 // class SvxJavaClassPathDlg ---------------------------------------------
150 
151 class SvxJavaClassPathDlg : public ModalDialog
152 {
153 private:
154     FixedText               m_aPathLabel;
155     ListBox                 m_aPathList;
156     PushButton              m_aAddArchiveBtn;
157     PushButton              m_aAddPathBtn;
158     PushButton              m_aRemoveBtn;
159 
160     FixedLine               m_aButtonsLine;
161     OKButton                m_aOKBtn;
162     CancelButton            m_aCancelBtn;
163     HelpButton              m_aHelpBtn;
164 
165     String                  m_sOldPath;
166 
167     DECL_LINK(              AddArchiveHdl_Impl, PushButton * );
168     DECL_LINK(              AddPathHdl_Impl, PushButton * );
169     DECL_LINK(              RemoveHdl_Impl, PushButton * );
170     DECL_LINK(              SelectHdl_Impl, ListBox * );
171 
172     bool                    IsPathDuplicate( const String& _rPath );
EnableRemoveButton()173     inline void             EnableRemoveButton()
174                                 { m_aRemoveBtn.Enable(
175                                     m_aPathList.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ); }
176 
177 public:
178     SvxJavaClassPathDlg( Window* pParent );
179     ~SvxJavaClassPathDlg();
180 
GetOldPath() const181     inline const String&    GetOldPath() const { return m_sOldPath; }
SetFocus()182     inline void             SetFocus() { m_aPathList.GrabFocus(); }
183 
184     String                  GetClassPath() const;
185     void                    SetClassPath( const String& _rPath );
186 };
187 
188 #endif // #ifndef _SVX_OPTJAVA_HXX
189 
190