diff options
-rw-r--r-- | bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx | 4 | ||||
-rw-r--r-- | cppuhelper/source/exc_thrower.cxx | 8 | ||||
-rw-r--r-- | desktop/Library_sofficeapp.mk | 5 | ||||
-rw-r--r-- | include/ios/ios.hxx | 19 | ||||
-rw-r--r-- | ios/Module_ios.mk | 1 | ||||
-rw-r--r-- | ios/StaticLibrary_ios.mk | 20 | ||||
-rw-r--r-- | ios/source/ios.cxx | 35 | ||||
-rw-r--r-- | vcl/source/app/svmain.cxx | 83 |
8 files changed, 174 insertions, 1 deletions
diff --git a/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx index 762dbdc8db76..595d0e06cee3 100644 --- a/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx @@ -455,6 +455,10 @@ namespace sal_Int32 functionIndex, sal_Int32 vtableOffset) { + // For now temporarily assert when we get here. The intent is + // that we won't need the code snippets at all on iOS. + assert(false); + assert(functionIndex < nFunIndexes); if (!(functionIndex < nFunIndexes)) return NULL; diff --git a/cppuhelper/source/exc_thrower.cxx b/cppuhelper/source/exc_thrower.cxx index 4e39ae6c8b5a..4dd0b57c00de 100644 --- a/cppuhelper/source/exc_thrower.cxx +++ b/cppuhelper/source/exc_thrower.cxx @@ -29,6 +29,10 @@ #include <cppuhelper/exc_hlp.hxx> +#ifdef IOS +#include <ios/ios.hxx> +#endif + using namespace ::osl; using namespace ::cppu; using namespace ::com::sun::star; @@ -185,6 +189,9 @@ void SAL_CALL throwException( Any const & exc ) "(must be derived from com::sun::star::uno::Exception)!" ); } +#ifdef IOS + lo_ios_throwException(exc); +#else Mapping uno2cpp(Environment(UNO_LB_UNO), Environment::getCurrent()); if (! uno2cpp.is()) { @@ -199,6 +206,7 @@ void SAL_CALL throwException( Any const & exc ) ExceptionThrower::getCppuType() ); OSL_ASSERT( xThrower.is() ); xThrower->throwException( exc ); +#endif } diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk index 53496f2c1544..1491358a510e 100644 --- a/desktop/Library_sofficeapp.mk +++ b/desktop/Library_sofficeapp.mk @@ -43,7 +43,10 @@ $(eval $(call gb_Library_use_custom_headers,sofficeapp,\ officecfg/registry \ )) -$(eval $(call gb_Library_use_sdk_api,sofficeapp)) +$(eval $(call gb_Library_use_api,sofficeapp,\ + udkapi \ + offapi \ +)) $(eval $(call gb_Library_add_defs,sofficeapp,\ -DDESKTOP_DLLIMPLEMENTATION \ diff --git a/include/ios/ios.hxx b/include/ios/ios.hxx new file mode 100644 index 000000000000..d8fe4d7bd6e1 --- /dev/null +++ b/include/ios/ios.hxx @@ -0,0 +1,19 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_IOS_IOS_HXX +#define INCLUDED_IOS_IOS_HXX + +#include "com/sun/star/uno/Any.hxx" + +extern void lo_ios_throwException(css::uno::Any const& aException); + +#endif // INCLUDED_IOS_IOS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ios/Module_ios.mk b/ios/Module_ios.mk index 1425e6076190..bc50bfc424f3 100644 --- a/ios/Module_ios.mk +++ b/ios/Module_ios.mk @@ -11,6 +11,7 @@ $(eval $(call gb_Module_Module,ios)) ifeq ($(OS),IOS) $(eval $(call gb_Module_add_targets,ios,\ + StaticLibrary_ios \ CustomTarget_iOS_setup \ )) diff --git a/ios/StaticLibrary_ios.mk b/ios/StaticLibrary_ios.mk new file mode 100644 index 000000000000..36baff4e064b --- /dev/null +++ b/ios/StaticLibrary_ios.mk @@ -0,0 +1,20 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +$(eval $(call gb_StaticLibrary_StaticLibrary,ios)) + +$(eval $(call gb_StaticLibrary_use_api,ios,\ + udkapi \ + offapi \ +)) + +$(eval $(call gb_StaticLibrary_add_exception_objects,ios,\ + ios/source/ios \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/ios/source/ios.cxx b/ios/source/ios.cxx new file mode 100644 index 000000000000..60b455d287ee --- /dev/null +++ b/ios/source/ios.cxx @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <cassert> + +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp" +#include "ios/ios.hxx" + +namespace +{ +template <class E> void tryThrow(css::uno::Any const& aException) +{ + E aSpecificException; + if (aException >>= aSpecificException) + throw aSpecificException; +} +} + +void lo_ios_throwException(css::uno::Any const& aException) +{ + assert(aException.getValueTypeClass() == css::uno::TypeClass_EXCEPTION); + + tryThrow<css::ucb::InteractiveAugmentedIOException>(aException); + + assert(false); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index f7d24d09079a..3a444e9c6119 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -176,6 +176,85 @@ oslSignalAction SAL_CALL VCLExceptionSignal_impl( void* /*pData*/, oslSignalInfo } +#ifdef IOS + +#include <cppuhelper/exc_hlp.hxx> +#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp> + +// Swiped from cppuhelper/qa/misc/test_misc.cxx. Ideally we should +// have a unit test app for iOS that would somehow include relevant +// unit tests from source files all over the place. + +static void testExceptions() +{ + css::uno::Any aSavedExceptionAny; + std::exception_ptr + aSavedException; /// exception caught during unzipping is saved to be thrown during reading + try + { + throw css::uno::RuntimeException("RuntimeException"); + } + catch (...) + { + aSavedException = std::current_exception(); + } + assert(bool(aSavedException)); + try + { + std::rethrow_exception(aSavedException); + } + catch (const css::uno::RuntimeException&) + { + // the expected case + aSavedExceptionAny = cppu::getCaughtException(); + } + catch (...) + { + assert(false); + } + assert(aSavedExceptionAny.hasValue()); + + try + { + throw css::ucb::InteractiveAugmentedIOException(); + } + catch (const css::ucb::InteractiveAugmentedIOException&) + { + aSavedExceptionAny = cppu::getCaughtException(); + } + catch (const css::uno::Exception&) + { + assert(false); + } + catch (...) + { + assert(false); + } + assert(aSavedExceptionAny.hasValue()); + + try + { + css::ucb::InteractiveAugmentedIOException iaie; + css::uno::Any aEx = css::uno::makeAny(iaie); + // css::uno::Exception e; + // css::uno::Any aEx = css::uno::makeAny(e); + cppu::throwException(aEx); + } + catch (const css::ucb::InteractiveAugmentedIOException&) + { + } + catch (const css::uno::Exception& e) + { + assert(false); + } + catch (...) + { + assert(false); + } +} + +#endif + int ImplSVMain() { // The 'real' SVMain() @@ -191,6 +270,10 @@ int ImplSVMain() postInitVCLinitNSApp(); #endif +#ifdef IOS + testExceptions(); +#endif + if( bInit ) { // call application main |