From c8d1c4350b6828f64121ff4a443700a5b9035e9d Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Sun, 29 Oct 2017 14:16:19 +0100 Subject: iOS, tested document open from 3rd party app. This patch allows integration of 3rd party app. if e.g. in mail and clicking on a OO document, LibreOfficeLight will open and present the document Change-Id: I86c77cd3af3aac41fda441b7c5625a2063343971 --- .../LibreOfficeLight/AppDelegate.swift | 7 +++--- .../LibreOfficeLight/DocumentController.swift | 26 +++++++++++++++++----- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/ios/LibreOfficeLight/LibreOfficeLight/AppDelegate.swift b/ios/LibreOfficeLight/LibreOfficeLight/AppDelegate.swift index 31da9986b9f3..766aa4976a29 100644 --- a/ios/LibreOfficeLight/LibreOfficeLight/AppDelegate.swift +++ b/ios/LibreOfficeLight/LibreOfficeLight/AppDelegate.swift @@ -24,8 +24,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate // remark if the app is not started it will be started first func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool { - // called when started from another Application. - //FIXME + let document = window?.rootViewController?.childViewControllers[0] as! DocumentController + document.doOpen(url) return true } @@ -102,7 +102,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate // Saves changes in the application's managed object context before the application terminates. func applicationWillTerminate(_ application: UIApplication) { - // Jan to be done (terminate LO) + let document = window?.rootViewController?.childViewControllers[0] as! DocumentController + document.Hipernate() } } diff --git a/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift b/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift index a6c4a0b26f82..5034d46533c1 100755 --- a/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift +++ b/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift @@ -67,6 +67,8 @@ class DocumentController: UIViewController, MenuDelegate, UIDocumentBrowserViewC // The PropertiesController is a left sidebar, that will scroll in when activated // The Controller handles manipulation of properties in the document + + // Activate/Deactivate PropertiesController (from navigationController, see storyboard) @IBAction func doProperties(_ sender: UIBarButtonItem) { @@ -155,10 +157,10 @@ class DocumentController: UIViewController, MenuDelegate, UIDocumentBrowserViewC switch tag { case 1: // Open... - doOpenDocument() + startOpenDocument() case 2: // Properties - doProperties() + showProperties() case 3: // Save doSave() @@ -173,7 +175,7 @@ class DocumentController: UIViewController, MenuDelegate, UIDocumentBrowserViewC doSaveAsPDF() case 6: // Print... - doPrint() + startPrint() default: // should not happen print("unknown menu" + String(tag)) @@ -188,7 +190,7 @@ class DocumentController: UIViewController, MenuDelegate, UIDocumentBrowserViewC // Load document into LibreOfficeKit and present it - internal func doOpenDocument() + internal func startOpenDocument() { //FIXME @@ -205,7 +207,7 @@ class DocumentController: UIViewController, MenuDelegate, UIDocumentBrowserViewC // Show document properties (new overloaded page) - internal func doProperties() + internal func showProperties() { //FIXME print("menu Properties to be done") @@ -250,7 +252,7 @@ class DocumentController: UIViewController, MenuDelegate, UIDocumentBrowserViewC // print current document - internal func doPrint() + internal func startPrint() { //FIXME print("menu Print... to be done") @@ -296,6 +298,18 @@ class DocumentController: UIViewController, MenuDelegate, UIDocumentBrowserViewC // open document and present it internal func documentBrowser(_ controller: UIDocumentBrowserViewController, didPickDocumentURLs documentURLs: [URL]) + { + doOpen(documentURLs[0]) + } + + + + // *** Handling of document (open/print) + + + + // Real open and presentation of document + public func doOpen(_ docURL : URL) { //FIXME //BridgeLOkit_open(documentURLs); -- cgit