bump product version to 5.0.4.1
[LibreOffice.git] / writerperfect / source / draw / WPGImportFilter.cxx
blobd99572a1d6d1e39fe920e331a747ddaa6a51c482
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/Reference.h>
17 #include <com/sun/star/uno/XComponentContext.hpp>
18 #include <cppuhelper/supportsservice.hxx>
20 #include <libodfgen/libodfgen.hxx>
22 #include <libwpg/libwpg.h>
24 #include "WPGImportFilter.hxx"
26 using com::sun::star::uno::Reference;
27 using com::sun::star::uno::Exception;
28 using com::sun::star::uno::RuntimeException;
29 using com::sun::star::uno::Sequence;
30 using com::sun::star::uno::XComponentContext;
31 using com::sun::star::uno::XInterface;
33 bool WPGImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdgGenerator &rGenerator, utl::MediaDescriptor &)
35 return libwpg::WPGraphics::parse(&rInput, &rGenerator);
38 bool WPGImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
40 if (libwpg::WPGraphics::isSupported(&rInput))
42 rTypeName = "draw_WordPerfect_Graphics";
43 return true;
46 return false;
49 OUString WPGImportFilter_getImplementationName()
50 throw (RuntimeException)
52 return OUString("com.sun.star.comp.Draw.WPGImportFilter");
55 Sequence< OUString > SAL_CALL WPGImportFilter_getSupportedServiceNames()
56 throw (RuntimeException)
58 Sequence < OUString > aRet(2);
59 OUString *pArray = aRet.getArray();
60 pArray[0] = "com.sun.star.document.ImportFilter";
61 pArray[1] = "com.sun.star.document.ExtendedTypeDetection";
62 return aRet;
65 Reference< XInterface > SAL_CALL WPGImportFilter_createInstance(const Reference< XComponentContext > &rContext)
66 throw(Exception)
68 return (cppu::OWeakObject *) new WPGImportFilter(rContext);
71 // XServiceInfo
72 OUString SAL_CALL WPGImportFilter::getImplementationName()
73 throw (RuntimeException, std::exception)
75 return WPGImportFilter_getImplementationName();
77 sal_Bool SAL_CALL WPGImportFilter::supportsService(const OUString &rServiceName)
78 throw (RuntimeException, std::exception)
80 return cppu::supportsService(this, rServiceName);
82 Sequence< OUString > SAL_CALL WPGImportFilter::getSupportedServiceNames()
83 throw (RuntimeException, std::exception)
85 return WPGImportFilter_getSupportedServiceNames();
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */