LibreOffice Module desktop (master) 1
dp_gui_dialog2.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 <vcl/timer.hxx>
23#include <vcl/idle.hxx>
24#include <vcl/locktoplevels.hxx>
25#include <vcl/customweld.hxx>
26#include <vcl/weld.hxx>
27
28#include <osl/mutex.hxx>
29
30#include <rtl/ustring.hxx>
31
33#include <unotools/resmgr.hxx>
34
35#include <com/sun/star/deployment/XPackage.hpp>
36#include <com/sun/star/uno/XComponentContext.hpp>
37#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
38#include <com/sun/star/lang/XServiceInfo.hpp>
39
40struct ImplSVEvent;
41
42namespace dp_gui {
43
44class ExtBoxWithBtns_Impl;
45class ExtensionBox_Impl;
46class TheExtensionManager;
47
49{
50 css::uno::Reference< css::uno::XComponentContext > m_xContext;
54
55public:
56 DialogHelper(const css::uno::Reference< css::uno::XComponentContext > &,
57 weld::Window* pWindow);
58 virtual ~DialogHelper();
59
60 void openWebBrowser(const OUString& rURL, const OUString& rTitle);
61 weld::Window* getFrameWeld() const { return m_pWindow; }
62 void PostUserEvent( const Link<void*,void>& rLink, void* pCaller );
63 void clearEventID() { m_nEventID = nullptr; }
64
65 virtual void showProgress( bool bStart ) = 0;
66 virtual void updateProgress( const OUString &rText,
67 const css::uno::Reference< css::task::XAbortChannel > &xAbortChannel) = 0;
68 virtual void updateProgress( const tools::Long nProgress ) = 0;
69
70 virtual void updatePackageInfo( const css::uno::Reference< css::deployment::XPackage > &xPackage ) = 0;
71 virtual void addPackageToList( const css::uno::Reference< css::deployment::XPackage > &xPackage,
72 bool bLicenseMissing = false ) = 0;
73
74 virtual void prepareChecking() = 0;
75 virtual void checkEntries() = 0;
76
77 static bool IsSharedPkgMgr( const css::uno::Reference< css::deployment::XPackage > &);
78 bool continueOnSharedExtension( const css::uno::Reference< css::deployment::XPackage > &,
79 weld::Widget* pParent,
80 TranslateId pResID,
81 bool &bHadWarning );
82
84 void decBusy() { m_aBusy.decBusy(); }
85 bool isBusy() const { return m_aBusy.isBusy(); }
86 bool installExtensionWarn(std::u16string_view rExtensionURL);
87 bool installForAllUsers(bool &bInstallForAll);
88};
89
91 , public DialogHelper
92{
93 const OUString m_sAddPackages;
95 ::osl::Mutex m_aMutex;
107
108 css::uno::Reference< css::task::XAbortChannel > m_xAbortChannel;
109
110 std::unique_ptr<ExtBoxWithBtns_Impl> m_xExtensionBox;
111 std::unique_ptr<weld::CustomWeld> m_xExtensionBoxWnd;
112 std::unique_ptr<weld::Button> m_xOptionsBtn;
113 std::unique_ptr<weld::Button> m_xAddBtn;
114 std::unique_ptr<weld::Button> m_xRemoveBtn;
115 std::unique_ptr<weld::Button> m_xEnableBtn;
116 std::unique_ptr<weld::Button> m_xUpdateBtn;
117 std::unique_ptr<weld::Button> m_xCloseBtn;
118 std::unique_ptr<weld::CheckButton> m_xBundledCbx;
119 std::unique_ptr<weld::CheckButton> m_xSharedCbx;
120 std::unique_ptr<weld::CheckButton> m_xUserCbx;
121 std::unique_ptr<weld::LinkButton> m_xGetExtensions;
122 std::unique_ptr<weld::Label> m_xProgressText;
123 std::unique_ptr<weld::ProgressBar> m_xProgressBar;
124 std::unique_ptr<weld::Button> m_xCancelBtn;
125 std::unique_ptr<weld::Entry> m_xSearchEntry;
126
127 bool removeExtensionWarn(std::u16string_view rExtensionTitle);
128
129 DECL_LINK( HandleOptionsBtn, weld::Button&, void );
130 DECL_LINK( HandleAddBtn, weld::Button&, void );
131 DECL_LINK( HandleRemoveBtn, weld::Button&, void );
132 DECL_LINK( HandleEnableBtn, weld::Button&, void );
133 DECL_LINK( HandleUpdateBtn, weld::Button&, void );
134 DECL_LINK( HandleCancelBtn, weld::Button&, void );
135 DECL_LINK( HandleCloseBtn, weld::Button&, void );
136 DECL_LINK( HandleExtTypeCbx, weld::Toggleable&, void );
137 DECL_LINK( HandleSearch, weld::Entry&, void );
138 DECL_LINK( TimeOutHdl, Timer *, void );
139 DECL_LINK( startProgress, void *, void );
140
141public:
142 ExtMgrDialog(weld::Window * pParent, TheExtensionManager *pManager);
143 virtual ~ExtMgrDialog() override;
144
145 virtual void showProgress( bool bStart ) override;
146 virtual void updateProgress( const OUString &rText,
147 const css::uno::Reference< css::task::XAbortChannel > &xAbortChannel) override;
148 virtual void updateProgress( const tools::Long nProgress ) override;
149
150 virtual void updatePackageInfo( const css::uno::Reference< css::deployment::XPackage > &xPackage ) override;
151
152 void setGetExtensionsURL( const OUString &rURL );
153 virtual void addPackageToList( const css::uno::Reference< css::deployment::XPackage > &,
154 bool bLicenseMissing = false ) override;
155 void enablePackage(const css::uno::Reference< css::deployment::XPackage > &xPackage,
156 bool bEnable );
157 void removePackage(const css::uno::Reference< css::deployment::XPackage > &xPackage );
158 void updatePackage(const css::uno::Reference< css::deployment::XPackage > &xPackage );
159 bool acceptLicense(const css::uno::Reference< css::deployment::XPackage > &xPackage );
160
161 void Close();
162
164
165 void updateList();
166 virtual void prepareChecking() override;
167 virtual void checkEntries() override;
168
169 css::uno::Sequence< OUString > raiseAddPicker();
170
171 void enableOptionsButton( bool bEnable );
172 void enableRemoveButton( bool bEnable );
173 void enableEnableButton( bool bEnable );
174 /*
175 * Transform the button to "Enable", or to "Disable"
176 * based on the value of bEnable.
177 */
178 void enableButtontoEnable( bool bEnable );
179};
180
181
183 , public DialogHelper
184{
185 const OUString m_sCloseText;
187 ::osl::Mutex m_aMutex;
196
197 css::uno::Reference< css::task::XAbortChannel > m_xAbortChannel;
198
199 std::unique_ptr<ExtensionBox_Impl> m_xExtensionBox;
200 std::unique_ptr<weld::CustomWeld> m_xExtensionBoxWnd;
201 std::unique_ptr<weld::Label> m_xUpdateNeeded;
202 std::unique_ptr<weld::Button> m_xUpdateBtn;
203 std::unique_ptr<weld::Button> m_xCloseBtn;
204 std::unique_ptr<weld::Button> m_xCancelBtn;
205 std::unique_ptr<weld::Label> m_xProgressText;
206 std::unique_ptr<weld::ProgressBar> m_xProgressBar;
207
208 DECL_LINK( HandleUpdateBtn, weld::Button&, void );
209 DECL_LINK( HandleCloseBtn, weld::Button&, void );
210 DECL_LINK( HandleCancelBtn, weld::Button&, void );
211 DECL_LINK( TimeOutHdl, Timer *, void );
212 DECL_LINK( startProgress, void *, void );
213
214 static bool isEnabled( const css::uno::Reference< css::deployment::XPackage > &xPackage );
215 static bool checkDependencies( const css::uno::Reference< css::deployment::XPackage > &xPackage );
216 bool hasActiveEntries();
217 void disableAllEntries();
218
219public:
221 virtual ~UpdateRequiredDialog() override;
222
223 virtual short run() override;
224
225 virtual void showProgress( bool bStart ) override;
226 virtual void updateProgress( const OUString &rText,
227 const css::uno::Reference< css::task::XAbortChannel > &xAbortChannel) override;
228 virtual void updateProgress( const tools::Long nProgress ) override;
229
230 virtual void updatePackageInfo( const css::uno::Reference< css::deployment::XPackage > &xPackage ) override;
231
232 virtual void addPackageToList( const css::uno::Reference< css::deployment::XPackage > &,
233 bool bLicenseMissing = false ) override;
234
235 virtual void prepareChecking() override;
236 virtual void checkEntries() override;
237};
238
239
241{
242 std::unique_ptr<weld::TextView> m_xLicenseText;
243public:
244 ShowLicenseDialog(weld::Window * pParent, const css::uno::Reference< css::deployment::XPackage > &xPackage);
245 virtual ~ShowLicenseDialog() override;
246};
247
248class UpdateRequiredDialogService : public ::cppu::WeakImplHelper< css::ui::dialogs::XExecutableDialog, css::lang::XServiceInfo >
249{
250 css::uno::Reference< css::uno::XComponentContext > const m_xComponentContext;
251public:
252 UpdateRequiredDialogService( css::uno::Sequence< css::uno::Any > const & args,
253 css::uno::Reference< css::uno::XComponentContext> xComponentContext );
254
255 // XServiceInfo
256 virtual OUString SAL_CALL getImplementationName() override;
257 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
258 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
259
260 // XExecutableDialog
261 virtual void SAL_CALL setTitle( OUString const & title ) override;
262 virtual sal_Int16 SAL_CALL execute() override;
263};
264
265} // namespace dp_gui
266
267/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool isBusy() const
void incBusy(const weld::Widget *pIgnore)
bool installForAllUsers(bool &bInstallForAll)
void openWebBrowser(const OUString &rURL, const OUString &rTitle)
bool continueOnSharedExtension(const css::uno::Reference< css::deployment::XPackage > &, weld::Widget *pParent, TranslateId pResID, bool &bHadWarning)
virtual void updateProgress(const OUString &rText, const css::uno::Reference< css::task::XAbortChannel > &xAbortChannel)=0
ImplSVEvent * m_nEventID
TopLevelWindowLocker m_aBusy
css::uno::Reference< css::uno::XComponentContext > m_xContext
weld::Window * getFrameWeld() const
virtual void updatePackageInfo(const css::uno::Reference< css::deployment::XPackage > &xPackage)=0
virtual void showProgress(bool bStart)=0
virtual void addPackageToList(const css::uno::Reference< css::deployment::XPackage > &xPackage, bool bLicenseMissing=false)=0
virtual void prepareChecking()=0
weld::Window * m_pWindow
bool installExtensionWarn(std::u16string_view rExtensionURL)
virtual void updateProgress(const tools::Long nProgress)=0
DialogHelper(const css::uno::Reference< css::uno::XComponentContext > &, weld::Window *pWindow)
void PostUserEvent(const Link< void *, void > &rLink, void *pCaller)
virtual void checkEntries()=0
static bool IsSharedPkgMgr(const css::uno::Reference< css::deployment::XPackage > &)
void enableButtontoEnable(bool bEnable)
css::uno::Reference< css::task::XAbortChannel > m_xAbortChannel
DECL_LINK(HandleAddBtn, weld::Button &, void)
std::unique_ptr< weld::Button > m_xRemoveBtn
DECL_LINK(HandleExtTypeCbx, weld::Toggleable &, void)
virtual void showProgress(bool bStart) override
DECL_LINK(HandleSearch, weld::Entry &, void)
TheExtensionManager * m_pManager
std::unique_ptr< weld::LinkButton > m_xGetExtensions
DECL_LINK(HandleRemoveBtn, weld::Button &, void)
std::unique_ptr< weld::Button > m_xCancelBtn
bool acceptLicense(const css::uno::Reference< css::deployment::XPackage > &xPackage)
virtual ~ExtMgrDialog() override
void removePackage(const css::uno::Reference< css::deployment::XPackage > &xPackage)
bool removeExtensionWarn(std::u16string_view rExtensionTitle)
const OUString m_sAddPackages
DECL_LINK(startProgress, void *, void)
std::unique_ptr< weld::Button > m_xCloseBtn
DECL_LINK(TimeOutHdl, Timer *, void)
std::unique_ptr< weld::Label > m_xProgressText
void updatePackage(const css::uno::Reference< css::deployment::XPackage > &xPackage)
DECL_LINK(HandleUpdateBtn, weld::Button &, void)
std::unique_ptr< weld::Button > m_xUpdateBtn
std::unique_ptr< weld::CustomWeld > m_xExtensionBoxWnd
virtual void prepareChecking() override
void enableEnableButton(bool bEnable)
DECL_LINK(HandleCloseBtn, weld::Button &, void)
DECL_LINK(HandleOptionsBtn, weld::Button &, void)
std::unique_ptr< weld::CheckButton > m_xBundledCbx
void enableRemoveButton(bool bEnable)
DECL_LINK(HandleEnableBtn, weld::Button &, void)
std::unique_ptr< weld::Button > m_xAddBtn
ExtMgrDialog(weld::Window *pParent, TheExtensionManager *pManager)
virtual void updatePackageInfo(const css::uno::Reference< css::deployment::XPackage > &xPackage) override
void enablePackage(const css::uno::Reference< css::deployment::XPackage > &xPackage, bool bEnable)
std::unique_ptr< weld::CheckButton > m_xSharedCbx
virtual void updateProgress(const OUString &rText, const css::uno::Reference< css::task::XAbortChannel > &xAbortChannel) override
std::unique_ptr< weld::CheckButton > m_xUserCbx
css::uno::Sequence< OUString > raiseAddPicker()
std::unique_ptr< weld::Button > m_xEnableBtn
TheExtensionManager * getExtensionManager() const
void enableOptionsButton(bool bEnable)
std::unique_ptr< weld::Entry > m_xSearchEntry
virtual void addPackageToList(const css::uno::Reference< css::deployment::XPackage > &, bool bLicenseMissing=false) override
void setGetExtensionsURL(const OUString &rURL)
std::unique_ptr< ExtBoxWithBtns_Impl > m_xExtensionBox
std::unique_ptr< weld::ProgressBar > m_xProgressBar
std::unique_ptr< weld::Button > m_xOptionsBtn
virtual void checkEntries() override
DECL_LINK(HandleCancelBtn, weld::Button &, void)
virtual ~ShowLicenseDialog() override
ShowLicenseDialog(weld::Window *pParent, const css::uno::Reference< css::deployment::XPackage > &xPackage)
std::unique_ptr< weld::TextView > m_xLicenseText
virtual void SAL_CALL setTitle(OUString const &title) override
css::uno::Reference< css::uno::XComponentContext > const m_xComponentContext
UpdateRequiredDialogService(css::uno::Sequence< css::uno::Any > const &args, css::uno::Reference< css::uno::XComponentContext > xComponentContext)
virtual sal_Int16 SAL_CALL execute() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
static bool isEnabled(const css::uno::Reference< css::deployment::XPackage > &xPackage)
std::unique_ptr< ExtensionBox_Impl > m_xExtensionBox
virtual void checkEntries() override
std::unique_ptr< weld::Button > m_xUpdateBtn
std::unique_ptr< weld::ProgressBar > m_xProgressBar
DECL_LINK(startProgress, void *, void)
virtual void updatePackageInfo(const css::uno::Reference< css::deployment::XPackage > &xPackage) override
static bool checkDependencies(const css::uno::Reference< css::deployment::XPackage > &xPackage)
virtual void showProgress(bool bStart) override
virtual ~UpdateRequiredDialog() override
TheExtensionManager * m_pManager
std::unique_ptr< weld::Label > m_xUpdateNeeded
DECL_LINK(HandleCloseBtn, weld::Button &, void)
std::unique_ptr< weld::Label > m_xProgressText
virtual void updateProgress(const OUString &rText, const css::uno::Reference< css::task::XAbortChannel > &xAbortChannel) override
DECL_LINK(HandleUpdateBtn, weld::Button &, void)
std::unique_ptr< weld::Button > m_xCloseBtn
std::unique_ptr< weld::Button > m_xCancelBtn
css::uno::Reference< css::task::XAbortChannel > m_xAbortChannel
DECL_LINK(TimeOutHdl, Timer *, void)
std::unique_ptr< weld::CustomWeld > m_xExtensionBoxWnd
virtual void prepareChecking() override
UpdateRequiredDialog(weld::Window *pParent, TheExtensionManager *pManager)
DECL_LINK(HandleCancelBtn, weld::Button &, void)
virtual short run() override
virtual void addPackageToList(const css::uno::Reference< css::deployment::XPackage > &, bool bLicenseMissing=false) override
Definition: dp_gui.h:22
long Long
unsigned char sal_Bool