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( const Reference< XMultiServiceFactory >& rSrvMgr ) :
56 0 : m_SrvMgr( rSrvMgr )
57 : {
58 0 : }
59 :
60 : //------------------------------------------------------------------------
61 : // createMimeContentType
62 : //------------------------------------------------------------------------
63 :
64 0 : Reference< XMimeContentType > CMimeContentTypeFactory::createMimeContentType( const OUString& aContentType )
65 : throw( IllegalArgumentException, RuntimeException )
66 : {
67 0 : MutexGuard aGuard( m_aMutex );
68 0 : return Reference< XMimeContentType >( new CMimeContentType( aContentType ) );
69 : }
70 :
71 : // -------------------------------------------------
72 : // XServiceInfo
73 : // -------------------------------------------------
74 :
75 0 : OUString SAL_CALL CMimeContentTypeFactory::getImplementationName( )
76 : throw( RuntimeException )
77 : {
78 0 : return OUString( MIMECONTENTTYPEFACTORY_IMPL_NAME );
79 : }
80 :
81 : // -------------------------------------------------
82 : // XServiceInfo
83 : // -------------------------------------------------
84 :
85 0 : sal_Bool SAL_CALL CMimeContentTypeFactory::supportsService( const OUString& ServiceName )
86 : throw( RuntimeException )
87 : {
88 0 : Sequence < OUString > SupportedServicesNames = MimeContentTypeFactory_getSupportedServiceNames();
89 :
90 0 : for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
91 0 : if (SupportedServicesNames[n].compareTo(ServiceName) == 0)
92 0 : return sal_True;
93 :
94 0 : return sal_False;
95 : }
96 :
97 : // -------------------------------------------------
98 : // XServiceInfo
99 : // -------------------------------------------------
100 :
101 0 : Sequence< OUString > SAL_CALL CMimeContentTypeFactory::getSupportedServiceNames( )
102 : throw( RuntimeException )
103 : {
104 0 : return MimeContentTypeFactory_getSupportedServiceNames( );
105 : }
106 :
107 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|