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