diff options
author | Tor Lillqvist <tml@iki.fi> | 2013-01-05 23:13:49 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2013-01-06 16:01:08 +0200 |
commit | 4a11f5c28a2d7b4d50d67f26cba889169977a0ce (patch) | |
tree | 6ae9219cfa45632ead3e8cdd047da7080804b4e0 /ios | |
parent | 392510d7e483e8c181540dfdbabf4de53e4dcbe1 (diff) |
More hacking on iOS stuff
Get the app bundle directory from Xcode's SCRIPT_OUTPUT_FILE_0.
Copy .rdb, registry, .res files, set up the various rc files.
Don't list a bunch of .component files on the command line, surely
that is not sane.
Change-Id: I6fb8bd4bea8d5afd30900daa1b916defb894e78c
Diffstat (limited to 'ios')
-rw-r--r-- | ios/CustomTarget_Viewer_app.mk | 76 | ||||
-rw-r--r-- | ios/experimental/Viewer/Viewer/lo-viewer.mm | 92 |
2 files changed, 103 insertions, 65 deletions
diff --git a/ios/CustomTarget_Viewer_app.mk b/ios/CustomTarget_Viewer_app.mk index 36cf8c59fa7a..9af7a493a270 100644 --- a/ios/CustomTarget_Viewer_app.mk +++ b/ios/CustomTarget_Viewer_app.mk @@ -48,13 +48,85 @@ endif ifneq ($(SCRIPT_OUTPUT_FILE_0),) # When run from Xcode, we move the Viewer executable from solver into -# the Viewer.app directory that Xcode uses. +# the Viewer.app directory that Xcode uses. We also set up/copy all +# the run-time configuration etc files that the app needs. $(call gb_CustomTarget_get_target,ios/Viewer_app) : $(SCRIPT_OUTPUT_FILE_0) +appdir=$(dir $(SCRIPT_OUTPUT_FILE_0)) +buildid=$(shell git log -1 --format=%H) + $(SCRIPT_OUTPUT_FILE_0) : $(call gb_Executable_get_target,Viewer) $(call gb_Output_announce,$@,fii,APP,2) - mkdir -p `dirname $(SCRIPT_OUTPUT_FILE_0)` + mkdir -p $(appdir)/ure mv $(call gb_Executable_get_target,Viewer) $(SCRIPT_OUTPUT_FILE_0) +# +# Copy rdb files +# + cp $(OUTDIR)/bin/types.rdb $(appdir) + cp $(OUTDIR)/bin/ure/types.rdb $(appdir)/ure + cp $(OUTDIR)/bin/offapi.rdb $(appdir) + cp $(OUTDIR)/xml/services.rdb $(appdir) + cp $(OUTDIR)/xml/ure/services.rdb $(appdir)/ure +# +# Copy "registry" files +# + mkdir -p $(appdir)/registry/modules $(appdir)/registry/res + cp $(OUTDIR)/xml/*.xcd $(appdir)/registry + mv $(appdir)/registry/fcfg_langpack_en-US.xcd $(appdir)/registry/res + cp -R $(OUTDIR)/xml/registry/* $(appdir)/registry +# +# Copy .res files +# +# program/resource is hardcoded in tools/source/rc/resmgr.cxx. Sure, +# we could set STAR_RESOURCE_PATH instead. sigh... +# + mkdir -p $(appdir)/program/resource + cp $(OUTDIR)/bin/*en-US.res $(appdir)/program/resource +# +# Set up rc, the "inifile". See getIniFileName_Impl(). +# + ( \ + echo '[Bootstrap]' && \ + echo 'URE_BOOTSTRAP=file://$$APP_DATA_DIR/fundamentalrc' && \ + echo 'HOME=$$APP_DATA_DIR/tmp' && \ + : ) > $(appdir)/rc +# +# Set up fundamentalrc, unorc, bootstraprc and versionrc. +# +# Do we really need all these? +# + ( \ + echo '[Bootstrap]' && \ + echo 'BRAND_BASE_DIR=file://$$APP_DATA_DIR' && \ + echo 'CONFIGURATION_LAYERS=xcsxcu:$${BRAND_BASE_DIR}/registry module:$${BRAND_BASE_DIR}/registry/modules res:$${BRAND_BASE_DIR}/registry' && \ + : ) > $(appdir)/fundamentalrc +# + ( \ + echo '[Bootstrap]' && \ + : UNO_TYPES and UNO_SERVICES are set up in lo-viewer.mm, is that sane? && \ + : ) > $(appdir)/unorc +# +# bootstraprc must be in $BRAND_BASE_DIR/program +# + mkdir -p $(appdir)/program + ( \ + echo '[Bootstrap]' && \ + echo 'InstallMode=<installmode>' && \ + echo 'ProductKey=LibreOffice Viewer $(PRODUCTVERSION)' && \ + echo 'UserInstallation=file://$$APP_DATA_DIR' && \ + : ) > $(appdir)/program/bootstraprc +# +# Is this really needed? +# + ( \ + echo '[Version]' && \ + echo 'AllLanguages=en-US' && \ + echo 'BuildVersion=' && \ + echo 'buildid=$(buildid)' && \ + echo 'ProductBuildid=3' && \ + echo 'ProductMajor=360' && \ + echo 'ProductMinor=1' && \ + : ) > $(appdir)/program/versionrc else # When run just from the command line, we don't have any app bundle to diff --git a/ios/experimental/Viewer/Viewer/lo-viewer.mm b/ios/experimental/Viewer/Viewer/lo-viewer.mm index a40cb78c6804..616f136d7cad 100644 --- a/ios/experimental/Viewer/Viewer/lo-viewer.mm +++ b/ios/experimental/Viewer/Viewer/lo-viewer.mm @@ -13,6 +13,7 @@ #import <UIKit/UIKit.h> #include <postmac.h> +#include <comphelper/processfactory.hxx> #include <cppuhelper/bootstrap.hxx> #include <osl/detail/ios-bootstrap.h> #include <osl/process.h> @@ -21,14 +22,12 @@ #include <com/sun/star/bridge/XUnoUrlResolver.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/registry/XSimpleRegistry.hpp> -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::bridge; -using namespace com::sun::star::frame; -using namespace com::sun::star::registry; +#include <vcl/svapp.hxx> + +using namespace com::sun::star; using ::rtl::OUString; using ::rtl::OUStringToOString; @@ -122,15 +121,10 @@ lo_get_libmap(void) void lo_initialize(void) { - // See unotest/source/cpp/bootstrapfixturebase.cxx - const char *app_root = [[[NSBundle mainBundle] bundlePath] UTF8String]; - setenv("SRC_ROOT", app_root, 1); - setenv("OUTDIR_FOR_BUILD", app_root, 1); - - setenv("SAL_LOG", "yes", 1); + setenv("SAL_LOG", "+WARN+INFO", 1); const char *argv[] = { - "Viewer", + "placeholder-exe", "-env:URE_INTERNAL_LIB_DIR=file:///", "placeholder-uno-types", "placeholder-uno-services" @@ -138,65 +132,31 @@ lo_initialize(void) const int argc = sizeof(argv)/sizeof(*argv); + argv[0] = [[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent: @"Viewer"] UTF8String]; + NSString *app_root_escaped = [[[NSBundle mainBundle] bundlePath] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; NSString *uno_types = @"-env:UNO_TYPES="; uno_types = [uno_types stringByAppendingString: @"file://"]; - uno_types = [uno_types stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"udkapi.rdb"]]; + uno_types = [uno_types stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"ure/types.rdb"]]; - uno_types = [uno_types stringByAppendingString: @" "]; - uno_types = [uno_types stringByAppendingString: @"file://"]; + uno_types = [uno_types stringByAppendingString: @" file://"]; uno_types = [uno_types stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"types.rdb"]]; - uno_types = [uno_types stringByAppendingString: @" "]; - uno_types = [uno_types stringByAppendingString: @"file://"]; - uno_types = [uno_types stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"ure/types.rdb"]]; + uno_types = [uno_types stringByAppendingString: @" file://"]; + uno_types = [uno_types stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"offapi.rdb"]]; assert(strcmp(argv[argc-2], "placeholder-uno-types") == 0); argv[argc-2] = [uno_types UTF8String]; NSString *uno_services = @"-env:UNO_SERVICES="; - const char *services[] = { - "services.rdb", - "ComponentTarget/basic/util/sb.component", - "ComponentTarget/chart2/source/controller/chartcontroller.component", - "ComponentTarget/chart2/source/chartcore.component", - "ComponentTarget/comphelper/util/comphelp.component", - "ComponentTarget/eventattacher/source/evtatt.component", - "ComponentTarget/fileaccess/source/fileacc.component", - "ComponentTarget/filter/source/config/cache/filterconfig1.component", - "ComponentTarget/oox/util/oox.component", - "ComponentTarget/package/source/xstor/xstor.component", - "ComponentTarget/package/util/package2.component", - "ComponentTarget/sax/source/expatwrap/expwrap.component", - "ComponentTarget/sax/source/fastparser/fastsax.component", - "ComponentTarget/sc/util/sc.component", - "ComponentTarget/sc/util/scfilt.component", - "ComponentTarget/scaddins/source/analysis/analysis.component", - "ComponentTarget/scaddins/source/datefunc/date.component", - "ComponentTarget/sot/util/sot.component", - "ComponentTarget/svl/util/svl.component", - "ComponentTarget/toolkit/util/tk.component", - "ComponentTarget/ucb/source/ucp/tdoc/ucptdoc1.component", - "ComponentTarget/unotools/util/utl.component", - "ComponentTarget/unoxml/source/rdf/unordf.component", - "ComponentTarget/framework/util/fwk.component", - "ComponentTarget/i18npool/util/i18npool.component", - "ComponentTarget/sfx2/util/sfx.component", - "ComponentTarget/unoxml/source/service/unoxml.component", - "ComponentTarget/configmgr/source/configmgr.component", - "ComponentTarget/ucb/source/core/ucb1.component", - "ComponentTarget/ucb/source/ucp/file/ucpfile1.component" - }; + uno_services = [uno_services stringByAppendingString: @"file://"]; + uno_services = [uno_services stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"ure/services.rdb"]]; - for (unsigned i = 0; i < sizeof(services)/sizeof(services[0]); i++) { - uno_services = [uno_services stringByAppendingString: @"file://"]; - uno_services = [uno_services stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: [NSString stringWithUTF8String: services[i]]]]; - if (i < sizeof(services)/sizeof(services[0]) - 1) - uno_services = [uno_services stringByAppendingString: @" "]; - } + uno_services = [uno_services stringByAppendingString: @" file://"]; + uno_services = [uno_services stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"services.rdb"]]; assert(strcmp(argv[argc-1], "placeholder-uno-services") == 0); argv[argc-1] = [uno_services UTF8String]; @@ -205,15 +165,21 @@ lo_initialize(void) try { - Reference< XComponentContext > xComponentContext(::cppu::defaultBootstrap_InitialComponentContext()); + 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 ); - Reference< XMultiComponentFactory > xMultiComponentFactoryClient( xComponentContext->getServiceManager() ); + InitVCL(); - Reference< XInterface > xInterface = - xMultiComponentFactoryClient->createInstanceWithContext( OUString("com.sun.star.frame.Desktop"), - xComponentContext ); + uno::Reference< uno::XInterface > xInterface = + xFactory->createInstanceWithContext( "com.sun.star.frame.Desktop", + xContext ); } - catch (Exception e) { + catch ( uno::Exception e ) { SAL_WARN("Viewer", e.Message); } } |