LCOV - code coverage report
Current view: top level - desktop/source/deployment/gui - dp_gui_dialog2.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 7 14.3 %
Date: 2014-11-03 Functions: 1 9 11.1 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10