1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* CMXImportFilter: 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 /* "This product is not manufactured, approved, or supported by
11 * Corel Corporation or Corel Corporation Limited."
14 #include <com/sun/star/uno/Reference.h>
15 #include <com/sun/star/uno/XComponentContext.hpp>
16 #include <cppuhelper/supportsservice.hxx>
18 #include <libcdr/libcdr.h>
19 #include <libodfgen/libodfgen.hxx>
21 #include "CMXImportFilter.hxx"
23 using com::sun::star::uno::Reference
;
24 using com::sun::star::uno::Exception
;
25 using com::sun::star::uno::RuntimeException
;
26 using com::sun::star::uno::Sequence
;
27 using com::sun::star::uno::XComponentContext
;
28 using com::sun::star::uno::XInterface
;
30 bool CMXImportFilter::doImportDocument(librevenge::RVNGInputStream
&rInput
, OdgGenerator
&rGenerator
, utl::MediaDescriptor
&)
32 return libcdr::CMXDocument::parse(&rInput
, &rGenerator
);
35 bool CMXImportFilter::doDetectFormat(librevenge::RVNGInputStream
&rInput
, OUString
&rTypeName
)
37 if (libcdr::CMXDocument::isSupported(&rInput
))
39 rTypeName
= "draw_Corel_Presentation_Exchange";
46 OUString
CMXImportFilter_getImplementationName()
47 throw (RuntimeException
)
49 return OUString("com.sun.star.comp.Draw.CMXImportFilter");
52 Sequence
< OUString
> SAL_CALL
CMXImportFilter_getSupportedServiceNames()
53 throw (RuntimeException
)
55 Sequence
< OUString
> aRet(2);
56 OUString
*pArray
= aRet
.getArray();
57 pArray
[0] = "com.sun.star.document.ImportFilter";
58 pArray
[1] = "com.sun.star.document.ExtendedTypeDetection";
62 Reference
< XInterface
> SAL_CALL
CMXImportFilter_createInstance(const Reference
< XComponentContext
> &rContext
)
65 return (cppu::OWeakObject
*) new CMXImportFilter(rContext
);
69 OUString SAL_CALL
CMXImportFilter::getImplementationName()
70 throw (RuntimeException
, std::exception
)
72 return CMXImportFilter_getImplementationName();
74 sal_Bool SAL_CALL
CMXImportFilter::supportsService(const OUString
&rServiceName
)
75 throw (RuntimeException
, std::exception
)
77 return cppu::supportsService(this, rServiceName
);
79 Sequence
< OUString
> SAL_CALL
CMXImportFilter::getSupportedServiceNames()
80 throw (RuntimeException
, std::exception
)
82 return CMXImportFilter_getSupportedServiceNames();
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */