Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / writerperfect / source / draw / WPGImportFilter.cxx
blobdbac05dd7bd0f04533b7a943e136b1a1788f0607
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* WPGImportFilter: Sets up the filter, and calls OdgExporter
3 * to do the actual filtering
5 * This file is part of the LibreOffice project.
7 * This Source Code Form is subject to the terms of the Mozilla Public
8 * License, v. 2.0. If a copy of the MPL was not distributed with this
9 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 /* "This product is not manufactured, approved, or supported by
13 * Corel Corporation or Corel Corporation Limited."
16 #include <com/sun/star/uno/XComponentContext.hpp>
17 #include <cppuhelper/supportsservice.hxx>
19 #include <libodfgen/libodfgen.hxx>
21 #include <libwpg/libwpg.h>
23 #include "WPGImportFilter.hxx"
25 using com::sun::star::uno::RuntimeException;
26 using com::sun::star::uno::Sequence;
27 using com::sun::star::uno::XComponentContext;
28 using com::sun::star::uno::XInterface;
30 bool WPGImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdgGenerator &rGenerator, utl::MediaDescriptor &)
32 return libwpg::WPGraphics::parse(&rInput, &rGenerator);
35 bool WPGImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
37 if (libwpg::WPGraphics::isSupported(&rInput))
39 rTypeName = "draw_WordPerfect_Graphics";
40 return true;
43 return false;
46 // XServiceInfo
47 OUString SAL_CALL WPGImportFilter::getImplementationName()
48 throw (RuntimeException, std::exception)
50 return OUString("com.sun.star.comp.Draw.WPGImportFilter");
53 sal_Bool SAL_CALL WPGImportFilter::supportsService(const OUString &rServiceName)
54 throw (RuntimeException, std::exception)
56 return cppu::supportsService(this, rServiceName);
59 Sequence< OUString > SAL_CALL WPGImportFilter::getSupportedServiceNames()
60 throw (RuntimeException, std::exception)
62 Sequence < OUString > aRet(2);
63 OUString *pArray = aRet.getArray();
64 pArray[0] = "com.sun.star.document.ImportFilter";
65 pArray[1] = "com.sun.star.document.ExtendedTypeDetection";
66 return aRet;
69 extern "C"
70 SAL_DLLPUBLIC_EXPORT css::uno::XInterface *SAL_CALL
71 com_sun_star_comp_Draw_WPGImportFilter_get_implementation(
72 css::uno::XComponentContext *const context,
73 const css::uno::Sequence<css::uno::Any> &)
75 return cppu::acquire(new WPGImportFilter(context));
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */