Line data Source code
1 : #ifndef INCLUDED_COM_SUN_STAR_SECURITY_DOCUMENTDIGITALSIGNATURES_HPP
2 : #define INCLUDED_COM_SUN_STAR_SECURITY_DOCUMENTDIGITALSIGNATURES_HPP
3 :
4 : #include "sal/config.h"
5 :
6 : #include <cassert>
7 :
8 : #include "com/sun/star/security/XDocumentDigitalSignatures.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 : #include "sal/types.h"
20 :
21 : namespace com { namespace sun { namespace star { namespace security {
22 :
23 : class DocumentDigitalSignatures {
24 : public:
25 0 : static ::com::sun::star::uno::Reference< css::security::XDocumentDigitalSignatures > createDefault(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context) {
26 : assert(the_context.is());
27 0 : ::com::sun::star::uno::Reference< css::security::XDocumentDigitalSignatures > the_instance;
28 : try {
29 0 : the_instance = ::com::sun::star::uno::Reference< css::security::XDocumentDigitalSignatures >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString( "com.sun.star.security.DocumentDigitalSignatures" ), ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >(), the_context), ::com::sun::star::uno::UNO_QUERY);
30 0 : } catch (const ::com::sun::star::uno::RuntimeException &) {
31 0 : throw;
32 0 : } catch (const ::com::sun::star::uno::Exception & the_exception) {
33 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.security.DocumentDigitalSignatures of type com.sun.star.security.XDocumentDigitalSignatures: " ) + the_exception.Message, the_context);
34 : }
35 0 : if (!the_instance.is()) {
36 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.security.DocumentDigitalSignatures of type com.sun.star.security.XDocumentDigitalSignatures" ), the_context);
37 : }
38 0 : return the_instance;
39 : }
40 :
41 132 : static ::com::sun::star::uno::Reference< css::security::XDocumentDigitalSignatures > createWithVersion(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::rtl::OUString& ODFVersion) {
42 : assert(the_context.is());
43 132 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(1);
44 132 : the_arguments[0] <<= ODFVersion;
45 132 : ::com::sun::star::uno::Reference< css::security::XDocumentDigitalSignatures > the_instance;
46 : try {
47 132 : the_instance = ::com::sun::star::uno::Reference< css::security::XDocumentDigitalSignatures >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString( "com.sun.star.security.DocumentDigitalSignatures" ), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
48 0 : } catch (const ::com::sun::star::uno::RuntimeException &) {
49 0 : throw;
50 0 : } catch (const ::com::sun::star::uno::Exception & the_exception) {
51 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.security.DocumentDigitalSignatures of type com.sun.star.security.XDocumentDigitalSignatures: " ) + the_exception.Message, the_context);
52 : }
53 132 : if (!the_instance.is()) {
54 62 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.security.DocumentDigitalSignatures of type com.sun.star.security.XDocumentDigitalSignatures" ), the_context);
55 : }
56 132 : return the_instance;
57 : }
58 :
59 0 : static ::com::sun::star::uno::Reference< css::security::XDocumentDigitalSignatures > createWithVersionAndValidSignature(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context, const ::rtl::OUString& ODFVersion, ::sal_Bool HasValidDocumentSignature) {
60 : assert(the_context.is());
61 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > the_arguments(2);
62 0 : the_arguments[0] <<= ODFVersion;
63 0 : the_arguments[1] <<= HasValidDocumentSignature;
64 0 : ::com::sun::star::uno::Reference< css::security::XDocumentDigitalSignatures > the_instance;
65 : try {
66 0 : the_instance = ::com::sun::star::uno::Reference< css::security::XDocumentDigitalSignatures >(the_context->getServiceManager()->createInstanceWithArgumentsAndContext(::rtl::OUString( "com.sun.star.security.DocumentDigitalSignatures" ), the_arguments, the_context), ::com::sun::star::uno::UNO_QUERY);
67 0 : } catch (const ::com::sun::star::uno::RuntimeException &) {
68 0 : throw;
69 0 : } catch (const ::com::sun::star::uno::Exception & the_exception) {
70 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.security.DocumentDigitalSignatures of type com.sun.star.security.XDocumentDigitalSignatures: " ) + the_exception.Message, the_context);
71 : }
72 0 : if (!the_instance.is()) {
73 0 : throw ::com::sun::star::uno::DeploymentException(::rtl::OUString( "component context fails to supply service com.sun.star.security.DocumentDigitalSignatures of type com.sun.star.security.XDocumentDigitalSignatures" ), the_context);
74 : }
75 0 : return the_instance;
76 : }
77 :
78 : private:
79 : DocumentDigitalSignatures(); // not implemented
80 : DocumentDigitalSignatures(DocumentDigitalSignatures &); // not implemented
81 : ~DocumentDigitalSignatures(); // not implemented
82 : void operator =(DocumentDigitalSignatures); // not implemented
83 : };
84 :
85 : } } } }
86 :
87 : #endif // INCLUDED_COM_SUN_STAR_SECURITY_DOCUMENTDIGITALSIGNATURES_HPP
|