1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* MSPUBImportFilter: 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 <com/sun/star/uno/Reference.h>
11 #include <com/sun/star/uno/XComponentContext.hpp>
12 #include <cppuhelper/supportsservice.hxx>
14 #include <libmspub/libmspub.h>
15 #include <libodfgen/libodfgen.hxx>
17 #include "MSPUBImportFilter.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 MSPUBImportFilter::doImportDocument(librevenge::RVNGInputStream
&rInput
, OdgGenerator
&rGenerator
, utl::MediaDescriptor
&)
30 return libmspub::MSPUBDocument::parse(&rInput
, &rGenerator
);
33 bool MSPUBImportFilter::doDetectFormat(librevenge::RVNGInputStream
&rInput
, OUString
&rTypeName
)
35 if (libmspub::MSPUBDocument::isSupported(&rInput
))
37 rTypeName
= "draw_Publisher_Document";
44 OUString
MSPUBImportFilter_getImplementationName()
45 throw (RuntimeException
)
47 return OUString("com.sun.star.comp.Draw.MSPUBImportFilter");
50 Sequence
< OUString
> SAL_CALL
MSPUBImportFilter_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
MSPUBImportFilter_createInstance(const Reference
< XComponentContext
> &rContext
)
63 return (cppu::OWeakObject
*) new MSPUBImportFilter(rContext
);
67 OUString SAL_CALL
MSPUBImportFilter::getImplementationName()
68 throw (RuntimeException
, std::exception
)
70 return MSPUBImportFilter_getImplementationName();
72 sal_Bool SAL_CALL
MSPUBImportFilter::supportsService(const OUString
&rServiceName
)
73 throw (RuntimeException
, std::exception
)
75 return cppu::supportsService(this, rServiceName
);
77 Sequence
< OUString
> SAL_CALL
MSPUBImportFilter::getSupportedServiceNames()
78 throw (RuntimeException
, std::exception
)
80 return MSPUBImportFilter_getSupportedServiceNames();
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */