Branch data Line data Source code
1 : : #ifndef INCLUDED_COM_SUN_STAR_DRAWING_FRAMEWORK_RESOURCEID_HPP
2 : : #define INCLUDED_COM_SUN_STAR_DRAWING_FRAMEWORK_RESOURCEID_HPP
3 : :
4 : : #include "sal/config.h"
5 : :
6 : : #include "com/sun/star/uno/RuntimeException.hpp"
7 : : #include "com/sun/star/lang/XMultiComponentFactory.hpp"
8 : : #include "com/sun/star/uno/XComponentContext.hpp"
9 : : #include "com/sun/star/uno/DeploymentException.hpp"
10 : : #include "com/sun/star/uno/Exception.hpp"
11 : : #include "com/sun/star/drawing/framework/XResourceId.hpp"
12 : : #include "com/sun/star/uno/Any.hxx"
13 : : #include "com/sun/star/uno/Reference.hxx"
14 : : #include "com/sun/star/uno/Sequence.hxx"
15 : : #include "cppu/unotype.hxx"
16 : : #include "rtl/ustring.h"
17 : : #include "rtl/ustring.hxx"
18 : :
19 : : namespace com { namespace sun { namespace star { namespace drawing { namespace framework {
20 : :
21 : : class ResourceId {
22 : : public:
23 : : static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > createEmpty(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context) {
24 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > the_factory(the_context->getServiceManager());
25 : : if (!the_factory.is()) {
26 : : throw com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service manager")), the_context);
27 : : }
28 : : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > the_instance;
29 : : try {
30 : : the_instance = ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >(the_factory->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.framework.ResourceId")), ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >(), the_context), ::com::sun::star::uno::UNO_QUERY);
31 : : } catch (::com::sun::star::uno::RuntimeException &) {
32 : : throw;
33 : : } catch (::com::sun::star::uno::Exception & the_exception) {
34 : : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.drawing.framework.ResourceId of type com.sun.star.drawing.framework.XResourceId: ")) + the_exception.Message, the_context);
35 : : }
36 : : if (!the_instance.is()) {
37 : : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.drawing.framework.ResourceId of type com.sun.star.drawing.framework.XResourceId")), the_context);
38 : : }
39 : : return the_instance;
40 : : }
41 : :
42 : 189 : static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::rtl::OUString& sResourceURL) {
43 [ + - ][ + - ]: 189 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > the_factory(the_context->getServiceManager());
44 [ - + ]: 189 : if (!the_factory.is()) {
45 [ # # ][ # # ]: 0 : throw com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service manager")), the_context);
46 : : }
47 [ + - ]: 189 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(1);
48 [ + - ][ + - ]: 189 : the_arguments[0] <<= sResourceURL;
49 : 189 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > the_instance;
50 : : try {
51 [ + - ][ + - ]: 189 : the_instance = ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >(the_factory->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.framework.ResourceId")), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
[ + - ][ + - ]
[ + - ]
52 : 0 : } catch (::com::sun::star::uno::RuntimeException &) {
53 : 0 : throw;
54 [ # # # ]: 0 : } catch (::com::sun::star::uno::Exception & the_exception) {
55 [ # # # # ]: 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.drawing.framework.ResourceId of type com.sun.star.drawing.framework.XResourceId: ")) + the_exception.Message, the_context);
56 : : }
57 [ - + ]: 189 : if (!the_instance.is()) {
58 [ # # ][ # # ]: 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.drawing.framework.ResourceId of type com.sun.star.drawing.framework.XResourceId")), the_context);
59 : : }
60 [ + - ]: 189 : return the_instance;
61 : : }
62 : :
63 : 0 : static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > createWithAnchor(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::rtl::OUString& sResourceURL, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& xAnchor) {
64 [ # # ][ # # ]: 0 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > the_factory(the_context->getServiceManager());
65 [ # # ]: 0 : if (!the_factory.is()) {
66 [ # # ][ # # ]: 0 : throw com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service manager")), the_context);
67 : : }
68 [ # # ]: 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(2);
69 [ # # ][ # # ]: 0 : the_arguments[0] <<= sResourceURL;
70 [ # # ][ # # ]: 0 : the_arguments[1] <<= xAnchor;
71 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > the_instance;
72 : : try {
73 [ # # ][ # # ]: 0 : the_instance = ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >(the_factory->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.framework.ResourceId")), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
[ # # ][ # # ]
[ # # ]
74 : 0 : } catch (::com::sun::star::uno::RuntimeException &) {
75 : 0 : throw;
76 [ # # # ]: 0 : } catch (::com::sun::star::uno::Exception & the_exception) {
77 [ # # # # ]: 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.drawing.framework.ResourceId of type com.sun.star.drawing.framework.XResourceId: ")) + the_exception.Message, the_context);
78 : : }
79 [ # # ]: 0 : if (!the_instance.is()) {
80 [ # # ][ # # ]: 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.drawing.framework.ResourceId of type com.sun.star.drawing.framework.XResourceId")), the_context);
81 : : }
82 [ # # ]: 0 : return the_instance;
83 : : }
84 : :
85 : 0 : static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > createWithAnchorURL(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::rtl::OUString& sResourceURL, const ::rtl::OUString& sAnchorURL) {
86 [ # # ][ # # ]: 0 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > the_factory(the_context->getServiceManager());
87 [ # # ]: 0 : if (!the_factory.is()) {
88 [ # # ][ # # ]: 0 : throw com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service manager")), the_context);
89 : : }
90 [ # # ]: 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(2);
91 [ # # ][ # # ]: 0 : the_arguments[0] <<= sResourceURL;
92 [ # # ][ # # ]: 0 : the_arguments[1] <<= sAnchorURL;
93 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId > the_instance;
94 : : try {
95 [ # # ][ # # ]: 0 : the_instance = ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >(the_factory->createInstanceWithArgumentsAndContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.framework.ResourceId")), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
[ # # ][ # # ]
[ # # ]
96 : 0 : } catch (::com::sun::star::uno::RuntimeException &) {
97 : 0 : throw;
98 [ # # # ]: 0 : } catch (::com::sun::star::uno::Exception & the_exception) {
99 [ # # # # ]: 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.drawing.framework.ResourceId of type com.sun.star.drawing.framework.XResourceId: ")) + the_exception.Message, the_context);
100 : : }
101 [ # # ]: 0 : if (!the_instance.is()) {
102 [ # # ][ # # ]: 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("component context fails to supply service com.sun.star.drawing.framework.ResourceId of type com.sun.star.drawing.framework.XResourceId")), the_context);
103 : : }
104 [ # # ]: 0 : return the_instance;
105 : : }
106 : :
107 : : private:
108 : : ResourceId(); // not implemented
109 : : ResourceId(ResourceId &); // not implemented
110 : : ~ResourceId(); // not implemented
111 : : void operator =(ResourceId); // not implemented
112 : : };
113 : :
114 : : } } } } }
115 : :
116 : : #endif // INCLUDED_COM_SUN_STAR_DRAWING_FRAMEWORK_RESOURCEID_HPP
|