diff options
author | jan Iversen <jani@libreoffice.org> | 2017-02-23 12:47:34 +0100 |
---|---|---|
committer | jan iversen <jani@libreoffice.org> | 2017-03-19 16:36:11 +0000 |
commit | c1f46c54a62030efb93443c025487d2caade5b9c (patch) | |
tree | 2aaad8dd781dc2559feeb09cf1a2189c79022076 /ios | |
parent | 7a2f07c4bd5d26657593044dd441ba5fd168e5de (diff) |
ios LibreOfficeLight LOkit integration
Integrated LibreOfficeLight into gbuild.
added lo.xcconfig and Resources (needed to link with LO and run LO)
added swift --> C interface for LOkit
add known commands from JS client
added C++ condition in LibreOfficekitInit.h (inline no good in a C file)
Change-Id: I19ebe8912546408bf701c96c0c63541d6e37cad8
Reviewed-on: https://gerrit.libreoffice.org/35430
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@libreoffice.org>
Diffstat (limited to 'ios')
7 files changed, 683 insertions, 4 deletions
diff --git a/ios/CustomTarget_LibreOfficeLight_app.mk b/ios/CustomTarget_LibreOfficeLight_app.mk new file mode 100644 index 000000000000..ed61f279e2cf --- /dev/null +++ b/ios/CustomTarget_LibreOfficeLight_app.mk @@ -0,0 +1,30 @@ +# -*- 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/. + +#- Env ------------------------------------------------------------------------ +BUILDID :=$(shell cd $(SRCDIR) && git log -1 --format=%H) + +#- Targets -------------------------------------------------------------------- + +.PHONY: LibreOfficeLight_setup + +# Register target +$(eval $(call gb_CustomTarget_CustomTarget,ios/LibreOfficeLight)) + +# Build +# Depend on the custom target that sets up lo.xcconfig +$(call gb_CustomTarget_get_target,ios/LibreOfficeLight): $(call gb_CustomTarget_get_target,ios/Lo_Xcconfig) + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),APP,2) + $(call IOSbuild,LibreOfficeLight, clean build) + +# Clean +$(call gb_CustomTarget_get_clean_target,ios/LibreOfficeLight): + $(call gb_Output_announce,$(subst $(WORKDIR)/Clean/,,$@),$(false),APP,2) + $(call IOSbuild,LibreOfficeLight, clean) + +# vim: set noet sw=4 ts=4: diff --git a/ios/Module_ios.mk b/ios/Module_ios.mk index 13c607b9d497..22b551214631 100644 --- a/ios/Module_ios.mk +++ b/ios/Module_ios.mk @@ -14,6 +14,7 @@ $(eval $(call gb_Module_add_targets,ios,\ CustomTarget_Lo_Xcconfig \ CustomTarget_TiledLibreOffice_app \ CustomTarget_Prototype_app \ + CustomTarget_LibreOfficeLight_app \ )) endif diff --git a/ios/experimental/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj b/ios/experimental/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj index 837aa290bfee..73e789d2311b 100644 --- a/ios/experimental/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj +++ b/ios/experimental/LibreOfficeLight/LibreOfficeLight.xcodeproj/project.pbxproj @@ -21,6 +21,17 @@ 3992D85E1E5B764A00BEA987 /* ViewFileManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3992D85C1E5B764A00BEA987 /* ViewFileManager.swift */; }; 399648471E5B87DC00E73E83 /* ViewProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 399648461E5B87DC00E73E83 /* ViewProperties.swift */; }; 399648491E5C4E5500E73E83 /* LO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 399648481E5C4E5500E73E83 /* LO.swift */; }; + 39A83A8F1E5F471D00D0C683 /* lokit.c in Sources */ = {isa = PBXBuildFile; fileRef = 39A83A8E1E5F471D00D0C683 /* lokit.c */; }; + 39B084E31E5F0A9600682A59 /* lo.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 39B084E21E5F0A9600682A59 /* lo.xcconfig */; }; + 39B08B9D1E5F0BB600682A59 /* fundamentalrc in Resources */ = {isa = PBXBuildFile; fileRef = 39B084E51E5F0BB400682A59 /* fundamentalrc */; }; + 39B08B9E1E5F0BB600682A59 /* offapi.rdb in Resources */ = {isa = PBXBuildFile; fileRef = 39B084E61E5F0BB400682A59 /* offapi.rdb */; }; + 39B08B9F1E5F0BB600682A59 /* oovbaapi.rdb in Resources */ = {isa = PBXBuildFile; fileRef = 39B084E71E5F0BB400682A59 /* oovbaapi.rdb */; }; + 39B08BD71E5F0BB600682A59 /* rc in Resources */ = {isa = PBXBuildFile; fileRef = 39B085211E5F0BB400682A59 /* rc */; }; + 39B08BD91E5F0BB600682A59 /* services.rdb in Resources */ = {isa = PBXBuildFile; fileRef = 39B085241E5F0BB400682A59 /* services.rdb */; }; + 39B091CD1E5F0BB800682A59 /* udkapi.rdb in Resources */ = {isa = PBXBuildFile; fileRef = 39B08B9B1E5F0BB600682A59 /* udkapi.rdb */; }; + 39B091CE1E5F0BB800682A59 /* unorc in Resources */ = {isa = PBXBuildFile; fileRef = 39B08B9C1E5F0BB600682A59 /* unorc */; }; + 39B091D01E5F102E00682A59 /* test1.odt in Resources */ = {isa = PBXBuildFile; fileRef = 39B091CF1E5F102E00682A59 /* test1.odt */; }; + 39B091D21E5F109A00682A59 /* icudt58l.dat in Resources */ = {isa = PBXBuildFile; fileRef = 39B091D11E5F109A00682A59 /* icudt58l.dat */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -61,6 +72,19 @@ 3992D85C1E5B764A00BEA987 /* ViewFileManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewFileManager.swift; sourceTree = "<group>"; }; 399648461E5B87DC00E73E83 /* ViewProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewProperties.swift; sourceTree = "<group>"; }; 399648481E5C4E5500E73E83 /* LO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LO.swift; sourceTree = "<group>"; }; + 39A83A8D1E5F471C00D0C683 /* lokit-Bridging-Header.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; path = "lokit-Bridging-Header.h"; sourceTree = "<group>"; }; + 39A83A8E1E5F471D00D0C683 /* lokit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lokit.c; path = LibreOfficeLight/lokit.c; sourceTree = SOURCE_ROOT; }; + 39B084E21E5F0A9600682A59 /* lo.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = lo.xcconfig; path = "../../../../ios-work/workdir/ios/generated/lo.xcconfig"; sourceTree = SOURCE_ROOT; }; + 39B084E51E5F0BB400682A59 /* fundamentalrc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = fundamentalrc; path = "../../../../ios-work/workdir/ios/resources/fundamentalrc"; sourceTree = SOURCE_ROOT; }; + 39B084E61E5F0BB400682A59 /* offapi.rdb */ = {isa = PBXFileReference; lastKnownFileType = file; name = offapi.rdb; path = "../../../../ios-work/workdir/ios/resources/offapi.rdb"; sourceTree = SOURCE_ROOT; }; + 39B084E71E5F0BB400682A59 /* oovbaapi.rdb */ = {isa = PBXFileReference; lastKnownFileType = file; name = oovbaapi.rdb; path = "../../../../ios-work/workdir/ios/resources/oovbaapi.rdb"; sourceTree = SOURCE_ROOT; }; + 39B085211E5F0BB400682A59 /* rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = rc; path = "../../../../ios-work/workdir/ios/resources/rc"; sourceTree = SOURCE_ROOT; }; + 39B085241E5F0BB400682A59 /* services.rdb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = services.rdb; path = "../../../../ios-work/workdir/ios/resources/services.rdb"; sourceTree = SOURCE_ROOT; }; + 39B08B9B1E5F0BB600682A59 /* udkapi.rdb */ = {isa = PBXFileReference; lastKnownFileType = file; name = udkapi.rdb; path = "../../../../ios-work/workdir/ios/resources/udkapi.rdb"; sourceTree = SOURCE_ROOT; }; + 39B08B9C1E5F0BB600682A59 /* unorc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = unorc; path = "../../../../ios-work/workdir/ios/resources/unorc"; sourceTree = SOURCE_ROOT; }; + 39B091CF1E5F102E00682A59 /* test1.odt */ = {isa = PBXFileReference; lastKnownFileType = file; name = test1.odt; path = ../../../odk/examples/java/DocumentHandling/test/test1.odt; sourceTree = SOURCE_ROOT; }; + 39B091D11E5F109A00682A59 /* icudt58l.dat */ = {isa = PBXFileReference; lastKnownFileType = file; name = icudt58l.dat; path = "../../../../ios-work/workdir/UnpackedTarball/icu/source/data/in/icudt58l.dat"; sourceTree = "<group>"; }; + 39B092501E5F3DEA00682A59 /* LibreOfficeLight-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "LibreOfficeLight-Prefix.pch"; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -91,6 +115,8 @@ 3911D89F1E5993600050D6BC /* Support files */ = { isa = PBXGroup; children = ( + 39B092501E5F3DEA00682A59 /* LibreOfficeLight-Prefix.pch */, + 39B084E21E5F0A9600682A59 /* lo.xcconfig */, 397E09071E597BD8001374E0 /* Assets.xcassets */, 397E09041E597BD8001374E0 /* LibreOfficeLight.xcdatamodeld */, 397E090C1E597BD8001374E0 /* Info.plist */, @@ -102,6 +128,8 @@ 397E08F11E597BD8001374E0 = { isa = PBXGroup; children = ( + 39B084E41E5F0B5200682A59 /* Resources */, + 3911D89F1E5993600050D6BC /* Support files */, 397E08FC1E597BD8001374E0 /* LibreOfficeLight */, 397E09141E597BD8001374E0 /* LibreOfficeLightTests */, 397E091F1E597BD8001374E0 /* LibreOfficeLightUITests */, @@ -122,6 +150,7 @@ 397E08FC1E597BD8001374E0 /* LibreOfficeLight */ = { isa = PBXGroup; children = ( + 39A83A8E1E5F471D00D0C683 /* lokit.c */, 397E08FD1E597BD8001374E0 /* AppDelegate.swift */, 3992D8571E5B761700BEA987 /* ViewController.swift */, 3992D85B1E5B764A00BEA987 /* SideMenu.swift */, @@ -132,7 +161,7 @@ 399648481E5C4E5500E73E83 /* LO.swift */, 397E09011E597BD8001374E0 /* Main.storyboard */, 397868D81E59A3EA007F9248 /* LaunchScreen.xib */, - 3911D89F1E5993600050D6BC /* Support files */, + 39A83A8D1E5F471C00D0C683 /* lokit-Bridging-Header.h */, ); path = LibreOfficeLight; sourceTree = SOURCE_ROOT; @@ -155,6 +184,22 @@ path = LibreOfficeLightUITests; sourceTree = SOURCE_ROOT; }; + 39B084E41E5F0B5200682A59 /* Resources */ = { + isa = PBXGroup; + children = ( + 39B084E51E5F0BB400682A59 /* fundamentalrc */, + 39B084E61E5F0BB400682A59 /* offapi.rdb */, + 39B084E71E5F0BB400682A59 /* oovbaapi.rdb */, + 39B085211E5F0BB400682A59 /* rc */, + 39B085241E5F0BB400682A59 /* services.rdb */, + 39B08B9B1E5F0BB600682A59 /* udkapi.rdb */, + 39B08B9C1E5F0BB600682A59 /* unorc */, + 39B091CF1E5F102E00682A59 /* test1.odt */, + 39B091D11E5F109A00682A59 /* icudt58l.dat */, + ); + name = Resources; + sourceTree = SOURCE_ROOT; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -223,6 +268,7 @@ TargetAttributes = { 397E08F91E597BD8001374E0 = { CreatedOnToolsVersion = 8.2; + LastSwiftMigration = 0820; ProvisioningStyle = Automatic; }; 397E09101E597BD8001374E0 = { @@ -261,8 +307,18 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 39B091D21E5F109A00682A59 /* icudt58l.dat in Resources */, 397E09081E597BD8001374E0 /* Assets.xcassets in Resources */, + 39B08BD71E5F0BB600682A59 /* rc in Resources */, + 39B08B9E1E5F0BB600682A59 /* offapi.rdb in Resources */, + 39B084E31E5F0A9600682A59 /* lo.xcconfig in Resources */, 397868D61E59A3EA007F9248 /* LaunchScreen.xib in Resources */, + 39B08B9F1E5F0BB600682A59 /* oovbaapi.rdb in Resources */, + 39B08B9D1E5F0BB600682A59 /* fundamentalrc in Resources */, + 39B091CD1E5F0BB800682A59 /* udkapi.rdb in Resources */, + 39B08BD91E5F0BB600682A59 /* services.rdb in Resources */, + 39B091D01E5F102E00682A59 /* test1.odt in Resources */, + 39B091CE1E5F0BB800682A59 /* unorc in Resources */, 397E09031E597BD8001374E0 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -295,6 +351,7 @@ 3992D85E1E5B764A00BEA987 /* ViewFileManager.swift in Sources */, 3992D85A1E5B762A00BEA987 /* ViewDocument.swift in Sources */, 397E08FE1E597BD8001374E0 /* AppDelegate.swift in Sources */, + 39A83A8F1E5F471D00D0C683 /* lokit.c in Sources */, 399648491E5C4E5500E73E83 /* LO.swift in Sources */, 3992D8581E5B761700BEA987 /* ViewController.swift in Sources */, ); @@ -354,6 +411,7 @@ /* Begin XCBuildConfiguration section */ 397E09231E597BD8001374E0 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 39B084E21E5F0A9600682A59 /* lo.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -392,6 +450,26 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(LO_BUILDDIR)/config_host", + "$(LO_SRCDIR)/include", + "$(LO_WORKDIR)/UnoApiHeadersTarget/udkapi/comprehensive", + "$(LO_WORKDIR)/UnoApiHeadersTarget/offapi/comprehensive", + "$(LO_WORKDIR)/UnpackedTarball/icu/source/common", + "$(LO_WORKDIR)/ios/generated", + ); + "HEADER_SEARCH_PATHS[arch=*]" = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(LO_BUILDDIR)/config_host", + "$(LO_SRCDIR)/include", + "$(LO_WORKDIR)/UnoApiHeadersTarget/udkapi/comprehensive", + "$(LO_WORKDIR)/UnoApiHeadersTarget/offapi/comprehensive", + "$(LO_WORKDIR)/UnpackedTarball/icu/source/common", + "$(LO_WORKDIR)/ios/generated", + ); IPHONEOS_DEPLOYMENT_TARGET = 10.2; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; @@ -404,6 +482,7 @@ }; 397E09241E597BD8001374E0 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 39B084E21E5F0A9600682A59 /* lo.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -436,8 +515,29 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(LO_BUILDDIR)/config_host", + "$(LO_SRCDIR)/include", + "$(LO_WORKDIR)/UnoApiHeadersTarget/udkapi/comprehensive", + "$(LO_WORKDIR)/UnoApiHeadersTarget/offapi/comprehensive", + "$(LO_WORKDIR)/UnpackedTarball/icu/source/common", + "$(LO_WORKDIR)/ios/generated", + ); + "HEADER_SEARCH_PATHS[arch=*]" = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(LO_BUILDDIR)/config_host", + "$(LO_SRCDIR)/include", + "$(LO_WORKDIR)/UnoApiHeadersTarget/udkapi/comprehensive", + "$(LO_WORKDIR)/UnoApiHeadersTarget/offapi/comprehensive", + "$(LO_WORKDIR)/UnpackedTarball/icu/source/common", + "$(LO_WORKDIR)/ios/generated", + ); IPHONEOS_DEPLOYMENT_TARGET = 10.2; MTL_ENABLE_DEBUG_INFO = NO; + ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; TARGETED_DEVICE_FAMILY = "1,2"; @@ -447,30 +547,51 @@ }; 397E09261E597BD8001374E0 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 39B084E21E5F0A9600682A59 /* lo.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = NO; + CLANG_WARN_INFINITE_RECURSION = NO; + ENABLE_TESTABILITY = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "LibreOfficeLight/LibreOfficeLight-Prefix.pch"; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; INFOPLIST_FILE = LibreOfficeLight/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = jani.libreofficeLight.LibreOfficeLight; + PRODUCT_BUNDLE_IDENTIFIER = LibreOfficeLight; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "LibreOfficeLight/lokit-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 3.0; }; name = Debug; }; 397E09271E597BD8001374E0 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 39B084E21E5F0A9600682A59 /* lo.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = NO; + CLANG_WARN_INFINITE_RECURSION = NO; + COPY_PHASE_STRIP = YES; + ENABLE_TESTABILITY = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "LibreOfficeLight/LibreOfficeLight-Prefix.pch"; INFOPLIST_FILE = LibreOfficeLight/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = jani.libreofficeLight.LibreOfficeLight; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = LibreOfficeLight; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "LibreOfficeLight/lokit-Bridging-Header.h"; SWIFT_VERSION = 3.0; }; name = Release; }; 397E09291E597BD8001374E0 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 39B084E21E5F0A9600682A59 /* lo.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUNDLE_LOADER = "$(TEST_HOST)"; @@ -485,6 +606,7 @@ }; 397E092A1E597BD8001374E0 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 39B084E21E5F0A9600682A59 /* lo.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUNDLE_LOADER = "$(TEST_HOST)"; @@ -499,6 +621,7 @@ }; 397E092C1E597BD8001374E0 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 39B084E21E5F0A9600682A59 /* lo.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; INFOPLIST_FILE = LibreOfficeLightUITests/Info.plist; @@ -512,6 +635,7 @@ }; 397E092D1E597BD8001374E0 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 39B084E21E5F0A9600682A59 /* lo.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; INFOPLIST_FILE = LibreOfficeLightUITests/Info.plist; diff --git a/ios/experimental/LibreOfficeLight/LibreOfficeLight/LO.swift b/ios/experimental/LibreOfficeLight/LibreOfficeLight/LO.swift index e6556adafe3a..ed039fccd49f 100755 --- a/ios/experimental/LibreOfficeLight/LibreOfficeLight/LO.swift +++ b/ios/experimental/LibreOfficeLight/LibreOfficeLight/LO.swift @@ -16,7 +16,7 @@ class LOkit { init() { - + LOkit_Init() } diff --git a/ios/experimental/LibreOfficeLight/LibreOfficeLight/LibreOfficeLight-Prefix.pch b/ios/experimental/LibreOfficeLight/LibreOfficeLight/LibreOfficeLight-Prefix.pch new file mode 100644 index 000000000000..638bf30e867e --- /dev/null +++ b/ios/experimental/LibreOfficeLight/LibreOfficeLight/LibreOfficeLight-Prefix.pch @@ -0,0 +1,22 @@ +// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +// +// 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/. + +#import <Availability.h> + +#ifndef __IPHONE_5_0 +#warning "This project uses features only available in iOS SDK 5.0 and later." +#endif + +#ifdef __OBJC__ + #include <premac.h> + #import <UIKit/UIKit.h> + #import <Foundation/Foundation.h> + #include <postmac.h> +#endif + +// vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/ios/experimental/LibreOfficeLight/LibreOfficeLight/lokit-Bridging-Header.h b/ios/experimental/LibreOfficeLight/LibreOfficeLight/lokit-Bridging-Header.h new file mode 100644 index 000000000000..862785f0ac50 --- /dev/null +++ b/ios/experimental/LibreOfficeLight/LibreOfficeLight/lokit-Bridging-Header.h @@ -0,0 +1,11 @@ +// +// 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/. +// + + +// Bridge functions to LibreOfficeKit +int LOkit_Init(); diff --git a/ios/experimental/LibreOfficeLight/LibreOfficeLight/lokit.c b/ios/experimental/LibreOfficeLight/LibreOfficeLight/lokit.c new file mode 100755 index 000000000000..af77f40454d0 --- /dev/null +++ b/ios/experimental/LibreOfficeLight/LibreOfficeLight/lokit.c @@ -0,0 +1,491 @@ +// +// 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 <stdio.h> +#define LOK_USE_UNSTABLE_API +#include <LibreOfficeKit/LibreOfficeKitInit.h> + +// pointers to our instance +static LibreOfficeKit* kit; +static LibreOfficeKitDocument* document; + + +// Bridge functions to LibreOfficeKit +int LOkit_Init() +{ + // Initialize LibreOfficeKit + kit = lok_init(NULL); + return 0; +} + + +int LOkit_open(char *file) +{ + document = kit->pClass->documentLoad(kit, file); + document->pClass->initializeForRendering(document, ""); + return 0; +} + + +#if 0 +// createpath from tiled +static NSString *createPaths(NSString *base, NSString *appRootEscaped, NSArray *fileNames) +{ + NSString *result; + NSString *prefix = @"file://"; + BOOL first = YES; + + result = base; + for (NSString *fileName in fileNames) { + result = [result stringByAppendingString: prefix]; + result = [result stringByAppendingString: [appRootEscaped stringByAppendingPathComponent: fileName]]; + + if (first) { + prefix = [@" " stringByAppendingString:prefix]; + first = NO; + } + } + + return result; +} + + +// Force reference to libreofficekit_hook +extern "C" void *libreofficekit_hook(const char *); +static __attribute__((used)) void *(*foop)(const char *) = libreofficekit_hook; + +extern "C" void lo_initialize(NSString *documentPath) +{ + NSString *bundlePath = [[NSBundle mainBundle] bundlePath]; + NSString *app_root_escaped = [bundlePath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + NSString *uno_types = createPaths(@"-env:UNO_TYPES=", app_root_escaped, @[@"offapi.rdb", @"oovbaapi.rdb", @"types.rdb"]); + NSString *uno_services = createPaths(@"-env:UNO_SERVICES=", app_root_escaped, @[@"ure/services.rdb", @"services.rdb"]); + + int fd = open([[bundlePath stringByAppendingPathComponent:@U_ICUDATA_NAME".dat"] UTF8String], O_RDONLY); + if (fd != -1) { + struct stat st; + if (fstat(fd, &st) != -1 + && st.st_size < (size_t)-1) { + void *icudata = mmap(0, (size_t) st.st_size, PROT_READ, MAP_FILE|MAP_PRIVATE, fd, 0); + if (icudata == MAP_FAILED) { +#if OSL_DEBUG_LEVEL > 0 + NSLog(@"mmap failed:%s", strerror(errno)); +#endif + } else { + UErrorCode icuStatus = U_ZERO_ERROR; + udata_setCommonData(icudata, &icuStatus); +#if OSL_DEBUG_LEVEL > 0 + if (U_FAILURE(icuStatus)) + NSLog(@"udata_setCommonData failed"); + else { + // Test that ICU works... + UConverter *cnv = ucnv_open("iso-8859-3", &icuStatus); + NSLog(@"ucnv_open(iso-8859-3)-> %p, err = %s, name=%s", + (void *)cnv, u_errorName(icuStatus), (!cnv)?"?":ucnv_getName(cnv,&icuStatus)); + if (U_SUCCESS(icuStatus)) + ucnv_close(cnv); + } +#endif + } + } + close(fd); + } + + const char *argv[] = { + [[[NSBundle mainBundle] executablePath] UTF8String], + "-env:URE_INTERNAL_LIB_DIR=file:///", + [uno_types UTF8String], + [uno_services UTF8String], + [[@"file://" stringByAppendingString: [documentPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] UTF8String] + }; + + const int argc = sizeof(argv)/sizeof(*argv); + + osl_setCommandArgs(argc, (char **) argv); +} + +#endif + + +#if 0 +// LOK_main (online) +#endif + + +// CLIENT COMMAND INTERFACE +static bool client_canceltiles(char *input, int argc, char *args[]) +{ + // command: canceltiles + // arguments: NONE + // description: + // All outstanding tile messages from the client to the server are + // dropped and will not be handled, except tile messages with an id + // parameter. There is no guarantee of exactly which tile: messages + // might still be sent back to the client. + // + return true; +} + +static bool client_clientvisiblearea(char *input, int argc, char *args[]) +{ + // command: clientvisiblearea + // arguments: x=<x> + // y=<y> + // width=<width> + // height=<height> + return true; +} + +static bool client_closedocument(char *input, int argc, char *args[]) +{ + // command: closedocument + // arguments: None + // description: + // This gives document owners the ability to terminate all sessions + // currently having that document opened. This functionality is enabled + // only in case WOPI. host mentions 'EnableOwnerTermination' flag in + // its CheckFileInfo response + return true; +} + +static bool client_commandvalues(char *input, int argc, char *args[]) +{ + // command: commandvalues + // arguments: None + return true; +} + +static bool client_downloadas(char *input, int argc, char *args[]) +{ + // command: downloadas + // arguments: name=<fileName> + // id=<id> + // format=<document format> + // options=<SkipImages, etc> + // description: + // Exports the current document to the desired format and returns a + // download URL. The id identifies the request on the client. id can + // take following values: + // * 'print': When request for download is basically for print purposes + // * 'slideshow': When request for download is for showing slideshow + // * 'export': Just a simple download + return true; +} + +static bool client_getchildid(char *input, int argc, char *args[]) +{ + // command: getchildid + // arguments: None + // description: + // Requests the child id so that it knows where the files needs to be sent + // when it is inserted in the document + return true; +} + +static bool client_gettextselection(char *input, int argc, char *args[]) +{ + // command: gettextselection + // arguments: None + // description: + // Request selection's content + return true; +} + +static bool client_insertfile(char *input, int argc, char *args[]) +{ + // command: insertfile + // arguments: name=<name> + // type=<type> + // description: + // Inserts the file with the name <name> into the document, + // we currently support type = 'graphic' + return true; +} + +static bool client_key(char *input, int argc, char *args[]) +{ + // command: key + // arguments: type=<type> + // char=<charcode> + // key=<keycode> + // description: + // <type> is 'input' or 'up', <charcode> and <keycode> are numbers. + return true; +} + +static bool client_load(char *input, int argc, char *args[]) +{ + // command: load + // arguments: [part=<partNumber>] + // url=<url> + // [timestamp=<time>] + //. [options=<options>] + // description: + // part is an optional parameter. <partNumber> is a number. + // timestamp is an optional parameter. <time> is provided in + // microseconds since the Unix epoch - midnight, January 1, 1970. + // options are the whole rest of the line, not URL-encoded, + // and must be valid JSON. + return true; +} + +static bool client_loolclient(char *input, int argc, char *args[]) +{ + // command: loolclient + // arguments: <major.minor[-patch]> + // description: + // Upon connection, a client must announce the version number it supports. + // Major: an integer that must always match between client and server, + // otherwise there are no guarantees of any sensible compatibility. + // This is bumped when API changes. + // Minor: an integer is more flexible and is at the discretion of either party. + // Security fixes that do not alter the API would bump the minor version number. + // Patch: an optional string that is informational. + return true; +} + +static bool client_mouse(char *input, int argc, char *args[]) +{ + // command: mouse + // arguments: type=<type> + // x=<x> + // y=<y> + // count=<count> + // description: + // <type> is 'buttondown', 'buttonup' or 'move', others are numbers. + return true; +} + +static bool client_paste(char *input, int argc, char *args[]) +{ + // command: paste + // arguments: mimetype=<mimeType> + // <binaryPasteData> + // description: + // Paste content at the current cursor position + return true; +} + +static bool client_ping(char *input, int argc, char *args[]) +{ + // command: ping + // argument: None + // description: + // requests a 'pong' server message. + return true; +} + +static bool client_renderfont(char *input, int argc, char *args[]) +{ + // command: renderfont + // arguments: font=<font> + // char=<characters> + // description: + // requests the rendering of the given font. + // The font parameter is URL encoded + // The char parameter is URL encoded + return true; +} + +static bool client_requestloksession(char *input, int argc, char *args[]) +{ + // command: requestloksession + // arguments: None + // description: + // requests the initialization of a LOK process in an attempt + // to predict the user's interaction with the document + return true; +} + +static bool client_resetselection(char *input, int argc, char *args[]) +{ + // command: resetselection + // arguments: None + return true; +} + +static bool client_saveas(char *input, int argc, char *args[]) +{ + // command: saveas + // arguments: url=<url> + // format=<format> + // options=<options> + // description: + // <url> is a URL, encoded. <format> is also URL-encoded, + // i.e. spaces as %20 and it can be empty + // options are the whole rest of the line, not URL-encoded, and can be empty + return true; +} + +static bool client_selectgraphic(char *input, int argc, char *args[]) +{ + // command: selectgraphic + // arguments: type=<type> + // x=<x> + // y=<y> + // description: + // <type> is 'start' or 'end'. <x> and <y> are numbers. + return true; +} + +static bool client_selecttext(char *input, int argc, char *args[]) +{ + // command: selecttext + // arguments: type=<type> + // x=<x> + // y=<y> + // description: + // <type> is 'start', 'end' or 'reset', <x> and <y> are numbers. + return true; +} + +static bool client_setclientpart(char *input, int argc, char *args[]) +{ + // command: setclientpart + // arguments: part=<partNumber> + // description: + // Informs the server that the client changed to part <partNumber>. + return true; +} + +static bool client_status(char *input, int argc, char *args[]) +{ + // command: status + // arguments: None + return true; +} + +static bool client_styles(char *input, int argc, char *args[]) +{ + // command: styles + // arguments: None + return true; +} + +static bool client_tile(char *input, int argc, char *args[]) +{ + // command: tile + // arguments: part=<partNumber> + // width=<width> + // height=<height> + // tileposx=<xpos> + // tileposy=<ypos> + // tilewidth=<tileWidth> + // tileheight=<tileHeight> + // [timestamp=<time>] + // [id=<id>] + // [broadcast=<yesOrNo>] + // [oldhash=<hash>] + // description: + // Parameters are numbers except broadcast which is 'yes' or 'no' + // and hash which is a 64-bit hash. (There is no need for the client + // to parse it into a number, it can be treated as an opaque string.) + // Note: id must be echoed back in the response verbatim. It and the + // following parameter, broadcast, are used when rendering slide + // previews of presentation documents, and not for anything else. It + // is only useful to loleaflet and will break it if not returned in + // the response. + return true; +} + +static bool client_tilecombine(char *input, int argc, char *args[]) +{ + // command: tilecombine + // arguments: <parameters> + // description: + // Accepts same parameters as the 'tile' message except that + // parameters 'tileposx', 'tileposy' and 'oldhash' are + // comma-separated lists, and the number of elements in each + // must be same. + return true; +} + +static bool client_uno(char *input, int argc, char *args[]) +{ + // command: uno + // arguments: <command> + // description: + // <command> is a line of text. + return true; +} + +static bool client_useractive(char *input, int argc, char *args[]) +{ + // command: useractive + // arguments: None + // description: + // Sent when the user regains focus or clicks within the active + // area to disable the inactive state. + // Will send invalidation and update notifications to force refreshing the screen. + // See 'userinactive'. + return true; +} + +static bool client_userinactive(char *input, int argc, char *args[]) +{ + // command: userinactive + // arguments: None + // description: + // Sent when the user has switched tabs or away from the Browser + // altogether. It should throttle updates until the user is active again. + // See 'useractive'. + return true; +} + + + +typedef struct {const char *command; bool (*funcCmd)(char *, int, char *[]);} CLIENTCOMMAND; +static CLIENTCOMMAND clientcommands[] = {{"canceltiles", client_canceltiles}, + {"clientvisiblearea", client_clientvisiblearea}, + {"closedocument", client_closedocument}, + {"commandvalues", client_commandvalues}, + {"downloadas", client_downloadas}, + {"getchildid", client_getchildid}, + {"gettextselection", client_gettextselection}, + {"insertfile", client_insertfile}, + {"key", client_key}, + {"load", client_load}, + {"loolclient", client_loolclient}, + {"mouse", client_mouse}, + {"paste", client_paste}, + {"ping", client_ping}, + {"renderfont", client_renderfont}, + {"requestloksession", client_requestloksession}, + {"resetselection", client_resetselection}, + {"saveas", client_saveas}, + {"selectgraphic", client_selectgraphic}, + {"selecttext", client_selecttext}, + {"setclientpart", client_setclientpart}, + {"status", client_status}, + {"styles", client_styles}, + {"tile", client_tile}, + {"tilecombine", client_tilecombine}, + {"uno", client_uno}, + {"useractive", client_useractive}, + {"userinactive", client_userinactive}, + {NULL, NULL} + }; + + + + +bool ClientCommand(char *input) +{ + CLIENTCOMMAND *cmd = clientcommands; + + // Split input into cmd + args + + // Locate correct command + for (; cmd->command; ++cmd) + if (!strcmp(cmd->command,"mycommand")) + return cmd->funcCmd(input, 0, NULL); + + // Call/Return from command + return false; +} + + |