loplugin:constmethod in editeng
[LibreOffice.git] / vcl / workben / fftester.cxx
blob9325cb5b67486d1859299d6bb9c1751028bbed0d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 /* e.g.
21 make
22 cp workdir/LinkTarget/Executable/fftester instdir/program
23 LD_LIBRARY_PATH=`pwd`/instdir/program instdir/program/fftester <foo> png
26 #include <sal/main.h>
27 #include <tools/extendapplicationenvironment.hxx>
29 #include <cppuhelper/bootstrap.hxx>
30 #include <comphelper/processfactory.hxx>
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <com/sun/star/ucb/XContentProvider.hpp>
34 #include <com/sun/star/ucb/XUniversalContentBroker.hpp>
35 #include <com/sun/star/uno/XComponentContext.hpp>
36 #include <unotools/configmgr.hxx>
37 #include <vcl/dibtools.hxx>
38 #include <vcl/event.hxx>
39 #include <vcl/graphicfilter.hxx>
40 #include <vcl/pngread.hxx>
41 #include <vcl/svapp.hxx>
42 #include <vcl/wmf.hxx>
43 #include <vcl/wrkwin.hxx>
44 #include <vcl/fltcall.hxx>
45 #include <osl/file.hxx>
46 #include <osl/module.hxx>
47 #include <tools/stream.hxx>
48 #include <vcl/gdimtf.hxx>
50 #include "../source/filter/igif/gifread.hxx"
51 #include "../source/filter/ixbm/xbmread.hxx"
52 #include "../source/filter/ixpm/xpmread.hxx"
53 #include "../source/filter/jpeg/jpeg.hxx"
55 using namespace ::com::sun::star::uno;
56 using namespace ::com::sun::star::lang;
57 using namespace cppu;
59 #ifndef DISABLE_DYNLOADING
60 extern "C" { static void thisModule() {} }
61 #endif
63 typedef bool (*FFilterCall)(SvStream &rStream);
65 SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
67 int ret = -1;
68 try
70 if (argc < 3)
72 fprintf(stderr, "Usage: fftester <filename> <wmf|jpg>\n");
73 return -1;
76 setenv("SAL_USE_VCLPLUGIN", "svp", 1);
77 setenv("JPEGMEM", "768M", 1);
78 setenv("SC_MAX_MATRIX_ELEMENTS", "60000000", 1);
79 setenv("SC_NO_THREADED_CALCULATION", "1", 1);
80 setenv("SAL_WMF_COMPLEXCLIP_VIA_REGION", "1", 1);
81 setenv("SAL_DISABLE_PRINTERLIST", "1", 1);
82 setenv("SAL_DISABLE_DEFAULTPRINTER", "1", 1);
83 setenv("SAL_NO_FONT_LOOKUP", "1", 1);
85 OUString in(argv[1], strlen(argv[1]), RTL_TEXTENCODING_UTF8);
86 OUString out;
87 osl::File::getFileURLFromSystemPath(in, out);
89 tools::extendApplicationEnvironment();
91 Reference< XComponentContext > xContext = defaultBootstrap_InitialComponentContext();
92 Reference< XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), UNO_QUERY );
93 if( !xServiceManager.is() )
94 Application::Abort( "Failed to bootstrap" );
95 comphelper::setProcessServiceFactory( xServiceManager );
96 utl::ConfigManager::EnableFuzzing();
98 // initialise unconfigured UCB:
99 css::uno::Reference<css::ucb::XUniversalContentBroker> xUcb(comphelper::getProcessServiceFactory()->
100 createInstance("com.sun.star.ucb.UniversalContentBroker"), css::uno::UNO_QUERY_THROW);
101 css::uno::Sequence<css::uno::Any> aArgs(1);
102 aArgs[0] <<= OUString("NoConfig");
103 css::uno::Reference<css::ucb::XContentProvider> xFileProvider(comphelper::getProcessServiceFactory()->
104 createInstanceWithArguments("com.sun.star.ucb.FileContentProvider", aArgs), css::uno::UNO_QUERY_THROW);
105 xUcb->registerContentProvider(xFileProvider, "file", true);
107 Application::EnableHeadlessMode(false);
108 InitVCL();
110 if (strcmp(argv[2], "wmf") == 0 || strcmp(argv[2], "emf") == 0)
112 GDIMetaFile aGDIMetaFile;
113 SvFileStream aFileStream(out, StreamMode::READ);
114 ret = static_cast<int>(ReadWindowMetafile(aFileStream, aGDIMetaFile));
116 else if (strcmp(argv[2], "jpg") == 0)
118 Graphic aGraphic;
119 SvFileStream aFileStream(out, StreamMode::READ);
120 ret = static_cast<int>(ImportJPEG(aFileStream, aGraphic, GraphicFilterImportFlags::NONE, nullptr));
122 else if (strcmp(argv[2], "gif") == 0)
124 SvFileStream aFileStream(out, StreamMode::READ);
125 Graphic aGraphic;
126 ret = static_cast<int>(ImportGIF(aFileStream, aGraphic));
128 else if (strcmp(argv[2], "xbm") == 0)
130 Graphic aGraphic;
131 SvFileStream aFileStream(out, StreamMode::READ);
132 ret = static_cast<int>(ImportXBM(aFileStream, aGraphic));
134 else if (strcmp(argv[2], "xpm") == 0)
136 Graphic aGraphic;
137 SvFileStream aFileStream(out, StreamMode::READ);
138 ret = static_cast<int>(ImportXPM(aFileStream, aGraphic));
140 else if (strcmp(argv[2], "png") == 0)
142 SvFileStream aFileStream(out, StreamMode::READ);
143 vcl::PNGReader aReader(aFileStream);
144 ret = static_cast<int>(!!aReader.Read());
146 else if (strcmp(argv[2], "bmp") == 0)
148 Bitmap aTarget;
149 SvFileStream aFileStream(out, StreamMode::READ);
150 ret = static_cast<int>(ReadDIB(aTarget, aFileStream, true));
152 else if (strcmp(argv[2], "svm") == 0)
154 GDIMetaFile aGDIMetaFile;
155 SvFileStream aFileStream(out, StreamMode::READ);
156 ReadGDIMetaFile(aFileStream, aGDIMetaFile);
158 #ifndef DISABLE_DYNLOADING
159 else if (strcmp(argv[2], "pcd") == 0)
161 static PFilterCall pfnImport(nullptr);
162 if (!pfnImport)
164 osl::Module aLibrary;
165 aLibrary.loadRelative(&thisModule, "libgielo.so");
166 pfnImport = reinterpret_cast<PFilterCall>(
167 aLibrary.getFunctionSymbol("icdGraphicImport"));
168 aLibrary.release();
170 Graphic aGraphic;
171 SvFileStream aFileStream(out, StreamMode::READ);
172 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
174 else if (strcmp(argv[2], "dxf") == 0)
176 static PFilterCall pfnImport(nullptr);
177 if (!pfnImport)
179 osl::Module aLibrary;
180 aLibrary.loadRelative(&thisModule, "libgielo.so");
181 pfnImport = reinterpret_cast<PFilterCall>(
182 aLibrary.getFunctionSymbol("idxGraphicImport"));
183 aLibrary.release();
185 Graphic aGraphic;
186 SvFileStream aFileStream(out, StreamMode::READ);
187 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
189 else if (strcmp(argv[2], "met") == 0)
191 static PFilterCall pfnImport(nullptr);
192 if (!pfnImport)
194 osl::Module aLibrary;
195 aLibrary.loadRelative(&thisModule, "libgielo.so");
196 pfnImport = reinterpret_cast<PFilterCall>(
197 aLibrary.getFunctionSymbol("imeGraphicImport"));
198 aLibrary.release();
200 Graphic aGraphic;
201 SvFileStream aFileStream(out, StreamMode::READ);
202 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
204 else if ((strcmp(argv[2], "pbm") == 0) || strcmp(argv[2], "ppm") == 0)
206 static PFilterCall pfnImport(nullptr);
207 if (!pfnImport)
209 osl::Module aLibrary;
210 aLibrary.loadRelative(&thisModule, "libgielo.so");
211 pfnImport = reinterpret_cast<PFilterCall>(
212 aLibrary.getFunctionSymbol("ipbGraphicImport"));
213 aLibrary.release();
215 Graphic aGraphic;
216 SvFileStream aFileStream(out, StreamMode::READ);
217 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
219 else if (strcmp(argv[2], "psd") == 0)
221 static PFilterCall pfnImport(nullptr);
222 if (!pfnImport)
224 osl::Module aLibrary;
225 aLibrary.loadRelative(&thisModule, "libgielo.so");
226 pfnImport = reinterpret_cast<PFilterCall>(
227 aLibrary.getFunctionSymbol("ipdGraphicImport"));
228 aLibrary.release();
230 Graphic aGraphic;
231 SvFileStream aFileStream(out, StreamMode::READ);
232 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
234 else if (strcmp(argv[2], "eps") == 0)
236 static PFilterCall pfnImport(nullptr);
237 if (!pfnImport)
239 osl::Module aLibrary;
240 aLibrary.loadRelative(&thisModule, "libgielo.so");
241 pfnImport = reinterpret_cast<PFilterCall>(
242 aLibrary.getFunctionSymbol("ipsGraphicImport"));
243 aLibrary.release();
245 Graphic aGraphic;
246 SvFileStream aFileStream(out, StreamMode::READ);
247 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
249 else if (strcmp(argv[2], "pct") == 0)
251 static PFilterCall pfnImport(nullptr);
252 if (!pfnImport)
254 osl::Module aLibrary;
255 aLibrary.loadRelative(&thisModule, "libgielo.so");
256 pfnImport = reinterpret_cast<PFilterCall>(
257 aLibrary.getFunctionSymbol("iptGraphicImport"));
258 aLibrary.release();
260 Graphic aGraphic;
261 SvFileStream aFileStream(out, StreamMode::READ);
262 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
264 else if (strcmp(argv[2], "pcx") == 0)
266 static PFilterCall pfnImport(nullptr);
267 if (!pfnImport)
269 osl::Module aLibrary;
270 aLibrary.loadRelative(&thisModule, "libgielo.so");
271 pfnImport = reinterpret_cast<PFilterCall>(
272 aLibrary.getFunctionSymbol("ipxGraphicImport"));
273 aLibrary.release();
275 Graphic aGraphic;
276 SvFileStream aFileStream(out, StreamMode::READ);
277 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
279 else if (strcmp(argv[2], "ras") == 0)
281 static PFilterCall pfnImport(nullptr);
282 if (!pfnImport)
284 osl::Module aLibrary;
285 aLibrary.loadRelative(&thisModule, "libgielo.so");
286 pfnImport = reinterpret_cast<PFilterCall>(
287 aLibrary.getFunctionSymbol("iraGraphicImport"));
288 aLibrary.release();
290 Graphic aGraphic;
291 SvFileStream aFileStream(out, StreamMode::READ);
292 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
294 else if (strcmp(argv[2], "tga") == 0)
296 static PFilterCall pfnImport(nullptr);
297 if (!pfnImport)
299 osl::Module aLibrary;
300 aLibrary.loadRelative(&thisModule, "libgielo.so");
301 pfnImport = reinterpret_cast<PFilterCall>(
302 aLibrary.getFunctionSymbol("itgGraphicImport"));
303 aLibrary.release();
305 Graphic aGraphic;
306 SvFileStream aFileStream(out, StreamMode::READ);
307 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
309 else if (strcmp(argv[2], "tif") == 0)
311 static PFilterCall pfnImport(nullptr);
312 if (!pfnImport)
314 osl::Module aLibrary;
315 aLibrary.loadRelative(&thisModule, "libgielo.so");
316 pfnImport = reinterpret_cast<PFilterCall>(
317 aLibrary.getFunctionSymbol("itiGraphicImport"));
318 aLibrary.release();
320 Graphic aGraphic;
321 SvFileStream aFileStream(out, StreamMode::READ);
322 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
324 else if ((strcmp(argv[2], "doc") == 0) || (strcmp(argv[2], "ww8") == 0))
326 static FFilterCall pfnImport(nullptr);
327 if (!pfnImport)
329 osl::Module aLibrary;
330 aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY);
331 pfnImport = reinterpret_cast<FFilterCall>(
332 aLibrary.getFunctionSymbol("TestImportWW8"));
333 aLibrary.release();
335 SvFileStream aFileStream(out, StreamMode::READ);
336 ret = static_cast<int>((*pfnImport)(aFileStream));
338 else if (strcmp(argv[2], "ww6") == 0)
340 static FFilterCall pfnImport(nullptr);
341 if (!pfnImport)
343 osl::Module aLibrary;
344 aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY);
345 pfnImport = reinterpret_cast<FFilterCall>(
346 aLibrary.getFunctionSymbol("TestImportWW6"));
347 aLibrary.release();
349 SvFileStream aFileStream(out, StreamMode::READ);
350 ret = static_cast<int>((*pfnImport)(aFileStream));
352 else if (strcmp(argv[2], "ww2") == 0)
354 static FFilterCall pfnImport(nullptr);
355 if (!pfnImport)
357 osl::Module aLibrary;
358 aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY);
359 pfnImport = reinterpret_cast<FFilterCall>(
360 aLibrary.getFunctionSymbol("TestImportWW2"));
361 aLibrary.release();
363 SvFileStream aFileStream(out, StreamMode::READ);
364 ret = static_cast<int>((*pfnImport)(aFileStream));
366 else if (strcmp(argv[2], "rtf") == 0)
368 static FFilterCall pfnImport(nullptr);
369 if (!pfnImport)
371 osl::Module aLibrary;
372 aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY);
373 pfnImport = reinterpret_cast<FFilterCall>(
374 aLibrary.getFunctionSymbol("TestImportRTF"));
375 aLibrary.release();
377 SvFileStream aFileStream(out, StreamMode::READ);
378 ret = static_cast<int>((*pfnImport)(aFileStream));
380 else if (strcmp(argv[2], "html") == 0)
382 static FFilterCall pfnImport(nullptr);
383 if (!pfnImport)
385 osl::Module aLibrary;
386 aLibrary.loadRelative(&thisModule, "libswlo.so", SAL_LOADMODULE_LAZY);
387 pfnImport = reinterpret_cast<FFilterCall>(
388 aLibrary.getFunctionSymbol("TestImportHTML"));
389 aLibrary.release();
391 SvFileStream aFileStream(out, StreamMode::READ);
392 ret = static_cast<int>((*pfnImport)(aFileStream));
394 else if (strcmp(argv[2], "fodt") == 0)
396 static FFilterCall pfnImport(nullptr);
397 if (!pfnImport)
399 osl::Module aLibrary;
400 aLibrary.loadRelative(&thisModule, "libswlo.so", SAL_LOADMODULE_LAZY);
401 pfnImport = reinterpret_cast<FFilterCall>(
402 aLibrary.getFunctionSymbol("TestImportFODT"));
403 aLibrary.release();
405 SvFileStream aFileStream(out, StreamMode::READ);
406 ret = static_cast<int>((*pfnImport)(aFileStream));
408 else if (strcmp(argv[2], "docx") == 0)
410 static FFilterCall pfnImport(nullptr);
411 if (!pfnImport)
413 osl::Module aLibrary;
414 aLibrary.loadRelative(&thisModule, "libswlo.so", SAL_LOADMODULE_LAZY);
415 pfnImport = reinterpret_cast<FFilterCall>(
416 aLibrary.getFunctionSymbol("TestImportDOCX"));
417 aLibrary.release();
419 SvFileStream aFileStream(out, StreamMode::READ);
420 ret = static_cast<int>((*pfnImport)(aFileStream));
422 else if (strcmp(argv[2], "fods") == 0)
424 static FFilterCall pfnImport(nullptr);
425 if (!pfnImport)
427 osl::Module aLibrary;
428 aLibrary.loadRelative(&thisModule, "libsclo.so", SAL_LOADMODULE_LAZY);
429 pfnImport = reinterpret_cast<FFilterCall>(
430 aLibrary.getFunctionSymbol("TestImportFODS"));
431 aLibrary.release();
433 SvFileStream aFileStream(out, StreamMode::READ);
434 ret = static_cast<int>((*pfnImport)(aFileStream));
436 else if (strcmp(argv[2], "xlsx") == 0)
438 static FFilterCall pfnImport(nullptr);
439 if (!pfnImport)
441 osl::Module aLibrary;
442 aLibrary.loadRelative(&thisModule, "libsclo.so", SAL_LOADMODULE_LAZY);
443 pfnImport = reinterpret_cast<FFilterCall>(
444 aLibrary.getFunctionSymbol("TestImportXLSX"));
445 aLibrary.release();
447 SvFileStream aFileStream(out, StreamMode::READ);
448 ret = static_cast<int>((*pfnImport)(aFileStream));
450 else if (strcmp(argv[2], "fodp") == 0)
452 static FFilterCall pfnImport(nullptr);
453 if (!pfnImport)
455 osl::Module aLibrary;
456 aLibrary.loadRelative(&thisModule, "libsdlo.so", SAL_LOADMODULE_LAZY);
457 pfnImport = reinterpret_cast<FFilterCall>(
458 aLibrary.getFunctionSymbol("TestImportFODP"));
459 aLibrary.release();
461 SvFileStream aFileStream(out, StreamMode::READ);
462 ret = static_cast<int>((*pfnImport)(aFileStream));
464 else if (strcmp(argv[2], "pptx") == 0)
466 static FFilterCall pfnImport(nullptr);
467 if (!pfnImport)
469 osl::Module aLibrary;
470 aLibrary.loadRelative(&thisModule, "libsdlo.so", SAL_LOADMODULE_LAZY);
471 pfnImport = reinterpret_cast<FFilterCall>(
472 aLibrary.getFunctionSymbol("TestImportPPTX"));
473 aLibrary.release();
475 SvFileStream aFileStream(out, StreamMode::READ);
476 ret = static_cast<int>((*pfnImport)(aFileStream));
478 else if (strcmp(argv[2], "xls") == 0)
480 static FFilterCall pfnImport(nullptr);
481 if (!pfnImport)
483 osl::Module aLibrary;
484 aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY);
485 pfnImport = reinterpret_cast<FFilterCall>(
486 aLibrary.getFunctionSymbol("TestImportXLS"));
487 aLibrary.release();
489 SvFileStream aFileStream(out, StreamMode::READ);
490 ret = static_cast<int>((*pfnImport)(aFileStream));
492 else if (strcmp(argv[2], "wks") == 0)
494 static FFilterCall pfnImport(nullptr);
495 if (!pfnImport)
497 osl::Module aLibrary;
498 aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY);
499 pfnImport = reinterpret_cast<FFilterCall>(
500 aLibrary.getFunctionSymbol("TestImportWKS"));
501 aLibrary.release();
503 SvFileStream aFileStream(out, StreamMode::READ);
504 ret = static_cast<int>((*pfnImport)(aFileStream));
506 else if (strcmp(argv[2], "hwp") == 0)
508 static FFilterCall pfnImport(nullptr);
509 if (!pfnImport)
511 osl::Module aLibrary;
512 aLibrary.loadRelative(&thisModule, "libhwplo.so", SAL_LOADMODULE_LAZY);
513 pfnImport = reinterpret_cast<FFilterCall>(
514 aLibrary.getFunctionSymbol("TestImportHWP"));
515 aLibrary.release();
517 SvFileStream aFileStream(out, StreamMode::READ);
518 ret = static_cast<int>((*pfnImport)(aFileStream));
520 else if (strcmp(argv[2], "602") == 0)
522 static FFilterCall pfnImport(nullptr);
523 if (!pfnImport)
525 osl::Module aLibrary;
526 aLibrary.loadRelative(&thisModule, "libt602filterlo.so", SAL_LOADMODULE_LAZY);
527 pfnImport = reinterpret_cast<FFilterCall>(
528 aLibrary.getFunctionSymbol("TestImport602"));
529 aLibrary.release();
531 SvFileStream aFileStream(out, StreamMode::READ);
532 ret = static_cast<int>((*pfnImport)(aFileStream));
534 else if (strcmp(argv[2], "lwp") == 0)
536 static FFilterCall pfnImport(nullptr);
537 if (!pfnImport)
539 osl::Module aLibrary;
540 aLibrary.loadRelative(&thisModule, "liblwpftlo.so", SAL_LOADMODULE_LAZY);
541 pfnImport = reinterpret_cast<FFilterCall>(
542 aLibrary.getFunctionSymbol("TestImportLWP"));
543 aLibrary.release();
545 SvFileStream aFileStream(out, StreamMode::READ);
546 ret = static_cast<int>((*pfnImport)(aFileStream));
548 else if (strcmp(argv[2], "ppt") == 0)
550 static FFilterCall pfnImport(nullptr);
551 if (!pfnImport)
553 osl::Module aLibrary;
554 aLibrary.loadRelative(&thisModule, "libsdfiltlo.so", SAL_LOADMODULE_LAZY);
555 pfnImport = reinterpret_cast<FFilterCall>(
556 aLibrary.getFunctionSymbol("TestImportPPT"));
557 aLibrary.release();
559 SvFileStream aFileStream(out, StreamMode::READ);
560 ret = static_cast<int>((*pfnImport)(aFileStream));
562 else if (strcmp(argv[2], "cgm") == 0)
564 static FFilterCall pfnImport(nullptr);
565 if (!pfnImport)
567 osl::Module aLibrary;
568 aLibrary.loadRelative(&thisModule, "libsdlo.so", SAL_LOADMODULE_LAZY);
569 pfnImport = reinterpret_cast<FFilterCall>(
570 aLibrary.getFunctionSymbol("TestImportCGM"));
571 aLibrary.release();
573 SvFileStream aFileStream(out, StreamMode::READ);
574 ret = static_cast<int>((*pfnImport)(aFileStream));
576 else if (strcmp(argv[2], "qpw") == 0)
578 static FFilterCall pfnImport(nullptr);
579 if (!pfnImport)
581 osl::Module aLibrary;
582 aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY);
583 pfnImport = reinterpret_cast<FFilterCall>(
584 aLibrary.getFunctionSymbol("TestImportQPW"));
585 aLibrary.release();
587 SvFileStream aFileStream(out, StreamMode::READ);
588 ret = static_cast<int>((*pfnImport)(aFileStream));
590 else if (strcmp(argv[2], "dif") == 0)
592 static FFilterCall pfnImport(nullptr);
593 if (!pfnImport)
595 osl::Module aLibrary;
596 aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY);
597 pfnImport = reinterpret_cast<FFilterCall>(
598 aLibrary.getFunctionSymbol("TestImportDIF"));
599 aLibrary.release();
601 SvFileStream aFileStream(out, StreamMode::READ);
602 ret = static_cast<int>((*pfnImport)(aFileStream));
604 else if (strcmp(argv[2], "sc-rtf") == 0)
606 static FFilterCall pfnImport(nullptr);
607 if (!pfnImport)
609 osl::Module aLibrary;
610 aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY);
611 pfnImport = reinterpret_cast<FFilterCall>(
612 aLibrary.getFunctionSymbol("TestImportCalcRTF"));
613 aLibrary.release();
615 SvFileStream aFileStream(out, StreamMode::READ);
616 ret = static_cast<int>((*pfnImport)(aFileStream));
618 else if (strcmp(argv[2], "slk") == 0)
620 static FFilterCall pfnImport(nullptr);
621 if (!pfnImport)
623 osl::Module aLibrary;
624 aLibrary.loadRelative(&thisModule, "libsclo.so", SAL_LOADMODULE_LAZY);
625 pfnImport = reinterpret_cast<FFilterCall>(
626 aLibrary.getFunctionSymbol("TestImportSLK"));
627 aLibrary.release();
629 SvFileStream aFileStream(out, StreamMode::READ);
630 ret = static_cast<int>((*pfnImport)(aFileStream));
632 else if (strcmp(argv[2], "ole") == 0)
634 static FFilterCall pfnImport(nullptr);
635 if (!pfnImport)
637 osl::Module aLibrary;
638 aLibrary.loadRelative(&thisModule, "libsotlo.so", SAL_LOADMODULE_LAZY);
639 pfnImport = reinterpret_cast<FFilterCall>(
640 aLibrary.getFunctionSymbol("TestImportOLE2"));
641 aLibrary.release();
643 SvFileStream aFileStream(out, StreamMode::READ);
644 ret = static_cast<int>((*pfnImport)(aFileStream));
646 else if (strcmp(argv[2], "mml") == 0)
648 static FFilterCall pfnImport(nullptr);
649 if (!pfnImport)
651 osl::Module aLibrary;
652 aLibrary.loadRelative(&thisModule, "libsmlo.so", SAL_LOADMODULE_LAZY);
653 pfnImport = reinterpret_cast<FFilterCall>(
654 aLibrary.getFunctionSymbol("TestImportMML"));
655 aLibrary.release();
657 SvFileStream aFileStream(out, StreamMode::READ);
658 ret = static_cast<int>((*pfnImport)(aFileStream));
660 else if (strcmp(argv[2], "mtp") == 0)
662 static FFilterCall pfnImport(nullptr);
663 if (!pfnImport)
665 osl::Module aLibrary;
666 aLibrary.loadRelative(&thisModule, "libsmlo.so", SAL_LOADMODULE_LAZY);
667 pfnImport = reinterpret_cast<FFilterCall>(
668 aLibrary.getFunctionSymbol("TestImportMathType"));
669 aLibrary.release();
671 SvFileStream aFileStream(out, StreamMode::READ);
672 ret = static_cast<int>((*pfnImport)(aFileStream));
674 else if (strcmp(argv[2], "sft") == 0)
676 SvFileStream aFileStream(out, StreamMode::READ);
677 std::vector<sal_uInt8> aData(aFileStream.remainingSize());
678 aFileStream.ReadBytes(aData.data(), aData.size());
679 (void)vcl::Font::identifyFont(aData.data(), aData.size());
682 #endif
684 catch (...)
686 abort();
689 return ret;
692 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */