Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / vcl / workben / fftester.cxx
blobe5bd5dbcd9d4ad8dc7f81aaf4871bff857904319
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>
47 #include "../source/filter/igif/gifread.hxx"
48 #include "../source/filter/ixbm/xbmread.hxx"
49 #include "../source/filter/ixpm/xpmread.hxx"
50 #include "../source/filter/jpeg/jpeg.hxx"
52 using namespace ::com::sun::star::uno;
53 using namespace ::com::sun::star::lang;
54 using namespace cppu;
56 #ifndef DISABLE_DYNLOADING
57 extern "C" { static void thisModule() {} }
58 #endif
60 typedef bool (*FFilterCall)(SvStream &rStream);
62 SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
64 int ret = -1;
65 try
67 if (argc < 3)
69 fprintf(stderr, "Usage: fftester <filename> <wmf|jpg>\n");
70 return -1;
73 setenv("SAL_USE_VCLPLUGIN", "svp", 1);
74 setenv("JPEGMEM", "768M", 1);
75 setenv("SC_MAX_MATRIX_ELEMENTS", "60000000", 1);
76 setenv("SC_NO_THREADED_CALCULATION", "1", 1);
77 setenv("SAL_WMF_COMPLEXCLIP_VIA_REGION", "1", 1);
78 setenv("SAL_DISABLE_PRINTERLIST", "1", 1);
79 setenv("SAL_DISABLE_DEFAULTPRINTER", "1", 1);
80 setenv("SAL_NO_FONT_LOOKUP", "1", 1);
82 OUString in(argv[1], strlen(argv[1]), RTL_TEXTENCODING_UTF8);
83 OUString out;
84 osl::File::getFileURLFromSystemPath(in, out);
86 tools::extendApplicationEnvironment();
88 Reference< XComponentContext > xContext = defaultBootstrap_InitialComponentContext();
89 Reference< XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), UNO_QUERY );
90 if( !xServiceManager.is() )
91 Application::Abort( "Failed to bootstrap" );
92 comphelper::setProcessServiceFactory( xServiceManager );
93 utl::ConfigManager::EnableFuzzing();
95 // initialise unconfigured UCB:
96 css::uno::Reference<css::ucb::XUniversalContentBroker> xUcb(comphelper::getProcessServiceFactory()->
97 createInstance("com.sun.star.ucb.UniversalContentBroker"), css::uno::UNO_QUERY_THROW);
98 css::uno::Sequence<css::uno::Any> aArgs(1);
99 aArgs[0] <<= OUString("NoConfig");
100 css::uno::Reference<css::ucb::XContentProvider> xFileProvider(comphelper::getProcessServiceFactory()->
101 createInstanceWithArguments("com.sun.star.ucb.FileContentProvider", aArgs), css::uno::UNO_QUERY_THROW);
102 xUcb->registerContentProvider(xFileProvider, "file", true);
104 InitVCL();
106 Application::SetDialogCancelMode(Application::DialogCancelMode::Silent);
108 if (strcmp(argv[2], "wmf") == 0 || strcmp(argv[2], "emf") == 0)
110 GDIMetaFile aGDIMetaFile;
111 SvFileStream aFileStream(out, StreamMode::READ);
112 ret = static_cast<int>(ReadWindowMetafile(aFileStream, aGDIMetaFile));
114 else if (strcmp(argv[2], "jpg") == 0)
116 Graphic aGraphic;
117 SvFileStream aFileStream(out, StreamMode::READ);
118 ret = static_cast<int>(ImportJPEG(aFileStream, aGraphic, GraphicFilterImportFlags::NONE, nullptr));
120 else if (strcmp(argv[2], "gif") == 0)
122 SvFileStream aFileStream(out, StreamMode::READ);
123 Graphic aGraphic;
124 ret = static_cast<int>(ImportGIF(aFileStream, aGraphic));
126 else if (strcmp(argv[2], "xbm") == 0)
128 Graphic aGraphic;
129 SvFileStream aFileStream(out, StreamMode::READ);
130 ret = static_cast<int>(ImportXBM(aFileStream, aGraphic));
132 else if (strcmp(argv[2], "xpm") == 0)
134 Graphic aGraphic;
135 SvFileStream aFileStream(out, StreamMode::READ);
136 ret = static_cast<int>(ImportXPM(aFileStream, aGraphic));
138 else if (strcmp(argv[2], "png") == 0)
140 SvFileStream aFileStream(out, StreamMode::READ);
141 vcl::PNGReader aReader(aFileStream);
142 ret = static_cast<int>(!!aReader.Read());
144 else if (strcmp(argv[2], "bmp") == 0)
146 Bitmap aTarget;
147 SvFileStream aFileStream(out, StreamMode::READ);
148 ret = static_cast<int>(ReadDIB(aTarget, aFileStream, true));
150 else if (strcmp(argv[2], "svm") == 0)
152 GDIMetaFile aGDIMetaFile;
153 SvFileStream aFileStream(out, StreamMode::READ);
154 ReadGDIMetaFile(aFileStream, aGDIMetaFile);
156 #ifndef DISABLE_DYNLOADING
157 else if (strcmp(argv[2], "pcd") == 0)
159 static PFilterCall pfnImport(nullptr);
160 if (!pfnImport)
162 osl::Module aLibrary;
163 aLibrary.loadRelative(&thisModule, "libgielo.so");
164 pfnImport = reinterpret_cast<PFilterCall>(
165 aLibrary.getFunctionSymbol("icdGraphicImport"));
166 aLibrary.release();
168 Graphic aGraphic;
169 SvFileStream aFileStream(out, StreamMode::READ);
170 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
172 else if (strcmp(argv[2], "dxf") == 0)
174 static PFilterCall pfnImport(nullptr);
175 if (!pfnImport)
177 osl::Module aLibrary;
178 aLibrary.loadRelative(&thisModule, "libgielo.so");
179 pfnImport = reinterpret_cast<PFilterCall>(
180 aLibrary.getFunctionSymbol("idxGraphicImport"));
181 aLibrary.release();
183 Graphic aGraphic;
184 SvFileStream aFileStream(out, StreamMode::READ);
185 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
187 else if (strcmp(argv[2], "met") == 0)
189 static PFilterCall pfnImport(nullptr);
190 if (!pfnImport)
192 osl::Module aLibrary;
193 aLibrary.loadRelative(&thisModule, "libgielo.so");
194 pfnImport = reinterpret_cast<PFilterCall>(
195 aLibrary.getFunctionSymbol("imeGraphicImport"));
196 aLibrary.release();
198 Graphic aGraphic;
199 SvFileStream aFileStream(out, StreamMode::READ);
200 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
202 else if ((strcmp(argv[2], "pbm") == 0) || strcmp(argv[2], "ppm") == 0)
204 static PFilterCall pfnImport(nullptr);
205 if (!pfnImport)
207 osl::Module aLibrary;
208 aLibrary.loadRelative(&thisModule, "libgielo.so");
209 pfnImport = reinterpret_cast<PFilterCall>(
210 aLibrary.getFunctionSymbol("ipbGraphicImport"));
211 aLibrary.release();
213 Graphic aGraphic;
214 SvFileStream aFileStream(out, StreamMode::READ);
215 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
217 else if (strcmp(argv[2], "psd") == 0)
219 static PFilterCall pfnImport(nullptr);
220 if (!pfnImport)
222 osl::Module aLibrary;
223 aLibrary.loadRelative(&thisModule, "libgielo.so");
224 pfnImport = reinterpret_cast<PFilterCall>(
225 aLibrary.getFunctionSymbol("ipdGraphicImport"));
226 aLibrary.release();
228 Graphic aGraphic;
229 SvFileStream aFileStream(out, StreamMode::READ);
230 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
232 else if (strcmp(argv[2], "eps") == 0)
234 static PFilterCall pfnImport(nullptr);
235 if (!pfnImport)
237 osl::Module aLibrary;
238 aLibrary.loadRelative(&thisModule, "libgielo.so");
239 pfnImport = reinterpret_cast<PFilterCall>(
240 aLibrary.getFunctionSymbol("ipsGraphicImport"));
241 aLibrary.release();
243 Graphic aGraphic;
244 SvFileStream aFileStream(out, StreamMode::READ);
245 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
247 else if (strcmp(argv[2], "pct") == 0)
249 static PFilterCall pfnImport(nullptr);
250 if (!pfnImport)
252 osl::Module aLibrary;
253 aLibrary.loadRelative(&thisModule, "libgielo.so");
254 pfnImport = reinterpret_cast<PFilterCall>(
255 aLibrary.getFunctionSymbol("iptGraphicImport"));
256 aLibrary.release();
258 Graphic aGraphic;
259 SvFileStream aFileStream(out, StreamMode::READ);
260 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
262 else if (strcmp(argv[2], "pcx") == 0)
264 static PFilterCall pfnImport(nullptr);
265 if (!pfnImport)
267 osl::Module aLibrary;
268 aLibrary.loadRelative(&thisModule, "libgielo.so");
269 pfnImport = reinterpret_cast<PFilterCall>(
270 aLibrary.getFunctionSymbol("ipxGraphicImport"));
271 aLibrary.release();
273 Graphic aGraphic;
274 SvFileStream aFileStream(out, StreamMode::READ);
275 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
277 else if (strcmp(argv[2], "ras") == 0)
279 static PFilterCall pfnImport(nullptr);
280 if (!pfnImport)
282 osl::Module aLibrary;
283 aLibrary.loadRelative(&thisModule, "libgielo.so");
284 pfnImport = reinterpret_cast<PFilterCall>(
285 aLibrary.getFunctionSymbol("iraGraphicImport"));
286 aLibrary.release();
288 Graphic aGraphic;
289 SvFileStream aFileStream(out, StreamMode::READ);
290 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
292 else if (strcmp(argv[2], "tga") == 0)
294 static PFilterCall pfnImport(nullptr);
295 if (!pfnImport)
297 osl::Module aLibrary;
298 aLibrary.loadRelative(&thisModule, "libgielo.so");
299 pfnImport = reinterpret_cast<PFilterCall>(
300 aLibrary.getFunctionSymbol("itgGraphicImport"));
301 aLibrary.release();
303 Graphic aGraphic;
304 SvFileStream aFileStream(out, StreamMode::READ);
305 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
307 else if (strcmp(argv[2], "tif") == 0)
309 static PFilterCall pfnImport(nullptr);
310 if (!pfnImport)
312 osl::Module aLibrary;
313 aLibrary.loadRelative(&thisModule, "libgielo.so");
314 pfnImport = reinterpret_cast<PFilterCall>(
315 aLibrary.getFunctionSymbol("itiGraphicImport"));
316 aLibrary.release();
318 Graphic aGraphic;
319 SvFileStream aFileStream(out, StreamMode::READ);
320 ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
322 else if ((strcmp(argv[2], "doc") == 0) || (strcmp(argv[2], "ww8") == 0))
324 static FFilterCall pfnImport(nullptr);
325 if (!pfnImport)
327 osl::Module aLibrary;
328 aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY);
329 pfnImport = reinterpret_cast<FFilterCall>(
330 aLibrary.getFunctionSymbol("TestImportWW8"));
331 aLibrary.release();
333 SvFileStream aFileStream(out, StreamMode::READ);
334 ret = static_cast<int>((*pfnImport)(aFileStream));
336 else if (strcmp(argv[2], "ww6") == 0)
338 static FFilterCall pfnImport(nullptr);
339 if (!pfnImport)
341 osl::Module aLibrary;
342 aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY);
343 pfnImport = reinterpret_cast<FFilterCall>(
344 aLibrary.getFunctionSymbol("TestImportWW6"));
345 aLibrary.release();
347 SvFileStream aFileStream(out, StreamMode::READ);
348 ret = static_cast<int>((*pfnImport)(aFileStream));
350 else if (strcmp(argv[2], "ww2") == 0)
352 static FFilterCall pfnImport(nullptr);
353 if (!pfnImport)
355 osl::Module aLibrary;
356 aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY);
357 pfnImport = reinterpret_cast<FFilterCall>(
358 aLibrary.getFunctionSymbol("TestImportWW2"));
359 aLibrary.release();
361 SvFileStream aFileStream(out, StreamMode::READ);
362 ret = static_cast<int>((*pfnImport)(aFileStream));
364 else if (strcmp(argv[2], "rtf") == 0)
366 static FFilterCall pfnImport(nullptr);
367 if (!pfnImport)
369 osl::Module aLibrary;
370 aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY);
371 pfnImport = reinterpret_cast<FFilterCall>(
372 aLibrary.getFunctionSymbol("TestImportRTF"));
373 aLibrary.release();
375 SvFileStream aFileStream(out, StreamMode::READ);
376 ret = static_cast<int>((*pfnImport)(aFileStream));
378 else if (strcmp(argv[2], "html") == 0)
380 static FFilterCall pfnImport(nullptr);
381 if (!pfnImport)
383 osl::Module aLibrary;
384 aLibrary.loadRelative(&thisModule, "libswlo.so", SAL_LOADMODULE_LAZY);
385 pfnImport = reinterpret_cast<FFilterCall>(
386 aLibrary.getFunctionSymbol("TestImportHTML"));
387 aLibrary.release();
389 SvFileStream aFileStream(out, StreamMode::READ);
390 ret = static_cast<int>((*pfnImport)(aFileStream));
392 else if (strcmp(argv[2], "fodt") == 0)
394 static FFilterCall pfnImport(nullptr);
395 if (!pfnImport)
397 osl::Module aLibrary;
398 aLibrary.loadRelative(&thisModule, "libswlo.so", SAL_LOADMODULE_LAZY);
399 pfnImport = reinterpret_cast<FFilterCall>(
400 aLibrary.getFunctionSymbol("TestImportFODT"));
401 aLibrary.release();
403 SvFileStream aFileStream(out, StreamMode::READ);
404 ret = static_cast<int>((*pfnImport)(aFileStream));
406 else if (strcmp(argv[2], "docx") == 0)
408 static FFilterCall pfnImport(nullptr);
409 if (!pfnImport)
411 osl::Module aLibrary;
412 aLibrary.loadRelative(&thisModule, "libswlo.so", SAL_LOADMODULE_LAZY);
413 pfnImport = reinterpret_cast<FFilterCall>(
414 aLibrary.getFunctionSymbol("TestImportDOCX"));
415 aLibrary.release();
417 SvFileStream aFileStream(out, StreamMode::READ);
418 ret = static_cast<int>((*pfnImport)(aFileStream));
420 else if (strcmp(argv[2], "fods") == 0)
422 static FFilterCall pfnImport(nullptr);
423 if (!pfnImport)
425 osl::Module aLibrary;
426 aLibrary.loadRelative(&thisModule, "libsclo.so", SAL_LOADMODULE_LAZY);
427 pfnImport = reinterpret_cast<FFilterCall>(
428 aLibrary.getFunctionSymbol("TestImportFODS"));
429 aLibrary.release();
431 SvFileStream aFileStream(out, StreamMode::READ);
432 ret = static_cast<int>((*pfnImport)(aFileStream));
434 else if (strcmp(argv[2], "xlsx") == 0)
436 static FFilterCall pfnImport(nullptr);
437 if (!pfnImport)
439 osl::Module aLibrary;
440 aLibrary.loadRelative(&thisModule, "libsclo.so", SAL_LOADMODULE_LAZY);
441 pfnImport = reinterpret_cast<FFilterCall>(
442 aLibrary.getFunctionSymbol("TestImportXLSX"));
443 aLibrary.release();
445 SvFileStream aFileStream(out, StreamMode::READ);
446 ret = static_cast<int>((*pfnImport)(aFileStream));
448 else if (strcmp(argv[2], "fodp") == 0)
450 static FFilterCall pfnImport(nullptr);
451 if (!pfnImport)
453 osl::Module aLibrary;
454 aLibrary.loadRelative(&thisModule, "libsdlo.so", SAL_LOADMODULE_LAZY);
455 pfnImport = reinterpret_cast<FFilterCall>(
456 aLibrary.getFunctionSymbol("TestImportFODP"));
457 aLibrary.release();
459 SvFileStream aFileStream(out, StreamMode::READ);
460 ret = static_cast<int>((*pfnImport)(aFileStream));
462 else if (strcmp(argv[2], "pptx") == 0)
464 static FFilterCall pfnImport(nullptr);
465 if (!pfnImport)
467 osl::Module aLibrary;
468 aLibrary.loadRelative(&thisModule, "libsdlo.so", SAL_LOADMODULE_LAZY);
469 pfnImport = reinterpret_cast<FFilterCall>(
470 aLibrary.getFunctionSymbol("TestImportPPTX"));
471 aLibrary.release();
473 SvFileStream aFileStream(out, StreamMode::READ);
474 ret = static_cast<int>((*pfnImport)(aFileStream));
476 else if (strcmp(argv[2], "xls") == 0)
478 static FFilterCall pfnImport(nullptr);
479 if (!pfnImport)
481 osl::Module aLibrary;
482 aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY);
483 pfnImport = reinterpret_cast<FFilterCall>(
484 aLibrary.getFunctionSymbol("TestImportXLS"));
485 aLibrary.release();
487 SvFileStream aFileStream(out, StreamMode::READ);
488 ret = static_cast<int>((*pfnImport)(aFileStream));
490 else if (strcmp(argv[2], "wks") == 0)
492 static FFilterCall pfnImport(nullptr);
493 if (!pfnImport)
495 osl::Module aLibrary;
496 aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY);
497 pfnImport = reinterpret_cast<FFilterCall>(
498 aLibrary.getFunctionSymbol("TestImportWKS"));
499 aLibrary.release();
501 SvFileStream aFileStream(out, StreamMode::READ);
502 ret = static_cast<int>((*pfnImport)(aFileStream));
504 else if (strcmp(argv[2], "hwp") == 0)
506 static FFilterCall pfnImport(nullptr);
507 if (!pfnImport)
509 osl::Module aLibrary;
510 aLibrary.loadRelative(&thisModule, "libhwplo.so", SAL_LOADMODULE_LAZY);
511 pfnImport = reinterpret_cast<FFilterCall>(
512 aLibrary.getFunctionSymbol("TestImportHWP"));
513 aLibrary.release();
515 SvFileStream aFileStream(out, StreamMode::READ);
516 ret = static_cast<int>((*pfnImport)(aFileStream));
518 else if (strcmp(argv[2], "602") == 0)
520 static FFilterCall pfnImport(nullptr);
521 if (!pfnImport)
523 osl::Module aLibrary;
524 aLibrary.loadRelative(&thisModule, "libt602filterlo.so", SAL_LOADMODULE_LAZY);
525 pfnImport = reinterpret_cast<FFilterCall>(
526 aLibrary.getFunctionSymbol("TestImport602"));
527 aLibrary.release();
529 SvFileStream aFileStream(out, StreamMode::READ);
530 ret = static_cast<int>((*pfnImport)(aFileStream));
532 else if (strcmp(argv[2], "lwp") == 0)
534 static FFilterCall pfnImport(nullptr);
535 if (!pfnImport)
537 osl::Module aLibrary;
538 aLibrary.loadRelative(&thisModule, "liblwpftlo.so", SAL_LOADMODULE_LAZY);
539 pfnImport = reinterpret_cast<FFilterCall>(
540 aLibrary.getFunctionSymbol("TestImportLWP"));
541 aLibrary.release();
543 SvFileStream aFileStream(out, StreamMode::READ);
544 ret = static_cast<int>((*pfnImport)(aFileStream));
546 else if (strcmp(argv[2], "ppt") == 0)
548 static FFilterCall pfnImport(nullptr);
549 if (!pfnImport)
551 osl::Module aLibrary;
552 aLibrary.loadRelative(&thisModule, "libsdfiltlo.so", SAL_LOADMODULE_LAZY);
553 pfnImport = reinterpret_cast<FFilterCall>(
554 aLibrary.getFunctionSymbol("TestImportPPT"));
555 aLibrary.release();
557 SvFileStream aFileStream(out, StreamMode::READ);
558 ret = static_cast<int>((*pfnImport)(aFileStream));
560 else if (strcmp(argv[2], "cgm") == 0)
562 static FFilterCall pfnImport(nullptr);
563 if (!pfnImport)
565 osl::Module aLibrary;
566 aLibrary.loadRelative(&thisModule, "libsdlo.so", SAL_LOADMODULE_LAZY);
567 pfnImport = reinterpret_cast<FFilterCall>(
568 aLibrary.getFunctionSymbol("TestImportCGM"));
569 aLibrary.release();
571 SvFileStream aFileStream(out, StreamMode::READ);
572 ret = static_cast<int>((*pfnImport)(aFileStream));
574 else if (strcmp(argv[2], "qpw") == 0)
576 static FFilterCall pfnImport(nullptr);
577 if (!pfnImport)
579 osl::Module aLibrary;
580 aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY);
581 pfnImport = reinterpret_cast<FFilterCall>(
582 aLibrary.getFunctionSymbol("TestImportQPW"));
583 aLibrary.release();
585 SvFileStream aFileStream(out, StreamMode::READ);
586 ret = static_cast<int>((*pfnImport)(aFileStream));
588 else if (strcmp(argv[2], "dif") == 0)
590 static FFilterCall pfnImport(nullptr);
591 if (!pfnImport)
593 osl::Module aLibrary;
594 aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY);
595 pfnImport = reinterpret_cast<FFilterCall>(
596 aLibrary.getFunctionSymbol("TestImportDIF"));
597 aLibrary.release();
599 SvFileStream aFileStream(out, StreamMode::READ);
600 ret = static_cast<int>((*pfnImport)(aFileStream));
602 else if (strcmp(argv[2], "sc-rtf") == 0)
604 static FFilterCall pfnImport(nullptr);
605 if (!pfnImport)
607 osl::Module aLibrary;
608 aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY);
609 pfnImport = reinterpret_cast<FFilterCall>(
610 aLibrary.getFunctionSymbol("TestImportCalcRTF"));
611 aLibrary.release();
613 SvFileStream aFileStream(out, StreamMode::READ);
614 ret = static_cast<int>((*pfnImport)(aFileStream));
616 else if (strcmp(argv[2], "slk") == 0)
618 static FFilterCall pfnImport(nullptr);
619 if (!pfnImport)
621 osl::Module aLibrary;
622 aLibrary.loadRelative(&thisModule, "libsclo.so", SAL_LOADMODULE_LAZY);
623 pfnImport = reinterpret_cast<FFilterCall>(
624 aLibrary.getFunctionSymbol("TestImportSLK"));
625 aLibrary.release();
627 SvFileStream aFileStream(out, StreamMode::READ);
628 ret = static_cast<int>((*pfnImport)(aFileStream));
630 else if (strcmp(argv[2], "ole") == 0)
632 static FFilterCall pfnImport(nullptr);
633 if (!pfnImport)
635 osl::Module aLibrary;
636 aLibrary.loadRelative(&thisModule, "libsotlo.so", SAL_LOADMODULE_LAZY);
637 pfnImport = reinterpret_cast<FFilterCall>(
638 aLibrary.getFunctionSymbol("TestImportOLE2"));
639 aLibrary.release();
641 SvFileStream aFileStream(out, StreamMode::READ);
642 ret = static_cast<int>((*pfnImport)(aFileStream));
644 else if (strcmp(argv[2], "mml") == 0)
646 static FFilterCall pfnImport(nullptr);
647 if (!pfnImport)
649 osl::Module aLibrary;
650 aLibrary.loadRelative(&thisModule, "libsmlo.so", SAL_LOADMODULE_LAZY);
651 pfnImport = reinterpret_cast<FFilterCall>(
652 aLibrary.getFunctionSymbol("TestImportMML"));
653 aLibrary.release();
655 SvFileStream aFileStream(out, StreamMode::READ);
656 ret = static_cast<int>((*pfnImport)(aFileStream));
658 else if (strcmp(argv[2], "mtp") == 0)
660 static FFilterCall pfnImport(nullptr);
661 if (!pfnImport)
663 osl::Module aLibrary;
664 aLibrary.loadRelative(&thisModule, "libsmlo.so", SAL_LOADMODULE_LAZY);
665 pfnImport = reinterpret_cast<FFilterCall>(
666 aLibrary.getFunctionSymbol("TestImportMathType"));
667 aLibrary.release();
669 SvFileStream aFileStream(out, StreamMode::READ);
670 ret = static_cast<int>((*pfnImport)(aFileStream));
672 else if (strcmp(argv[2], "sft") == 0)
674 SvFileStream aFileStream(out, StreamMode::READ);
675 std::vector<sal_uInt8> aData(aFileStream.remainingSize());
676 aFileStream.ReadBytes(aData.data(), aData.size());
677 (void)vcl::Font::identifyFont(aData.data(), aData.size());
680 #endif
682 catch (...)
684 abort();
687 return ret;
690 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */