1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_DIALOG2_HXX
#define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_DIALOG2_HXX
#include "vcl/dialog.hxx"
#include "vcl/button.hxx"
#include "vcl/fixed.hxx"
#include "vcl/fixedhyper.hxx"
#include "vcl/prgsbar.hxx"
#include "vcl/timer.hxx"
#include "svtools/svmedit.hxx"
#include "osl/conditn.hxx"
#include "osl/mutex.hxx"
#include "rtl/ref.hxx"
#include "rtl/ustring.hxx"
#include "cppuhelper/implbase1.hxx"
#include "com/sun/star/awt/XWindow.hpp"
#include "com/sun/star/deployment/XPackage.hpp"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/ui/dialogs/XExecutableDialog.hpp"
#include "com/sun/star/util/XModifyListener.hpp"
namespace dp_gui {
class ExtBoxWithBtns_Impl;
class ExtensionBox_Impl;
class TheExtensionManager;
class DialogHelper
{
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
Dialog* m_pVCLWindow;
sal_uLong m_nEventID;
bool m_bIsBusy;
public:
DialogHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &,
Dialog *pWindow );
virtual ~DialogHelper();
void openWebBrowser( const OUString & sURL, const OUString & sTitle ) const;
Dialog* getWindow() const { return m_pVCLWindow; };
void PostUserEvent( const Link& rLink, void* pCaller );
void clearEventID() { m_nEventID = 0; }
virtual void showProgress( bool bStart ) = 0;
virtual void updateProgress( const OUString &rText,
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > &xAbortChannel) = 0;
virtual void updateProgress( const long nProgress ) = 0;
virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) = 0;
virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
bool bLicenseMissing = false ) = 0;
virtual void prepareChecking() = 0;
virtual void checkEntries() = 0;
static ResId getResId( sal_uInt16 nId );
static OUString getResourceString( sal_uInt16 id );
static bool IsSharedPkgMgr( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &);
static bool continueOnSharedExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &,
Window *pParent,
const sal_uInt16 nResID,
bool &bHadWarning );
void setBusy( const bool bBusy ) { m_bIsBusy = bBusy; }
bool isBusy() const { return m_bIsBusy; }
bool installExtensionWarn( const OUString &rExtensionURL ) const;
bool installForAllUsers( bool &bInstallForAll ) const;
};
class ExtMgrDialog : public ModelessDialog,
public DialogHelper
{
ExtBoxWithBtns_Impl *m_pExtensionBox;
PushButton *m_pAddBtn;
PushButton *m_pUpdateBtn;
CloseButton *m_pCloseBtn;
CheckBox *m_pBundledCbx;
CheckBox *m_pSharedCbx;
CheckBox *m_pUserCbx;
FixedHyperlink *m_pGetExtensions;
FixedText *m_pProgressText;
ProgressBar *m_pProgressBar;
CancelButton *m_pCancelBtn;
const OUString m_sAddPackages;
OUString m_sProgressText;
OUString m_sLastFolderURL;
::osl::Mutex m_aMutex;
bool m_bHasProgress;
bool m_bProgressChanged;
bool m_bStartProgress;
bool m_bStopProgress;
bool m_bEnableWarning;
bool m_bDisableWarning;
bool m_bDeleteWarning;
long m_nProgress;
Timer m_aTimeoutTimer;
TheExtensionManager *m_pManager;
::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > m_xAbortChannel;
bool removeExtensionWarn( const OUString &rExtensionTitle ) const;
DECL_DLLPRIVATE_LINK( HandleAddBtn, void * );
DECL_DLLPRIVATE_LINK( HandleUpdateBtn, void * );
DECL_DLLPRIVATE_LINK( HandleCancelBtn, void * );
DECL_DLLPRIVATE_LINK( HandleCloseBtn, void * );
DECL_DLLPRIVATE_LINK( HandleExtTypeCbx, void * );
DECL_DLLPRIVATE_LINK( HandleHyperlink, FixedHyperlink * );
DECL_DLLPRIVATE_LINK(TimeOutHdl, void *);
DECL_DLLPRIVATE_LINK( startProgress, void * );
public:
ExtMgrDialog( Window * pParent, TheExtensionManager *pManager );
virtual ~ExtMgrDialog();
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE;
virtual void showProgress( bool bStart ) SAL_OVERRIDE;
virtual void updateProgress( const OUString &rText,
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > &xAbortChannel) SAL_OVERRIDE;
virtual void updateProgress( const long nProgress ) SAL_OVERRIDE;
virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) SAL_OVERRIDE;
void setGetExtensionsURL( const OUString &rURL );
virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &,
bool bLicenseMissing = false ) SAL_OVERRIDE;
bool enablePackage(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
bool bEnable );
bool removePackage(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
bool updatePackage(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
bool acceptLicense(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
TheExtensionManager* getExtensionManager() const { return m_pManager; }
virtual void prepareChecking() SAL_OVERRIDE;
virtual void checkEntries() SAL_OVERRIDE;
::com::sun::star::uno::Sequence< OUString > raiseAddPicker();
};
class UpdateRequiredDialog : public ModalDialog,
public DialogHelper
{
ExtensionBox_Impl *m_pExtensionBox;
FixedText m_aUpdateNeeded;
PushButton m_aUpdateBtn;
PushButton m_aCloseBtn;
HelpButton m_aHelpBtn;
CancelButton m_aCancelBtn;
FixedLine m_aDivider;
FixedText m_aProgressText;
ProgressBar m_aProgressBar;
const OUString m_sAddPackages;
const OUString m_sCloseText;
OUString m_sProgressText;
::osl::Mutex m_aMutex;
bool m_bHasProgress;
bool m_bProgressChanged;
bool m_bStartProgress;
bool m_bStopProgress;
bool m_bUpdateWarning;
bool m_bDisableWarning;
bool m_bHasLockedEntries;
long m_nProgress;
Timer m_aTimeoutTimer;
TheExtensionManager *m_pManager;
::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > m_xAbortChannel;
DECL_DLLPRIVATE_LINK( HandleUpdateBtn, void * );
DECL_DLLPRIVATE_LINK( HandleCloseBtn, void * );
DECL_DLLPRIVATE_LINK( HandleCancelBtn, void * );
DECL_DLLPRIVATE_LINK(TimeOutHdl, void *);
DECL_DLLPRIVATE_LINK( startProgress, void * );
DECL_DLLPRIVATE_LINK( HandleHyperlink, FixedHyperlink * );
bool isEnabled( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
bool checkDependencies( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
bool hasActiveEntries();
void disableAllEntries();
public:
UpdateRequiredDialog( Window * pParent, TheExtensionManager *pManager );
virtual ~UpdateRequiredDialog();
virtual short Execute() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE;
virtual void showProgress( bool bStart ) SAL_OVERRIDE;
virtual void updateProgress( const OUString &rText,
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > &xAbortChannel) SAL_OVERRIDE;
virtual void updateProgress( const long nProgress ) SAL_OVERRIDE;
virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) SAL_OVERRIDE;
virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &,
bool bLicenseMissing = false ) SAL_OVERRIDE;
bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, bool bEnable );
bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
virtual void prepareChecking() SAL_OVERRIDE;
virtual void checkEntries() SAL_OVERRIDE;
::com::sun::star::uno::Sequence< OUString > raiseAddPicker();
bool installForAllUsers( bool &bInstallForAll ) const;
bool installExtensionWarn( const OUString &rExtensionURL ) const;
};
class ShowLicenseDialog : public ModalDialog
{
VclMultiLineEdit* m_pLicenseText;
public:
ShowLicenseDialog(Window * pParent, const css::uno::Reference< css::deployment::XPackage > &xPackage);
};
class UpdateRequiredDialogService : public ::cppu::WeakImplHelper1< ::com::sun::star::ui::dialogs::XExecutableDialog >
{
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const m_xComponentContext;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xParent;
OUString m_sInitialTitle;
public:
UpdateRequiredDialogService( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > const & args,
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const & xComponentContext );
// XExecutableDialog
virtual void SAL_CALL setTitle( OUString const & title ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
virtual sal_Int16 SAL_CALL execute() throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
};
} // namespace dp_gui
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|