bump product version to 5.0.4.1
[LibreOffice.git] / writerperfect / source / draw / VisioImportFilter.cxx
blobbfa1cbe396e45181546cb8f42fc7f98a5a641a46
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
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 */
10 #include <com/sun/star/uno/Reference.h>
11 #include <com/sun/star/uno/XComponentContext.hpp>
12 #include <cppuhelper/supportsservice.hxx>
14 #include <libvisio/libvisio.h>
15 #include <libodfgen/libodfgen.hxx>
17 #include "VisioImportFilter.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 VisioImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdgGenerator &rGenerator, utl::MediaDescriptor &)
28 return libvisio::VisioDocument::parse(&rInput, &rGenerator);
31 bool VisioImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
33 if (libvisio::VisioDocument::isSupported(&rInput))
35 rTypeName = "draw_Visio_Document";
36 return true;
39 return false;
42 OUString VisioImportFilter_getImplementationName()
43 throw (RuntimeException)
45 return OUString("com.sun.star.comp.Draw.VisioImportFilter");
48 Sequence< OUString > SAL_CALL VisioImportFilter_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";
55 return aRet;
58 Reference< XInterface > SAL_CALL VisioImportFilter_createInstance(const Reference< XComponentContext > &rContext)
59 throw(Exception)
61 return (cppu::OWeakObject *) new VisioImportFilter(rContext);
64 // XServiceInfo
65 OUString SAL_CALL VisioImportFilter::getImplementationName()
66 throw (RuntimeException, std::exception)
68 return VisioImportFilter_getImplementationName();
70 sal_Bool SAL_CALL VisioImportFilter::supportsService(const OUString &rServiceName)
71 throw (RuntimeException, std::exception)
73 return cppu::supportsService(this, rServiceName);
75 Sequence< OUString > SAL_CALL VisioImportFilter::getSupportedServiceNames()
76 throw (RuntimeException, std::exception)
78 return VisioImportFilter_getSupportedServiceNames();
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */