summaryrefslogtreecommitdiff
path: root/ucbhelper
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@suse.com>2012-03-28 16:42:01 +0300
committerTor Lillqvist <tlillqvist@suse.com>2012-03-28 16:57:59 +0300
commitbb84db9f44fd1fcadd86841411ac40d22281c157 (patch)
treeda32429c6d5e167b218c12129fb74335e8bdc818 /ucbhelper
parentc589fa17b8f3e6ded0d1e04120781eb5d6735bc7 (diff)
Add an InitUCBHelper function to be called from an Android app's Java level
Diffstat (limited to 'ucbhelper')
-rw-r--r--ucbhelper/source/client/contentbroker.cxx38
1 files changed, 38 insertions, 0 deletions
diff --git a/ucbhelper/source/client/contentbroker.cxx b/ucbhelper/source/client/contentbroker.cxx
index 0d865478bd8a..b38b421c4370 100644
--- a/ucbhelper/source/client/contentbroker.cxx
+++ b/ucbhelper/source/client/contentbroker.cxx
@@ -43,6 +43,12 @@
#include <com/sun/star/ucb/XCommandProcessor.hpp>
#include <ucbhelper/contentbroker.hxx>
+#ifdef ANDROID
+#include <cppuhelper/bootstrap.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <ucbhelper/configurationkeys.hxx>
+#endif
+
#ifdef DISABLE_DYNLOADING
#define MSF_CREATEINSTANCE(Msf, Service) \
@@ -220,6 +226,38 @@ sal_Bool ContentBroker::initialize(
return m_pTheBroker != 0;
}
+#ifdef ANDROID
+
+extern "C" __attribute__ ((visibility("default"))) void
+InitUCBHelper()
+{
+ Reference< XMultiServiceFactory > xFactory;
+ try
+ {
+ Reference< XComponentContext > xCtx = ::cppu::defaultBootstrap_InitialComponentContext();
+ xFactory = Reference< XMultiServiceFactory >( xCtx->getServiceManager(),
+ UNO_QUERY );
+ }
+ catch( Exception& )
+ {
+ }
+
+ if( !xFactory.is() )
+ {
+ fprintf( stderr,
+ "Could not bootstrap UNO, installation must be in disorder. Exiting.\n" );
+ exit( 1 );
+ }
+
+ // Create UCB.
+ Sequence< Any > aArgs( 2 );
+ aArgs[ 0 ] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( UCB_CONFIGURATION_KEY1_LOCAL ));
+ aArgs[ 1 ] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( UCB_CONFIGURATION_KEY2_OFFICE ));
+ ::ucbhelper::ContentBroker::initialize( xFactory, aArgs );
+}
+
+#endif
+
//=========================================================================
// static
void ContentBroker::deinitialize()