LibreOffice Module framework (master)
1
framework
source
services
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
20
#include <
services/mediatypedetectionhelper.hxx
>
21
#include <
svl/inettype.hxx
>
22
#include <
cppuhelper/supportsservice.hxx
>
23
#include <com/sun/star/uno/XComponentContext.hpp>
24
25
namespace
framework
26
{
27
28
using namespace
::
com::sun::star
;
29
30
// constructor
31
32
MediaTypeDetectionHelper::MediaTypeDetectionHelper
()
33
{
34
}
35
36
// destructor
37
38
MediaTypeDetectionHelper::~MediaTypeDetectionHelper
()
39
{
40
}
41
42
// XInterface, XTypeProvider, XServiceInfo
43
44
OUString SAL_CALL
MediaTypeDetectionHelper::getImplementationName
()
45
{
46
return
"com.sun.star.comp.framework.MediaTypeDetectionHelper"
;
47
}
48
49
sal_Bool
SAL_CALL
MediaTypeDetectionHelper::supportsService
(
const
OUString& sServiceName )
50
{
51
return
cppu::supportsService
(
this
,
sServiceName
);
52
}
53
54
css::uno::Sequence< OUString > SAL_CALL
MediaTypeDetectionHelper::getSupportedServiceNames
()
55
{
56
return
{
"com.sun.star.frame.MediaTypeDetectionHelper"
};
57
}
58
59
60
// XStringMapping
61
62
sal_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
];
70
INetContentType
eType
=
INetContentTypes::GetContentTypeFromURL
( rUrl );
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
85
extern
"C"
SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
86
framework_MediaTypeDetectionHelper_get_implementation
(
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: */
sServiceName
constexpr OUStringLiteral sServiceName
INetContentTypes::GetContentType
static INetContentType GetContentType(OUString const &rTypeName)
INetContentTypes::GetContentTypeFromURL
static INetContentType GetContentTypeFromURL(std::u16string_view aURL)
framework::MediaTypeDetectionHelper
Definition:
mediatypedetectionhelper.hxx:42
framework::MediaTypeDetectionHelper::mapStrings
virtual sal_Bool SAL_CALL mapStrings(css::uno::Sequence< OUString > &seqParameter) override
Definition:
mediatypedetectionhelper.cxx:62
framework::MediaTypeDetectionHelper::supportsService
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
Definition:
mediatypedetectionhelper.cxx:49
framework::MediaTypeDetectionHelper::~MediaTypeDetectionHelper
virtual ~MediaTypeDetectionHelper() override
Definition:
mediatypedetectionhelper.cxx:38
framework::MediaTypeDetectionHelper::getImplementationName
virtual OUString SAL_CALL getImplementationName() override
Definition:
mediatypedetectionhelper.cxx:44
framework::MediaTypeDetectionHelper::getSupportedServiceNames
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition:
mediatypedetectionhelper.cxx:54
framework::MediaTypeDetectionHelper::MediaTypeDetectionHelper
MediaTypeDetectionHelper()
Definition:
mediatypedetectionhelper.cxx:32
eType
DocumentType eType
inettype.hxx
INetContentType
INetContentType
framework_MediaTypeDetectionHelper_get_implementation
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * framework_MediaTypeDetectionHelper_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition:
mediatypedetectionhelper.cxx:86
mediatypedetectionhelper.hxx
com::sun::star
cppu::supportsService
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
framework
Definition:
acceleratorcache.cxx:27
i
int i
supportsservice.hxx
sal_Bool
unsigned char sal_Bool
Generated on Sun Jul 30 2023 04:33:29 for LibreOffice Module framework (master) by
1.9.3