Line data Source code
1 : #ifndef INCLUDED_COM_SUN_STAR_RESOURCE_STRINGRESOURCEWITHSTORAGE_HPP
2 : #define INCLUDED_COM_SUN_STAR_RESOURCE_STRINGRESOURCEWITHSTORAGE_HPP
3 :
4 : #include "sal/config.h"
5 :
6 : #include <cassert>
7 :
8 : #include "com/sun/star/embed/XStorage.hpp"
9 : #include "com/sun/star/lang/IllegalArgumentException.hpp"
10 : #include "com/sun/star/lang/Locale.hpp"
11 : #include "com/sun/star/resource/XStringResourceWithStorage.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 StringResourceWithStorage {
27 : public:
28 0 : static ::com::sun::star::uno::Reference< css::resource::XStringResourceWithStorage > create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::com::sun::star::uno::Reference< css::embed::XStorage >& Storage, ::sal_Bool ReadOnly, const css::lang::Locale& locale, const ::rtl::OUString& BaseName, const ::rtl::OUString& Comment) {
29 : assert(the_context.is());
30 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(5);
31 0 : the_arguments[0] <<= Storage;
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 : ::com::sun::star::uno::Reference< css::resource::XStringResourceWithStorage > the_instance;
37 : try {
38 0 : the_instance = ::com::sun::star::uno::Reference< css::resource::XStringResourceWithStorage >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString( "com.sun.star.resource.StringResourceWithStorage" ), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
39 0 : } catch (const ::com::sun::star::uno::RuntimeException &) {
40 0 : throw;
41 0 : } catch (const ::com::sun::star::uno::Exception & the_exception) {
42 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.resource.StringResourceWithStorage of type com.sun.star.resource.XStringResourceWithStorage: " ) + the_exception.Message, the_context);
43 : }
44 0 : if (!the_instance.is()) {
45 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.resource.StringResourceWithStorage of type com.sun.star.resource.XStringResourceWithStorage" ), the_context);
46 : }
47 0 : return the_instance;
48 : }
49 :
50 : private:
51 : StringResourceWithStorage(); // not implemented
52 : StringResourceWithStorage(StringResourceWithStorage &); // not implemented
53 : ~StringResourceWithStorage(); // not implemented
54 : void operator =(StringResourceWithStorage); // not implemented
55 : };
56 :
57 : } } } }
58 :
59 : #endif // INCLUDED_COM_SUN_STAR_RESOURCE_STRINGRESOURCEWITHSTORAGE_HPP
|