Line data Source code
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
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 <libodfgen/libodfgen.hxx>
11 :
12 : #include <libpagemaker/libpagemaker.h>
13 :
14 : #include <com/sun/star/uno/Reference.h>
15 : #include <com/sun/star/uno/XComponentContext.hpp>
16 :
17 : #include <cppuhelper/supportsservice.hxx>
18 :
19 : #include "PageMakerImportFilter.hxx"
20 :
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;
27 :
28 0 : bool PageMakerImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdgGenerator &rGenerator, utl::MediaDescriptor &)
29 : {
30 0 : return libpagemaker::PMDocument::parse(&rInput, &rGenerator);
31 : }
32 :
33 87 : bool PageMakerImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
34 : {
35 87 : if (libpagemaker::PMDocument::isSupported(&rInput))
36 : {
37 0 : rTypeName = "draw_PageMaker_Document";
38 0 : return true;
39 : }
40 :
41 87 : return false;
42 : }
43 :
44 38 : OUString PageMakerImportFilter_getImplementationName()
45 : throw (RuntimeException)
46 : {
47 38 : return OUString("org.libreoffice.comp.Draw.PageMakerImportFilter");
48 : }
49 :
50 6 : Sequence< OUString > SAL_CALL PageMakerImportFilter_getSupportedServiceNames()
51 : throw (RuntimeException)
52 : {
53 6 : Sequence< OUString > aRet(2);
54 6 : OUString *pArray = aRet.getArray();
55 6 : pArray[0] = "com.sun.star.document.ImportFilter";
56 6 : pArray[1] = "com.sun.star.document.ExtendedTypeDetection";
57 6 : return aRet;
58 : }
59 :
60 88 : Reference< XInterface > SAL_CALL PageMakerImportFilter_createInstance(const Reference< XComponentContext > &rContext)
61 : throw(Exception)
62 : {
63 88 : return static_cast<cppu::OWeakObject *>(new PageMakerImportFilter(rContext));
64 : }
65 :
66 : // XServiceInfo
67 1 : OUString SAL_CALL PageMakerImportFilter::getImplementationName()
68 : throw (RuntimeException, std::exception)
69 : {
70 1 : return PageMakerImportFilter_getImplementationName();
71 : }
72 0 : sal_Bool SAL_CALL PageMakerImportFilter::supportsService(const OUString &rServiceName)
73 : throw (RuntimeException, std::exception)
74 : {
75 0 : return cppu::supportsService(this, rServiceName);
76 : }
77 1 : Sequence< OUString > SAL_CALL PageMakerImportFilter::getSupportedServiceNames()
78 : throw (RuntimeException, std::exception)
79 : {
80 1 : return PageMakerImportFilter_getSupportedServiceNames();
81 : }
82 :
83 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|