LibreOffice Module framework (master) 1
mediatypedetectionhelper.cxx
Go to the documentation of this file.
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
21#include <svl/inettype.hxx>
23#include <com/sun/star/uno/XComponentContext.hpp>
24
25namespace framework
26{
27
28using namespace ::com::sun::star;
29
30// constructor
31
33{
34}
35
36// destructor
37
39{
40}
41
42// XInterface, XTypeProvider, XServiceInfo
43
45{
46 return "com.sun.star.comp.framework.MediaTypeDetectionHelper";
47}
48
49sal_Bool SAL_CALL MediaTypeDetectionHelper::supportsService( const OUString& sServiceName )
50{
52}
53
54css::uno::Sequence< OUString > SAL_CALL MediaTypeDetectionHelper::getSupportedServiceNames()
55{
56 return { "com.sun.star.frame.MediaTypeDetectionHelper" };
57}
58
59
60// XStringMapping
61
62sal_Bool SAL_CALL MediaTypeDetectionHelper::mapStrings(uno::Sequence< OUString >& rSeq)
63{
64 bool bModified = false;
65 auto rSeqRange = asNonConstRange(rSeq);
66 for( sal_Int32 i = rSeq.getLength(); i--; )
67 {
68
69 OUString& rUrl = rSeqRange[i];
71
72 OUString aType( INetContentTypes::GetContentType( eType ) );
73 if (!aType.isEmpty())
74 {
75 rUrl = aType;
76 bModified = true;
77 }
78 }
79 return bModified;
80}
81
82} // namespace framework
83
84
85extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
87 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const& )
88{
89 return cppu::acquire(new framework::MediaTypeDetectionHelper());
90}
91
92/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr OUStringLiteral sServiceName
static INetContentType GetContentType(OUString const &rTypeName)
static INetContentType GetContentTypeFromURL(std::u16string_view aURL)
virtual sal_Bool SAL_CALL mapStrings(css::uno::Sequence< OUString > &seqParameter) override
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
DocumentType eType
INetContentType
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * framework_MediaTypeDetectionHelper_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
int i
unsigned char sal_Bool