Branch data Line data Source code
1 : : #ifndef INCLUDED_COM_SUN_STAR_DEPLOYMENT_UI_PACKAGEMANAGERDIALOG_HPP
2 : : #define INCLUDED_COM_SUN_STAR_DEPLOYMENT_UI_PACKAGEMANAGERDIALOG_HPP
3 : :
4 : : #include "sal/config.h"
5 : :
6 : : #include "com/sun/star/uno/RuntimeException.hpp"
7 : : #include "com/sun/star/uno/Exception.hpp"
8 : : #include "com/sun/star/awt/XWindow.hpp"
9 : : #include "com/sun/star/uno/DeploymentException.hpp"
10 : : #include "com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp"
11 : : #include "com/sun/star/uno/XComponentContext.hpp"
12 : : #include "com/sun/star/lang/XMultiComponentFactory.hpp"
13 : : #include "com/sun/star/uno/Any.hxx"
14 : : #include "com/sun/star/uno/Reference.hxx"
15 : : #include "com/sun/star/uno/Sequence.hxx"
16 : : #include "cppu/unotype.hxx"
17 : : #include "rtl/ustring.h"
18 : : #include "rtl/ustring.hxx"
19 : :
20 : : namespace com { namespace sun { namespace star { namespace deployment { namespace ui {
21 : :
22 : : class PackageManagerDialog {
23 : : public:
24 : : static ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XAsynchronousExecutableDialog > createDefault(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context) {
25 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > the_factory(the_context->getServiceManager());
26 : : if (!the_factory.is()) {
27 : : throw com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service manager")), the_context);
28 : : }
29 : : ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XAsynchronousExecutableDialog > the_instance;
30 : : try {
31 : : the_instance = ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XAsynchronousExecutableDialog >(the_factory->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.deployment.ui.PackageManagerDialog")), ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >(), the_context), ::com::sun::star::uno::UNO_QUERY);
32 : : } catch (::com::sun::star::uno::RuntimeException &) {
33 : : throw;
34 : : } catch (::com::sun::star::uno::Exception & the_exception) {
35 : : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.deployment.ui.PackageManagerDialog of type com.sun.star.ui.dialogs.XAsynchronousExecutableDialog: ")) + the_exception.Message, the_context);
36 : : }
37 : : if (!the_instance.is()) {
38 : : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.deployment.ui.PackageManagerDialog of type com.sun.star.ui.dialogs.XAsynchronousExecutableDialog")), the_context);
39 : : }
40 : : return the_instance;
41 : : }
42 : :
43 : : static ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XAsynchronousExecutableDialog > create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& xParent, const ::rtl::OUString& focussedContext) {
44 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > the_factory(the_context->getServiceManager());
45 : : if (!the_factory.is()) {
46 : : throw com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service manager")), the_context);
47 : : }
48 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(2);
49 : : the_arguments[0] <<= xParent;
50 : : the_arguments[1] <<= focussedContext;
51 : : ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XAsynchronousExecutableDialog > the_instance;
52 : : try {
53 : : the_instance = ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XAsynchronousExecutableDialog >(the_factory->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.deployment.ui.PackageManagerDialog")), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
54 : : } catch (::com::sun::star::uno::RuntimeException &) {
55 : : throw;
56 : : } catch (::com::sun::star::uno::Exception & the_exception) {
57 : : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.deployment.ui.PackageManagerDialog of type com.sun.star.ui.dialogs.XAsynchronousExecutableDialog: ")) + the_exception.Message, the_context);
58 : : }
59 : : if (!the_instance.is()) {
60 : : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.deployment.ui.PackageManagerDialog of type com.sun.star.ui.dialogs.XAsynchronousExecutableDialog")), the_context);
61 : : }
62 : : return the_instance;
63 : : }
64 : :
65 : 0 : static ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XAsynchronousExecutableDialog > createAndInstall(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::rtl::OUString& extensionURL) {
66 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > the_factory(the_context->getServiceManager());
67 : 0 : if (!the_factory.is()) {
68 : 0 : throw com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service manager")), the_context);
69 : : }
70 : 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(1);
71 : 0 : the_arguments[0] <<= extensionURL;
72 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XAsynchronousExecutableDialog > the_instance;
73 : : try {
74 : 0 : the_instance = ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XAsynchronousExecutableDialog >(the_factory->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.deployment.ui.PackageManagerDialog")), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
75 : 0 : } catch (::com::sun::star::uno::RuntimeException &) {
76 : 0 : throw;
77 : 0 : } catch (::com::sun::star::uno::Exception & the_exception) {
78 : 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.deployment.ui.PackageManagerDialog of type com.sun.star.ui.dialogs.XAsynchronousExecutableDialog: ")) + the_exception.Message, the_context);
79 : : }
80 : 0 : if (!the_instance.is()) {
81 : 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.deployment.ui.PackageManagerDialog of type com.sun.star.ui.dialogs.XAsynchronousExecutableDialog")), the_context);
82 : : }
83 : 0 : return the_instance;
84 : : }
85 : :
86 : : private:
87 : : PackageManagerDialog(); // not implemented
88 : : PackageManagerDialog(PackageManagerDialog &); // not implemented
89 : : ~PackageManagerDialog(); // not implemented
90 : : void operator =(PackageManagerDialog); // not implemented
91 : : };
92 : :
93 : : } } } } }
94 : :
95 : : #endif // INCLUDED_COM_SUN_STAR_DEPLOYMENT_UI_PACKAGEMANAGERDIALOG_HPP
|