bump product version to 5.0.4.1
[LibreOffice.git] / writerperfect / source / draw / CDRImportFilter.cxx
blobe5671da860c2f3885f64b57cf188917ec9f63ee8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* CDRImportFilter: 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 /* "This product is not manufactured, approved, or supported by
11 * Corel Corporation or Corel Corporation Limited."
14 #include <com/sun/star/uno/Reference.h>
15 #include <com/sun/star/uno/XComponentContext.hpp>
16 #include <cppuhelper/supportsservice.hxx>
18 #include <libcdr/libcdr.h>
19 #include <libodfgen/libodfgen.hxx>
21 #include "CDRImportFilter.hxx"
23 using com::sun::star::uno::Reference;
24 using com::sun::star::uno::Exception;
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 CDRImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdgGenerator &rGenerator, utl::MediaDescriptor &)
32 return libcdr::CDRDocument::parse(&rInput, &rGenerator);
35 bool CDRImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
37 if (libcdr::CDRDocument::isSupported(&rInput))
39 rTypeName = "draw_CorelDraw_Document";
40 return true;
43 return false;
46 OUString CDRImportFilter_getImplementationName()
47 throw (RuntimeException)
49 return OUString("com.sun.star.comp.Draw.CDRImportFilter");
52 Sequence< OUString > SAL_CALL CDRImportFilter_getSupportedServiceNames()
53 throw (RuntimeException)
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 Reference< XInterface > SAL_CALL CDRImportFilter_createInstance(const Reference< XComponentContext > &rContext)
63 throw(Exception)
65 return (cppu::OWeakObject *) new CDRImportFilter(rContext);
68 // XServiceInfo
69 OUString SAL_CALL CDRImportFilter::getImplementationName()
70 throw (RuntimeException, std::exception)
72 return CDRImportFilter_getImplementationName();
74 sal_Bool SAL_CALL CDRImportFilter::supportsService(const OUString &rServiceName)
75 throw (RuntimeException, std::exception)
77 return cppu::supportsService(this, rServiceName);
79 Sequence< OUString > SAL_CALL CDRImportFilter::getSupportedServiceNames()
80 throw (RuntimeException, std::exception)
82 return CDRImportFilter_getSupportedServiceNames();
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */