Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / cui / source / options / optjava.hxx
blobe5537f1e1ff77e290efbe37c8beba944f4dc424e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_CUI_SOURCE_OPTIONS_OPTJAVA_HXX
20 #define INCLUDED_CUI_SOURCE_OPTIONS_OPTJAVA_HXX
22 #include <config_java.h>
24 #include <memory>
25 #include <vector>
26 #include <vcl/timer.hxx>
27 #include <vcl/idle.hxx>
28 #include <vcl/weld.hxx>
29 #include <sfx2/tabdlg.hxx>
30 #include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
31 #include <svtools/dialogclosedlistener.hxx>
32 #include <svtools/restartdialog.hxx>
34 // forward ---------------------------------------------------------------
36 #if HAVE_FEATURE_JAVA
37 struct JavaInfo;
38 #else
39 typedef void* JavaInfo;
40 #endif
42 class SvxJavaParameterDlg;
43 class SvxJavaClassPathDlg;
44 class SvxJavaListBox;
45 class OfaTreeOptionsDialog;
47 // class SvxJavaOptionsPage ----------------------------------------------
49 class SvxJavaOptionsPage : public SfxTabPage
51 private:
52 #if HAVE_FEATURE_JAVA
53 std::vector<std::unique_ptr<JavaInfo>> m_parJavaInfo;
54 std::vector<OUString> m_parParameters;
55 OUString m_pClassPath;
56 #endif
57 OUString m_sInstallText;
58 OUString m_sAccessibilityText;
59 OUString m_sAddDialogText;
60 Idle m_aResetIdle;
62 std::vector<std::unique_ptr<JavaInfo>> m_aAddedInfos;
64 rtl::Reference< ::svt::DialogClosedListener > xDialogListener;
65 css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker;
67 std::unique_ptr<weld::CheckButton> m_xJavaEnableCB;
68 std::unique_ptr<weld::TreeView> m_xJavaList;
69 std::unique_ptr<weld::Label> m_xJavaPathText;
70 std::unique_ptr<weld::Button> m_xAddBtn;
71 std::unique_ptr<weld::Button> m_xParameterBtn;
72 std::unique_ptr<weld::Button> m_xClassPathBtn;
73 std::unique_ptr<weld::Button> m_xExpertConfigBtn;
75 std::unique_ptr<SvxJavaParameterDlg> m_xParamDlg;
76 std::unique_ptr<SvxJavaClassPathDlg> m_xPathDlg;
78 std::unique_ptr<weld::CheckButton> m_xExperimentalCB;
79 std::unique_ptr<weld::CheckButton> m_xMacroCB;
81 std::unique_ptr<weld::Label> m_xAccessibilityText;
82 std::unique_ptr<weld::Label> m_xAddDialogText;
84 std::unique_ptr<weld::Widget> m_xJavaFrame;
86 DECL_LINK(EnableHdl_Impl, weld::Button&, void);
87 typedef std::pair<int, int> row_col;
88 DECL_LINK(CheckHdl_Impl, const row_col&, void);
89 DECL_LINK(SelectHdl_Impl, weld::TreeView&, void);
90 DECL_LINK(AddHdl_Impl, weld::Button&, void);
91 DECL_LINK(ParameterHdl_Impl, weld::Button&, void);
92 DECL_LINK(ClassPathHdl_Impl, weld::Button&, void);
93 DECL_LINK(ResetHdl_Impl, Timer *, void);
95 DECL_LINK(StartFolderPickerHdl, void *, void);
96 DECL_LINK(DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, void);
98 DECL_LINK(ExpertConfigHdl_Impl, weld::Button&, void);
100 void ClearJavaInfo();
101 void ClearJavaList();
102 void LoadJREs();
103 void AddJRE( JavaInfo const * _pInfo );
104 void HandleCheckEntry(int nCheckedRow);
105 void AddFolder( const OUString& _rFolder );
106 void RequestRestart( svtools::RestartReason eReason );
108 public:
109 SvxJavaOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
110 virtual ~SvxJavaOptionsPage() override;
112 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
114 virtual bool FillItemSet( SfxItemSet* rSet ) override;
115 virtual void Reset( const SfxItemSet* rSet ) override;
116 virtual void FillUserData() override;
119 // class SvxJavaParameterDlg ---------------------------------------------
121 class SvxJavaParameterDlg : public weld::GenericDialogController
123 private:
124 std::unique_ptr<weld::Entry> m_xParameterEdit;
125 std::unique_ptr<weld::Button> m_xAssignBtn;
126 std::unique_ptr<weld::TreeView> m_xAssignedList;
127 std::unique_ptr<weld::Button> m_xRemoveBtn;
128 std::unique_ptr<weld::Button> m_xEditBtn;
130 DECL_LINK(ModifyHdl_Impl, weld::Entry&, void);
131 DECL_LINK(AssignHdl_Impl, weld::Button&, void);
132 DECL_LINK(SelectHdl_Impl, weld::TreeView&, void);
133 DECL_LINK(DblClickHdl_Impl, weld::TreeView&, bool);
134 DECL_LINK(RemoveHdl_Impl, weld::Button&, void);
135 DECL_LINK(EditHdl_Impl, weld::Button&, void);
137 void EnableRemoveButton()
139 m_xRemoveBtn->set_sensitive(m_xAssignedList->get_selected_index() != -1);
142 void EnableEditButton()
144 m_xEditBtn->set_sensitive(m_xAssignedList->get_selected_index() != -1);
147 void DisableAssignButton()
149 m_xAssignBtn->set_sensitive(false);
152 void DisableRemoveButton()
154 m_xRemoveBtn->set_sensitive(false);
157 void DisableEditButton()
159 m_xEditBtn->set_sensitive(false);
162 public:
163 explicit SvxJavaParameterDlg(weld::Window* pParent);
164 virtual ~SvxJavaParameterDlg() override;
166 virtual short run() override;
168 std::vector< OUString > GetParameters() const;
169 void SetParameters( std::vector< OUString > const & rParams );
170 void DisableButtons();
171 void EditParameter();
174 // class SvxJavaClassPathDlg ---------------------------------------------
176 class SvxJavaClassPathDlg : public weld::GenericDialogController
178 private:
179 std::unique_ptr<weld::TreeView> m_xPathList;
180 std::unique_ptr<weld::Button> m_xAddArchiveBtn;
181 std::unique_ptr<weld::Button> m_xAddPathBtn;
182 std::unique_ptr<weld::Button> m_xRemoveBtn;
184 OUString m_sOldPath;
186 DECL_LINK(AddArchiveHdl_Impl, weld::Button&, void);
187 DECL_LINK(AddPathHdl_Impl, weld::Button&, void);
188 DECL_LINK(RemoveHdl_Impl, weld::Button&, void);
189 DECL_LINK(SelectHdl_Impl, weld::TreeView&, void);
191 bool IsPathDuplicate(const OUString& _rPath);
192 void EnableRemoveButton()
194 m_xRemoveBtn->set_sensitive(m_xPathList->get_selected_index() != -1);
197 public:
198 explicit SvxJavaClassPathDlg(weld::Window* pParent);
199 virtual ~SvxJavaClassPathDlg() override;
201 const OUString& GetOldPath() const { return m_sOldPath; }
202 void SetFocus() { m_xPathList->grab_focus(); }
204 OUString GetClassPath() const;
205 void SetClassPath( const OUString& _rPath );
208 #endif // INCLUDED_CUI_SOURCE_OPTIONS_OPTJAVA_HXX
210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */