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 <cassert>
7 :
8 : #include "com/sun/star/drawing/framework/XResourceId.hpp"
9 : #include "com/sun/star/uno/DeploymentException.hpp"
10 : #include "com/sun/star/uno/Exception.hpp"
11 : #include "com/sun/star/uno/RuntimeException.hpp"
12 : #include "com/sun/star/uno/XComponentContext.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 :
20 : namespace com { namespace sun { namespace star { namespace drawing { namespace framework {
21 :
22 : class ResourceId {
23 : public:
24 : static ::com::sun::star::uno::Reference< css::drawing::framework::XResourceId > createEmpty(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context) {
25 : assert(the_context.is());
26 : ::com::sun::star::uno::Reference< css::drawing::framework::XResourceId > the_instance;
27 : try {
28 : the_instance = ::com::sun::star::uno::Reference< css::drawing::framework::XResourceId >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString( "com.sun.star.drawing.framework.ResourceId" ), ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >(), the_context), ::com::sun::star::uno::UNO_QUERY);
29 : } catch (const ::com::sun::star::uno::RuntimeException &) {
30 : throw;
31 : } catch (const ::com::sun::star::uno::Exception & the_exception) {
32 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "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);
33 : }
34 : if (!the_instance.is()) {
35 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.drawing.framework.ResourceId of type com.sun.star.drawing.framework.XResourceId" ), the_context);
36 : }
37 : return the_instance;
38 : }
39 :
40 96 : static ::com::sun::star::uno::Reference< css::drawing::framework::XResourceId > create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::rtl::OUString& sResourceURL) {
41 : assert(the_context.is());
42 96 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(1);
43 96 : the_arguments[0] <<= sResourceURL;
44 96 : ::com::sun::star::uno::Reference< css::drawing::framework::XResourceId > the_instance;
45 : try {
46 96 : the_instance = ::com::sun::star::uno::Reference< css::drawing::framework::XResourceId >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString( "com.sun.star.drawing.framework.ResourceId" ), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
47 0 : } catch (const ::com::sun::star::uno::RuntimeException &) {
48 0 : throw;
49 0 : } catch (const ::com::sun::star::uno::Exception & the_exception) {
50 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "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);
51 : }
52 96 : if (!the_instance.is()) {
53 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.drawing.framework.ResourceId of type com.sun.star.drawing.framework.XResourceId" ), the_context);
54 : }
55 96 : return the_instance;
56 : }
57 :
58 0 : static ::com::sun::star::uno::Reference< css::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< css::drawing::framework::XResourceId >& xAnchor) {
59 : assert(the_context.is());
60 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(2);
61 0 : the_arguments[0] <<= sResourceURL;
62 0 : the_arguments[1] <<= xAnchor;
63 0 : ::com::sun::star::uno::Reference< css::drawing::framework::XResourceId > the_instance;
64 : try {
65 0 : the_instance = ::com::sun::star::uno::Reference< css::drawing::framework::XResourceId >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString( "com.sun.star.drawing.framework.ResourceId" ), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
66 0 : } catch (const ::com::sun::star::uno::RuntimeException &) {
67 0 : throw;
68 0 : } catch (const ::com::sun::star::uno::Exception & the_exception) {
69 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "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);
70 : }
71 0 : if (!the_instance.is()) {
72 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.drawing.framework.ResourceId of type com.sun.star.drawing.framework.XResourceId" ), the_context);
73 : }
74 0 : return the_instance;
75 : }
76 :
77 0 : static ::com::sun::star::uno::Reference< css::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) {
78 : assert(the_context.is());
79 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(2);
80 0 : the_arguments[0] <<= sResourceURL;
81 0 : the_arguments[1] <<= sAnchorURL;
82 0 : ::com::sun::star::uno::Reference< css::drawing::framework::XResourceId > the_instance;
83 : try {
84 0 : the_instance = ::com::sun::star::uno::Reference< css::drawing::framework::XResourceId >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString( "com.sun.star.drawing.framework.ResourceId" ), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
85 0 : } catch (const ::com::sun::star::uno::RuntimeException &) {
86 0 : throw;
87 0 : } catch (const ::com::sun::star::uno::Exception & the_exception) {
88 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "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);
89 : }
90 0 : if (!the_instance.is()) {
91 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.drawing.framework.ResourceId of type com.sun.star.drawing.framework.XResourceId" ), the_context);
92 : }
93 0 : return the_instance;
94 : }
95 :
96 : private:
97 : ResourceId(); // not implemented
98 : ResourceId(ResourceId &); // not implemented
99 : ~ResourceId(); // not implemented
100 : void operator =(ResourceId); // not implemented
101 : };
102 :
103 : } } } } }
104 :
105 : #endif // INCLUDED_COM_SUN_STAR_DRAWING_FRAMEWORK_RESOURCEID_HPP
|