Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / writerperfect / source / draw / MSPUBImportFilter.cxx
blob03a3ff54a0f5fec8823fdbe4d79f61fbf04cf074
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* MSPUBImportFilter: Sets up the filter, and calls OdgExporter
3 * to do the actual filtering
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 */
10 #include <com/sun/star/uno/XComponentContext.hpp>
11 #include <cppuhelper/supportsservice.hxx>
13 #include <libmspub/libmspub.h>
14 #include <libodfgen/libodfgen.hxx>
16 #include "MSPUBImportFilter.hxx"
18 using com::sun::star::uno::RuntimeException;
19 using com::sun::star::uno::Sequence;
20 using com::sun::star::uno::XComponentContext;
21 using com::sun::star::uno::XInterface;
23 bool MSPUBImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdgGenerator &rGenerator, utl::MediaDescriptor &)
25 return libmspub::MSPUBDocument::parse(&rInput, &rGenerator);
28 bool MSPUBImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
30 if (libmspub::MSPUBDocument::isSupported(&rInput))
32 rTypeName = "draw_Publisher_Document";
33 return true;
36 return false;
39 // XServiceInfo
40 OUString SAL_CALL MSPUBImportFilter::getImplementationName()
41 throw (RuntimeException, std::exception)
43 return OUString("com.sun.star.comp.Draw.MSPUBImportFilter");
46 sal_Bool SAL_CALL MSPUBImportFilter::supportsService(const OUString &rServiceName)
47 throw (RuntimeException, std::exception)
49 return cppu::supportsService(this, rServiceName);
52 Sequence< OUString > SAL_CALL MSPUBImportFilter::getSupportedServiceNames()
53 throw (RuntimeException, std::exception)
55 Sequence < OUString > aRet(2);
56 OUString *pArray = aRet.getArray();
57 pArray[0] = "com.sun.star.document.ImportFilter";
58 pArray[1] = "com.sun.star.document.ExtendedTypeDetection";
59 return aRet;
62 extern "C"
63 SAL_DLLPUBLIC_EXPORT css::uno::XInterface *SAL_CALL
64 com_sun_star_comp_Draw_MSPUBImportFilter_get_implementation(
65 css::uno::XComponentContext *const context,
66 const css::uno::Sequence<css::uno::Any> &)
68 return cppu::acquire(new MSPUBImportFilter(context));
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */