Line data Source code
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
4 : *
5 : * This file is part of the LibreOffice project.
6 : *
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/.
10 : */
11 :
12 : /* "This product is not manufactured, approved, or supported by
13 : * Corel Corporation or Corel Corporation Limited."
14 : */
15 :
16 : #include <com/sun/star/uno/Reference.h>
17 : #include <com/sun/star/uno/XComponentContext.hpp>
18 : #include <cppuhelper/supportsservice.hxx>
19 :
20 : #include <libodfgen/libodfgen.hxx>
21 :
22 : #include <libwpg/libwpg.h>
23 :
24 : #include "WPGImportFilter.hxx"
25 :
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;
32 :
33 1 : bool WPGImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdgGenerator &rGenerator, utl::MediaDescriptor &)
34 : {
35 1 : return libwpg::WPGraphics::parse(&rInput, &rGenerator);
36 : }
37 :
38 85 : bool WPGImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
39 : {
40 85 : if (libwpg::WPGraphics::isSupported(&rInput))
41 : {
42 1 : rTypeName = "draw_WordPerfect_Graphics";
43 1 : return true;
44 : }
45 :
46 84 : return false;
47 : }
48 :
49 38 : OUString WPGImportFilter_getImplementationName()
50 : throw (RuntimeException)
51 : {
52 38 : return OUString("com.sun.star.comp.Draw.WPGImportFilter");
53 : }
54 :
55 5 : Sequence< OUString > SAL_CALL WPGImportFilter_getSupportedServiceNames()
56 : throw (RuntimeException)
57 : {
58 5 : Sequence < OUString > aRet(2);
59 5 : OUString *pArray = aRet.getArray();
60 5 : pArray[0] = "com.sun.star.document.ImportFilter";
61 5 : pArray[1] = "com.sun.star.document.ExtendedTypeDetection";
62 5 : return aRet;
63 : }
64 :
65 86 : Reference< XInterface > SAL_CALL WPGImportFilter_createInstance(const Reference< XComponentContext > &rContext)
66 : throw(Exception)
67 : {
68 86 : return static_cast<cppu::OWeakObject *>(new WPGImportFilter(rContext));
69 : }
70 :
71 : // XServiceInfo
72 1 : OUString SAL_CALL WPGImportFilter::getImplementationName()
73 : throw (RuntimeException, std::exception)
74 : {
75 1 : return WPGImportFilter_getImplementationName();
76 : }
77 0 : sal_Bool SAL_CALL WPGImportFilter::supportsService(const OUString &rServiceName)
78 : throw (RuntimeException, std::exception)
79 : {
80 0 : return cppu::supportsService(this, rServiceName);
81 : }
82 1 : Sequence< OUString > SAL_CALL WPGImportFilter::getSupportedServiceNames()
83 : throw (RuntimeException, std::exception)
84 : {
85 1 : return WPGImportFilter_getSupportedServiceNames();
86 : }
87 :
88 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|