Line data Source code
1 : #ifndef INCLUDED_COM_SUN_STAR_RESOURCE_STRINGRESOURCEWITHLOCATION_HPP
2 : #define INCLUDED_COM_SUN_STAR_RESOURCE_STRINGRESOURCEWITHLOCATION_HPP
3 :
4 : #include "sal/config.h"
5 :
6 : #include <cassert>
7 :
8 : #include "com/sun/star/lang/IllegalArgumentException.hpp"
9 : #include "com/sun/star/lang/Locale.hpp"
10 : #include "com/sun/star/resource/XStringResourceWithLocation.hpp"
11 : #include "com/sun/star/task/XInteractionHandler.hpp"
12 : #include "com/sun/star/uno/DeploymentException.hpp"
13 : #include "com/sun/star/uno/Exception.hpp"
14 : #include "com/sun/star/uno/RuntimeException.hpp"
15 : #include "com/sun/star/uno/XComponentContext.hpp"
16 : #include "com/sun/star/uno/Any.hxx"
17 : #include "com/sun/star/uno/Reference.hxx"
18 : #include "com/sun/star/uno/Sequence.hxx"
19 : #include "cppu/unotype.hxx"
20 : #include "rtl/ustring.h"
21 : #include "rtl/ustring.hxx"
22 : #include "sal/types.h"
23 :
24 : namespace com { namespace sun { namespace star { namespace resource {
25 :
26 : class StringResourceWithLocation {
27 : public:
28 0 : static ::com::sun::star::uno::Reference< css::resource::XStringResourceWithLocation > create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::rtl::OUString& URL, ::sal_Bool ReadOnly, const css::lang::Locale& locale, const ::rtl::OUString& BaseName, const ::rtl::OUString& Comment, const ::com::sun::star::uno::Reference< css::task::XInteractionHandler >& Handler) {
29 : assert(the_context.is());
30 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(6);
31 0 : the_arguments[0] <<= URL;
32 0 : the_arguments[1] <<= ReadOnly;
33 0 : the_arguments[2] <<= locale;
34 0 : the_arguments[3] <<= BaseName;
35 0 : the_arguments[4] <<= Comment;
36 0 : the_arguments[5] <<= Handler;
37 0 : ::com::sun::star::uno::Reference< css::resource::XStringResourceWithLocation > the_instance;
38 : try {
39 0 : the_instance = ::com::sun::star::uno::Reference< css::resource::XStringResourceWithLocation >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString( "com.sun.star.resource.StringResourceWithLocation" ), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
40 0 : } catch (const ::com::sun::star::uno::RuntimeException &) {
41 0 : throw;
42 0 : } catch (const ::com::sun::star::uno::Exception & the_exception) {
43 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.resource.StringResourceWithLocation of type com.sun.star.resource.XStringResourceWithLocation: " ) + the_exception.Message, the_context);
44 : }
45 0 : if (!the_instance.is()) {
46 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.resource.StringResourceWithLocation of type com.sun.star.resource.XStringResourceWithLocation" ), the_context);
47 : }
48 0 : return the_instance;
49 : }
50 :
51 : private:
52 : StringResourceWithLocation(); // not implemented
53 : StringResourceWithLocation(StringResourceWithLocation &); // not implemented
54 : ~StringResourceWithLocation(); // not implemented
55 : void operator =(StringResourceWithLocation); // not implemented
56 : };
57 :
58 : } } } }
59 :
60 : #endif // INCLUDED_COM_SUN_STAR_RESOURCE_STRINGRESOURCEWITHLOCATION_HPP
|