LibreOffice Module writerperfect (master) 1
PagesImportFilter.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* PagesImportFilter: 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
16#include "PagesImportFilter.hxx"
17
18using libetonyek::EtonyekDocument;
19
20bool PagesImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
21 OdtGenerator& rGenerator, utl::MediaDescriptor&)
22{
23 return EtonyekDocument::parse(&rInput, &rGenerator);
24}
25
26bool PagesImportFilter::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_PAGES))
32 {
33 rTypeName = "writer_ApplePages";
34 return true;
35 }
36
37 return false;
38}
39
40// XServiceInfo
42{
43 return "org.libreoffice.comp.Writer.PagesImportFilter";
44}
45
46sal_Bool SAL_CALL PagesImportFilter::supportsService(const OUString& rServiceName)
47{
48 return cppu::supportsService(this, rServiceName);
49}
50
51css::uno::Sequence<OUString> SAL_CALL PagesImportFilter::getSupportedServiceNames()
52{
53 return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" };
54}
55
56extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
58 css::uno::XComponentContext* const context, const css::uno::Sequence<css::uno::Any>&)
59{
60 return cppu::acquire(new PagesImportFilter(context));
61}
62
63/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * org_libreoffice_comp_Writer_PagesImportFilter_get_implementation(css::uno::XComponentContext *const context, const css::uno::Sequence< css::uno::Any > &)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual OUString SAL_CALL getImplementationName() override
virtual bool doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName) override
virtual bool doImportDocument(weld::Window *pParent, librevenge::RVNGInputStream &rInput, OdtGenerator &rGenerator, utl::MediaDescriptor &rDescriptor) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
unsigned char sal_Bool
ResultType type