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