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