LibreOffice Module writerperfect (master) 1
ZMFImportFilter.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* ZMFImportFilter: Sets up the filter, and calls OdgExporter
3 * to do the actual filtering
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10#include <libzmf/libzmf.h>
11
13
14#include "ZMFImportFilter.hxx"
15
17using com::sun::star::uno::XComponentContext;
18using com::sun::star::uno::XInterface;
19
20bool ZMFImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
21 OdgGenerator& rGenerator, utl::MediaDescriptor&)
22{
23 return libzmf::ZMFDocument::parse(&rInput, &rGenerator);
24}
25
26bool ZMFImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName)
27{
28 if (libzmf::ZMFDocument::isSupported(&rInput))
29 {
30 rTypeName = "draw_ZMF_Document";
31 return true;
32 }
33
34 return false;
35}
36
37// XServiceInfo
39{
40 return "org.libreoffice.comp.Draw.ZMFImportFilter";
41}
42
43sal_Bool SAL_CALL ZMFImportFilter::supportsService(const OUString& rServiceName)
44{
45 return cppu::supportsService(this, rServiceName);
46}
47
49{
50 return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" };
51}
52
53extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
55 css::uno::XComponentContext* const context, const css::uno::Sequence<css::uno::Any>&)
56{
57 return cppu::acquire(new ZMFImportFilter(context));
58}
59
60/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * org_libreoffice_comp_Draw_ZMFImportFilter_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 bool doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName) override
virtual bool doImportDocument(weld::Window *pParent, librevenge::RVNGInputStream &rInput, OdgGenerator &rGenerator, utl::MediaDescriptor &) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getImplementationName() override
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
unsigned char sal_Bool