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