1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef INCLUDED_DP_GUI_DIALOG2_HXX 29*cdf0e10cSrcweir #define INCLUDED_DP_GUI_DIALOG2_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "vcl/dialog.hxx" 32*cdf0e10cSrcweir #include "vcl/button.hxx" 33*cdf0e10cSrcweir #include "vcl/fixed.hxx" 34*cdf0e10cSrcweir #include "vcl/timer.hxx" 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir #include "svtools/fixedhyper.hxx" 37*cdf0e10cSrcweir #include "svtools/prgsbar.hxx" 38*cdf0e10cSrcweir #include "svtools/svmedit.hxx" 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #include "osl/conditn.hxx" 41*cdf0e10cSrcweir #include "osl/mutex.hxx" 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #include "rtl/ref.hxx" 44*cdf0e10cSrcweir #include "rtl/ustring.hxx" 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir #include "cppuhelper/implbase1.hxx" 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir #include "com/sun/star/awt/XWindow.hpp" 49*cdf0e10cSrcweir #include "com/sun/star/deployment/XPackage.hpp" 50*cdf0e10cSrcweir #include "com/sun/star/uno/XComponentContext.hpp" 51*cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/XExecutableDialog.hpp" 52*cdf0e10cSrcweir #include "com/sun/star/util/XModifyListener.hpp" 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir namespace dp_gui { 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir //============================================================================== 57*cdf0e10cSrcweir class ExtBoxWithBtns_Impl; 58*cdf0e10cSrcweir class ExtensionBox_Impl; 59*cdf0e10cSrcweir class TheExtensionManager; 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir //============================================================================== 62*cdf0e10cSrcweir class DialogHelper 63*cdf0e10cSrcweir { 64*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; 65*cdf0e10cSrcweir Dialog* m_pVCLWindow; 66*cdf0e10cSrcweir sal_uLong m_nEventID; 67*cdf0e10cSrcweir bool m_bIsBusy; 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir public: 70*cdf0e10cSrcweir DialogHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &, 71*cdf0e10cSrcweir Dialog *pWindow ); 72*cdf0e10cSrcweir virtual ~DialogHelper(); 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir void openWebBrowser( const ::rtl::OUString & sURL, const ::rtl::OUString & sTitle ) const; 75*cdf0e10cSrcweir Dialog* getWindow() const { return m_pVCLWindow; }; 76*cdf0e10cSrcweir void PostUserEvent( const Link& rLink, void* pCaller ); 77*cdf0e10cSrcweir void clearEventID() { m_nEventID = 0; } 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir virtual void showProgress( bool bStart ) = 0; 80*cdf0e10cSrcweir virtual void updateProgress( const ::rtl::OUString &rText, 81*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > &xAbortChannel) = 0; 82*cdf0e10cSrcweir virtual void updateProgress( const long nProgress ) = 0; 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) = 0; 85*cdf0e10cSrcweir virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, 86*cdf0e10cSrcweir bool bLicenseMissing = false ) = 0; 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir virtual void prepareChecking() = 0; 89*cdf0e10cSrcweir virtual void checkEntries() = 0; 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir static ResId getResId( sal_uInt16 nId ); 92*cdf0e10cSrcweir static String getResourceString( sal_uInt16 id ); 93*cdf0e10cSrcweir static bool IsSharedPkgMgr( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &); 94*cdf0e10cSrcweir static bool continueOnSharedExtension( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &, 95*cdf0e10cSrcweir Window *pParent, 96*cdf0e10cSrcweir const sal_uInt16 nResID, 97*cdf0e10cSrcweir bool &bHadWarning ); 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir void setBusy( const bool bBusy ) { m_bIsBusy = bBusy; } 100*cdf0e10cSrcweir bool isBusy() const { return m_bIsBusy; } 101*cdf0e10cSrcweir bool installExtensionWarn( const ::rtl::OUString &rExtensionURL ) const; 102*cdf0e10cSrcweir bool installForAllUsers( bool &bInstallForAll ) const; 103*cdf0e10cSrcweir }; 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir //============================================================================== 106*cdf0e10cSrcweir class ExtMgrDialog : public ModelessDialog, 107*cdf0e10cSrcweir public DialogHelper 108*cdf0e10cSrcweir { 109*cdf0e10cSrcweir ExtBoxWithBtns_Impl *m_pExtensionBox; 110*cdf0e10cSrcweir PushButton m_aAddBtn; 111*cdf0e10cSrcweir PushButton m_aUpdateBtn; 112*cdf0e10cSrcweir OKButton m_aCloseBtn; 113*cdf0e10cSrcweir HelpButton m_aHelpBtn; 114*cdf0e10cSrcweir FixedLine m_aDivider; 115*cdf0e10cSrcweir svt::FixedHyperlink m_aGetExtensions; 116*cdf0e10cSrcweir FixedText m_aProgressText; 117*cdf0e10cSrcweir ProgressBar m_aProgressBar; 118*cdf0e10cSrcweir CancelButton m_aCancelBtn; 119*cdf0e10cSrcweir const String m_sAddPackages; 120*cdf0e10cSrcweir String m_sProgressText; 121*cdf0e10cSrcweir String m_sLastFolderURL; 122*cdf0e10cSrcweir ::osl::Mutex m_aMutex; 123*cdf0e10cSrcweir bool m_bHasProgress; 124*cdf0e10cSrcweir bool m_bProgressChanged; 125*cdf0e10cSrcweir bool m_bStartProgress; 126*cdf0e10cSrcweir bool m_bStopProgress; 127*cdf0e10cSrcweir bool m_bUpdateWarning; 128*cdf0e10cSrcweir bool m_bEnableWarning; 129*cdf0e10cSrcweir bool m_bDisableWarning; 130*cdf0e10cSrcweir bool m_bDeleteWarning; 131*cdf0e10cSrcweir long m_nProgress; 132*cdf0e10cSrcweir Timer m_aTimeoutTimer; 133*cdf0e10cSrcweir TheExtensionManager *m_pManager; 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > m_xAbortChannel; 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir bool removeExtensionWarn( const ::rtl::OUString &rExtensionTitle ) const; 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( HandleAddBtn, void * ); 140*cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( HandleUpdateBtn, void * ); 141*cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( HandleCancelBtn, void * ); 142*cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( HandleHyperlink, svt::FixedHyperlink * ); 143*cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( TimeOutHdl, Timer* ); 144*cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( startProgress, void * ); 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir public: 147*cdf0e10cSrcweir ExtMgrDialog( Window * pParent, TheExtensionManager *pManager ); 148*cdf0e10cSrcweir virtual ~ExtMgrDialog(); 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir virtual void Resize(); 151*cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 152*cdf0e10cSrcweir virtual sal_Bool Close(); 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir virtual void showProgress( bool bStart ); 155*cdf0e10cSrcweir virtual void updateProgress( const ::rtl::OUString &rText, 156*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > &xAbortChannel); 157*cdf0e10cSrcweir virtual void updateProgress( const long nProgress ); 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir void setGetExtensionsURL( const ::rtl::OUString &rURL ); 162*cdf0e10cSrcweir virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &, 163*cdf0e10cSrcweir bool bLicenseMissing = false ); 164*cdf0e10cSrcweir bool enablePackage(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, 165*cdf0e10cSrcweir bool bEnable ); 166*cdf0e10cSrcweir bool removePackage(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); 167*cdf0e10cSrcweir bool updatePackage(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); 168*cdf0e10cSrcweir bool acceptLicense(const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir virtual void prepareChecking(); 171*cdf0e10cSrcweir virtual void checkEntries(); 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker(); 174*cdf0e10cSrcweir }; 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir //============================================================================== 177*cdf0e10cSrcweir class UpdateRequiredDialog : public ModalDialog, 178*cdf0e10cSrcweir public DialogHelper 179*cdf0e10cSrcweir { 180*cdf0e10cSrcweir ExtensionBox_Impl *m_pExtensionBox; 181*cdf0e10cSrcweir FixedText m_aUpdateNeeded; 182*cdf0e10cSrcweir PushButton m_aUpdateBtn; 183*cdf0e10cSrcweir PushButton m_aCloseBtn; 184*cdf0e10cSrcweir HelpButton m_aHelpBtn; 185*cdf0e10cSrcweir CancelButton m_aCancelBtn; 186*cdf0e10cSrcweir FixedLine m_aDivider; 187*cdf0e10cSrcweir FixedText m_aProgressText; 188*cdf0e10cSrcweir ProgressBar m_aProgressBar; 189*cdf0e10cSrcweir const String m_sAddPackages; 190*cdf0e10cSrcweir const String m_sCloseText; 191*cdf0e10cSrcweir String m_sProgressText; 192*cdf0e10cSrcweir ::osl::Mutex m_aMutex; 193*cdf0e10cSrcweir bool m_bHasProgress; 194*cdf0e10cSrcweir bool m_bProgressChanged; 195*cdf0e10cSrcweir bool m_bStartProgress; 196*cdf0e10cSrcweir bool m_bStopProgress; 197*cdf0e10cSrcweir bool m_bUpdateWarning; 198*cdf0e10cSrcweir bool m_bDisableWarning; 199*cdf0e10cSrcweir bool m_bHasLockedEntries; 200*cdf0e10cSrcweir long m_nProgress; 201*cdf0e10cSrcweir Timer m_aTimeoutTimer; 202*cdf0e10cSrcweir TheExtensionManager *m_pManager; 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > m_xAbortChannel; 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( HandleUpdateBtn, void * ); 207*cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( HandleCloseBtn, void * ); 208*cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( HandleCancelBtn, void * ); 209*cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( TimeOutHdl, Timer* ); 210*cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( startProgress, void * ); 211*cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( HandleHyperlink, svt::FixedHyperlink * ); 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir bool isEnabled( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; 214*cdf0e10cSrcweir bool checkDependencies( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const; 215*cdf0e10cSrcweir bool hasActiveEntries(); 216*cdf0e10cSrcweir void disableAllEntries(); 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir public: 219*cdf0e10cSrcweir UpdateRequiredDialog( Window * pParent, TheExtensionManager *pManager ); 220*cdf0e10cSrcweir virtual ~UpdateRequiredDialog(); 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir virtual short Execute(); 223*cdf0e10cSrcweir virtual void Resize(); 224*cdf0e10cSrcweir virtual sal_Bool Close(); 225*cdf0e10cSrcweir // virtual long Notify( NotifyEvent& rNEvt ); 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir virtual void showProgress( bool bStart ); 228*cdf0e10cSrcweir virtual void updateProgress( const ::rtl::OUString &rText, 229*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::task::XAbortChannel > &xAbortChannel); 230*cdf0e10cSrcweir virtual void updateProgress( const long nProgress ); 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir void selectEntry( long nPos ); 235*cdf0e10cSrcweir virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &, 236*cdf0e10cSrcweir bool bLicenseMissing = false ); 237*cdf0e10cSrcweir bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, bool bEnable ); 238*cdf0e10cSrcweir bool updatePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir virtual void prepareChecking(); 241*cdf0e10cSrcweir virtual void checkEntries(); 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > raiseAddPicker(); 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir bool installForAllUsers( bool &bInstallForAll ) const; 246*cdf0e10cSrcweir bool installExtensionWarn( const ::rtl::OUString &rExtensionURL ) const; 247*cdf0e10cSrcweir }; 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir //============================================================================== 250*cdf0e10cSrcweir class ShowLicenseDialog : public ModalDialog 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir MultiLineEdit m_aLicenseText; 253*cdf0e10cSrcweir OKButton m_aCloseBtn; 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir public: 256*cdf0e10cSrcweir ShowLicenseDialog( Window * pParent, 257*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); 258*cdf0e10cSrcweir virtual ~ShowLicenseDialog(); 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir virtual void Resize(); 261*cdf0e10cSrcweir }; 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir //============================================================================== 264*cdf0e10cSrcweir class UpdateRequiredDialogService : public ::cppu::WeakImplHelper1< ::com::sun::star::ui::dialogs::XExecutableDialog > 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const m_xComponentContext; 267*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xParent; 268*cdf0e10cSrcweir ::rtl::OUString m_sInitialTitle; 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir public: 271*cdf0e10cSrcweir UpdateRequiredDialogService( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > const & args, 272*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const & xComponentContext ); 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir // XExecutableDialog 275*cdf0e10cSrcweir virtual void SAL_CALL setTitle( rtl::OUString const & title ) throw ( ::com::sun::star::uno::RuntimeException ); 276*cdf0e10cSrcweir virtual sal_Int16 SAL_CALL execute() throw ( ::com::sun::star::uno::RuntimeException ); 277*cdf0e10cSrcweir }; 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir } // namespace dp_gui 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir #endif 282