fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / writerperfect / source / impress / MWAWPresentationImportFilter.cxx
blobc93a9bcf7802e4613b2e6e7831c0735d747c1052
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* MWAWPresentationImportFilter: Sets up the filter, and calls DocumentCollector
3 * to do the actual filtering
5 * This file is part of the LibreOffice project.
7 * This Source Code Form is subject to the terms of the Mozilla Public
8 * License, v. 2.0. If a copy of the MPL was not distributed with this
9 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 #include <com/sun/star/uno/Reference.h>
13 #include <cppuhelper/supportsservice.hxx>
15 #include <libmwaw/libmwaw.hxx>
16 #include <libodfgen/libodfgen.hxx>
18 #include "MWAWPresentationImportFilter.hxx"
20 using com::sun::star::uno::Sequence;
21 using com::sun::star::uno::Reference;
22 using com::sun::star::uno::Any;
23 using com::sun::star::uno::XInterface;
24 using com::sun::star::uno::Exception;
25 using com::sun::star::uno::RuntimeException;
26 using com::sun::star::uno::XComponentContext;
28 static bool handleEmbeddedMWAWGraphicObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType)
30 OdgGenerator exporter;
31 exporter.addDocumentHandler(pHandler, streamType);
32 return MWAWDocument::decodeGraphic(data, &exporter);
35 static bool handleEmbeddedMWAWSpreadsheetObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType)
37 OdsGenerator exporter;
38 exporter.addDocumentHandler(pHandler, streamType);
39 return MWAWDocument::decodeSpreadsheet(data, &exporter);
42 bool MWAWPresentationImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdpGenerator &rGenerator, utl::MediaDescriptor &)
44 return MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&rInput, &rGenerator);
47 bool MWAWPresentationImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
49 rTypeName.clear();
51 MWAWDocument::Type docType = MWAWDocument::MWAW_T_UNKNOWN;
52 MWAWDocument::Kind docKind = MWAWDocument::MWAW_K_UNKNOWN;
53 const MWAWDocument::Confidence confidence = MWAWDocument::isFileFormatSupported(&rInput, docType, docKind);
55 if (confidence == MWAWDocument::MWAW_C_EXCELLENT)
57 if (docKind == MWAWDocument::MWAW_K_PRESENTATION)
59 switch (docType)
61 case MWAWDocument::MWAW_T_CLARISWORKS:
62 rTypeName = "impress_ClarisWorks";
63 break;
65 case MWAWDocument::MWAW_T_ACTA:
66 case MWAWDocument::MWAW_T_BEAGLEWORKS:
67 case MWAWDocument::MWAW_T_ADOBEILLUSTRATOR:
68 case MWAWDocument::MWAW_T_CLARISRESOLVE:
69 case MWAWDocument::MWAW_T_DBASE:
70 case MWAWDocument::MWAW_T_DOCMAKER:
71 case MWAWDocument::MWAW_T_EDOC:
72 case MWAWDocument::MWAW_T_FAMILYTREEMAKER:
73 case MWAWDocument::MWAW_T_FILEMAKER:
74 case MWAWDocument::MWAW_T_FOXBASE:
75 case MWAWDocument::MWAW_T_FRAMEMAKER:
76 case MWAWDocument::MWAW_T_FULLIMPACT:
77 case MWAWDocument::MWAW_T_FULLPAINT:
78 case MWAWDocument::MWAW_T_FULLWRITE:
79 case MWAWDocument::MWAW_T_GREATWORKS:
80 case MWAWDocument::MWAW_T_INFOGENIE:
81 case MWAWDocument::MWAW_T_KALEIDAGRAPH:
82 case MWAWDocument::MWAW_T_HANMACWORDJ:
83 case MWAWDocument::MWAW_T_HANMACWORDK:
84 case MWAWDocument::MWAW_T_LIGHTWAYTEXT:
85 case MWAWDocument::MWAW_T_MACDOC:
86 case MWAWDocument::MWAW_T_MACDRAFT:
87 case MWAWDocument::MWAW_T_MACDRAW:
88 case MWAWDocument::MWAW_T_MACDRAWPRO:
89 case MWAWDocument::MWAW_T_MACPAINT:
90 case MWAWDocument::MWAW_T_MACWRITE:
91 case MWAWDocument::MWAW_T_MACWRITEPRO:
92 case MWAWDocument::MWAW_T_MARINERWRITE:
93 case MWAWDocument::MWAW_T_MINDWRITE:
94 case MWAWDocument::MWAW_T_MICROSOFTFILE:
95 case MWAWDocument::MWAW_T_MICROSOFTMULTIPLAN:
96 case MWAWDocument::MWAW_T_MICROSOFTWORD:
97 case MWAWDocument::MWAW_T_MICROSOFTWORKS:
98 case MWAWDocument::MWAW_T_MORE:
99 case MWAWDocument::MWAW_T_NISUSWRITER:
100 case MWAWDocument::MWAW_T_OVERVUE:
101 case MWAWDocument::MWAW_T_PAGEMAKER:
102 case MWAWDocument::MWAW_T_PIXELPAINT:
103 case MWAWDocument::MWAW_T_RAGTIME:
104 case MWAWDocument::MWAW_T_READYSETGO:
105 case MWAWDocument::MWAW_T_SUPERPAINT:
106 case MWAWDocument::MWAW_T_SYMPOSIUM:
107 case MWAWDocument::MWAW_T_TEACHTEXT:
108 case MWAWDocument::MWAW_T_TEXEDIT:
109 case MWAWDocument::MWAW_T_TRAPEZE:
110 case MWAWDocument::MWAW_T_WINGZ:
111 case MWAWDocument::MWAW_T_WRITENOW:
112 case MWAWDocument::MWAW_T_WRITERPLUS:
113 case MWAWDocument::MWAW_T_XPRESS:
114 case MWAWDocument::MWAW_T_ZWRITE:
115 case MWAWDocument::MWAW_T_4DIMENSION:
117 case MWAWDocument::MWAW_T_RESERVED1:
118 case MWAWDocument::MWAW_T_RESERVED2:
119 case MWAWDocument::MWAW_T_RESERVED3:
120 case MWAWDocument::MWAW_T_RESERVED4:
121 case MWAWDocument::MWAW_T_RESERVED5:
122 case MWAWDocument::MWAW_T_RESERVED6:
123 case MWAWDocument::MWAW_T_RESERVED7:
124 case MWAWDocument::MWAW_T_RESERVED8:
125 case MWAWDocument::MWAW_T_RESERVED9:
126 case MWAWDocument::MWAW_T_UNKNOWN:
127 default:
128 break;
133 return !rTypeName.isEmpty();
136 void MWAWPresentationImportFilter::doRegisterHandlers(OdpGenerator &rGenerator)
138 rGenerator.registerEmbeddedObjectHandler("image/mwaw-odg", &handleEmbeddedMWAWGraphicObject);
139 rGenerator.registerEmbeddedObjectHandler("image/mwaw-ods", &handleEmbeddedMWAWSpreadsheetObject);
142 OUString MWAWPresentationImportFilter_getImplementationName()
143 throw (RuntimeException)
145 return OUString("com.sun.star.comp.Impress.MWAWPresentationImportFilter");
148 Sequence< OUString > SAL_CALL MWAWPresentationImportFilter_getSupportedServiceNames()
149 throw (RuntimeException)
151 Sequence < OUString > aRet(2);
152 OUString *pArray = aRet.getArray();
153 pArray[0] = "com.sun.star.document.ImportFilter";
154 pArray[1] = "com.sun.star.document.ExtendedTypeDetection";
155 return aRet;
158 Reference< XInterface > SAL_CALL MWAWPresentationImportFilter_createInstance(const Reference< XComponentContext > &rContext)
159 throw(Exception)
161 return (cppu::OWeakObject *) new MWAWPresentationImportFilter(rContext);
164 // XServiceInfo
165 OUString SAL_CALL MWAWPresentationImportFilter::getImplementationName()
166 throw (RuntimeException, std::exception)
168 return MWAWPresentationImportFilter_getImplementationName();
170 sal_Bool SAL_CALL MWAWPresentationImportFilter::supportsService(const OUString &rServiceName)
171 throw (RuntimeException, std::exception)
173 return cppu::supportsService(this, rServiceName);
175 Sequence< OUString > SAL_CALL MWAWPresentationImportFilter::getSupportedServiceNames()
176 throw (RuntimeException, std::exception)
178 return MWAWPresentationImportFilter_getSupportedServiceNames();
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */