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/.
10 #include <libodfgen/libodfgen.hxx>
12 #include <libpagemaker/libpagemaker.h>
14 #include <com/sun/star/uno/Reference.h>
15 #include <com/sun/star/uno/XComponentContext.hpp>
17 #include <cppuhelper/supportsservice.hxx>
19 #include "PageMakerImportFilter.hxx"
21 using com::sun::star::uno::Reference
;
22 using com::sun::star::uno::Exception
;
23 using com::sun::star::uno::RuntimeException
;
24 using com::sun::star::uno::Sequence
;
25 using com::sun::star::uno::XComponentContext
;
26 using com::sun::star::uno::XInterface
;
28 bool PageMakerImportFilter::doImportDocument(librevenge::RVNGInputStream
&rInput
, OdgGenerator
&rGenerator
, utl::MediaDescriptor
&)
30 return libpagemaker::PMDocument::parse(&rInput
, &rGenerator
);
33 bool PageMakerImportFilter::doDetectFormat(librevenge::RVNGInputStream
&rInput
, OUString
&rTypeName
)
35 if (libpagemaker::PMDocument::isSupported(&rInput
))
37 rTypeName
= "draw_PageMaker_Document";
44 OUString
PageMakerImportFilter_getImplementationName()
45 throw (RuntimeException
)
47 return OUString("org.libreoffice.comp.Draw.PageMakerImportFilter");
50 Sequence
< OUString
> SAL_CALL
PageMakerImportFilter_getSupportedServiceNames()
51 throw (RuntimeException
)
53 Sequence
< OUString
> aRet(2);
54 OUString
*pArray
= aRet
.getArray();
55 pArray
[0] = "com.sun.star.document.ImportFilter";
56 pArray
[1] = "com.sun.star.document.ExtendedTypeDetection";
60 Reference
< XInterface
> SAL_CALL
PageMakerImportFilter_createInstance(const Reference
< XComponentContext
> &rContext
)
63 return (cppu::OWeakObject
*) new PageMakerImportFilter(rContext
);
67 OUString SAL_CALL
PageMakerImportFilter::getImplementationName()
68 throw (RuntimeException
, std::exception
)
70 return PageMakerImportFilter_getImplementationName();
72 sal_Bool SAL_CALL
PageMakerImportFilter::supportsService(const OUString
&rServiceName
)
73 throw (RuntimeException
, std::exception
)
75 return cppu::supportsService(this, rServiceName
);
77 Sequence
< OUString
> SAL_CALL
PageMakerImportFilter::getSupportedServiceNames()
78 throw (RuntimeException
, std::exception
)
80 return PageMakerImportFilter_getSupportedServiceNames();
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */