Branch data Line data Source code
1 : : #ifndef INCLUDED_COM_SUN_STAR_FORM_RUNTIME_FORMOPERATIONS_HPP
2 : : #define INCLUDED_COM_SUN_STAR_FORM_RUNTIME_FORMOPERATIONS_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/uno/DeploymentException.hpp"
9 : : #include "com/sun/star/uno/XComponentContext.hpp"
10 : : #include "com/sun/star/lang/XMultiComponentFactory.hpp"
11 : : #include "com/sun/star/form/runtime/XFormController.hpp"
12 : : #include "com/sun/star/form/runtime/XFormOperations.hpp"
13 : : #include "com/sun/star/lang/IllegalArgumentException.hpp"
14 : : #include "com/sun/star/form/XForm.hpp"
15 : : #include "com/sun/star/uno/Any.hxx"
16 : : #include "com/sun/star/uno/Reference.hxx"
17 : : #include "com/sun/star/uno/Sequence.hxx"
18 : : #include "cppu/unotype.hxx"
19 : : #include "rtl/ustring.h"
20 : : #include "rtl/ustring.hxx"
21 : :
22 : : namespace com { namespace sun { namespace star { namespace form { namespace runtime {
23 : :
24 : : class FormOperations {
25 : : public:
26 : 22 : static ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations > createWithFormController(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController >& Controller) {
27 [ + - ][ + - ]: 22 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > the_factory(the_context->getServiceManager());
28 [ - + ]: 22 : if (!the_factory.is()) {
29 [ # # ][ # # ]: 0 : throw com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service manager")), the_context);
30 : : }
31 [ + - ]: 22 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(1);
32 [ + - ][ + - ]: 22 : the_arguments[0] <<= Controller;
33 : 22 : ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations > the_instance;
34 : : try {
35 [ + - ][ + - ]: 22 : the_instance = ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >(the_factory->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.runtime.FormOperations")), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
[ + - ][ + - ]
[ + - ]
36 : 0 : } catch (::com::sun::star::uno::RuntimeException &) {
37 : 0 : throw;
38 : 0 : } catch (::com::sun::star::lang::IllegalArgumentException &) {
39 : 0 : throw;
40 [ # # # # ]: 0 : } catch (::com::sun::star::uno::Exception & the_exception) {
41 [ # # # # ]: 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.form.runtime.FormOperations of type com.sun.star.form.runtime.XFormOperations: ")) + the_exception.Message, the_context);
42 : : }
43 [ - + ]: 22 : if (!the_instance.is()) {
44 [ # # ][ # # ]: 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.form.runtime.FormOperations of type com.sun.star.form.runtime.XFormOperations")), the_context);
45 : : }
46 [ + - ]: 22 : return the_instance;
47 : : }
48 : :
49 : : static ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations > createWithForm(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& Form) {
50 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > the_factory(the_context->getServiceManager());
51 : : if (!the_factory.is()) {
52 : : throw com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service manager")), the_context);
53 : : }
54 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(1);
55 : : the_arguments[0] <<= Form;
56 : : ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations > the_instance;
57 : : try {
58 : : the_instance = ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >(the_factory->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.runtime.FormOperations")), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
59 : : } catch (::com::sun::star::uno::RuntimeException &) {
60 : : throw;
61 : : } catch (::com::sun::star::lang::IllegalArgumentException &) {
62 : : throw;
63 : : } catch (::com::sun::star::uno::Exception & the_exception) {
64 : : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.form.runtime.FormOperations of type com.sun.star.form.runtime.XFormOperations: ")) + the_exception.Message, the_context);
65 : : }
66 : : if (!the_instance.is()) {
67 : : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.form.runtime.FormOperations of type com.sun.star.form.runtime.XFormOperations")), the_context);
68 : : }
69 : : return the_instance;
70 : : }
71 : :
72 : : private:
73 : : FormOperations(); // not implemented
74 : : FormOperations(FormOperations &); // not implemented
75 : : ~FormOperations(); // not implemented
76 : : void operator =(FormOperations); // not implemented
77 : : };
78 : :
79 : : } } } } }
80 : :
81 : : #endif // INCLUDED_COM_SUN_STAR_FORM_RUNTIME_FORMOPERATIONS_HPP
|