LibreOffice Module writerperfect (master) 1
NumbersImportFilter.cxx
Go to the documentation of this file.
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
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 <libetonyek/libetonyek.h>
13
15
17
18using libetonyek::EtonyekDocument;
19
20bool NumbersImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
21 OdsGenerator& rGenerator, utl::MediaDescriptor&)
22{
23 return EtonyekDocument::parse(&rInput, &rGenerator);
24}
25
26bool NumbersImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName)
27{
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))
32 {
33 rTypeName = "calc_AppleNumbers";
34 return true;
35 }
36
37 return false;
38}
39
41
42// XServiceInfo
44{
45 return "org.libreoffice.comp.Calc.NumbersImportFilter";
46}
47
48sal_Bool SAL_CALL NumbersImportFilter::supportsService(const OUString& rServiceName)
49{
50 return cppu::supportsService(this, rServiceName);
51}
52
53css::uno::Sequence<OUString> SAL_CALL NumbersImportFilter::getSupportedServiceNames()
54{
55 return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" };
56}
57
58extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
60 css::uno::XComponentContext* const context, const css::uno::Sequence<css::uno::Any>&)
61{
62 return cppu::acquire(new NumbersImportFilter(context));
63}
64
65/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * org_libreoffice_comp_Calc_NumbersImportFilter_get_implementation(css::uno::XComponentContext *const context, const css::uno::Sequence< css::uno::Any > &)
virtual void doRegisterHandlers(OdsGenerator &rGenerator) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual bool doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName) override
virtual OUString SAL_CALL getImplementationName() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual bool doImportDocument(weld::Window *pParent, librevenge::RVNGInputStream &rInput, OdsGenerator &rGenerator, utl::MediaDescriptor &) override
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
unsigned char sal_Bool
ResultType type