1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dp_gui_theextmgr.hxx,v $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef INCLUDED_DP_GUI_THEEXTMGR_HXX
33 #define INCLUDED_DP_GUI_THEEXTMGR_HXX
35 #include "comphelper/sequence.hxx"
37 #include "cppuhelper/implbase2.hxx"
39 #include "com/sun/star/container/XNameAccess.hpp"
40 #include "com/sun/star/deployment/XPackageManager.hpp"
41 #include "com/sun/star/frame/XDesktop.hpp"
42 #include "com/sun/star/frame/XTerminateListener.hpp"
43 #include "com/sun/star/uno/XComponentContext.hpp"
44 #include "com/sun/star/util/XModifyListener.hpp"
47 #include "dp_gui_dialog2.hxx"
48 #include "dp_gui_updatedata.hxx"
50 //==============================================================================
53 //------------------------------------------------------------------------------
54 class ExtensionCmdQueue
;
56 //------------------------------------------------------------------------------
57 class TheExtensionManager
:
58 public ::cppu::WeakImplHelper2
< ::com::sun::star::frame::XTerminateListener
,
59 ::com::sun::star::util::XModifyListener
>
62 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
63 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDesktop
> m_xDesktop
;
64 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
< ::com::sun::star::deployment::XPackageManager
> > m_sPackageManagers
;
65 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xNameAccessNodes
;
67 ::std::auto_ptr
< ExtensionCmdQueue
> m_pExecuteCmdQueue
;
70 ExtMgrDialog
*m_pExtMgrDialog
;
71 UpdateRequiredDialog
*m_pUpdReqDialog
;
73 ::rtl::OUString m_sGetExtensionsURL
;
75 // liste der packages ( xpackage?, mit parent manager, ... )
77 void createPackageList();
78 bool createPackageList( const ::com::sun::star::uno::Reference
< ::com::sun::star::deployment::XPackageManager
> &xPackageManager
);
81 static ::rtl::Reference
<TheExtensionManager
> s_ExtMgr
;
83 TheExtensionManager( Window
* pParent
,
84 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> &xContext
);
85 ~TheExtensionManager();
87 void createDialog( const bool bCreateUpdDlg
);
90 Dialog
* getDialog() { return m_pExtMgrDialog
? (Dialog
*) m_pExtMgrDialog
: (Dialog
*) m_pUpdReqDialog
; }
91 DialogHelper
* getDialogHelper() { return m_pExtMgrDialog
? (DialogHelper
*) m_pExtMgrDialog
: (DialogHelper
*) m_pUpdReqDialog
; }
93 void SetText( const ::rtl::OUString
&rTitle
);
95 void ToTop( USHORT nFlags
);
100 bool checkUpdates( bool showUpdateOnly
, bool parentVisible
);
101 bool updatePackages( const std::vector
< TUpdateListEntry
> &vList
);
103 bool enablePackage( const ::com::sun::star::uno::Reference
< ::com::sun::star::deployment::XPackage
> &xPackage
,
105 bool removePackage( const ::com::sun::star::uno::Reference
< ::com::sun::star::deployment::XPackageManager
> &xPackageManager
,
106 const ::com::sun::star::uno::Reference
< ::com::sun::star::deployment::XPackage
> &xPackage
);
107 bool installPackage( const ::rtl::OUString
&rPackageURL
, bool bWarnUser
= false );
109 bool queryTermination();
110 void terminateDialog();
113 bool supportsOptions( const ::com::sun::star::uno::Reference
< ::com::sun::star::deployment::XPackage
> &xPackage
) const;
114 PackageState
getPackageState( const ::com::sun::star::uno::Reference
< ::com::sun::star::deployment::XPackage
> &xPackage
) const;
115 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> getContext() const { return m_xContext
; }
116 ::com::sun::star::uno::Reference
< ::com::sun::star::deployment::XPackageManager
> getUserPkgMgr() const { return m_sPackageManagers
[0]; }
117 ::com::sun::star::uno::Reference
< ::com::sun::star::deployment::XPackageManager
> getSharedPkgMgr() const { return m_sPackageManagers
[1]; }
120 static ::rtl::Reference
<TheExtensionManager
> get(
121 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> const & xContext
,
122 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> const & xParent
= 0,
123 ::rtl::OUString
const & view
= ::rtl::OUString() );
126 virtual void SAL_CALL
disposing( ::com::sun::star::lang::EventObject
const & evt
)
127 throw (::com::sun::star::uno::RuntimeException
);
129 // XTerminateListener
130 virtual void SAL_CALL
queryTermination( ::com::sun::star::lang::EventObject
const & evt
)
131 throw (::com::sun::star::frame::TerminationVetoException
, ::com::sun::star::uno::RuntimeException
);
132 virtual void SAL_CALL
notifyTermination( ::com::sun::star::lang::EventObject
const & evt
)
133 throw (::com::sun::star::uno::RuntimeException
);
136 virtual void SAL_CALL
modified( ::com::sun::star::lang::EventObject
const & evt
)
137 throw (::com::sun::star::uno::RuntimeException
);
140 } // namespace dp_gui