Line data Source code
1 : #ifndef INCLUDED_COM_SUN_STAR_AWT_DIALOGPROVIDER_HPP
2 : #define INCLUDED_COM_SUN_STAR_AWT_DIALOGPROVIDER_HPP
3 :
4 : #include "sal/config.h"
5 :
6 : #include <cassert>
7 :
8 : #include "com/sun/star/awt/XDialogProvider.hpp"
9 : #include "com/sun/star/container/XNameContainer.hpp"
10 : #include "com/sun/star/frame/XModel.hpp"
11 : #include "com/sun/star/io/XInputStream.hpp"
12 : #include "com/sun/star/script/XScriptListener.hpp"
13 : #include "com/sun/star/uno/DeploymentException.hpp"
14 : #include "com/sun/star/uno/Exception.hpp"
15 : #include "com/sun/star/uno/RuntimeException.hpp"
16 : #include "com/sun/star/uno/XComponentContext.hpp"
17 : #include "com/sun/star/uno/Any.hxx"
18 : #include "com/sun/star/uno/Reference.hxx"
19 : #include "com/sun/star/uno/Sequence.hxx"
20 : #include "cppu/unotype.hxx"
21 : #include "rtl/ustring.h"
22 : #include "rtl/ustring.hxx"
23 :
24 : namespace com { namespace sun { namespace star { namespace awt {
25 :
26 : class DialogProvider {
27 : public:
28 2 : static ::com::sun::star::uno::Reference< css::awt::XDialogProvider > createWithModel(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::com::sun::star::uno::Reference< css::frame::XModel >& Model) {
29 : assert(the_context.is());
30 2 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(1);
31 2 : the_arguments[0] <<= Model;
32 2 : ::com::sun::star::uno::Reference< css::awt::XDialogProvider > the_instance;
33 : try {
34 2 : the_instance = ::com::sun::star::uno::Reference< css::awt::XDialogProvider >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString( "com.sun.star.awt.DialogProvider" ), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
35 0 : } catch (const ::com::sun::star::uno::RuntimeException &) {
36 0 : throw;
37 0 : } catch (const ::com::sun::star::uno::Exception & the_exception) {
38 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.awt.DialogProvider of type com.sun.star.awt.XDialogProvider: " ) + the_exception.Message, the_context);
39 : }
40 2 : if (!the_instance.is()) {
41 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.awt.DialogProvider of type com.sun.star.awt.XDialogProvider" ), the_context);
42 : }
43 2 : return the_instance;
44 : }
45 :
46 0 : static ::com::sun::star::uno::Reference< css::awt::XDialogProvider > createWithModelAndScripting(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::com::sun::star::uno::Reference< css::frame::XModel >& Model, const ::com::sun::star::uno::Reference< css::io::XInputStream >& InStream, const ::com::sun::star::uno::Reference< css::container::XNameContainer >& DialogLib, const ::com::sun::star::uno::Reference< css::script::XScriptListener >& ScriptListener) {
47 : assert(the_context.is());
48 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(4);
49 0 : the_arguments[0] <<= Model;
50 0 : the_arguments[1] <<= InStream;
51 0 : the_arguments[2] <<= DialogLib;
52 0 : the_arguments[3] <<= ScriptListener;
53 0 : ::com::sun::star::uno::Reference< css::awt::XDialogProvider > the_instance;
54 : try {
55 0 : the_instance = ::com::sun::star::uno::Reference< css::awt::XDialogProvider >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString( "com.sun.star.awt.DialogProvider" ), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
56 0 : } catch (const ::com::sun::star::uno::RuntimeException &) {
57 0 : throw;
58 0 : } catch (const ::com::sun::star::uno::Exception & the_exception) {
59 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.awt.DialogProvider of type com.sun.star.awt.XDialogProvider: " ) + the_exception.Message, the_context);
60 : }
61 0 : if (!the_instance.is()) {
62 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.awt.DialogProvider of type com.sun.star.awt.XDialogProvider" ), the_context);
63 : }
64 0 : return the_instance;
65 : }
66 :
67 : private:
68 : DialogProvider(); // not implemented
69 : DialogProvider(DialogProvider &); // not implemented
70 : ~DialogProvider(); // not implemented
71 : void operator =(DialogProvider); // not implemented
72 : };
73 :
74 : } } } }
75 :
76 : #endif // INCLUDED_COM_SUN_STAR_AWT_DIALOGPROVIDER_HPP
|