Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <osl/diagnose.h>
21 : #include "mcnttfactory.hxx"
22 : #include "mcnttype.hxx"
23 :
24 : #define MIMECONTENTTYPEFACTORY_IMPL_NAME "com.sun.star.datatransfer.MimeCntTypeFactory"
25 :
26 : //------------------------------------------------------------------------
27 : // namespace directives
28 : //------------------------------------------------------------------------
29 :
30 : using namespace ::rtl;
31 : using namespace ::osl;
32 : using namespace ::cppu;
33 : using namespace com::sun::star::uno;
34 : using namespace com::sun::star::lang;
35 : using namespace com::sun::star::datatransfer;
36 :
37 : //------------------------------------------------------------------------
38 : // helper functions
39 : //------------------------------------------------------------------------
40 :
41 : namespace
42 : {
43 0 : Sequence< OUString > SAL_CALL MimeContentTypeFactory_getSupportedServiceNames( )
44 : {
45 0 : Sequence< OUString > aRet(1);
46 0 : aRet[0] = OUString("com.sun.star.datatransfer.MimeContentTypeFactory");
47 0 : return aRet;
48 : }
49 : }
50 :
51 : //------------------------------------------------------------------------
52 : // ctor
53 : //------------------------------------------------------------------------
54 :
55 0 : CMimeContentTypeFactory::CMimeContentTypeFactory()
56 : {
57 0 : }
58 :
59 : //------------------------------------------------------------------------
60 : // createMimeContentType
61 : //------------------------------------------------------------------------
62 :
63 0 : Reference< XMimeContentType > CMimeContentTypeFactory::createMimeContentType( const OUString& aContentType )
64 : throw( IllegalArgumentException, RuntimeException )
65 : {
66 0 : MutexGuard aGuard( m_aMutex );
67 0 : return Reference< XMimeContentType >( new CMimeContentType( aContentType ) );
68 : }
69 :
70 : // -------------------------------------------------
71 : // XServiceInfo
72 : // -------------------------------------------------
73 :
74 0 : OUString SAL_CALL CMimeContentTypeFactory::getImplementationName( )
75 : throw( RuntimeException )
76 : {
77 0 : return OUString( MIMECONTENTTYPEFACTORY_IMPL_NAME );
78 : }
79 :
80 : // -------------------------------------------------
81 : // XServiceInfo
82 : // -------------------------------------------------
83 :
84 0 : sal_Bool SAL_CALL CMimeContentTypeFactory::supportsService( const OUString& ServiceName )
85 : throw( RuntimeException )
86 : {
87 0 : Sequence < OUString > SupportedServicesNames = MimeContentTypeFactory_getSupportedServiceNames();
88 :
89 0 : for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
90 0 : if ( SupportedServicesNames[n] == ServiceName )
91 0 : return sal_True;
92 :
93 0 : return sal_False;
94 : }
95 :
96 : // -------------------------------------------------
97 : // XServiceInfo
98 : // -------------------------------------------------
99 :
100 0 : Sequence< OUString > SAL_CALL CMimeContentTypeFactory::getSupportedServiceNames( )
101 : throw( RuntimeException )
102 : {
103 0 : return MimeContentTypeFactory_getSupportedServiceNames( );
104 : }
105 :
106 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|