Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* AbiWordImportFilter: Sets up the filter, and calls DocumentCollector
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 : #include <com/sun/star/uno/Reference.h>
13 : #include <cppuhelper/supportsservice.hxx>
14 :
15 : #include <libabw/libabw.h>
16 :
17 : #include "AbiWordImportFilter.hxx"
18 :
19 : using com::sun::star::uno::Sequence;
20 : using com::sun::star::uno::Reference;
21 : using com::sun::star::uno::Any;
22 : using com::sun::star::uno::Exception;
23 : using com::sun::star::uno::RuntimeException;
24 : using com::sun::star::uno::XComponentContext;
25 : using com::sun::star::uno::XInterface;
26 :
27 4 : bool AbiWordImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdtGenerator &rGenerator, utl::MediaDescriptor &)
28 : {
29 4 : return libabw::AbiDocument::parse(&rInput, &rGenerator);
30 : }
31 :
32 4 : bool AbiWordImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
33 : {
34 4 : if (libabw::AbiDocument::isFileFormatSupported(&rInput))
35 : {
36 4 : rTypeName = "writer_AbiWord_Document";
37 4 : return true;
38 : }
39 :
40 0 : return false;
41 : }
42 :
43 10 : OUString AbiWordImportFilter_getImplementationName()
44 : throw (RuntimeException)
45 : {
46 10 : return OUString("com.sun.star.comp.Writer.AbiWordImportFilter");
47 : }
48 :
49 2 : Sequence< OUString > SAL_CALL AbiWordImportFilter_getSupportedServiceNames()
50 : throw (RuntimeException)
51 : {
52 2 : Sequence < OUString > aRet(2);
53 2 : OUString *pArray = aRet.getArray();
54 2 : pArray[0] = "com.sun.star.document.ImportFilter";
55 2 : pArray[1] = "com.sun.star.document.ExtendedTypeDetection";
56 2 : return aRet;
57 : }
58 : #undef SERVICE_NAME2
59 : #undef SERVICE_NAME1
60 :
61 2 : Reference< XInterface > SAL_CALL AbiWordImportFilter_createInstance(const Reference< XComponentContext > &rContext)
62 : throw(Exception)
63 : {
64 2 : return (cppu::OWeakObject *) new AbiWordImportFilter(rContext);
65 : }
66 :
67 : // XServiceInfo
68 0 : OUString SAL_CALL AbiWordImportFilter::getImplementationName()
69 : throw (RuntimeException, std::exception)
70 : {
71 0 : return AbiWordImportFilter_getImplementationName();
72 : }
73 0 : sal_Bool SAL_CALL AbiWordImportFilter::supportsService(const OUString &rServiceName)
74 : throw (RuntimeException, std::exception)
75 : {
76 0 : return cppu::supportsService(this, rServiceName);
77 : }
78 0 : Sequence< OUString > SAL_CALL AbiWordImportFilter::getSupportedServiceNames()
79 : throw (RuntimeException, std::exception)
80 : {
81 0 : return AbiWordImportFilter_getSupportedServiceNames();
82 : }
83 :
84 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|