diff options
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/source/pdfimport/test/pdf2xml.cxx | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/sdext/source/pdfimport/test/pdf2xml.cxx b/sdext/source/pdfimport/test/pdf2xml.cxx index 88b3535bfff1..f081097c52d0 100644 --- a/sdext/source/pdfimport/test/pdf2xml.cxx +++ b/sdext/source/pdfimport/test/pdf2xml.cxx @@ -39,40 +39,48 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) if( argc < 4 ) return 1; - OUString aBaseURL, aTmpURL, aSrcURL, aDstURL; + try + { + OUString aBaseURL, aTmpURL, aSrcURL, aDstURL; - TreeVisitorFactorySharedPtr pTreeFactory; - if( rtl_str_compare(argv[1], "-writer") == 0 ) - pTreeFactory = createWriterTreeVisitorFactory(); - else if( rtl_str_compare(argv[1], "-draw") == 0 ) - pTreeFactory = createDrawTreeVisitorFactory(); - else if( rtl_str_compare(argv[1], "-impress") == 0 ) - pTreeFactory = createImpressTreeVisitorFactory(); - else - return 1; + TreeVisitorFactorySharedPtr pTreeFactory; + if( rtl_str_compare(argv[1], "-writer") == 0 ) + pTreeFactory = createWriterTreeVisitorFactory(); + else if( rtl_str_compare(argv[1], "-draw") == 0 ) + pTreeFactory = createDrawTreeVisitorFactory(); + else if( rtl_str_compare(argv[1], "-impress") == 0 ) + pTreeFactory = createImpressTreeVisitorFactory(); + else + return 1; - osl_getProcessWorkingDir(&aBaseURL.pData); - osl_getFileURLFromSystemPath( OUString::createFromAscii(argv[2]).pData, - &aTmpURL.pData ); - osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aSrcURL.pData); + osl_getProcessWorkingDir(&aBaseURL.pData); + osl_getFileURLFromSystemPath( OUString::createFromAscii(argv[2]).pData, + &aTmpURL.pData ); + osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aSrcURL.pData); - osl_getFileURLFromSystemPath( OUString::createFromAscii(argv[3]).pData, - &aTmpURL.pData ); - osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aDstURL.pData); + osl_getFileURLFromSystemPath( OUString::createFromAscii(argv[3]).pData, + &aTmpURL.pData ); + osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aDstURL.pData); - // bootstrap UNO - uno::Reference< uno::XComponentContext > xContext( - cppu::defaultBootstrap_InitialComponentContext() ); - uno::Reference<lang::XMultiComponentFactory> xFactory(xContext->getServiceManager()); - uno::Reference<lang::XMultiServiceFactory> xSM(xFactory, uno::UNO_QUERY_THROW); - comphelper::setProcessServiceFactory(xSM); + // bootstrap UNO + uno::Reference< uno::XComponentContext > xContext( + cppu::defaultBootstrap_InitialComponentContext() ); + uno::Reference<lang::XMultiComponentFactory> xFactory(xContext->getServiceManager()); + uno::Reference<lang::XMultiServiceFactory> xSM(xFactory, uno::UNO_QUERY_THROW); + comphelper::setProcessServiceFactory(xSM); - test::BootstrapFixtureBase aEnv; - aEnv.setUp(); + test::BootstrapFixtureBase aEnv; + aEnv.setUp(); - pdfi::PDFIRawAdaptor aAdaptor( aEnv.getComponentContext() ); - aAdaptor.setTreeVisitorFactory(pTreeFactory); - aAdaptor.odfConvert( aSrcURL, new OutputWrap(aDstURL), NULL ); + pdfi::PDFIRawAdaptor aAdaptor( aEnv.getComponentContext() ); + aAdaptor.setTreeVisitorFactory(pTreeFactory); + aAdaptor.odfConvert( aSrcURL, new OutputWrap(aDstURL), NULL ); + } + catch (const uno::Exception& e) + { + SAL_WARN("vcl.app", "Fatal exception: " << e.Message); + return 1; + } return 0; } |