1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: mediatypedetectionhelper.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_framework.hxx"
34 //_________________________________________________________________________________________________________________
36 //_________________________________________________________________________________________________________________
37 #include <services/mediatypedetectionhelper.hxx>
39 #include <svtools/inettype.hxx>
40 #include <tools/string.hxx>
41 #include <rtl/logfile.hxx>
43 //_________________________________________________________________________________________________________________
45 //_________________________________________________________________________________________________________________
47 //_________________________________________________________________________________________________________________
49 //_________________________________________________________________________________________________________________
54 using namespace ::com::sun::star
;
55 using namespace ::rtl
;
57 //_________________________________________________________________________________________________________________
59 //_________________________________________________________________________________________________________________
61 //*****************************************************************************************************************
63 //*****************************************************************************************************************
64 MediaTypeDetectionHelper::MediaTypeDetectionHelper( const uno::Reference
< lang::XMultiServiceFactory
>& xFactory
)
65 : m_xFactory( xFactory
)
69 //*****************************************************************************************************************
71 //*****************************************************************************************************************
72 MediaTypeDetectionHelper::~MediaTypeDetectionHelper()
76 DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( MediaTypeDetectionHelper
78 , SERVICENAME_MEDIATYPEDETECTIONHELPER
79 , IMPLEMENTATIONNAME_MEDIATYPEDETECTIONHELPER
82 DEFINE_INIT_SERVICE ( MediaTypeDetectionHelper
,
87 //*****************************************************************************************************************
89 //*****************************************************************************************************************
92 sal_Bool SAL_CALL
MediaTypeDetectionHelper::mapStrings(
93 uno::Sequence
< OUString
>& rSeq
)
94 throw(uno::RuntimeException
)
96 sal_Bool bModified
= sal_False
;
97 for( sal_Int32 i
= rSeq
.getLength(); i
--; )
100 OUString
& rUrl
= rSeq
[i
];
101 INetContentType eType
= INetContentTypes::GetContentTypeFromURL( rUrl
);
103 UniString
aType( INetContentTypes::GetContentType( eType
) );
107 bModified
= sal_True
;
113 } // namespace framework