Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "dp_gui.hrc"
30 : : #include "svtools/controldims.hrc"
31 : : #include "svtools/svtools.hrc"
32 : :
33 : : #include "dp_gui.h"
34 : : #include "dp_gui_dialog2.hxx"
35 : : #include "dp_gui_extlistbox.hxx"
36 : : #include "dp_gui_shared.hxx"
37 : : #include "dp_gui_theextmgr.hxx"
38 : : #include "dp_gui_extensioncmdqueue.hxx"
39 : : #include "dp_misc.h"
40 : : #include "dp_ucb.h"
41 : : #include "dp_update.hxx"
42 : : #include "dp_identifier.hxx"
43 : : #include "dp_descriptioninfoset.hxx"
44 : :
45 : : #include "vcl/ctrl.hxx"
46 : : #include "vcl/menu.hxx"
47 : : #include "vcl/msgbox.hxx"
48 : : #include "vcl/scrbar.hxx"
49 : : #include "vcl/svapp.hxx"
50 : :
51 : : #include "osl/mutex.hxx"
52 : :
53 : : #include "svtools/extensionlistbox.hxx"
54 : :
55 : : #include "sfx2/sfxdlg.hxx"
56 : :
57 : : #include "comphelper/anytostring.hxx"
58 : : #include "cppuhelper/exc_hlp.hxx"
59 : : #include "cppuhelper/bootstrap.hxx"
60 : :
61 : : #include "comphelper/processfactory.hxx"
62 : : #include "ucbhelper/content.hxx"
63 : : #include "unotools/collatorwrapper.hxx"
64 : : #include "unotools/configmgr.hxx"
65 : :
66 : : #include "com/sun/star/beans/StringPair.hpp"
67 : :
68 : : #include "com/sun/star/i18n/CollatorOptions.hpp"
69 : :
70 : : #include "com/sun/star/system/SystemShellExecuteFlags.hpp"
71 : : #include "com/sun/star/system/XSystemShellExecute.hpp"
72 : :
73 : : #include "com/sun/star/ui/dialogs/ExecutableDialogResults.hpp"
74 : : #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
75 : : #include "com/sun/star/ui/dialogs/XFilePicker.hpp"
76 : : #include "com/sun/star/ui/dialogs/XFilterManager.hpp"
77 : :
78 : : #include "com/sun/star/uno/Any.hxx"
79 : : #include "com/sun/star/uno/XComponentContext.hpp"
80 : :
81 : : #include <map>
82 : : #include <vector>
83 : : #include <boost/shared_ptr.hpp>
84 : :
85 : : #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
86 : :
87 : : using namespace ::com::sun::star;
88 : : using namespace ::com::sun::star::system;
89 : :
90 : : using ::rtl::OUString;
91 : :
92 : :
93 : : namespace dp_gui {
94 : :
95 : : #define TOP_OFFSET 5
96 : : #define LINE_SIZE 4
97 : : #define PROGRESS_WIDTH 60
98 : : #define PROGRESS_HEIGHT 14
99 : :
100 : : #define USER_PACKAGE_MANAGER OUSTR("user")
101 : : #define SHARED_PACKAGE_MANAGER OUSTR("shared")
102 : : #define BUNDLED_PACKAGE_MANAGER OUSTR("bundled")
103 : :
104 : : //------------------------------------------------------------------------------
105 : : struct StrAllFiles : public rtl::StaticWithInit< OUString, StrAllFiles >
106 : : {
107 : 0 : const OUString operator () () {
108 : 0 : const SolarMutexGuard guard;
109 : 0 : ::std::auto_ptr< ResMgr > const resmgr( ResMgr::CreateResMgr( "fps_office" ) );
110 : : OSL_ASSERT( resmgr.get() != 0 );
111 : 0 : String ret( ResId( STR_FILTERNAME_ALL, *resmgr.get() ) );
112 : 0 : return ret;
113 : : }
114 : : };
115 : :
116 : : //------------------------------------------------------------------------------
117 : : // ExtBoxWithBtns_Impl
118 : : //------------------------------------------------------------------------------
119 : :
120 : : enum MENU_COMMAND
121 : : {
122 : : CMD_NONE = 0,
123 : : CMD_REMOVE = 1,
124 : : CMD_ENABLE,
125 : : CMD_DISABLE,
126 : : CMD_UPDATE,
127 : : CMD_SHOW_LICENSE
128 : : };
129 : :
130 : : class ExtBoxWithBtns_Impl : public ExtensionBox_Impl
131 : : {
132 : : Size m_aOutputSize;
133 : : bool m_bInterfaceLocked;
134 : :
135 : : PushButton *m_pOptionsBtn;
136 : : PushButton *m_pEnableBtn;
137 : : PushButton *m_pRemoveBtn;
138 : :
139 : : ExtMgrDialog *m_pParent;
140 : :
141 : : void SetButtonPos( const Rectangle& rRect );
142 : : void SetButtonStatus( const TEntry_Impl pEntry );
143 : : bool HandleTabKey( bool bReverse );
144 : : MENU_COMMAND ShowPopupMenu( const Point &rPos, const long nPos );
145 : :
146 : : //-----------------
147 : : DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * );
148 : :
149 : : DECL_DLLPRIVATE_LINK( HandleOptionsBtn, void * );
150 : : DECL_DLLPRIVATE_LINK( HandleEnableBtn, void * );
151 : : DECL_DLLPRIVATE_LINK( HandleRemoveBtn, void * );
152 : : DECL_DLLPRIVATE_LINK( HandleHyperlink, svt::FixedHyperlink * );
153 : :
154 : : public:
155 : : ExtBoxWithBtns_Impl( ExtMgrDialog* pParent, TheExtensionManager *pManager );
156 : : ~ExtBoxWithBtns_Impl();
157 : :
158 : : virtual void MouseButtonDown( const MouseEvent& rMEvt );
159 : : virtual long Notify( NotifyEvent& rNEvt );
160 : :
161 : : const Size GetMinOutputSizePixel() const;
162 : :
163 : : virtual void RecalcAll();
164 : : virtual void selectEntry( const long nPos );
165 : : //-----------------
166 : : void enableButtons( bool bEnable );
167 : : };
168 : :
169 : : //------------------------------------------------------------------------------
170 : 0 : ExtBoxWithBtns_Impl::ExtBoxWithBtns_Impl( ExtMgrDialog* pParent, TheExtensionManager *pManager ) :
171 : : ExtensionBox_Impl( pParent, pManager ),
172 : : m_bInterfaceLocked( false ),
173 : : m_pOptionsBtn( NULL ),
174 : : m_pEnableBtn( NULL ),
175 : : m_pRemoveBtn( NULL ),
176 : 0 : m_pParent( pParent )
177 : : {
178 : 0 : m_pOptionsBtn = new PushButton( this, WB_TABSTOP );
179 : 0 : m_pEnableBtn = new PushButton( this, WB_TABSTOP );
180 : 0 : m_pRemoveBtn = new PushButton( this, WB_TABSTOP );
181 : :
182 : 0 : SetHelpId( HID_EXTENSION_MANAGER_LISTBOX );
183 : 0 : m_pOptionsBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_OPTIONS );
184 : 0 : m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_DISABLE );
185 : 0 : m_pRemoveBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_REMOVE );
186 : :
187 : 0 : m_pOptionsBtn->SetClickHdl( LINK( this, ExtBoxWithBtns_Impl, HandleOptionsBtn ) );
188 : 0 : m_pEnableBtn->SetClickHdl( LINK( this, ExtBoxWithBtns_Impl, HandleEnableBtn ) );
189 : 0 : m_pRemoveBtn->SetClickHdl( LINK( this, ExtBoxWithBtns_Impl, HandleRemoveBtn ) );
190 : :
191 : 0 : m_pOptionsBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_OPTIONS ) );
192 : 0 : m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
193 : 0 : m_pRemoveBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) );
194 : :
195 : : Size aSize = LogicToPixel( Size( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ),
196 : 0 : MapMode( MAP_APPFONT ) );
197 : 0 : m_pOptionsBtn->SetSizePixel( aSize );
198 : 0 : m_pEnableBtn->SetSizePixel( aSize );
199 : 0 : m_pRemoveBtn->SetSizePixel( aSize );
200 : :
201 : 0 : SetExtraSize( aSize.Height() + 2 * TOP_OFFSET );
202 : :
203 : 0 : SetScrollHdl( LINK( this, ExtBoxWithBtns_Impl, ScrollHdl ) );
204 : 0 : }
205 : :
206 : : //------------------------------------------------------------------------------
207 : 0 : ExtBoxWithBtns_Impl::~ExtBoxWithBtns_Impl()
208 : : {
209 : 0 : delete m_pOptionsBtn;
210 : 0 : delete m_pEnableBtn;
211 : 0 : delete m_pRemoveBtn;
212 : 0 : }
213 : :
214 : : //------------------------------------------------------------------------------
215 : 0 : const Size ExtBoxWithBtns_Impl::GetMinOutputSizePixel() const
216 : : {
217 : 0 : Size aMinSize( ExtensionBox_Impl::GetMinOutputSizePixel() );
218 : 0 : long nHeight = aMinSize.Height();
219 : 0 : nHeight += m_pOptionsBtn->GetSizePixel().Height();
220 : 0 : nHeight += 2 * TOP_OFFSET;
221 : 0 : long nWidth = m_pOptionsBtn->GetSizePixel().Width();
222 : 0 : nWidth *= 3;
223 : 0 : nWidth += 5*TOP_OFFSET + 20;
224 : :
225 : 0 : return Size( nWidth, nHeight );
226 : : }
227 : :
228 : : // -----------------------------------------------------------------------
229 : 0 : void ExtBoxWithBtns_Impl::RecalcAll()
230 : : {
231 : 0 : const sal_Int32 nActive = getSelIndex();
232 : :
233 : 0 : if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
234 : : {
235 : 0 : SetButtonStatus( GetEntryData( nActive) );
236 : : }
237 : : else
238 : : {
239 : 0 : m_pOptionsBtn->Hide();
240 : 0 : m_pEnableBtn->Hide();
241 : 0 : m_pRemoveBtn->Hide();
242 : : }
243 : :
244 : 0 : ExtensionBox_Impl::RecalcAll();
245 : :
246 : 0 : if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
247 : 0 : SetButtonPos( GetEntryRect( nActive ) );
248 : 0 : }
249 : :
250 : :
251 : : //------------------------------------------------------------------------------
252 : : //This function may be called with nPos < 0
253 : 0 : void ExtBoxWithBtns_Impl::selectEntry( const long nPos )
254 : : {
255 : 0 : if ( HasActive() && ( nPos == getSelIndex() ) )
256 : 0 : return;
257 : :
258 : 0 : ExtensionBox_Impl::selectEntry( nPos );
259 : : }
260 : :
261 : : // -----------------------------------------------------------------------
262 : 0 : void ExtBoxWithBtns_Impl::SetButtonPos( const Rectangle& rRect )
263 : : {
264 : 0 : Size aBtnSize( m_pOptionsBtn->GetSizePixel() );
265 : 0 : Point aBtnPos( rRect.Left() + ICON_OFFSET,
266 : 0 : rRect.Bottom() - TOP_OFFSET - aBtnSize.Height() );
267 : :
268 : 0 : m_pOptionsBtn->SetPosPixel( aBtnPos );
269 : 0 : aBtnPos.X() = rRect.Right() - TOP_OFFSET - aBtnSize.Width();
270 : 0 : m_pRemoveBtn->SetPosPixel( aBtnPos );
271 : 0 : aBtnPos.X() -= ( TOP_OFFSET + aBtnSize.Width() );
272 : 0 : m_pEnableBtn->SetPosPixel( aBtnPos );
273 : 0 : }
274 : :
275 : : // -----------------------------------------------------------------------
276 : 0 : void ExtBoxWithBtns_Impl::SetButtonStatus( const TEntry_Impl pEntry )
277 : : {
278 : 0 : bool bShowOptionBtn = true;
279 : :
280 : 0 : pEntry->m_bHasButtons = false;
281 : 0 : if ( ( pEntry->m_eState == REGISTERED ) || ( pEntry->m_eState == NOT_AVAILABLE ) )
282 : : {
283 : 0 : m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
284 : 0 : m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_DISABLE );
285 : : }
286 : : else
287 : : {
288 : 0 : m_pEnableBtn->SetText( DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) );
289 : 0 : m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_ENABLE );
290 : 0 : bShowOptionBtn = false;
291 : : }
292 : :
293 : 0 : if ( ( !pEntry->m_bUser || ( pEntry->m_eState == NOT_AVAILABLE ) || pEntry->m_bMissingDeps )
294 : 0 : && !pEntry->m_bMissingLic )
295 : 0 : m_pEnableBtn->Hide();
296 : : else
297 : : {
298 : 0 : m_pEnableBtn->Enable( !pEntry->m_bLocked );
299 : 0 : m_pEnableBtn->Show();
300 : 0 : pEntry->m_bHasButtons = true;
301 : : }
302 : :
303 : 0 : if ( pEntry->m_bHasOptions && bShowOptionBtn )
304 : : {
305 : 0 : m_pOptionsBtn->Enable( pEntry->m_bHasOptions );
306 : 0 : m_pOptionsBtn->Show();
307 : 0 : pEntry->m_bHasButtons = true;
308 : : }
309 : : else
310 : 0 : m_pOptionsBtn->Hide();
311 : :
312 : 0 : if ( pEntry->m_bUser || pEntry->m_bShared )
313 : : {
314 : 0 : m_pRemoveBtn->Enable( !pEntry->m_bLocked );
315 : 0 : m_pRemoveBtn->Show();
316 : 0 : pEntry->m_bHasButtons = true;
317 : : }
318 : : else
319 : 0 : m_pRemoveBtn->Hide();
320 : 0 : }
321 : :
322 : : // -----------------------------------------------------------------------
323 : 0 : bool ExtBoxWithBtns_Impl::HandleTabKey( bool bReverse )
324 : : {
325 : 0 : sal_Int32 nIndex = getSelIndex();
326 : :
327 : 0 : if ( nIndex == EXTENSION_LISTBOX_ENTRY_NOTFOUND )
328 : 0 : return false;
329 : :
330 : 0 : PushButton *pNext = NULL;
331 : :
332 : 0 : if ( m_pOptionsBtn->HasFocus() ) {
333 : 0 : if ( !bReverse && !GetEntryData( nIndex )->m_bLocked )
334 : 0 : pNext = m_pEnableBtn;
335 : : }
336 : 0 : else if ( m_pEnableBtn->HasFocus() ) {
337 : 0 : if ( !bReverse )
338 : 0 : pNext = m_pRemoveBtn;
339 : 0 : else if ( GetEntryData( nIndex )->m_bHasOptions )
340 : 0 : pNext = m_pOptionsBtn;
341 : : }
342 : 0 : else if ( m_pRemoveBtn->HasFocus() ) {
343 : 0 : if ( bReverse )
344 : 0 : pNext = m_pEnableBtn;
345 : : }
346 : : else {
347 : 0 : if ( !bReverse ) {
348 : 0 : if ( GetEntryData( nIndex )->m_bHasOptions )
349 : 0 : pNext = m_pOptionsBtn;
350 : 0 : else if ( ! GetEntryData( nIndex )->m_bLocked )
351 : 0 : pNext = m_pEnableBtn;
352 : : } else {
353 : 0 : if ( ! GetEntryData( nIndex )->m_bLocked )
354 : 0 : pNext = m_pRemoveBtn;
355 : 0 : else if ( GetEntryData( nIndex )->m_bHasOptions )
356 : 0 : pNext = m_pOptionsBtn;
357 : : }
358 : : }
359 : :
360 : 0 : if ( pNext )
361 : : {
362 : 0 : pNext->GrabFocus();
363 : 0 : return true;
364 : : }
365 : : else
366 : 0 : return false;
367 : : }
368 : :
369 : : // -----------------------------------------------------------------------
370 : 0 : MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long nPos )
371 : : {
372 : 0 : if ( nPos >= (long) getItemCount() )
373 : 0 : return CMD_NONE;
374 : :
375 : 0 : PopupMenu aPopup;
376 : :
377 : 0 : aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) );
378 : :
379 : 0 : if ( ! GetEntryData( nPos )->m_bLocked )
380 : : {
381 : 0 : if ( GetEntryData( nPos )->m_bUser )
382 : : {
383 : 0 : if ( GetEntryData( nPos )->m_eState == REGISTERED )
384 : 0 : aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
385 : 0 : else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE )
386 : 0 : aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) );
387 : : }
388 : 0 : aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) );
389 : : }
390 : :
391 : 0 : if ( GetEntryData( nPos )->m_sLicenseText.Len() )
392 : 0 : aPopup.InsertItem( CMD_SHOW_LICENSE, DialogHelper::getResourceString( RID_STR_SHOW_LICENSE_CMD ) );
393 : :
394 : 0 : return (MENU_COMMAND) aPopup.Execute( this, rPos );
395 : : }
396 : :
397 : : //------------------------------------------------------------------------------
398 : 0 : void ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt )
399 : : {
400 : 0 : if ( m_bInterfaceLocked )
401 : 0 : return;
402 : :
403 : 0 : const Point aMousePos( rMEvt.GetPosPixel() );
404 : 0 : const long nPos = PointToPos( aMousePos );
405 : :
406 : 0 : if ( rMEvt.IsRight() )
407 : : {
408 : 0 : switch( ShowPopupMenu( aMousePos, nPos ) )
409 : : {
410 : 0 : case CMD_NONE: break;
411 : 0 : case CMD_ENABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackage, true );
412 : 0 : break;
413 : 0 : case CMD_DISABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackage, false );
414 : 0 : break;
415 : 0 : case CMD_UPDATE: m_pParent->updatePackage( GetEntryData( nPos )->m_xPackage );
416 : 0 : break;
417 : 0 : case CMD_REMOVE: m_pParent->removePackage( GetEntryData( nPos )->m_xPackage );
418 : 0 : break;
419 : : case CMD_SHOW_LICENSE:
420 : : {
421 : 0 : ShowLicenseDialog aLicenseDlg( m_pParent, GetEntryData( nPos )->m_xPackage );
422 : 0 : aLicenseDlg.Execute();
423 : 0 : break;
424 : : }
425 : : }
426 : : }
427 : 0 : else if ( rMEvt.IsLeft() )
428 : : {
429 : 0 : const SolarMutexGuard aGuard;
430 : 0 : if ( rMEvt.IsMod1() && HasActive() )
431 : 0 : selectEntry( EXTENSION_LISTBOX_ENTRY_NOTFOUND ); // Selecting an not existing entry will deselect the current one
432 : : else
433 : 0 : selectEntry( nPos );
434 : : }
435 : : }
436 : :
437 : : //------------------------------------------------------------------------------
438 : 0 : long ExtBoxWithBtns_Impl::Notify( NotifyEvent& rNEvt )
439 : : {
440 : 0 : bool bHandled = false;
441 : :
442 : 0 : if ( rNEvt.GetType() == EVENT_KEYINPUT )
443 : : {
444 : 0 : const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
445 : 0 : KeyCode aKeyCode = pKEvt->GetKeyCode();
446 : 0 : sal_uInt16 nKeyCode = aKeyCode.GetCode();
447 : :
448 : 0 : if ( nKeyCode == KEY_TAB )
449 : 0 : bHandled = HandleTabKey( aKeyCode.IsShift() );
450 : : }
451 : :
452 : 0 : if ( !bHandled )
453 : 0 : return ExtensionBox_Impl::Notify( rNEvt );
454 : : else
455 : 0 : return true;
456 : : }
457 : :
458 : : //------------------------------------------------------------------------------
459 : 0 : void ExtBoxWithBtns_Impl::enableButtons( bool bEnable )
460 : : {
461 : 0 : m_bInterfaceLocked = ! bEnable;
462 : :
463 : 0 : if ( bEnable )
464 : : {
465 : 0 : sal_Int32 nIndex = getSelIndex();
466 : 0 : if ( nIndex != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
467 : 0 : SetButtonStatus( GetEntryData( nIndex ) );
468 : : }
469 : : else
470 : : {
471 : 0 : m_pOptionsBtn->Enable( false );
472 : 0 : m_pRemoveBtn->Enable( false );
473 : 0 : m_pEnableBtn->Enable( false );
474 : : }
475 : 0 : }
476 : :
477 : : // -----------------------------------------------------------------------
478 : 0 : IMPL_LINK( ExtBoxWithBtns_Impl, ScrollHdl, ScrollBar*, pScrBar )
479 : : {
480 : 0 : long nDelta = pScrBar->GetDelta();
481 : :
482 : 0 : Point aNewOptPt( m_pOptionsBtn->GetPosPixel() - Point( 0, nDelta ) );
483 : 0 : Point aNewRemPt( m_pRemoveBtn->GetPosPixel() - Point( 0, nDelta ) );
484 : 0 : Point aNewEnPt( m_pEnableBtn->GetPosPixel() - Point( 0, nDelta ) );
485 : :
486 : 0 : DoScroll( nDelta );
487 : :
488 : 0 : m_pOptionsBtn->SetPosPixel( aNewOptPt );
489 : 0 : m_pRemoveBtn->SetPosPixel( aNewRemPt );
490 : 0 : m_pEnableBtn->SetPosPixel( aNewEnPt );
491 : :
492 : 0 : return 1;
493 : : }
494 : :
495 : : // -----------------------------------------------------------------------
496 : 0 : IMPL_LINK_NOARG(ExtBoxWithBtns_Impl, HandleOptionsBtn)
497 : : {
498 : 0 : const sal_Int32 nActive = getSelIndex();
499 : :
500 : 0 : if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
501 : : {
502 : 0 : SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
503 : :
504 : 0 : if ( pFact )
505 : : {
506 : 0 : OUString sExtensionId = GetEntryData( nActive )->m_xPackage->getIdentifier().Value;
507 : 0 : VclAbstractDialog* pDlg = pFact->CreateOptionsDialog( this, sExtensionId, rtl::OUString() );
508 : :
509 : 0 : pDlg->Execute();
510 : :
511 : 0 : delete pDlg;
512 : : }
513 : : }
514 : :
515 : 0 : return 1;
516 : : }
517 : :
518 : : // -----------------------------------------------------------------------
519 : 0 : IMPL_LINK_NOARG(ExtBoxWithBtns_Impl, HandleEnableBtn)
520 : : {
521 : 0 : const sal_Int32 nActive = getSelIndex();
522 : :
523 : 0 : if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
524 : : {
525 : 0 : TEntry_Impl pEntry = GetEntryData( nActive );
526 : :
527 : 0 : if ( pEntry->m_bMissingLic )
528 : 0 : m_pParent->acceptLicense( pEntry->m_xPackage );
529 : : else
530 : : {
531 : 0 : const bool bEnable( pEntry->m_eState != REGISTERED );
532 : 0 : m_pParent->enablePackage( pEntry->m_xPackage, bEnable );
533 : 0 : }
534 : : }
535 : :
536 : 0 : return 1;
537 : : }
538 : :
539 : : // -----------------------------------------------------------------------
540 : 0 : IMPL_LINK_NOARG(ExtBoxWithBtns_Impl, HandleRemoveBtn)
541 : : {
542 : 0 : const sal_Int32 nActive = getSelIndex();
543 : :
544 : 0 : if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
545 : : {
546 : 0 : TEntry_Impl pEntry = GetEntryData( nActive );
547 : 0 : m_pParent->removePackage( pEntry->m_xPackage );
548 : : }
549 : :
550 : 0 : return 1;
551 : : }
552 : :
553 : : //------------------------------------------------------------------------------
554 : : // DialogHelper
555 : : //------------------------------------------------------------------------------
556 : 0 : DialogHelper::DialogHelper( const uno::Reference< uno::XComponentContext > &xContext,
557 : : Dialog *pWindow ) :
558 : : m_pVCLWindow( pWindow ),
559 : : m_nEventID( 0 ),
560 : 0 : m_bIsBusy( false )
561 : : {
562 : 0 : m_xContext = xContext;
563 : 0 : }
564 : :
565 : : //------------------------------------------------------------------------------
566 : 0 : DialogHelper::~DialogHelper()
567 : : {
568 : 0 : if ( m_nEventID )
569 : 0 : Application::RemoveUserEvent( m_nEventID );
570 : 0 : }
571 : :
572 : : //------------------------------------------------------------------------------
573 : 0 : ResId DialogHelper::getResId( sal_uInt16 nId )
574 : : {
575 : 0 : const SolarMutexGuard guard;
576 : 0 : return ResId( nId, *DeploymentGuiResMgr::get() );
577 : : }
578 : :
579 : : //------------------------------------------------------------------------------
580 : 0 : String DialogHelper::getResourceString( sal_uInt16 id )
581 : : {
582 : 0 : const SolarMutexGuard guard;
583 : 0 : String ret( ResId( id, *DeploymentGuiResMgr::get() ) );
584 : 0 : if (ret.SearchAscii( "%PRODUCTNAME" ) != STRING_NOTFOUND) {
585 : : ret.SearchAndReplaceAllAscii(
586 : 0 : "%PRODUCTNAME", utl::ConfigManager::getProductName() );
587 : : }
588 : 0 : return ret;
589 : : }
590 : :
591 : : //------------------------------------------------------------------------------
592 : 0 : bool DialogHelper::IsSharedPkgMgr( const uno::Reference< deployment::XPackage > &xPackage )
593 : : {
594 : 0 : if ( xPackage->getRepositoryName().equals( SHARED_PACKAGE_MANAGER ) )
595 : 0 : return true;
596 : : else
597 : 0 : return false;
598 : : }
599 : :
600 : : //------------------------------------------------------------------------------
601 : 0 : bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment::XPackage > &xPackage,
602 : : Window *pParent,
603 : : const sal_uInt16 nResID,
604 : : bool &bHadWarning )
605 : : {
606 : 0 : if ( !bHadWarning && IsSharedPkgMgr( xPackage ) )
607 : : {
608 : 0 : const SolarMutexGuard guard;
609 : 0 : WarningBox aInfoBox( pParent, getResId( nResID ) );
610 : 0 : String aMsgText = aInfoBox.GetMessText();
611 : : aMsgText.SearchAndReplaceAllAscii(
612 : 0 : "%PRODUCTNAME", utl::ConfigManager::getProductName() );
613 : 0 : aInfoBox.SetMessText( aMsgText );
614 : :
615 : 0 : bHadWarning = true;
616 : :
617 : 0 : if ( RET_OK == aInfoBox.Execute() )
618 : 0 : return true;
619 : : else
620 : 0 : return false;
621 : : }
622 : : else
623 : 0 : return true;
624 : : }
625 : :
626 : : //------------------------------------------------------------------------------
627 : 0 : void DialogHelper::openWebBrowser( const OUString & sURL, const OUString &sTitle ) const
628 : : {
629 : 0 : if ( sURL.isEmpty() ) // Nothing to do, when the URL is empty
630 : 0 : return;
631 : :
632 : : try
633 : : {
634 : : uno::Reference< XSystemShellExecute > xSystemShellExecute(
635 : 0 : m_xContext->getServiceManager()->createInstanceWithContext( OUSTR( "com.sun.star.system.SystemShellExecute" ), m_xContext), uno::UNO_QUERY_THROW);
636 : : //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException
637 : 0 : xSystemShellExecute->execute( sURL, OUString(), SystemShellExecuteFlags::URIS_ONLY );
638 : : }
639 : 0 : catch ( const uno::Exception& )
640 : : {
641 : 0 : uno::Any exc( ::cppu::getCaughtException() );
642 : 0 : OUString msg( ::comphelper::anyToString( exc ) );
643 : 0 : const SolarMutexGuard guard;
644 : 0 : ErrorBox aErrorBox( NULL, WB_OK, msg );
645 : 0 : aErrorBox.SetText( sTitle );
646 : 0 : aErrorBox.Execute();
647 : : }
648 : : }
649 : :
650 : : //------------------------------------------------------------------------------
651 : 0 : bool DialogHelper::installExtensionWarn( const OUString &rExtensionName ) const
652 : : {
653 : 0 : const SolarMutexGuard guard;
654 : 0 : WarningBox aInfo( m_pVCLWindow, getResId( RID_WARNINGBOX_INSTALL_EXTENSION ) );
655 : :
656 : 0 : String sText( aInfo.GetMessText() );
657 : 0 : sText.SearchAndReplaceAllAscii( "%NAME", rExtensionName );
658 : 0 : aInfo.SetMessText( sText );
659 : :
660 : 0 : return ( RET_OK == aInfo.Execute() );
661 : : }
662 : :
663 : : //------------------------------------------------------------------------------
664 : 0 : bool DialogHelper::installForAllUsers( bool &bInstallForAll ) const
665 : : {
666 : 0 : const SolarMutexGuard guard;
667 : 0 : QueryBox aQuery( m_pVCLWindow, getResId( RID_QUERYBOX_INSTALL_FOR_ALL ) );
668 : :
669 : 0 : String sMsgText = aQuery.GetMessText();
670 : : sMsgText.SearchAndReplaceAllAscii(
671 : 0 : "%PRODUCTNAME", utl::ConfigManager::getProductName() );
672 : 0 : aQuery.SetMessText( sMsgText );
673 : :
674 : 0 : sal_uInt16 nYesBtnID = aQuery.GetButtonId( 0 );
675 : 0 : sal_uInt16 nNoBtnID = aQuery.GetButtonId( 1 );
676 : :
677 : 0 : if ( nYesBtnID != BUTTONDIALOG_BUTTON_NOTFOUND )
678 : 0 : aQuery.SetButtonText( nYesBtnID, getResourceString( RID_STR_INSTALL_FOR_ME ) );
679 : 0 : if ( nNoBtnID != BUTTONDIALOG_BUTTON_NOTFOUND )
680 : 0 : aQuery.SetButtonText( nNoBtnID, getResourceString( RID_STR_INSTALL_FOR_ALL ) );
681 : :
682 : 0 : short nRet = aQuery.Execute();
683 : :
684 : 0 : if ( nRet == RET_CANCEL )
685 : 0 : return false;
686 : :
687 : 0 : bInstallForAll = ( nRet == RET_NO );
688 : 0 : return true;
689 : : }
690 : :
691 : : //------------------------------------------------------------------------------
692 : 0 : void DialogHelper::PostUserEvent( const Link& rLink, void* pCaller )
693 : : {
694 : 0 : if ( m_nEventID )
695 : 0 : Application::RemoveUserEvent( m_nEventID );
696 : :
697 : 0 : m_nEventID = Application::PostUserEvent( rLink, pCaller );
698 : 0 : }
699 : :
700 : : //------------------------------------------------------------------------------
701 : : // ExtMgrDialog
702 : : //------------------------------------------------------------------------------
703 : 0 : ExtMgrDialog::ExtMgrDialog( Window *pParent, TheExtensionManager *pManager ) :
704 : : ModelessDialog( pParent, getResId( RID_DLG_EXTENSION_MANAGER ) ),
705 : : DialogHelper( pManager->getContext(), (Dialog*) this ),
706 : : m_aAddBtn( this, getResId( RID_EM_BTN_ADD ) ),
707 : : m_aUpdateBtn( this, getResId( RID_EM_BTN_CHECK_UPDATES ) ),
708 : : m_aCloseBtn( this, getResId( RID_EM_BTN_CLOSE ) ),
709 : : m_aHelpBtn( this, getResId( RID_EM_BTN_HELP ) ),
710 : : m_aDivider( this ),
711 : : m_aDivider2(this),
712 : : m_aTypeOfExtTxt( this , getResId( RID_EM_FT_TYPE_EXTENSIONS ) ),
713 : : m_aBundledCbx(this, getResId (RID_EM_CBX_BUNDLED)),
714 : : m_aSharedCbx(this, getResId (RID_EM_CBX_SHARED)),
715 : : m_aUserCbx (this, getResId (RID_EM_CBX_USER)),
716 : : m_aGetExtensions( this, getResId( RID_EM_FT_GET_EXTENSIONS ) ),
717 : : m_aProgressText( this, getResId( RID_EM_FT_PROGRESS ) ),
718 : : m_aProgressBar( this, WB_BORDER + WB_3DLOOK ),
719 : : m_aCancelBtn( this, getResId( RID_EM_BTN_CANCEL ) ),
720 : : m_sAddPackages( getResourceString( RID_STR_ADD_PACKAGES ) ),
721 : : m_bHasProgress( false ),
722 : : m_bProgressChanged( false ),
723 : : m_bStartProgress( false ),
724 : : m_bStopProgress( false ),
725 : : m_bUpdateWarning( false ),
726 : : m_bEnableWarning( false ),
727 : : m_bDisableWarning( false ),
728 : : m_bDeleteWarning( false ),
729 : : m_nProgress( 0 ),
730 : 0 : m_pManager( pManager )
731 : : {
732 : : // free local resources (RID < 256):
733 : 0 : FreeResource();
734 : :
735 : 0 : m_pExtensionBox = new ExtBoxWithBtns_Impl( this, pManager );
736 : 0 : m_pExtensionBox->SetHyperlinkHdl( LINK( this, ExtMgrDialog, HandleHyperlink ) );
737 : :
738 : 0 : m_aAddBtn.SetClickHdl( LINK( this, ExtMgrDialog, HandleAddBtn ) );
739 : 0 : m_aUpdateBtn.SetClickHdl( LINK( this, ExtMgrDialog, HandleUpdateBtn ) );
740 : 0 : m_aGetExtensions.SetClickHdl( LINK( this, ExtMgrDialog, HandleHyperlink ) );
741 : 0 : m_aCancelBtn.SetClickHdl( LINK( this, ExtMgrDialog, HandleCancelBtn ) );
742 : :
743 : 0 : m_aBundledCbx.SetClickHdl( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
744 : 0 : m_aSharedCbx.SetClickHdl( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
745 : 0 : m_aUserCbx.SetClickHdl( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
746 : :
747 : : // resize update button
748 : 0 : Size aBtnSize = m_aUpdateBtn.GetSizePixel();
749 : 0 : String sTitle = m_aUpdateBtn.GetText();
750 : 0 : long nWidth = m_aUpdateBtn.GetCtrlTextWidth( sTitle );
751 : 0 : nWidth += 2 * m_aUpdateBtn.GetTextHeight();
752 : 0 : if ( nWidth > aBtnSize.Width() )
753 : 0 : m_aUpdateBtn.SetSizePixel( Size( nWidth, aBtnSize.Height() ) );
754 : :
755 : : // minimum size:
756 : : SetMinOutputSizePixel(
757 : : Size( // width:
758 : 0 : (3 * m_aHelpBtn.GetSizePixel().Width()) +
759 : 0 : m_aUpdateBtn.GetSizePixel().Width() +
760 : : (5 * RSC_SP_DLG_INNERBORDER_LEFT ),
761 : : // height:
762 : 0 : (1 * m_aHelpBtn.GetSizePixel().Height()) +
763 : 0 : (1 * m_aGetExtensions.GetSizePixel().Height()) +
764 : 0 : (1 * m_pExtensionBox->GetMinOutputSizePixel().Height()) +
765 : 0 : (3 * RSC_SP_DLG_INNERBORDER_TOP) ) );
766 : :
767 : 0 : m_aDivider.Show();
768 : 0 : m_aDivider2.Show();
769 : :
770 : 0 : m_aBundledCbx.Check( true );
771 : 0 : m_aSharedCbx.Check( true );
772 : 0 : m_aUserCbx.Check( true );
773 : :
774 : 0 : m_aProgressBar.Hide();
775 : :
776 : 0 : m_aUpdateBtn.Enable( false );
777 : :
778 : 0 : m_aTimeoutTimer.SetTimeout( 500 ); // mSec
779 : 0 : m_aTimeoutTimer.SetTimeoutHdl( LINK( this, ExtMgrDialog, TimeOutHdl ) );
780 : 0 : }
781 : :
782 : : //------------------------------------------------------------------------------
783 : 0 : ExtMgrDialog::~ExtMgrDialog()
784 : : {
785 : 0 : m_aTimeoutTimer.Stop();
786 : 0 : delete m_pExtensionBox;
787 : 0 : }
788 : :
789 : : //------------------------------------------------------------------------------
790 : 0 : void ExtMgrDialog::setGetExtensionsURL( const ::rtl::OUString &rURL )
791 : : {
792 : 0 : m_aGetExtensions.SetURL( rURL );
793 : 0 : }
794 : :
795 : : //------------------------------------------------------------------------------
796 : 0 : long ExtMgrDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage,
797 : : bool bLicenseMissing )
798 : : {
799 : :
800 : 0 : const SolarMutexGuard aGuard;
801 : 0 : m_aUpdateBtn.Enable( true );
802 : :
803 : 0 : m_pExtensionBox->removeEntry(xPackage);
804 : :
805 : 0 : if (m_aBundledCbx.IsChecked() && xPackage->getRepositoryName().equals( BUNDLED_PACKAGE_MANAGER ))
806 : : {
807 : 0 : return m_pExtensionBox->addEntry( xPackage, bLicenseMissing );
808 : : }
809 : 0 : else if (m_aSharedCbx.IsChecked() && xPackage->getRepositoryName().equals( SHARED_PACKAGE_MANAGER ))
810 : : {
811 : 0 : return m_pExtensionBox->addEntry( xPackage, bLicenseMissing );
812 : : }
813 : 0 : else if (m_aUserCbx.IsChecked() && xPackage->getRepositoryName().equals( USER_PACKAGE_MANAGER ))
814 : : {
815 : 0 : return m_pExtensionBox->addEntry( xPackage, bLicenseMissing );
816 : : }
817 : : else
818 : : {
819 : : //OSL_FAIL("Package will not be displayed");
820 : 0 : return 0;
821 : 0 : }
822 : : }
823 : :
824 : : //------------------------------------------------------------------------------
825 : 0 : void ExtMgrDialog::prepareChecking()
826 : : {
827 : 0 : m_pExtensionBox->prepareChecking();
828 : 0 : }
829 : :
830 : : //------------------------------------------------------------------------------
831 : 0 : void ExtMgrDialog::checkEntries()
832 : : {
833 : 0 : const SolarMutexGuard guard;
834 : 0 : m_pExtensionBox->checkEntries();
835 : 0 : }
836 : :
837 : : //------------------------------------------------------------------------------
838 : 0 : bool ExtMgrDialog::removeExtensionWarn( const OUString &rExtensionName ) const
839 : : {
840 : 0 : const SolarMutexGuard guard;
841 : 0 : WarningBox aInfo( const_cast< ExtMgrDialog* >(this), getResId( RID_WARNINGBOX_REMOVE_EXTENSION ) );
842 : :
843 : 0 : String sText( aInfo.GetMessText() );
844 : 0 : sText.SearchAndReplaceAllAscii( "%NAME", rExtensionName );
845 : 0 : aInfo.SetMessText( sText );
846 : :
847 : 0 : return ( RET_OK == aInfo.Execute() );
848 : : }
849 : :
850 : : //------------------------------------------------------------------------------
851 : 0 : bool ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackage > &xPackage,
852 : : bool bEnable )
853 : : {
854 : 0 : if ( !xPackage.is() )
855 : 0 : return false;
856 : :
857 : 0 : if ( bEnable )
858 : : {
859 : 0 : if ( ! continueOnSharedExtension( xPackage, this, RID_WARNINGBOX_ENABLE_SHARED_EXTENSION, m_bEnableWarning ) )
860 : 0 : return false;
861 : : }
862 : : else
863 : : {
864 : 0 : if ( ! continueOnSharedExtension( xPackage, this, RID_WARNINGBOX_DISABLE_SHARED_EXTENSION, m_bDisableWarning ) )
865 : 0 : return false;
866 : : }
867 : :
868 : 0 : m_pManager->getCmdQueue()->enableExtension( xPackage, bEnable );
869 : :
870 : 0 : return true;
871 : : }
872 : :
873 : : //------------------------------------------------------------------------------
874 : 0 : bool ExtMgrDialog::removePackage( const uno::Reference< deployment::XPackage > &xPackage )
875 : : {
876 : 0 : if ( !xPackage.is() )
877 : 0 : return false;
878 : :
879 : 0 : if ( !IsSharedPkgMgr( xPackage ) || m_bDeleteWarning )
880 : : {
881 : 0 : if ( ! removeExtensionWarn( xPackage->getDisplayName() ) )
882 : 0 : return false;
883 : : }
884 : :
885 : 0 : if ( ! continueOnSharedExtension( xPackage, this, RID_WARNINGBOX_REMOVE_SHARED_EXTENSION, m_bDeleteWarning ) )
886 : 0 : return false;
887 : :
888 : 0 : m_pManager->getCmdQueue()->removeExtension( xPackage );
889 : :
890 : 0 : return true;
891 : : }
892 : :
893 : : //------------------------------------------------------------------------------
894 : 0 : bool ExtMgrDialog::updatePackage( const uno::Reference< deployment::XPackage > &xPackage )
895 : : {
896 : 0 : if ( !xPackage.is() )
897 : 0 : return false;
898 : :
899 : : // get the extension with highest version
900 : : uno::Sequence<uno::Reference<deployment::XPackage> > seqExtensions =
901 : 0 : m_pManager->getExtensionManager()->getExtensionsWithSameIdentifier(
902 : 0 : dp_misc::getIdentifier(xPackage), xPackage->getName(), uno::Reference<ucb::XCommandEnvironment>());
903 : : uno::Reference<deployment::XPackage> extension =
904 : 0 : dp_misc::getExtensionWithHighestVersion(seqExtensions);
905 : : OSL_ASSERT(extension.is());
906 : 0 : std::vector< css::uno::Reference< css::deployment::XPackage > > vEntries;
907 : 0 : vEntries.push_back(extension);
908 : :
909 : 0 : m_pManager->getCmdQueue()->checkForUpdates( vEntries );
910 : :
911 : 0 : return true;
912 : : }
913 : :
914 : : //------------------------------------------------------------------------------
915 : 0 : bool ExtMgrDialog::acceptLicense( const uno::Reference< deployment::XPackage > &xPackage )
916 : : {
917 : 0 : if ( !xPackage.is() )
918 : 0 : return false;
919 : :
920 : 0 : m_pManager->getCmdQueue()->acceptLicense( xPackage );
921 : :
922 : 0 : return true;
923 : : }
924 : :
925 : : //------------------------------------------------------------------------------
926 : 0 : uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker()
927 : : {
928 : 0 : const uno::Any mode( static_cast< sal_Int16 >( ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE ) );
929 : 0 : const uno::Reference< uno::XComponentContext > xContext( m_pManager->getContext() );
930 : : const uno::Reference< ui::dialogs::XFilePicker > xFilePicker(
931 : 0 : xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
932 : : OUSTR("com.sun.star.ui.dialogs.FilePicker"),
933 : 0 : uno::Sequence< uno::Any >( &mode, 1 ), xContext ), uno::UNO_QUERY_THROW );
934 : 0 : xFilePicker->setTitle( m_sAddPackages );
935 : :
936 : 0 : if ( m_sLastFolderURL.Len() )
937 : 0 : xFilePicker->setDisplayDirectory( m_sLastFolderURL );
938 : :
939 : : // collect and set filter list:
940 : : typedef ::std::map< OUString, OUString > t_string2string;
941 : 0 : t_string2string title2filter;
942 : 0 : OUString sDefaultFilter( StrAllFiles::get() );
943 : :
944 : : const uno::Sequence< uno::Reference< deployment::XPackageTypeInfo > > packageTypes(
945 : 0 : m_pManager->getExtensionManager()->getSupportedPackageTypes() );
946 : :
947 : 0 : for ( sal_Int32 pos = 0; pos < packageTypes.getLength(); ++pos )
948 : : {
949 : 0 : uno::Reference< deployment::XPackageTypeInfo > const & xPackageType = packageTypes[ pos ];
950 : 0 : const OUString filter( xPackageType->getFileFilter() );
951 : 0 : if (!filter.isEmpty())
952 : : {
953 : 0 : const OUString title( xPackageType->getShortDescription() );
954 : : const ::std::pair< t_string2string::iterator, bool > insertion(
955 : 0 : title2filter.insert( t_string2string::value_type( title, filter ) ) );
956 : 0 : if ( ! insertion.second )
957 : : { // already existing, append extensions:
958 : 0 : ::rtl::OUStringBuffer buf;
959 : 0 : buf.append( insertion.first->second );
960 : 0 : buf.append( static_cast<sal_Unicode>(';') );
961 : 0 : buf.append( filter );
962 : 0 : insertion.first->second = buf.makeStringAndClear();
963 : : }
964 : 0 : if ( xPackageType->getMediaType() == OUSTR( "application/vnd.sun.star.package-bundle" ) )
965 : 0 : sDefaultFilter = title;
966 : : }
967 : 0 : }
968 : :
969 : 0 : const uno::Reference< ui::dialogs::XFilterManager > xFilterManager( xFilePicker, uno::UNO_QUERY_THROW );
970 : : // All files at top:
971 : 0 : xFilterManager->appendFilter( StrAllFiles::get(), OUSTR("*.*") );
972 : : // then supported ones:
973 : 0 : t_string2string::const_iterator iPos( title2filter.begin() );
974 : 0 : const t_string2string::const_iterator iEnd( title2filter.end() );
975 : 0 : for ( ; iPos != iEnd; ++iPos ) {
976 : : try {
977 : 0 : xFilterManager->appendFilter( iPos->first, iPos->second );
978 : : }
979 : 0 : catch (const lang::IllegalArgumentException & exc) {
980 : : OSL_FAIL( ::rtl::OUStringToOString(
981 : : exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
982 : : (void) exc;
983 : : }
984 : : }
985 : 0 : xFilterManager->setCurrentFilter( sDefaultFilter );
986 : :
987 : 0 : if ( xFilePicker->execute() != ui::dialogs::ExecutableDialogResults::OK )
988 : 0 : return uno::Sequence<OUString>(); // cancelled
989 : :
990 : 0 : m_sLastFolderURL = xFilePicker->getDisplayDirectory();
991 : 0 : uno::Sequence< OUString > files( xFilePicker->getFiles() );
992 : : OSL_ASSERT( files.getLength() > 0 );
993 : 0 : return files;
994 : : }
995 : :
996 : : //------------------------------------------------------------------------------
997 : 0 : IMPL_LINK_NOARG(ExtMgrDialog, HandleCancelBtn)
998 : : {
999 : 0 : if ( m_xAbortChannel.is() )
1000 : : {
1001 : : try
1002 : : {
1003 : 0 : m_xAbortChannel->sendAbort();
1004 : : }
1005 : 0 : catch ( const uno::RuntimeException & )
1006 : : {
1007 : : OSL_FAIL( "### unexpected RuntimeException!" );
1008 : : }
1009 : : }
1010 : 0 : return 1;
1011 : : }
1012 : :
1013 : : // ------------------------------------------------------------------------------
1014 : 0 : IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface )
1015 : : {
1016 : 0 : ::osl::MutexGuard aGuard( m_aMutex );
1017 : 0 : bool bLockInterface = (bool) _bLockInterface;
1018 : :
1019 : 0 : if ( m_bStartProgress && !m_bHasProgress )
1020 : 0 : m_aTimeoutTimer.Start();
1021 : :
1022 : 0 : if ( m_bStopProgress )
1023 : : {
1024 : 0 : if ( m_aProgressBar.IsVisible() )
1025 : 0 : m_aProgressBar.SetValue( 100 );
1026 : 0 : m_xAbortChannel.clear();
1027 : :
1028 : : OSL_TRACE( " startProgress handler: stop" );
1029 : : }
1030 : : else
1031 : : {
1032 : : OSL_TRACE( " startProgress handler: start" );
1033 : : }
1034 : :
1035 : 0 : m_aCancelBtn.Enable( bLockInterface );
1036 : 0 : m_aAddBtn.Enable( !bLockInterface );
1037 : 0 : m_aUpdateBtn.Enable( !bLockInterface && m_pExtensionBox->getItemCount() );
1038 : 0 : m_pExtensionBox->enableButtons( !bLockInterface );
1039 : :
1040 : 0 : clearEventID();
1041 : :
1042 : 0 : return 0;
1043 : : }
1044 : :
1045 : : // ------------------------------------------------------------------------------
1046 : 0 : void ExtMgrDialog::showProgress( bool _bStart )
1047 : : {
1048 : 0 : ::osl::MutexGuard aGuard( m_aMutex );
1049 : :
1050 : 0 : bool bStart = _bStart;
1051 : :
1052 : 0 : if ( bStart )
1053 : : {
1054 : 0 : m_nProgress = 0;
1055 : 0 : m_bStartProgress = true;
1056 : : OSL_TRACE( "showProgress start" );
1057 : : }
1058 : : else
1059 : : {
1060 : 0 : m_nProgress = 100;
1061 : 0 : m_bStopProgress = true;
1062 : : OSL_TRACE( "showProgress stop!" );
1063 : : }
1064 : :
1065 : 0 : DialogHelper::PostUserEvent( LINK( this, ExtMgrDialog, startProgress ), (void*) bStart );
1066 : 0 : }
1067 : :
1068 : : // -----------------------------------------------------------------------
1069 : 0 : void ExtMgrDialog::updateProgress( const long nProgress )
1070 : : {
1071 : 0 : ::osl::MutexGuard aGuard( m_aMutex );
1072 : :
1073 : 0 : m_nProgress = nProgress;
1074 : 0 : }
1075 : :
1076 : : // -----------------------------------------------------------------------
1077 : 0 : void ExtMgrDialog::updateProgress( const OUString &rText,
1078 : : const uno::Reference< task::XAbortChannel > &xAbortChannel)
1079 : : {
1080 : 0 : ::osl::MutexGuard aGuard( m_aMutex );
1081 : :
1082 : 0 : m_xAbortChannel = xAbortChannel;
1083 : 0 : m_sProgressText = rText;
1084 : 0 : m_bProgressChanged = true;
1085 : 0 : }
1086 : :
1087 : : //------------------------------------------------------------------------------
1088 : 0 : void ExtMgrDialog::updatePackageInfo( const uno::Reference< deployment::XPackage > &xPackage )
1089 : : {
1090 : 0 : const SolarMutexGuard aGuard;
1091 : 0 : m_pExtensionBox->updateEntry( xPackage );
1092 : 0 : }
1093 : :
1094 : : // -----------------------------------------------------------------------
1095 : 0 : IMPL_LINK_NOARG(ExtMgrDialog, HandleAddBtn)
1096 : : {
1097 : 0 : setBusy( true );
1098 : :
1099 : 0 : uno::Sequence< OUString > aFileList = raiseAddPicker();
1100 : :
1101 : 0 : if ( aFileList.getLength() )
1102 : : {
1103 : 0 : m_pManager->installPackage( aFileList[0] );
1104 : : }
1105 : :
1106 : 0 : setBusy( false );
1107 : 0 : return 1;
1108 : : }
1109 : :
1110 : : // -----------------------------------------------------------------------
1111 : 0 : IMPL_LINK_NOARG(ExtMgrDialog, HandleExtTypeCbx)
1112 : : {
1113 : : // re-creates the list of packages with addEntry selecting the packages
1114 : 0 : m_pManager->createPackageList();
1115 : 0 : return 1;
1116 : : }
1117 : : // -----------------------------------------------------------------------
1118 : 0 : IMPL_LINK_NOARG(ExtMgrDialog, HandleUpdateBtn)
1119 : : {
1120 : 0 : m_pManager->checkUpdates( false, true );
1121 : :
1122 : 0 : return 1;
1123 : : }
1124 : :
1125 : : // -----------------------------------------------------------------------
1126 : 0 : IMPL_LINK( ExtMgrDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink )
1127 : : {
1128 : 0 : openWebBrowser( pHyperlink->GetURL(), GetText() );
1129 : :
1130 : 0 : return 1;
1131 : : }
1132 : :
1133 : : // -----------------------------------------------------------------------
1134 : 0 : IMPL_LINK_NOARG(ExtMgrDialog, TimeOutHdl)
1135 : : {
1136 : 0 : if ( m_bStopProgress )
1137 : : {
1138 : 0 : m_bHasProgress = false;
1139 : 0 : m_bStopProgress = false;
1140 : 0 : m_aProgressText.Hide();
1141 : 0 : m_aProgressBar.Hide();
1142 : 0 : m_aCancelBtn.Hide();
1143 : : }
1144 : : else
1145 : : {
1146 : 0 : if ( m_bProgressChanged )
1147 : : {
1148 : 0 : m_bProgressChanged = false;
1149 : 0 : m_aProgressText.SetText( m_sProgressText );
1150 : : }
1151 : :
1152 : 0 : if ( m_bStartProgress )
1153 : : {
1154 : 0 : m_bStartProgress = false;
1155 : 0 : m_bHasProgress = true;
1156 : 0 : m_aProgressBar.Show();
1157 : 0 : m_aProgressText.Show();
1158 : 0 : m_aCancelBtn.Enable();
1159 : 0 : m_aCancelBtn.Show();
1160 : : }
1161 : :
1162 : 0 : if ( m_aProgressBar.IsVisible() )
1163 : 0 : m_aProgressBar.SetValue( (sal_uInt16) m_nProgress );
1164 : :
1165 : 0 : m_aTimeoutTimer.Start();
1166 : : }
1167 : :
1168 : 0 : return 1;
1169 : : }
1170 : :
1171 : : //------------------------------------------------------------------------------
1172 : : // VCL::Window / Dialog
1173 : 0 : void ExtMgrDialog::Resize()
1174 : : {
1175 : 0 : Size aTotalSize( GetOutputSizePixel() );
1176 : 0 : Size aBtnSize( m_aHelpBtn.GetSizePixel() );
1177 : 0 : Size aUpdBtnSize( m_aUpdateBtn.GetSizePixel() );
1178 : : long offsetX;
1179 : :
1180 : : // last row of the box, lower 4 buttons
1181 : :
1182 : : Point aPos( RSC_SP_DLG_INNERBORDER_LEFT,
1183 : 0 : aTotalSize.Height() - RSC_SP_DLG_INNERBORDER_BOTTOM - aBtnSize.Height() );
1184 : :
1185 : 0 : m_aHelpBtn.SetPosPixel( aPos );
1186 : :
1187 : 0 : aPos.X() = aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_RIGHT - aBtnSize.Width();
1188 : 0 : m_aCloseBtn.SetPosPixel( aPos );
1189 : :
1190 : 0 : aPos.X() -= ( RSC_SP_CTRL_X + aUpdBtnSize.Width() );
1191 : 0 : m_aUpdateBtn.SetPosPixel( aPos );
1192 : :
1193 : 0 : aPos.X() -= ( RSC_SP_CTRL_GROUP_X + aBtnSize.Width() );
1194 : 0 : m_aAddBtn.SetPosPixel( aPos );
1195 : :
1196 : : // horizontal line above lower buttons
1197 : :
1198 : 0 : Size aDivSize( aTotalSize.Width(), LINE_SIZE );
1199 : 0 : aPos = Point( 0, aPos.Y() - LINE_SIZE - RSC_SP_DLG_INNERBORDER_BOTTOM );
1200 : 0 : m_aDivider.SetPosSizePixel( aPos, aDivSize );
1201 : :
1202 : : // text "get more extensions"
1203 : :
1204 : 0 : Size aFTSize( m_aGetExtensions.CalcMinimumSize() );
1205 : : // aPos = Point( RSC_SP_DLG_INNERBORDER_LEFT, aPos.Y() - RSC_CD_FIXEDTEXT_HEIGHT - 2*RSC_SP_DLG_INNERBORDER_BOTTOM );
1206 : 0 : aPos = Point( RSC_SP_DLG_INNERBORDER_LEFT, aPos.Y() - RSC_CD_PUSHBUTTON_HEIGHT - 2*RSC_SP_DLG_INNERBORDER_BOTTOM );
1207 : :
1208 : 0 : m_aGetExtensions.SetPosSizePixel( aPos, aFTSize );
1209 : :
1210 : : // installation progress bar + cancel button , on the right of the text to get extensions
1211 : :
1212 : 0 : aPos.X() = aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_RIGHT - aBtnSize.Width();
1213 : 0 : m_aCancelBtn.SetPosPixel( Point( aPos.X(), aPos.Y() - ((aBtnSize.Height()-aFTSize.Height())/2) ) );
1214 : :
1215 : : // Calc progress height
1216 : 0 : long nProgressHeight = aFTSize.Height();
1217 : :
1218 : 0 : if( IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) )
1219 : : {
1220 : 0 : ImplControlValue aValue;
1221 : 0 : Rectangle aControlRegion( Point( 0, 0 ), m_aProgressBar.GetSizePixel() );
1222 : 0 : Rectangle aNativeControlRegion, aNativeContentRegion;
1223 : 0 : if( GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
1224 : : CTRL_STATE_ENABLED, aValue, rtl::OUString(),
1225 : 0 : aNativeControlRegion, aNativeContentRegion ) != sal_False )
1226 : : {
1227 : 0 : nProgressHeight = aNativeControlRegion.GetHeight();
1228 : 0 : }
1229 : : }
1230 : :
1231 : 0 : if ( nProgressHeight < PROGRESS_HEIGHT )
1232 : 0 : nProgressHeight = PROGRESS_HEIGHT;
1233 : :
1234 : 0 : aPos.X() -= ( RSC_SP_CTRL_GROUP_Y + PROGRESS_WIDTH );
1235 : 0 : m_aProgressBar.SetPosSizePixel( Point( aPos.X(), aPos.Y() - ((nProgressHeight-aFTSize.Height())/2) ),
1236 : 0 : Size( PROGRESS_WIDTH, nProgressHeight ) );
1237 : :
1238 : 0 : Rectangle aRect1( m_aGetExtensions.GetPosPixel(), m_aGetExtensions.GetSizePixel() );
1239 : 0 : Rectangle aRect2( m_aProgressBar.GetPosPixel(), m_aProgressBar.GetSizePixel() );
1240 : :
1241 : 0 : aFTSize.Width() = ( aRect2.Left() - aRect1.Right() ) - 2*RSC_SP_DLG_INNERBORDER_LEFT;
1242 : 0 : aPos.X() = aRect1.Right() + RSC_SP_DLG_INNERBORDER_LEFT;
1243 : 0 : m_aProgressText.SetPosSizePixel( aPos, aFTSize );
1244 : :
1245 : : // checkboxes + text "type of extensions"
1246 : :
1247 : 0 : long nWidth = m_aBundledCbx.GetCtrlTextWidth( m_aBundledCbx.GetText() );
1248 : 0 : Size aBCBSize(m_aBundledCbx.GetSizePixel());
1249 : 0 : aBCBSize.Width() = nWidth + 30;
1250 : 0 : m_aBundledCbx.SetSizePixel( aBCBSize );
1251 : :
1252 : 0 : nWidth = m_aSharedCbx.GetCtrlTextWidth( m_aSharedCbx.GetText() );
1253 : 0 : Size aSCBSize(m_aSharedCbx.GetSizePixel());
1254 : 0 : aSCBSize.Width() = nWidth + 30;
1255 : 0 : m_aSharedCbx.SetSizePixel( aSCBSize );
1256 : :
1257 : 0 : nWidth = m_aUserCbx.GetCtrlTextWidth( m_aUserCbx.GetText() );
1258 : 0 : Size aUCBSize(m_aUserCbx.GetSizePixel());
1259 : 0 : aUCBSize.Width() = nWidth + 30;
1260 : 0 : m_aUserCbx.SetSizePixel( aUCBSize );
1261 : :
1262 : 0 : offsetX = 0.5*(aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_LEFT - RSC_SP_DLG_INNERBORDER_RIGHT - 3*RSC_SP_CTRL_GROUP_X - aBCBSize.Width() - aSCBSize.Width() - aUCBSize.Width() );
1263 : :
1264 : 0 : aPos = Point(offsetX, aPos.Y() - RSC_CD_CHECKBOX_HEIGHT - 2*RSC_SP_DLG_INNERBORDER_BOTTOM);
1265 : 0 : m_aBundledCbx.SetPosPixel( aPos );
1266 : 0 : aPos.X() += aBCBSize.Width() + 3 * RSC_SP_CTRL_GROUP_X;
1267 : 0 : m_aSharedCbx.SetPosPixel( aPos );
1268 : 0 : aPos.X() += aSCBSize.Width() + 3 * RSC_SP_CTRL_GROUP_X;
1269 : 0 : m_aUserCbx.SetPosPixel( aPos );
1270 : :
1271 : 0 : Size aFTTypeOfExtSize(m_aTypeOfExtTxt.GetSizePixel());
1272 : 0 : aPos = Point(RSC_SP_DLG_INNERBORDER_LEFT , aPos.Y() - RSC_CD_FIXEDTEXT_HEIGHT - 2*RSC_SP_DLG_INNERBORDER_BOTTOM);
1273 : :
1274 : 0 : m_aTypeOfExtTxt.SetPosSizePixel(aPos, aFTTypeOfExtSize);
1275 : :
1276 : 0 : aPos.X() = RSC_SP_DLG_INNERBORDER_LEFT + aFTTypeOfExtSize.Width();
1277 : 0 : aPos.Y() = aPos.Y() + RSC_CD_FIXEDTEXT_HEIGHT;
1278 : 0 : aDivSize.Width() = aTotalSize.Width() - aFTTypeOfExtSize.Width() - RSC_SP_DLG_INNERBORDER_LEFT - RSC_SP_DLG_INNERBORDER_RIGHT;
1279 : 0 : m_aDivider2.SetPosSizePixel( aPos , aDivSize );
1280 : :
1281 : : // extension listbox
1282 : :
1283 : 0 : Size aSize( aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_LEFT - RSC_SP_DLG_INNERBORDER_RIGHT,
1284 : 0 : aTotalSize.Height() - aBtnSize.Height() - LINE_SIZE - aBtnSize.Height()
1285 : 0 : - aBCBSize.Height() - aFTTypeOfExtSize.Height()
1286 : 0 : - RSC_SP_DLG_INNERBORDER_TOP - 5*RSC_SP_DLG_INNERBORDER_BOTTOM );
1287 : :
1288 : 0 : m_pExtensionBox->SetSizePixel(aSize );
1289 : :
1290 : 0 : }
1291 : : //------------------------------------------------------------------------------
1292 : : // VCL::Window / Dialog
1293 : :
1294 : 0 : long ExtMgrDialog::Notify( NotifyEvent& rNEvt )
1295 : : {
1296 : 0 : bool bHandled = false;
1297 : :
1298 : 0 : if ( rNEvt.GetType() == EVENT_KEYINPUT )
1299 : : {
1300 : 0 : const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
1301 : 0 : KeyCode aKeyCode = pKEvt->GetKeyCode();
1302 : 0 : sal_uInt16 nKeyCode = aKeyCode.GetCode();
1303 : :
1304 : 0 : if ( nKeyCode == KEY_TAB )
1305 : : {
1306 : 0 : if ( aKeyCode.IsShift() ) {
1307 : 0 : if ( m_aAddBtn.HasFocus() ) {
1308 : 0 : m_pExtensionBox->GrabFocus();
1309 : 0 : bHandled = true;
1310 : : }
1311 : : } else {
1312 : 0 : if ( m_aGetExtensions.HasFocus() ) {
1313 : 0 : m_pExtensionBox->GrabFocus();
1314 : 0 : bHandled = true;
1315 : : }
1316 : : }
1317 : : }
1318 : 0 : if ( aKeyCode.GetGroup() == KEYGROUP_CURSOR )
1319 : 0 : bHandled = m_pExtensionBox->Notify( rNEvt );
1320 : : }
1321 : : // VCLEVENT_WINDOW_CLOSE
1322 : 0 : if ( !bHandled )
1323 : 0 : return ModelessDialog::Notify( rNEvt );
1324 : : else
1325 : 0 : return true;
1326 : : }
1327 : :
1328 : : //------------------------------------------------------------------------------
1329 : 0 : sal_Bool ExtMgrDialog::Close()
1330 : : {
1331 : 0 : bool bRet = m_pManager->queryTermination();
1332 : 0 : if ( bRet )
1333 : : {
1334 : 0 : bRet = ModelessDialog::Close();
1335 : 0 : m_pManager->terminateDialog();
1336 : : }
1337 : 0 : return bRet;
1338 : : }
1339 : :
1340 : : //------------------------------------------------------------------------------
1341 : : // UpdateRequiredDialog
1342 : : //------------------------------------------------------------------------------
1343 : 0 : UpdateRequiredDialog::UpdateRequiredDialog( Window *pParent, TheExtensionManager *pManager ) :
1344 : : ModalDialog( pParent, getResId( RID_DLG_UPDATE_REQUIRED ) ),
1345 : : DialogHelper( pManager->getContext(), (Dialog*) this ),
1346 : : m_aUpdateNeeded( this, getResId( RID_EM_FT_MSG ) ),
1347 : : m_aUpdateBtn( this, getResId( RID_EM_BTN_CHECK_UPDATES ) ),
1348 : : m_aCloseBtn( this, getResId( RID_EM_BTN_CLOSE ) ),
1349 : : m_aHelpBtn( this, getResId( RID_EM_BTN_HELP ) ),
1350 : : m_aCancelBtn( this, getResId( RID_EM_BTN_CANCEL ) ),
1351 : : m_aDivider( this ),
1352 : : m_aProgressText( this, getResId( RID_EM_FT_PROGRESS ) ),
1353 : : m_aProgressBar( this, WB_BORDER + WB_3DLOOK ),
1354 : : m_sAddPackages( getResourceString( RID_STR_ADD_PACKAGES ) ),
1355 : : m_sCloseText( getResourceString( RID_STR_CLOSE_BTN ) ),
1356 : : m_bHasProgress( false ),
1357 : : m_bProgressChanged( false ),
1358 : : m_bStartProgress( false ),
1359 : : m_bStopProgress( false ),
1360 : : m_bUpdateWarning( false ),
1361 : : m_bDisableWarning( false ),
1362 : : m_bHasLockedEntries( false ),
1363 : : m_nProgress( 0 ),
1364 : 0 : m_pManager( pManager )
1365 : : {
1366 : : // free local resources (RID < 256):
1367 : 0 : FreeResource();
1368 : :
1369 : 0 : m_pExtensionBox = new ExtensionBox_Impl( this, pManager );
1370 : 0 : m_pExtensionBox->SetHyperlinkHdl( LINK( this, UpdateRequiredDialog, HandleHyperlink ) );
1371 : :
1372 : 0 : m_aUpdateBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleUpdateBtn ) );
1373 : 0 : m_aCloseBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCloseBtn ) );
1374 : 0 : m_aCancelBtn.SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCancelBtn ) );
1375 : :
1376 : 0 : String aText = m_aUpdateNeeded.GetText();
1377 : : aText.SearchAndReplaceAllAscii(
1378 : 0 : "%PRODUCTNAME", utl::ConfigManager::getProductName() );
1379 : 0 : m_aUpdateNeeded.SetText( aText );
1380 : :
1381 : : // resize update button
1382 : 0 : Size aBtnSize = m_aUpdateBtn.GetSizePixel();
1383 : 0 : String sTitle = m_aUpdateBtn.GetText();
1384 : 0 : long nWidth = m_aUpdateBtn.GetCtrlTextWidth( sTitle );
1385 : 0 : nWidth += 2 * m_aUpdateBtn.GetTextHeight();
1386 : 0 : if ( nWidth > aBtnSize.Width() )
1387 : 0 : m_aUpdateBtn.SetSizePixel( Size( nWidth, aBtnSize.Height() ) );
1388 : :
1389 : : // resize update button
1390 : 0 : aBtnSize = m_aCloseBtn.GetSizePixel();
1391 : 0 : sTitle = m_aCloseBtn.GetText();
1392 : 0 : nWidth = m_aCloseBtn.GetCtrlTextWidth( sTitle );
1393 : 0 : nWidth += 2 * m_aCloseBtn.GetTextHeight();
1394 : 0 : if ( nWidth > aBtnSize.Width() )
1395 : 0 : m_aCloseBtn.SetSizePixel( Size( nWidth, aBtnSize.Height() ) );
1396 : :
1397 : : // minimum size:
1398 : : SetMinOutputSizePixel(
1399 : : Size( // width:
1400 : 0 : (5 * m_aHelpBtn.GetSizePixel().Width()) +
1401 : : (5 * RSC_SP_DLG_INNERBORDER_LEFT ),
1402 : : // height:
1403 : 0 : (1 * m_aHelpBtn.GetSizePixel().Height()) +
1404 : 0 : (1 * m_aUpdateNeeded.GetSizePixel().Height()) +
1405 : 0 : (1 * m_pExtensionBox->GetMinOutputSizePixel().Height()) +
1406 : 0 : (3 * RSC_SP_DLG_INNERBORDER_LEFT) ) );
1407 : :
1408 : 0 : m_aDivider.Show();
1409 : 0 : m_aProgressBar.Hide();
1410 : 0 : m_aUpdateBtn.Enable( false );
1411 : 0 : m_aCloseBtn.GrabFocus();
1412 : :
1413 : 0 : m_aTimeoutTimer.SetTimeout( 50 ); // mSec
1414 : 0 : m_aTimeoutTimer.SetTimeoutHdl( LINK( this, UpdateRequiredDialog, TimeOutHdl ) );
1415 : 0 : }
1416 : :
1417 : : //------------------------------------------------------------------------------
1418 : 0 : UpdateRequiredDialog::~UpdateRequiredDialog()
1419 : : {
1420 : 0 : m_aTimeoutTimer.Stop();
1421 : :
1422 : 0 : delete m_pExtensionBox;
1423 : 0 : }
1424 : :
1425 : : //------------------------------------------------------------------------------
1426 : 0 : long UpdateRequiredDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage,
1427 : : bool bLicenseMissing )
1428 : : {
1429 : : // We will only add entries to the list with unsatisfied dependencies
1430 : 0 : if ( !bLicenseMissing && !checkDependencies( xPackage ) )
1431 : : {
1432 : 0 : m_bHasLockedEntries |= m_pManager->isReadOnly( xPackage );
1433 : 0 : const SolarMutexGuard aGuard;
1434 : 0 : m_aUpdateBtn.Enable( true );
1435 : 0 : return m_pExtensionBox->addEntry( xPackage );
1436 : : }
1437 : 0 : return 0;
1438 : : }
1439 : :
1440 : : //------------------------------------------------------------------------------
1441 : 0 : void UpdateRequiredDialog::prepareChecking()
1442 : : {
1443 : 0 : m_pExtensionBox->prepareChecking();
1444 : 0 : }
1445 : :
1446 : : //------------------------------------------------------------------------------
1447 : 0 : void UpdateRequiredDialog::checkEntries()
1448 : : {
1449 : 0 : const SolarMutexGuard guard;
1450 : 0 : m_pExtensionBox->checkEntries();
1451 : :
1452 : 0 : if ( ! hasActiveEntries() )
1453 : : {
1454 : 0 : m_aCloseBtn.SetText( m_sCloseText );
1455 : 0 : m_aCloseBtn.GrabFocus();
1456 : 0 : }
1457 : 0 : }
1458 : :
1459 : : //------------------------------------------------------------------------------
1460 : 0 : bool UpdateRequiredDialog::enablePackage( const uno::Reference< deployment::XPackage > &xPackage,
1461 : : bool bEnable )
1462 : : {
1463 : 0 : m_pManager->getCmdQueue()->enableExtension( xPackage, bEnable );
1464 : :
1465 : 0 : return true;
1466 : : }
1467 : :
1468 : : //------------------------------------------------------------------------------
1469 : 0 : IMPL_LINK_NOARG(UpdateRequiredDialog, HandleCancelBtn)
1470 : : {
1471 : 0 : if ( m_xAbortChannel.is() )
1472 : : {
1473 : : try
1474 : : {
1475 : 0 : m_xAbortChannel->sendAbort();
1476 : : }
1477 : 0 : catch ( const uno::RuntimeException & )
1478 : : {
1479 : : OSL_FAIL( "### unexpected RuntimeException!" );
1480 : : }
1481 : : }
1482 : 0 : return 1;
1483 : : }
1484 : :
1485 : : // ------------------------------------------------------------------------------
1486 : 0 : IMPL_LINK( UpdateRequiredDialog, startProgress, void*, _bLockInterface )
1487 : : {
1488 : 0 : ::osl::MutexGuard aGuard( m_aMutex );
1489 : 0 : bool bLockInterface = (bool) _bLockInterface;
1490 : :
1491 : 0 : if ( m_bStartProgress && !m_bHasProgress )
1492 : 0 : m_aTimeoutTimer.Start();
1493 : :
1494 : 0 : if ( m_bStopProgress )
1495 : : {
1496 : 0 : if ( m_aProgressBar.IsVisible() )
1497 : 0 : m_aProgressBar.SetValue( 100 );
1498 : 0 : m_xAbortChannel.clear();
1499 : : OSL_TRACE( " startProgress handler: stop" );
1500 : : }
1501 : : else
1502 : : {
1503 : : OSL_TRACE( " startProgress handler: start" );
1504 : : }
1505 : :
1506 : 0 : m_aCancelBtn.Enable( bLockInterface );
1507 : 0 : m_aUpdateBtn.Enable( false );
1508 : 0 : clearEventID();
1509 : :
1510 : 0 : return 0;
1511 : : }
1512 : :
1513 : : // ------------------------------------------------------------------------------
1514 : 0 : void UpdateRequiredDialog::showProgress( bool _bStart )
1515 : : {
1516 : 0 : ::osl::MutexGuard aGuard( m_aMutex );
1517 : :
1518 : 0 : bool bStart = _bStart;
1519 : :
1520 : 0 : if ( bStart )
1521 : : {
1522 : 0 : m_nProgress = 0;
1523 : 0 : m_bStartProgress = true;
1524 : : OSL_TRACE( "showProgress start" );
1525 : : }
1526 : : else
1527 : : {
1528 : 0 : m_nProgress = 100;
1529 : 0 : m_bStopProgress = true;
1530 : : OSL_TRACE( "showProgress stop!" );
1531 : : }
1532 : :
1533 : 0 : DialogHelper::PostUserEvent( LINK( this, UpdateRequiredDialog, startProgress ), (void*) bStart );
1534 : 0 : }
1535 : :
1536 : : // -----------------------------------------------------------------------
1537 : 0 : void UpdateRequiredDialog::updateProgress( const long nProgress )
1538 : : {
1539 : 0 : ::osl::MutexGuard aGuard( m_aMutex );
1540 : :
1541 : 0 : m_nProgress = nProgress;
1542 : 0 : }
1543 : :
1544 : : // -----------------------------------------------------------------------
1545 : 0 : void UpdateRequiredDialog::updateProgress( const OUString &rText,
1546 : : const uno::Reference< task::XAbortChannel > &xAbortChannel)
1547 : : {
1548 : 0 : ::osl::MutexGuard aGuard( m_aMutex );
1549 : :
1550 : 0 : m_xAbortChannel = xAbortChannel;
1551 : 0 : m_sProgressText = rText;
1552 : 0 : m_bProgressChanged = true;
1553 : 0 : }
1554 : :
1555 : : //------------------------------------------------------------------------------
1556 : 0 : void UpdateRequiredDialog::updatePackageInfo( const uno::Reference< deployment::XPackage > &xPackage )
1557 : : {
1558 : : // We will remove all updated packages with satisfied dependencies, but
1559 : : // we will show all disabled entries so the user sees the result
1560 : : // of the 'disable all' button
1561 : 0 : const SolarMutexGuard aGuard;
1562 : 0 : if ( isEnabled( xPackage ) && checkDependencies( xPackage ) )
1563 : 0 : m_pExtensionBox->removeEntry( xPackage );
1564 : : else
1565 : 0 : m_pExtensionBox->updateEntry( xPackage );
1566 : :
1567 : 0 : if ( ! hasActiveEntries() )
1568 : : {
1569 : 0 : m_aCloseBtn.SetText( m_sCloseText );
1570 : 0 : m_aCloseBtn.GrabFocus();
1571 : 0 : }
1572 : 0 : }
1573 : :
1574 : : // -----------------------------------------------------------------------
1575 : 0 : IMPL_LINK_NOARG(UpdateRequiredDialog, HandleUpdateBtn)
1576 : : {
1577 : 0 : ::osl::ClearableMutexGuard aGuard( m_aMutex );
1578 : :
1579 : 0 : std::vector< uno::Reference< deployment::XPackage > > vUpdateEntries;
1580 : 0 : sal_Int32 nCount = m_pExtensionBox->GetEntryCount();
1581 : :
1582 : 0 : for ( sal_Int32 i = 0; i < nCount; ++i )
1583 : : {
1584 : 0 : TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( i );
1585 : 0 : vUpdateEntries.push_back( pEntry->m_xPackage );
1586 : 0 : }
1587 : :
1588 : 0 : aGuard.clear();
1589 : :
1590 : 0 : m_pManager->getCmdQueue()->checkForUpdates( vUpdateEntries );
1591 : :
1592 : 0 : return 1;
1593 : : }
1594 : :
1595 : : // -----------------------------------------------------------------------
1596 : 0 : IMPL_LINK_NOARG(UpdateRequiredDialog, HandleCloseBtn)
1597 : : {
1598 : 0 : ::osl::MutexGuard aGuard( m_aMutex );
1599 : :
1600 : 0 : if ( !isBusy() )
1601 : : {
1602 : 0 : if ( m_bHasLockedEntries )
1603 : 0 : EndDialog( -1 );
1604 : 0 : else if ( hasActiveEntries() )
1605 : 0 : disableAllEntries();
1606 : : else
1607 : 0 : EndDialog( 0 );
1608 : : }
1609 : :
1610 : 0 : return 1;
1611 : : }
1612 : :
1613 : : // -----------------------------------------------------------------------
1614 : 0 : IMPL_LINK( UpdateRequiredDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink )
1615 : : {
1616 : 0 : openWebBrowser( pHyperlink->GetURL(), GetText() );
1617 : :
1618 : 0 : return 1;
1619 : : }
1620 : :
1621 : : // -----------------------------------------------------------------------
1622 : 0 : IMPL_LINK_NOARG(UpdateRequiredDialog, TimeOutHdl)
1623 : : {
1624 : 0 : if ( m_bStopProgress )
1625 : : {
1626 : 0 : m_bHasProgress = false;
1627 : 0 : m_bStopProgress = false;
1628 : 0 : m_aProgressText.Hide();
1629 : 0 : m_aProgressBar.Hide();
1630 : 0 : m_aCancelBtn.Hide();
1631 : : }
1632 : : else
1633 : : {
1634 : 0 : if ( m_bProgressChanged )
1635 : : {
1636 : 0 : m_bProgressChanged = false;
1637 : 0 : m_aProgressText.SetText( m_sProgressText );
1638 : : }
1639 : :
1640 : 0 : if ( m_bStartProgress )
1641 : : {
1642 : 0 : m_bStartProgress = false;
1643 : 0 : m_bHasProgress = true;
1644 : 0 : m_aProgressBar.Show();
1645 : 0 : m_aProgressText.Show();
1646 : 0 : m_aCancelBtn.Enable();
1647 : 0 : m_aCancelBtn.Show();
1648 : : }
1649 : :
1650 : 0 : if ( m_aProgressBar.IsVisible() )
1651 : 0 : m_aProgressBar.SetValue( (sal_uInt16) m_nProgress );
1652 : :
1653 : 0 : m_aTimeoutTimer.Start();
1654 : : }
1655 : :
1656 : 0 : return 1;
1657 : : }
1658 : :
1659 : : //------------------------------------------------------------------------------
1660 : : // VCL::Window / Dialog
1661 : 0 : void UpdateRequiredDialog::Resize()
1662 : : {
1663 : 0 : Size aTotalSize( GetOutputSizePixel() );
1664 : 0 : Size aBtnSize( m_aHelpBtn.GetSizePixel() );
1665 : :
1666 : : Point aPos( RSC_SP_DLG_INNERBORDER_LEFT,
1667 : 0 : aTotalSize.Height() - RSC_SP_DLG_INNERBORDER_BOTTOM - aBtnSize.Height() );
1668 : :
1669 : 0 : m_aHelpBtn.SetPosPixel( aPos );
1670 : :
1671 : 0 : aPos.X() = aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_RIGHT - m_aCloseBtn.GetSizePixel().Width();
1672 : 0 : m_aCloseBtn.SetPosPixel( aPos );
1673 : :
1674 : 0 : aPos.X() -= ( RSC_SP_CTRL_X + m_aUpdateBtn.GetSizePixel().Width() );
1675 : 0 : m_aUpdateBtn.SetPosPixel( aPos );
1676 : :
1677 : 0 : Size aDivSize( aTotalSize.Width(), LINE_SIZE );
1678 : 0 : aPos = Point( 0, aPos.Y() - LINE_SIZE - RSC_SP_DLG_INNERBORDER_BOTTOM );
1679 : 0 : m_aDivider.SetPosSizePixel( aPos, aDivSize );
1680 : :
1681 : : // Calc fixed text size
1682 : 0 : aPos = Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP );
1683 : 0 : Size aFTSize = m_aUpdateNeeded.CalcMinimumSize( aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_RIGHT - RSC_SP_DLG_INNERBORDER_LEFT );
1684 : 0 : m_aUpdateNeeded.SetPosSizePixel( aPos, aFTSize );
1685 : :
1686 : : // Calc list box size
1687 : 0 : Size aSize( aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_LEFT - RSC_SP_DLG_INNERBORDER_RIGHT,
1688 : 0 : aTotalSize.Height() - 2*aBtnSize.Height() - LINE_SIZE -
1689 : 0 : 2*RSC_SP_DLG_INNERBORDER_TOP - 3*RSC_SP_DLG_INNERBORDER_BOTTOM - aFTSize.Height() );
1690 : 0 : aPos.Y() += aFTSize.Height()+RSC_SP_DLG_INNERBORDER_TOP;
1691 : :
1692 : 0 : m_pExtensionBox->SetPosSizePixel( aPos, aSize );
1693 : :
1694 : 0 : aPos.X() = aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_RIGHT - aBtnSize.Width();
1695 : 0 : aPos.Y() += aSize.Height()+RSC_SP_DLG_INNERBORDER_TOP;
1696 : 0 : m_aCancelBtn.SetPosPixel( aPos );
1697 : :
1698 : : // Calc progress height
1699 : 0 : aFTSize = m_aProgressText.GetSizePixel();
1700 : 0 : long nProgressHeight = aFTSize.Height();
1701 : :
1702 : 0 : if( IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) )
1703 : : {
1704 : 0 : ImplControlValue aValue;
1705 : 0 : Rectangle aControlRegion( Point( 0, 0 ), m_aProgressBar.GetSizePixel() );
1706 : 0 : Rectangle aNativeControlRegion, aNativeContentRegion;
1707 : 0 : if( GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
1708 : : CTRL_STATE_ENABLED, aValue, rtl::OUString(),
1709 : 0 : aNativeControlRegion, aNativeContentRegion ) != sal_False )
1710 : : {
1711 : 0 : nProgressHeight = aNativeControlRegion.GetHeight();
1712 : 0 : }
1713 : : }
1714 : :
1715 : 0 : if ( nProgressHeight < PROGRESS_HEIGHT )
1716 : 0 : nProgressHeight = PROGRESS_HEIGHT;
1717 : :
1718 : 0 : aPos.X() -= ( RSC_SP_CTRL_GROUP_Y + PROGRESS_WIDTH );
1719 : 0 : m_aProgressBar.SetPosSizePixel( Point( aPos.X(), aPos.Y() + ((aBtnSize.Height()-nProgressHeight)/2) ),
1720 : 0 : Size( PROGRESS_WIDTH, nProgressHeight ) );
1721 : :
1722 : 0 : aFTSize.Width() = aPos.X() - 2*RSC_SP_DLG_INNERBORDER_LEFT;
1723 : 0 : aPos.X() = RSC_SP_DLG_INNERBORDER_LEFT;
1724 : 0 : aPos.Y() += ( aBtnSize.Height() - aFTSize.Height() - 1 ) / 2;
1725 : 0 : m_aProgressText.SetPosSizePixel( aPos, aFTSize );
1726 : 0 : }
1727 : :
1728 : : //------------------------------------------------------------------------------
1729 : : // VCL::Dialog
1730 : 0 : short UpdateRequiredDialog::Execute()
1731 : : {
1732 : 0 : if ( m_bHasLockedEntries )
1733 : : {
1734 : : // Set other text, disable update btn, remove not shared entries from list;
1735 : 0 : m_aUpdateNeeded.SetText( DialogHelper::getResourceString( RID_STR_NO_ADMIN_PRIVILEGE ) );
1736 : 0 : m_aCloseBtn.SetText( DialogHelper::getResourceString( RID_STR_EXIT_BTN ) );
1737 : 0 : m_aUpdateBtn.Enable( false );
1738 : 0 : m_pExtensionBox->RemoveUnlocked();
1739 : 0 : Resize();
1740 : : }
1741 : :
1742 : 0 : return Dialog::Execute();
1743 : : }
1744 : :
1745 : : //------------------------------------------------------------------------------
1746 : : // VCL::Dialog
1747 : 0 : sal_Bool UpdateRequiredDialog::Close()
1748 : : {
1749 : 0 : ::osl::MutexGuard aGuard( m_aMutex );
1750 : :
1751 : 0 : if ( !isBusy() )
1752 : : {
1753 : 0 : if ( m_bHasLockedEntries )
1754 : 0 : EndDialog( -1 );
1755 : 0 : else if ( hasActiveEntries() )
1756 : 0 : disableAllEntries();
1757 : : else
1758 : 0 : EndDialog( 0 );
1759 : : }
1760 : :
1761 : 0 : return false;
1762 : : }
1763 : :
1764 : : //------------------------------------------------------------------------------
1765 : : // Check dependencies of all packages
1766 : : //------------------------------------------------------------------------------
1767 : 0 : bool UpdateRequiredDialog::isEnabled( const uno::Reference< deployment::XPackage > &xPackage ) const
1768 : : {
1769 : 0 : bool bRegistered = false;
1770 : : try {
1771 : 0 : beans::Optional< beans::Ambiguous< sal_Bool > > option( xPackage->isRegistered( uno::Reference< task::XAbortChannel >(),
1772 : 0 : uno::Reference< ucb::XCommandEnvironment >() ) );
1773 : 0 : if ( option.IsPresent )
1774 : : {
1775 : 0 : ::beans::Ambiguous< sal_Bool > const & reg = option.Value;
1776 : 0 : if ( reg.IsAmbiguous )
1777 : 0 : bRegistered = false;
1778 : : else
1779 : 0 : bRegistered = reg.Value ? true : false;
1780 : : }
1781 : : else
1782 : 0 : bRegistered = false;
1783 : : }
1784 : 0 : catch ( const uno::RuntimeException & ) { throw; }
1785 : 0 : catch (const uno::Exception & exc) {
1786 : : (void) exc;
1787 : : OSL_FAIL( ::rtl::OUStringToOString( exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
1788 : 0 : bRegistered = false;
1789 : : }
1790 : :
1791 : 0 : return bRegistered;
1792 : : }
1793 : :
1794 : : //------------------------------------------------------------------------------
1795 : 0 : bool UpdateRequiredDialog::checkDependencies( const uno::Reference< deployment::XPackage > &xPackage ) const
1796 : : {
1797 : 0 : if ( isEnabled( xPackage ) )
1798 : : {
1799 : 0 : bool bDependenciesValid = false;
1800 : : try {
1801 : 0 : bDependenciesValid = xPackage->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() );
1802 : : }
1803 : 0 : catch ( const deployment::DeploymentException & ) {}
1804 : 0 : if ( ! bDependenciesValid )
1805 : : {
1806 : 0 : return false;
1807 : : }
1808 : : }
1809 : 0 : return true;
1810 : : }
1811 : :
1812 : : //------------------------------------------------------------------------------
1813 : 0 : bool UpdateRequiredDialog::hasActiveEntries()
1814 : : {
1815 : 0 : ::osl::MutexGuard aGuard( m_aMutex );
1816 : :
1817 : 0 : bool bRet = false;
1818 : 0 : long nCount = m_pExtensionBox->GetEntryCount();
1819 : 0 : for ( long nIndex = 0; nIndex < nCount; nIndex++ )
1820 : : {
1821 : 0 : TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( nIndex );
1822 : :
1823 : 0 : if ( !checkDependencies( pEntry->m_xPackage ) )
1824 : : {
1825 : 0 : bRet = true;
1826 : : break;
1827 : : }
1828 : 0 : }
1829 : :
1830 : 0 : return bRet;
1831 : : }
1832 : :
1833 : : //------------------------------------------------------------------------------
1834 : 0 : void UpdateRequiredDialog::disableAllEntries()
1835 : : {
1836 : 0 : ::osl::MutexGuard aGuard( m_aMutex );
1837 : :
1838 : 0 : setBusy( true );
1839 : :
1840 : 0 : long nCount = m_pExtensionBox->GetEntryCount();
1841 : 0 : for ( long nIndex = 0; nIndex < nCount; nIndex++ )
1842 : : {
1843 : 0 : TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( nIndex );
1844 : 0 : enablePackage( pEntry->m_xPackage, false );
1845 : 0 : }
1846 : :
1847 : 0 : setBusy( false );
1848 : :
1849 : 0 : if ( ! hasActiveEntries() )
1850 : 0 : m_aCloseBtn.SetText( m_sCloseText );
1851 : 0 : }
1852 : :
1853 : : //------------------------------------------------------------------------------
1854 : : // ShowLicenseDialog
1855 : : //------------------------------------------------------------------------------
1856 : 0 : ShowLicenseDialog::ShowLicenseDialog( Window * pParent,
1857 : : const uno::Reference< deployment::XPackage > &xPackage ) :
1858 : : ModalDialog( pParent, DialogHelper::getResId( RID_DLG_SHOW_LICENSE ) ),
1859 : : m_aLicenseText( this, DialogHelper::getResId( ML_LICENSE ) ),
1860 : 0 : m_aCloseBtn( this, DialogHelper::getResId( RID_EM_BTN_CLOSE ) )
1861 : : {
1862 : 0 : FreeResource();
1863 : :
1864 : 0 : OUString aText = xPackage->getLicenseText();
1865 : 0 : m_aLicenseText.SetText( aText );
1866 : 0 : }
1867 : :
1868 : : //------------------------------------------------------------------------------
1869 : 0 : ShowLicenseDialog::~ShowLicenseDialog()
1870 : 0 : {}
1871 : :
1872 : : //------------------------------------------------------------------------------
1873 : 0 : void ShowLicenseDialog::Resize()
1874 : : {
1875 : 0 : Size aTotalSize( GetOutputSizePixel() );
1876 : 0 : Size aTextSize( aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_LEFT - RSC_SP_DLG_INNERBORDER_RIGHT,
1877 : 0 : aTotalSize.Height() - RSC_SP_DLG_INNERBORDER_TOP - 2*RSC_SP_DLG_INNERBORDER_BOTTOM
1878 : 0 : - m_aCloseBtn.GetSizePixel().Height() );
1879 : :
1880 : : m_aLicenseText.SetPosSizePixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ),
1881 : 0 : aTextSize );
1882 : :
1883 : 0 : Point aBtnPos( (aTotalSize.Width() - m_aCloseBtn.GetSizePixel().Width())/2,
1884 : 0 : aTotalSize.Height() - RSC_SP_DLG_INNERBORDER_BOTTOM
1885 : 0 : - m_aCloseBtn.GetSizePixel().Height() );
1886 : 0 : m_aCloseBtn.SetPosPixel( aBtnPos );
1887 : 0 : }
1888 : :
1889 : : //=================================================================================
1890 : : // UpdateRequiredDialogService
1891 : : //=================================================================================
1892 : 0 : UpdateRequiredDialogService::UpdateRequiredDialogService( uno::Sequence< uno::Any > const&,
1893 : : uno::Reference< uno::XComponentContext > const& xComponentContext )
1894 : 0 : : m_xComponentContext( xComponentContext )
1895 : : {
1896 : 0 : }
1897 : :
1898 : : //------------------------------------------------------------------------------
1899 : : // XExecutableDialog
1900 : : //------------------------------------------------------------------------------
1901 : 0 : void UpdateRequiredDialogService::setTitle( OUString const & ) throw ( uno::RuntimeException )
1902 : : {
1903 : 0 : }
1904 : :
1905 : : //------------------------------------------------------------------------------
1906 : 0 : sal_Int16 UpdateRequiredDialogService::execute() throw ( uno::RuntimeException )
1907 : : {
1908 : : ::rtl::Reference< ::dp_gui::TheExtensionManager > xManager( TheExtensionManager::get(
1909 : : m_xComponentContext,
1910 : : uno::Reference< awt::XWindow >(),
1911 : 0 : OUString() ) );
1912 : 0 : xManager->createDialog( true );
1913 : 0 : sal_Int16 nRet = xManager->execute();
1914 : :
1915 : 0 : return nRet;
1916 : : }
1917 : :
1918 : : //------------------------------------------------------------------------------
1919 : 0 : SelectedPackage::~SelectedPackage() {}
1920 : :
1921 : : } //namespace dp_gui
1922 : :
1923 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|