diff options
-rw-r--r-- | svtools/langsupport/langsupport.cxx | 60 |
1 files changed, 34 insertions, 26 deletions
diff --git a/svtools/langsupport/langsupport.cxx b/svtools/langsupport/langsupport.cxx index 9dbc90ecabf1..b9038d0d8996 100644 --- a/svtools/langsupport/langsupport.cxx +++ b/svtools/langsupport/langsupport.cxx @@ -22,45 +22,53 @@ using namespace com::sun::star; SAL_IMPLEMENT_MAIN() { - tools::extendApplicationEnvironment(); + try + { + tools::extendApplicationEnvironment(); - uno::Reference<uno::XComponentContext> xContext = - cppu::defaultBootstrap_InitialComponentContext(); + uno::Reference<uno::XComponentContext> xContext = + cppu::defaultBootstrap_InitialComponentContext(); - uno::Reference<lang::XMultiComponentFactory> xFactory = - xContext->getServiceManager(); + uno::Reference<lang::XMultiComponentFactory> xFactory = + xContext->getServiceManager(); - uno::Reference<lang::XMultiServiceFactory> xSFactory(xFactory, - uno::UNO_QUERY_THROW); + uno::Reference<lang::XMultiServiceFactory> xSFactory(xFactory, + uno::UNO_QUERY_THROW); - comphelper::setProcessServiceFactory(xSFactory); + comphelper::setProcessServiceFactory(xSFactory); - InitVCL(); + InitVCL(); - { - sal_uInt32 nCount = SvtLanguageTable::GetLanguageEntryCount(); - for (sal_uInt32 i = 0; i < nCount; ++i) { - LanguageType eLang = SvtLanguageTable::GetLanguageTypeAtIndex(i); - - if (eLang == LANGUAGE_DONTKNOW || - eLang == LANGUAGE_NONE || - eLang == LANGUAGE_HID_HUMAN_INTERFACE_DEVICE || - eLang == LANGUAGE_SYSTEM) + sal_uInt32 nCount = SvtLanguageTable::GetLanguageEntryCount(); + for (sal_uInt32 i = 0; i < nCount; ++i) { - continue; - } + LanguageType eLang = SvtLanguageTable::GetLanguageTypeAtIndex(i); + + if (eLang == LANGUAGE_DONTKNOW || + eLang == LANGUAGE_NONE || + eLang == LANGUAGE_HID_HUMAN_INTERFACE_DEVICE || + eLang == LANGUAGE_SYSTEM) + { + continue; + } - OUString sTag( LanguageTag::convertToBcp47( eLang)); + OUString sTag( LanguageTag::convertToBcp47( eLang)); - std::cout << OUStringToOString(sTag, osl_getThreadTextEncoding()).getStr() - << std::endl; + std::cout << OUStringToOString(sTag, osl_getThreadTextEncoding()).getStr() + << std::endl; + } } - } - DeInitVCL(); + DeInitVCL(); - uno::Reference< lang::XComponent >(xContext, uno::UNO_QUERY_THROW)->dispose(); + uno::Reference< lang::XComponent >(xContext, uno::UNO_QUERY_THROW)->dispose(); + } + catch (const uno::Exception& e) + { + SAL_WARN("vcl.app", "Fatal exception: " << e.Message); + return 1; + } return 0; } |