LibreOffice Module cui (master) 1
optjava.hxx
Go to the documentation of this file.
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
20#pragma once
21
22#include <config_java.h>
23
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>
33
34// forward ---------------------------------------------------------------
35
36#if HAVE_FEATURE_JAVA
37struct JavaInfo;
38#else
39typedef void* JavaInfo;
40#endif
41
44class SvxJavaListBox;
46
47// class SvxJavaOptionsPage ----------------------------------------------
48
50{
51private:
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
60
61 std::vector<std::unique_ptr<JavaInfo>> m_aAddedInfos;
62
64 css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker;
65
66 std::unique_ptr<weld::CheckButton> m_xJavaEnableCB;
67 std::unique_ptr<weld::TreeView> m_xJavaList;
68 std::unique_ptr<weld::Label> m_xJavaPathText;
69 std::unique_ptr<weld::Button> m_xAddBtn;
70 std::unique_ptr<weld::Button> m_xParameterBtn;
71 std::unique_ptr<weld::Button> m_xClassPathBtn;
72 std::unique_ptr<weld::Button> m_xExpertConfigBtn;
73
74 std::unique_ptr<SvxJavaParameterDlg> m_xParamDlg;
75 std::unique_ptr<SvxJavaClassPathDlg> m_xPathDlg;
76
77 std::unique_ptr<weld::CheckButton> m_xExperimentalCB;
78 std::unique_ptr<weld::CheckButton> m_xMacroCB;
79
80 std::unique_ptr<weld::Label> m_xAddDialogText;
81
82 std::unique_ptr<weld::Widget> m_xJavaFrame;
83
84 DECL_LINK(EnableHdl_Impl, weld::Toggleable&, void);
85 DECL_LINK(CheckHdl_Impl, const weld::TreeView::iter_col&, void);
86 DECL_LINK(SelectHdl_Impl, weld::TreeView&, void);
87 DECL_LINK(AddHdl_Impl, weld::Button&, void);
88 DECL_LINK(ParameterHdl_Impl, weld::Button&, void);
89 DECL_LINK(ClassPathHdl_Impl, weld::Button&, void);
90 DECL_LINK(ResetHdl_Impl, Timer *, void);
91
92 DECL_LINK(StartFolderPickerHdl, void *, void);
93 DECL_LINK(DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, void);
94
95 DECL_LINK(ExpertConfigHdl_Impl, weld::Button&, void);
96
97 void ClearJavaInfo();
98 void LoadJREs();
99 void AddJRE( JavaInfo const * _pInfo );
100 void HandleCheckEntry(int nCheckedRow);
101 void UpdateJavaPathText();
102 void AddFolder( const OUString& _rFolder );
104
105public:
106 SvxJavaOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
107 virtual ~SvxJavaOptionsPage() override;
108
109 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
110
111 virtual bool FillItemSet( SfxItemSet* rSet ) override;
112 virtual void Reset( const SfxItemSet* rSet ) override;
113 virtual void FillUserData() override;
114};
115
116// class SvxJavaParameterDlg ---------------------------------------------
117
119{
120private:
121 std::unique_ptr<weld::Entry> m_xParameterEdit;
122 std::unique_ptr<weld::Button> m_xAssignBtn;
123 std::unique_ptr<weld::TreeView> m_xAssignedList;
124 std::unique_ptr<weld::Button> m_xRemoveBtn;
125 std::unique_ptr<weld::Button> m_xEditBtn;
126
127 DECL_LINK(ModifyHdl_Impl, weld::Entry&, void);
128 DECL_LINK(ActivateHdl_Impl, weld::Entry&, bool);
129 DECL_LINK(AssignHdl_Impl, weld::Button&, void);
130 DECL_LINK(SelectHdl_Impl, weld::TreeView&, void);
131 DECL_LINK(DblClickHdl_Impl, weld::TreeView&, bool);
132 DECL_LINK(RemoveHdl_Impl, weld::Button&, void);
133 DECL_LINK(EditHdl_Impl, weld::Button&, void);
134
136 {
137 m_xRemoveBtn->set_sensitive(m_xAssignedList->get_selected_index() != -1);
138 }
139
141 {
142 m_xEditBtn->set_sensitive(m_xAssignedList->get_selected_index() != -1);
143 }
144
146 {
147 m_xAssignBtn->set_sensitive(false);
148 }
149
151 {
152 m_xRemoveBtn->set_sensitive(false);
153 }
154
156 {
157 m_xEditBtn->set_sensitive(false);
158 }
159
160public:
161 explicit SvxJavaParameterDlg(weld::Window* pParent);
162 virtual ~SvxJavaParameterDlg() override;
163
164 virtual short run() override;
165
166 std::vector< OUString > GetParameters() const;
167 void SetParameters( std::vector< OUString > const & rParams );
168 void DisableButtons();
169 void EditParameter();
170};
171
172// class SvxJavaClassPathDlg ---------------------------------------------
173
175{
176private:
177 std::unique_ptr<weld::TreeView> m_xPathList;
178 std::unique_ptr<weld::Button> m_xAddArchiveBtn;
179 std::unique_ptr<weld::Button> m_xAddPathBtn;
180 std::unique_ptr<weld::Button> m_xRemoveBtn;
181
182 OUString m_sOldPath;
183
184 DECL_LINK(AddArchiveHdl_Impl, weld::Button&, void);
185 DECL_LINK(AddPathHdl_Impl, weld::Button&, void);
186 DECL_LINK(RemoveHdl_Impl, weld::Button&, void);
187 DECL_LINK(SelectHdl_Impl, weld::TreeView&, void);
188
189 bool IsPathDuplicate(std::u16string_view _rPath);
191 {
192 m_xRemoveBtn->set_sensitive(m_xPathList->get_selected_index() != -1);
193 }
194
195public:
196 explicit SvxJavaClassPathDlg(weld::Window* pParent);
197 virtual ~SvxJavaClassPathDlg() override;
198
199 const OUString& GetOldPath() const { return m_sOldPath; }
200 void SetFocus() { m_xPathList->grab_focus(); }
201
202 OUString GetClassPath() const;
203#if HAVE_FEATURE_JAVA
204 void SetClassPath( const OUString& _rPath );
205#endif
206};
207
208/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DECL_LINK(AddArchiveHdl_Impl, weld::Button &, void)
DECL_LINK(SelectHdl_Impl, weld::TreeView &, void)
DECL_LINK(AddPathHdl_Impl, weld::Button &, void)
OUString m_sOldPath
Definition: optjava.hxx:182
SvxJavaClassPathDlg(weld::Window *pParent)
Definition: optjava.cxx:769
std::unique_ptr< weld::Button > m_xAddArchiveBtn
Definition: optjava.hxx:178
std::unique_ptr< weld::TreeView > m_xPathList
Definition: optjava.hxx:177
DECL_LINK(RemoveHdl_Impl, weld::Button &, void)
bool IsPathDuplicate(std::u16string_view _rPath)
Definition: optjava.cxx:909
OUString GetClassPath() const
Definition: optjava.cxx:925
std::unique_ptr< weld::Button > m_xRemoveBtn
Definition: optjava.hxx:180
virtual ~SvxJavaClassPathDlg() override
Definition: optjava.cxx:787
std::unique_ptr< weld::Button > m_xAddPathBtn
Definition: optjava.hxx:179
void EnableRemoveButton()
Definition: optjava.hxx:190
const OUString & GetOldPath() const
Definition: optjava.hxx:199
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: optjava.cxx:470
std::unique_ptr< weld::CheckButton > m_xMacroCB
Definition: optjava.hxx:78
std::unique_ptr< weld::CheckButton > m_xJavaEnableCB
Definition: optjava.hxx:66
OUString m_sAddDialogText
Definition: optjava.hxx:58
DECL_LINK(ResetHdl_Impl, Timer *, void)
std::unique_ptr< weld::Button > m_xExpertConfigBtn
Definition: optjava.hxx:72
void HandleCheckEntry(int nCheckedRow)
Definition: optjava.cxx:367
void RequestRestart(svtools::RestartReason eReason)
Definition: optjava.cxx:458
void UpdateJavaPathText()
Definition: optjava.cxx:377
OUString m_sInstallText
Definition: optjava.hxx:57
std::unique_ptr< SvxJavaClassPathDlg > m_xPathDlg
Definition: optjava.hxx:75
std::unique_ptr< weld::TreeView > m_xJavaList
Definition: optjava.hxx:67
std::unique_ptr< weld::Button > m_xAddBtn
Definition: optjava.hxx:69
void AddFolder(const OUString &_rFolder)
Definition: optjava.cxx:387
DECL_LINK(ExpertConfigHdl_Impl, weld::Button &, void)
DECL_LINK(ParameterHdl_Impl, weld::Button &, void)
std::unique_ptr< SvxJavaParameterDlg > m_xParamDlg
Definition: optjava.hxx:74
DECL_LINK(ClassPathHdl_Impl, weld::Button &, void)
rtl::Reference< ::svt::DialogClosedListener > xDialogListener
Definition: optjava.hxx:63
DECL_LINK(DialogClosedHdl, css::ui::dialogs::DialogClosedEvent *, void)
DECL_LINK(StartFolderPickerHdl, void *, void)
std::unique_ptr< weld::Label > m_xJavaPathText
Definition: optjava.hxx:68
virtual void FillUserData() override
Definition: optjava.cxx:597
std::unique_ptr< weld::Widget > m_xJavaFrame
Definition: optjava.hxx:82
DECL_LINK(SelectHdl_Impl, weld::TreeView &, void)
void ClearJavaInfo()
Definition: optjava.cxx:300
std::unique_ptr< weld::CheckButton > m_xExperimentalCB
Definition: optjava.hxx:77
DECL_LINK(EnableHdl_Impl, weld::Toggleable &, void)
virtual ~SvxJavaOptionsPage() override
Definition: optjava.cxx:127
css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker
Definition: optjava.hxx:64
std::unique_ptr< weld::Button > m_xParameterBtn
Definition: optjava.hxx:70
void AddJRE(JavaInfo const *_pInfo)
Definition: optjava.cxx:349
std::unique_ptr< weld::Label > m_xAddDialogText
Definition: optjava.hxx:80
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: optjava.cxx:465
DECL_LINK(CheckHdl_Impl, const weld::TreeView::iter_col &, void)
virtual void Reset(const SfxItemSet *rSet) override
Definition: optjava.cxx:562
SvxJavaOptionsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: optjava.cxx:68
std::unique_ptr< weld::Button > m_xClassPathBtn
Definition: optjava.hxx:71
DECL_LINK(AddHdl_Impl, weld::Button &, void)
std::vector< std::unique_ptr< JavaInfo > > m_aAddedInfos
Definition: optjava.hxx:61
DECL_LINK(RemoveHdl_Impl, weld::Button &, void)
void EnableRemoveButton()
Definition: optjava.hxx:135
void SetParameters(std::vector< OUString > const &rParams)
Definition: optjava.cxx:755
DECL_LINK(SelectHdl_Impl, weld::TreeView &, void)
void EnableEditButton()
Definition: optjava.hxx:140
void DisableRemoveButton()
Definition: optjava.hxx:150
std::vector< OUString > GetParameters() const
Definition: optjava.cxx:738
SvxJavaParameterDlg(weld::Window *pParent)
Definition: optjava.cxx:604
std::unique_ptr< weld::Button > m_xAssignBtn
Definition: optjava.hxx:122
void DisableEditButton()
Definition: optjava.hxx:155
void DisableAssignButton()
Definition: optjava.hxx:145
virtual ~SvxJavaParameterDlg() override
Definition: optjava.cxx:628
std::unique_ptr< weld::Button > m_xEditBtn
Definition: optjava.hxx:125
DECL_LINK(EditHdl_Impl, weld::Button &, void)
DECL_LINK(DblClickHdl_Impl, weld::TreeView &, bool)
virtual short run() override
Definition: optjava.cxx:731
std::unique_ptr< weld::Button > m_xRemoveBtn
Definition: optjava.hxx:124
DECL_LINK(ActivateHdl_Impl, weld::Entry &, bool)
std::unique_ptr< weld::Entry > m_xParameterEdit
Definition: optjava.hxx:121
DECL_LINK(AssignHdl_Impl, weld::Button &, void)
std::unique_ptr< weld::TreeView > m_xAssignedList
Definition: optjava.hxx:123
DECL_LINK(ModifyHdl_Impl, weld::Entry &, void)
std::pair< const TreeIter &, int > iter_col
void * JavaInfo
Definition: optjava.hxx:39