1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* FreehandImportFilter: 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 <libfreehand/libfreehand.h>
15 #include <libodfgen/libodfgen.hxx>
17 #include "FreehandImportFilter.hxx"
19 using com::sun::star::uno::Reference
;
20 using com::sun::star::uno::Exception
;
21 using com::sun::star::uno::RuntimeException
;
22 using com::sun::star::uno::Sequence
;
23 using com::sun::star::uno::XComponentContext
;
24 using com::sun::star::uno::XInterface
;
26 bool FreehandImportFilter::doImportDocument(librevenge::RVNGInputStream
&rInput
, OdgGenerator
&rGenerator
, utl::MediaDescriptor
&)
28 return libfreehand::FreeHandDocument::parse(&rInput
, &rGenerator
);
31 bool FreehandImportFilter::doDetectFormat(librevenge::RVNGInputStream
&rInput
, OUString
&rTypeName
)
33 if (libfreehand::FreeHandDocument::isSupported(&rInput
))
35 rTypeName
= "draw_Freehand_Document";
42 OUString
FreehandImportFilter_getImplementationName()
43 throw (RuntimeException
)
45 return OUString("com.sun.star.comp.Draw.FreehandImportFilter");
48 Sequence
< OUString
> SAL_CALL
FreehandImportFilter_getSupportedServiceNames()
49 throw (RuntimeException
)
51 Sequence
< OUString
> aRet(2);
52 OUString
*pArray
= aRet
.getArray();
53 pArray
[0] = "com.sun.star.document.ImportFilter";
54 pArray
[1] = "com.sun.star.document.ExtendedTypeDetection";
58 Reference
< XInterface
> SAL_CALL
FreehandImportFilter_createInstance(const Reference
< XComponentContext
> &rContext
)
61 return (cppu::OWeakObject
*) new FreehandImportFilter(rContext
);
65 OUString SAL_CALL
FreehandImportFilter::getImplementationName()
66 throw (RuntimeException
, std::exception
)
68 return FreehandImportFilter_getImplementationName();
70 sal_Bool SAL_CALL
FreehandImportFilter::supportsService(const OUString
&rServiceName
)
71 throw (RuntimeException
, std::exception
)
73 return cppu::supportsService(this, rServiceName
);
75 Sequence
< OUString
> SAL_CALL
FreehandImportFilter::getSupportedServiceNames()
76 throw (RuntimeException
, std::exception
)
78 return FreehandImportFilter_getSupportedServiceNames();
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */