1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* NumbersImportFilter: Sets up the filter, and calls DocumentCollector
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 #include <libetonyek/libetonyek.h>
14 #include <cppuhelper/supportsservice.hxx>
16 #include "NumbersImportFilter.hxx"
18 using libetonyek::EtonyekDocument
;
20 bool NumbersImportFilter::doImportDocument(weld::Window
*, librevenge::RVNGInputStream
& rInput
,
21 OdsGenerator
& rGenerator
, utl::MediaDescriptor
&)
23 return EtonyekDocument::parse(&rInput
, &rGenerator
);
26 bool NumbersImportFilter::doDetectFormat(librevenge::RVNGInputStream
& rInput
, OUString
& rTypeName
)
28 EtonyekDocument::Type type
= EtonyekDocument::TYPE_UNKNOWN
;
29 const EtonyekDocument::Confidence confidence
= EtonyekDocument::isSupported(&rInput
, &type
);
30 if ((confidence
== EtonyekDocument::CONFIDENCE_EXCELLENT
)
31 && (type
== EtonyekDocument::TYPE_NUMBERS
))
33 rTypeName
= "calc_AppleNumbers";
40 void NumbersImportFilter::doRegisterHandlers(OdsGenerator
&) {}
43 OUString SAL_CALL
NumbersImportFilter::getImplementationName()
45 return u
"org.libreoffice.comp.Calc.NumbersImportFilter"_ustr
;
48 sal_Bool SAL_CALL
NumbersImportFilter::supportsService(const OUString
& rServiceName
)
50 return cppu::supportsService(this, rServiceName
);
53 css::uno::Sequence
<OUString
> SAL_CALL
NumbersImportFilter::getSupportedServiceNames()
55 return { u
"com.sun.star.document.ImportFilter"_ustr
,
56 u
"com.sun.star.document.ExtendedTypeDetection"_ustr
};
59 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
60 org_libreoffice_comp_Calc_NumbersImportFilter_get_implementation(
61 css::uno::XComponentContext
* const context
, const css::uno::Sequence
<css::uno::Any
>&)
63 return cppu::acquire(new NumbersImportFilter(context
));
66 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */