Branch data Line data Source code
1 : : #ifndef INCLUDED_COM_SUN_STAR_AWT_GRID_SORTABLEGRIDDATAMODEL_HPP
2 : : #define INCLUDED_COM_SUN_STAR_AWT_GRID_SORTABLEGRIDDATAMODEL_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/lang/IllegalArgumentException.hpp"
11 : : #include "com/sun/star/awt/grid/XSortableMutableGridDataModel.hpp"
12 : : #include "com/sun/star/uno/RuntimeException.hpp"
13 : : #include "com/sun/star/i18n/XCollator.hpp"
14 : : #include "com/sun/star/awt/grid/XMutableGridDataModel.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 awt { namespace grid {
23 : :
24 : : class SortableGridDataModel {
25 : : public:
26 : 2 : static ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XSortableMutableGridDataModel > create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XMutableGridDataModel >& DelegatorModel) {
27 [ + - ][ + - ]: 2 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > the_factory(the_context->getServiceManager());
28 [ - + ]: 2 : 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 [ + - ]: 2 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(1);
32 [ + - ][ + - ]: 2 : the_arguments[0] <<= DelegatorModel;
33 : 2 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XSortableMutableGridDataModel > the_instance;
34 : : try {
35 [ + - ][ + - ]: 2 : the_instance = ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XSortableMutableGridDataModel >(the_factory->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.grid.SortableGridDataModel")), 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.awt.grid.SortableGridDataModel of type com.sun.star.awt.grid.XSortableMutableGridDataModel: ")) + the_exception.Message, the_context);
42 : : }
43 [ - + ]: 2 : 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.awt.grid.SortableGridDataModel of type com.sun.star.awt.grid.XSortableMutableGridDataModel")), the_context);
45 : : }
46 [ + - ]: 2 : return the_instance;
47 : : }
48 : :
49 : : static ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XSortableMutableGridDataModel > createWithCollator(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XMutableGridDataModel >& DelegatorModel, const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator >& Collator) {
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(2);
55 : : the_arguments[0] <<= DelegatorModel;
56 : : the_arguments[1] <<= Collator;
57 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XSortableMutableGridDataModel > the_instance;
58 : : try {
59 : : the_instance = ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XSortableMutableGridDataModel >(the_factory->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.grid.SortableGridDataModel")), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
60 : : } catch (::com::sun::star::uno::RuntimeException &) {
61 : : throw;
62 : : } catch (::com::sun::star::lang::IllegalArgumentException &) {
63 : : throw;
64 : : } catch (::com::sun::star::uno::Exception & the_exception) {
65 : : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.awt.grid.SortableGridDataModel of type com.sun.star.awt.grid.XSortableMutableGridDataModel: ")) + the_exception.Message, the_context);
66 : : }
67 : : if (!the_instance.is()) {
68 : : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.awt.grid.SortableGridDataModel of type com.sun.star.awt.grid.XSortableMutableGridDataModel")), the_context);
69 : : }
70 : : return the_instance;
71 : : }
72 : :
73 : : private:
74 : : SortableGridDataModel(); // not implemented
75 : : SortableGridDataModel(SortableGridDataModel &); // not implemented
76 : : ~SortableGridDataModel(); // not implemented
77 : : void operator =(SortableGridDataModel); // not implemented
78 : : };
79 : :
80 : : } } } } }
81 : :
82 : : #endif // INCLUDED_COM_SUN_STAR_AWT_GRID_SORTABLEGRIDDATAMODEL_HPP
|