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