Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / writerperfect / source / draw / PageMakerImportFilter.cxx
bloba2ef7f8106c58caa29458ca6cc7b82161f25e077
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* PageMakerImportFilter: Sets up the filter, and calls OdgExporter
3 * to do the actual filtering
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 */
10 #include <libodfgen/libodfgen.hxx>
12 #include <libpagemaker/libpagemaker.h>
14 #include <com/sun/star/uno/XComponentContext.hpp>
16 #include <cppuhelper/supportsservice.hxx>
18 #include "PageMakerImportFilter.hxx"
20 using com::sun::star::uno::RuntimeException;
21 using com::sun::star::uno::Sequence;
22 using com::sun::star::uno::XComponentContext;
23 using com::sun::star::uno::XInterface;
25 bool PageMakerImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdgGenerator &rGenerator, utl::MediaDescriptor &)
27 return libpagemaker::PMDocument::parse(&rInput, &rGenerator);
30 bool PageMakerImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
32 if (libpagemaker::PMDocument::isSupported(&rInput))
34 rTypeName = "draw_PageMaker_Document";
35 return true;
38 return false;
41 // XServiceInfo
42 OUString SAL_CALL PageMakerImportFilter::getImplementationName()
43 throw (RuntimeException, std::exception)
45 return OUString("org.libreoffice.comp.Draw.PageMakerImportFilter");
48 sal_Bool SAL_CALL PageMakerImportFilter::supportsService(const OUString &rServiceName)
49 throw (RuntimeException, std::exception)
51 return cppu::supportsService(this, rServiceName);
54 Sequence< OUString > SAL_CALL PageMakerImportFilter::getSupportedServiceNames()
55 throw (RuntimeException, std::exception)
57 Sequence< OUString > aRet(2);
58 OUString *pArray = aRet.getArray();
59 pArray[0] = "com.sun.star.document.ImportFilter";
60 pArray[1] = "com.sun.star.document.ExtendedTypeDetection";
61 return aRet;
64 extern "C"
65 SAL_DLLPUBLIC_EXPORT css::uno::XInterface *SAL_CALL
66 org_libreoffice_comp_Draw_PageMakerImportFilter_get_implementation(
67 css::uno::XComponentContext *const context,
68 const css::uno::Sequence<css::uno::Any> &)
70 return cppu::acquire(new PageMakerImportFilter(context));
73 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */