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 <services/mediatypedetectionhelper.hxx>
21 : #include <services.h>
22 : #include <svl/inettype.hxx>
23 :
24 : namespace framework
25 : {
26 :
27 : using namespace ::com::sun::star;
28 : using namespace ::rtl;
29 :
30 : // constructor
31 :
32 0 : MediaTypeDetectionHelper::MediaTypeDetectionHelper( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
33 0 : : m_xFactory( xFactory )
34 : {
35 0 : }
36 :
37 : // destructor
38 :
39 0 : MediaTypeDetectionHelper::~MediaTypeDetectionHelper()
40 : {
41 0 : }
42 :
43 0 : DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( MediaTypeDetectionHelper
44 : , ::cppu::OWeakObject
45 : , "com.sun.star.frame.MediaTypeDetectionHelper"
46 : , IMPLEMENTATIONNAME_MEDIATYPEDETECTIONHELPER
47 : )
48 :
49 0 : DEFINE_INIT_SERVICE ( MediaTypeDetectionHelper,
50 : {
51 : }
52 : )
53 :
54 : // XStringMapping
55 :
56 0 : sal_Bool SAL_CALL MediaTypeDetectionHelper::mapStrings(uno::Sequence< OUString >& rSeq)
57 : throw (uno::RuntimeException, std::exception)
58 : {
59 0 : bool bModified = false;
60 0 : for( sal_Int32 i = rSeq.getLength(); i--; )
61 : {
62 :
63 0 : OUString& rUrl = rSeq[i];
64 0 : INetContentType eType = INetContentTypes::GetContentTypeFromURL( rUrl );
65 :
66 0 : OUString aType( INetContentTypes::GetContentType( eType ) );
67 0 : if (!aType.isEmpty())
68 : {
69 0 : rUrl = aType;
70 0 : bModified = true;
71 : }
72 0 : }
73 0 : return bModified;
74 : }
75 :
76 : } // namespace framework
77 :
78 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|