summaryrefslogtreecommitdiff
path: root/ios/experimental
diff options
context:
space:
mode:
Diffstat (limited to 'ios/experimental')
-rw-r--r--ios/experimental/Viewer/Viewer/LOViewerAppDelegate.h19
-rw-r--r--ios/experimental/Viewer/Viewer/LOViewerAppDelegate.mm31
-rw-r--r--ios/experimental/Viewer/Viewer/LOViewerWindow.h17
-rw-r--r--ios/experimental/Viewer/Viewer/LOViewerWindow.m26
-rw-r--r--ios/experimental/Viewer/Viewer/lo-viewer.h1
-rw-r--r--ios/experimental/Viewer/Viewer/lo-viewer.mm69
-rw-r--r--ios/experimental/Viewer/Viewer/main.mm1
7 files changed, 95 insertions, 69 deletions
diff --git a/ios/experimental/Viewer/Viewer/LOViewerAppDelegate.h b/ios/experimental/Viewer/Viewer/LOViewerAppDelegate.h
index 7f4b724b94f8..c1737a01e342 100644
--- a/ios/experimental/Viewer/Viewer/LOViewerAppDelegate.h
+++ b/ios/experimental/Viewer/Viewer/LOViewerAppDelegate.h
@@ -1,16 +1,23 @@
+// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
-// LOViewerAppDelegate.h
-// Viewer
-//
-// Created by Tor Lillqvist on 2012-11-27.
-// Copyright (c) 2012 Tor Lillqvist. All rights reserved.
+// 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 <UIKit/UIKit.h>
+#import "LOViewerWindow.h"
+
@interface LOViewerAppDelegate : UIResponder <UIApplicationDelegate>
+{
+ int nbytes;
+ char *pixelBuffer;
+ CGImageRef image;
+}
-@property (strong, nonatomic) UIWindow *window;
+@property (strong, nonatomic) LOViewerWindow *window;
- (void) threadMainMethod: (id) argument;
diff --git a/ios/experimental/Viewer/Viewer/LOViewerAppDelegate.mm b/ios/experimental/Viewer/Viewer/LOViewerAppDelegate.mm
index cc1e8d2f3c17..f9678c4f7393 100644
--- a/ios/experimental/Viewer/Viewer/LOViewerAppDelegate.mm
+++ b/ios/experimental/Viewer/Viewer/LOViewerAppDelegate.mm
@@ -5,16 +5,20 @@
// 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 <stdlib.h>
#import <UIKit/UIKit.h>
+#include <osl/detail/ios-bootstrap.h>
+
#import "LOViewerAppDelegate.h"
+#import "LOViewerWindow.h"
#include "lo-viewer.h"
+static UIWindow *theWindow;
+
@implementation LOViewerAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
@@ -22,10 +26,25 @@
(void) application;
(void) launchOptions;
- self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ CGRect bounds = [[UIScreen mainScreen] bounds];
+ self.window = [[LOViewerWindow alloc] initWithFrame:bounds];
+
+ theWindow = self.window;
self.window.backgroundColor = [UIColor whiteColor];
+ nbytes = bounds.size.width * bounds.size.height * 4;
+
+ pixelBuffer = (char *) malloc(nbytes);
+ memset(pixelBuffer, 0xFF, nbytes);
+
+ CGDataProviderRef provider = CGDataProviderCreateWithData( NULL, pixelBuffer, nbytes, NULL);
+ image = CGImageCreate(bounds.size.width, bounds.size.height, 8, 32, bounds.size.width*4, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaFirst, provider, NULL, false, kCGRenderingIntentDefault);
+
+ self.window.bounds = bounds;
+ self.window.pixelBuffer = pixelBuffer;
+ self.window.image = image;
+
[self.window makeKeyAndVisible];
NSThread* thread = [[NSThread alloc] initWithTarget:self
@@ -41,9 +60,8 @@
(void) argument;
@autoreleasepool {
-
lo_initialize();
-
+ lo_runMain();
}
}
@@ -86,4 +104,9 @@
@end
+extern "C" void lo_damaged()
+{
+ [theWindow performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:YES];
+}
+
// vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/ios/experimental/Viewer/Viewer/LOViewerWindow.h b/ios/experimental/Viewer/Viewer/LOViewerWindow.h
new file mode 100644
index 000000000000..b8f509f98471
--- /dev/null
+++ b/ios/experimental/Viewer/Viewer/LOViewerWindow.h
@@ -0,0 +1,17 @@
+// -*- 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 <UIKit/UIKit.h>
+
+@interface LOViewerWindow : UIWindow
+@property CGRect bounds;
+@property char *pixelBuffer;
+@property CGImageRef image;
+- (void)drawRect:(CGRect)rect;
+@end
diff --git a/ios/experimental/Viewer/Viewer/LOViewerWindow.m b/ios/experimental/Viewer/Viewer/LOViewerWindow.m
new file mode 100644
index 000000000000..1ce91033f384
--- /dev/null
+++ b/ios/experimental/Viewer/Viewer/LOViewerWindow.m
@@ -0,0 +1,26 @@
+// -*- 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 "LOViewerWindow.h"
+
+#include <osl/detail/ios-bootstrap.h>
+
+@implementation LOViewerWindow
+
+- (void)drawRect:(CGRect)rect
+{
+ (void) rect;
+
+ lo_render_windows([self pixelBuffer], [self bounds].size.width, [self bounds].size.height);
+
+ CGContextRef context = UIGraphicsGetCurrentContext();
+
+ CGContextDrawImage(context, [self bounds], [self image]);
+}
+
+@end
diff --git a/ios/experimental/Viewer/Viewer/lo-viewer.h b/ios/experimental/Viewer/Viewer/lo-viewer.h
index 1ce2031811a7..9d08e3a8b851 100644
--- a/ios/experimental/Viewer/Viewer/lo-viewer.h
+++ b/ios/experimental/Viewer/Viewer/lo-viewer.h
@@ -5,7 +5,6 @@
// 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 LO_VIEWER_H
#define LO_VIEWER_H
diff --git a/ios/experimental/Viewer/Viewer/lo-viewer.mm b/ios/experimental/Viewer/Viewer/lo-viewer.mm
index ff543fc9df6e..97669f14584e 100644
--- a/ios/experimental/Viewer/Viewer/lo-viewer.mm
+++ b/ios/experimental/Viewer/Viewer/lo-viewer.mm
@@ -5,7 +5,6 @@
// 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 <stdlib.h>
@@ -72,6 +71,7 @@ extern "C" {
extern void * textfd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * unoxml_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * unordf_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
+ extern void * uui_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * xmlfd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * xmlsecurity_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * xo_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
@@ -108,6 +108,7 @@ lo_get_libmap(void)
{ "libsdlo.a", sd_component_getFactory },
{ "libsmdlo.a", smd_component_getFactory },
{ "libsmlo.a", sm_component_getFactory },
+ { "libspelllo.a", spell_component_getFactory },
{ "libsvgfilterlo.a", svgfilter_component_getFactory },
{ "libswdlo.a", swd_component_getFactory },
{ "libswlo.a", sw_component_getFactory },
@@ -115,6 +116,7 @@ lo_get_libmap(void)
{ "libtextfdlo.a", textfd_component_getFactory },
{ "libunordflo.a", unordf_component_getFactory },
{ "libunoxmllo.a", unoxml_component_getFactory },
+ { "libuuilo.a", uui_component_getFactory },
{ "libxmlfdlo.a", xmlfd_component_getFactory },
{ "libxmlsecurity.a", xmlsecurity_component_getFactory },
{ "libxoflo.a", xof_component_getFactory },
@@ -134,7 +136,8 @@ lo_initialize(void)
"placeholder-exe",
"-env:URE_INTERNAL_LIB_DIR=file:///",
"placeholder-uno-types",
- "placeholder-uno-services"
+ "placeholder-uno-services",
+ "placeholder-document"
};
const int argc = sizeof(argv)/sizeof(*argv);
@@ -154,8 +157,8 @@ lo_initialize(void)
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];
+ assert(strcmp(argv[2], "placeholder-uno-types") == 0);
+ argv[2] = [uno_types UTF8String];
NSString *uno_services = @"-env:UNO_SERVICES=";
@@ -165,59 +168,11 @@ lo_initialize(void)
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];
-
- osl_setCommandArgs(argc, (char **) argv);
-
- try {
-
- // Should start a background thread to do all this UNO
- // initialisation crap
-
- 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 );
+ assert(strcmp(argv[3], "placeholder-uno-services") == 0);
+ argv[3] = [uno_services UTF8String];
- InitVCL();
+ assert(strcmp(argv[4], "placeholder-document") == 0);
+ argv[4] = [[app_root_escaped stringByAppendingPathComponent: @"test1.odt"] UTF8String];
- // Yes, this code does of course not belong here. Once this
- // turns into something that actually displays something and
- // has a proper app lifecycle etc that willl be fixed. But for
- // now this is just a test, not supposed to work in any sane
- // way from a "user" POV, and it doesn't matter that we do
- // this here.
-
- uno::Reference< uno::XInterface > xDesktop =
- xFactory->createInstanceWithContext( "com.sun.star.frame.Desktop", xContext );
- uno::Reference< frame::XComponentLoader > xComponentLoader( xDesktop, uno::UNO_QUERY_THROW );
-
- uno::Reference< uno::XInterface > xToolkitService =
- xFactory->createInstanceWithContext( "com.sun.star.awt.Toolkit", xContext );
-
- uno::Reference< awt::XToolkitExperimental > xToolkit( xToolkitService, uno::UNO_QUERY_THROW );
-
- char *smallbb = new char[ SMALLSIZE*SMALLSIZE*4 ];
-
- uno::Reference< awt::XDevice > xDummyDevice = xToolkit->createScreenCompatibleDeviceUsingBuffer( SMALLSIZE, SMALLSIZE, 1, 1, 0, 0, (sal_Int64) (intptr_t) smallbb);
-
- uno::Sequence< beans::PropertyValue > loadProps(3);
-
- loadProps[0].Name = "Hidden";
- loadProps[0].Value <<= sal_True;
- loadProps[1].Name = "ReadOnly";
- loadProps[1].Value <<= sal_True;
- loadProps[2].Name = "Preview";
- loadProps[2].Value <<= sal_True;
-
- OUString test1_odt( OUString( "file://" ) + OUString::createFromAscii( [[app_root_escaped stringByAppendingPathComponent: @"test1.odt"] UTF8String] ));
- uno::Reference< lang::XComponent > xDoc = xComponentLoader->loadComponentFromURL ( test1_odt, "_blank", 0, loadProps );
- }
- catch ( uno::Exception e ) {
- SAL_WARN("Viewer", e.Message);
- }
+ osl_setCommandArgs(argc, (char **) argv);
}
diff --git a/ios/experimental/Viewer/Viewer/main.mm b/ios/experimental/Viewer/Viewer/main.mm
index 247c2dc6afca..401cda5a4c52 100644
--- a/ios/experimental/Viewer/Viewer/main.mm
+++ b/ios/experimental/Viewer/Viewer/main.mm
@@ -5,7 +5,6 @@
// 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 <UIKit/UIKit.h>