diff options
Diffstat (limited to 'ios/experimental/LibreOffice/LibreOffice')
19 files changed, 0 insertions, 839 deletions
diff --git a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.h b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.h deleted file mode 100644 index ebc7f69d25c6..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.h +++ /dev/null @@ -1,23 +0,0 @@ -// -*- 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> - -#import "View.h" - -@interface AppDelegate : UIResponder <UIApplicationDelegate, UITextViewDelegate> - -@property (strong, nonatomic) UIWindow *window; -@property (strong, nonatomic) View *view; - -- (void)threadMainMethod: (id) argument; -- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text; - -@end - -// vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m b/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m deleted file mode 100644 index 198fb3437f13..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/AppDelegate.m +++ /dev/null @@ -1,267 +0,0 @@ -// -*- 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> - -#include <touch/touch.h> - -#import "AppDelegate.h" -#import "ViewController.h" - -#import "lo.h" - -static View *theView; -static BOOL keyboardShows; - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - (void) application; - (void) launchOptions; - - CGRect bounds = [[UIScreen mainScreen] bounds]; - - NSLog(@"mainScreen bounds: %dx%d@(%d,%d)", - (int) bounds.size.width, (int) bounds.size.height, - (int) bounds.origin.x, (int) bounds.origin.y); - - CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame]; - - NSLog(@"mainScreen applicationFrame: %dx%d@(%d,%d)", - (int) applicationFrame.size.width, (int) applicationFrame.size.height, - (int) applicationFrame.origin.x, (int) applicationFrame.origin.y); - - self.window = [[UIWindow alloc] initWithFrame:bounds]; - self.window.backgroundColor = [UIColor whiteColor]; - - ViewController *vc = [[ViewController alloc] init]; - self.window.rootViewController = vc; - - [self.window makeKeyAndVisible]; - - CGRect r = [self.window frame]; - - self.view = [[View alloc] initWithFrame: r]; - vc.view = self.view; - theView = self.view; - - self.view->textView = [[UITextView alloc] initWithFrame: r]; - self.view->textView.autocapitalizationType = UITextAutocapitalizationTypeNone; - self.view->textView.alpha = 0; - [self.view addSubview: self.view->textView]; - self.view->textView.delegate = self; - - UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self.view action:@selector(tapGesture:)]; - UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self.view action:@selector(panGesture:)]; - UILongPressGestureRecognizer * longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self.view action:@selector(longPressGesture:)]; - - [self.window addGestureRecognizer: tapRecognizer]; - [self.window addGestureRecognizer: panRecognizer]; - [self.window addGestureRecognizer: longPressRecognizer]; - - NSLog(@"statusBarOrientation: %ld", (long) [[UIApplication sharedApplication] statusBarOrientation]); - - if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) - touch_lo_set_view_size(r.size.height, r.size.width); - else - touch_lo_set_view_size(r.size.width, r.size.height); - - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardDidHideNotification object:nil]; - - NSThread* thread = [[NSThread alloc] initWithTarget:self - selector:@selector(threadMainMethod:) - object:nil]; - keyboardShows = NO; - - [thread start]; - - return YES; -} - -- (void)threadMainMethod:(id)argument -{ - (void) argument; - - @autoreleasepool { - lo_initialize(); - touch_lo_runMain(); - } -} - -- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text -{ - NSLog(@"textView: %@ shouldChangeTextInRange:[%lu,%lu] replacementText:%@", textView, (unsigned long) range.location, (unsigned long) range.length, text); - assert(textView == theView->textView); - - for (NSUInteger i = 0; i < [text length]; i++) - touch_lo_keyboard_input([text characterAtIndex: i]); - - return NO; -} - -- (void)applicationWillResignActive:(UIApplication *)application -{ - (void) application; -} - -- (void)applicationDidEnterBackground:(UIApplication *)application -{ - (void) application; -} - -- (void)applicationWillEnterForeground:(UIApplication *)application -{ - (void) application; -} - -- (void)applicationDidBecomeActive:(UIApplication *)application -{ - (void) application; -} - -- (void)applicationWillTerminate:(UIApplication *)application -{ - (void) application; -} - -- (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame -{ - (void) application; - (void) oldStatusBarFrame; - - CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame]; - NSLog(@"New applicationFrame: %dx%d@(%d,%d)", - (int) applicationFrame.size.width, (int) applicationFrame.size.height, - (int) applicationFrame.origin.x, (int) applicationFrame.origin.y); - NSLog(@"statusBarOrientation: %ld", (long) [[UIApplication sharedApplication] statusBarOrientation]); - - if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) - touch_lo_set_view_size(applicationFrame.size.height, applicationFrame.size.width); - else - touch_lo_set_view_size(applicationFrame.size.width, applicationFrame.size.height); -} - -- (void)keyboardWillShow:(NSNotification *)note -{ - NSDictionary *info = [note userInfo]; - CGRect frameBegin; - CGRect frameEnd; - - [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] getValue:&frameBegin]; - [[info objectForKey:UIKeyboardFrameEndUserInfoKey] getValue:&frameEnd]; - - NSLog(@"keyboardWillShow: frame:%dx%d@(%d,%d)", - (int) frameEnd.size.width, (int) frameEnd.size.height, - (int) frameEnd.origin.x, (int) frameEnd.origin.y); - - keyboardShows = YES; -} - -- (void)keyboardDidHide:(NSNotification *)note -{ - (void) note; - - NSLog(@"keyboardDidHide"); - - keyboardShows = NO; - - touch_lo_keyboard_did_hide(); -} - -@end - -// Functions called in the LO thread, which thus need to dispatch any -// CocoaTouch activity to happen on the GUI thread. Use -// dispatch_async() consistently. - -void touch_ui_damaged(int minX, int minY, int width, int height) -{ - CGRect rect = CGRectMake(minX, minY, width, height); - dispatch_async(dispatch_get_main_queue(), ^{ - [theView setNeedsDisplayInRect:rect]; - }); - // NSLog(@"lo_damaged: %dx%d@(%d,%d)", width, height, minX, minY); -} - -void touch_ui_show_keyboard() -{ -#if 0 - // Horrible hack - static bool beenHere = false; - if (!beenHere) { - beenHere = true; - touch_lo_keyboard_did_hide(); - return; - } -#endif - dispatch_async(dispatch_get_main_queue(), ^{ - [theView->textView becomeFirstResponder]; - }); -} - -void touch_ui_hide_keyboard() -{ - dispatch_async(dispatch_get_main_queue(), ^{ - [theView->textView resignFirstResponder]; - }); -} - -bool touch_ui_keyboard_visible() -{ - return keyboardShows; -} - -static const char * -dialog_kind_to_string(MLODialogKind kind) -{ - switch (kind) { - case MLODialogMessage: - return "MSG"; - case MLODialogInformation: - return "INF"; - case MLODialogWarning: - return "WRN"; - case MLODialogError: - return "ERR"; - case MLODialogQuery: - return "QRY"; - default: - return "WTF"; - } -} - -MLODialogResult touch_ui_dialog_modal(MLODialogKind kind, const char *message) -{ - NSLog(@"===> %s: %s", dialog_kind_to_string(kind), message); - return MLODialogOK; -} - -void touch_ui_selection_start(MLOSelectionKind kind, - const void *documentHandle, - MLORect *rectangles, - int rectangleCount, - void *preview) -{ - (void) preview; - - // Note that this is called on the LO thread - dispatch_async(dispatch_get_main_queue(), ^{ - [theView startSelectionOfType:kind withNumber:rectangleCount ofRectangles:rectangles forDocument:documentHandle]; - }); -} - -void touch_ui_selection_none() -{ - dispatch_async(dispatch_get_main_queue(), ^{ - [theView startSelectionOfType:MLOSelectionNone withNumber:0 ofRectangles:NULL forDocument:NULL]; - }); -} - -// vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/ios/experimental/LibreOffice/LibreOffice/Default-568h@2x.png b/ios/experimental/LibreOffice/LibreOffice/Default-568h@2x.png Binary files differdeleted file mode 100644 index 0891b7aabfcf..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/Default-568h@2x.png +++ /dev/null diff --git a/ios/experimental/LibreOffice/LibreOffice/Default.png b/ios/experimental/LibreOffice/LibreOffice/Default.png Binary files differdeleted file mode 100644 index 4c8ca6f693f9..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/Default.png +++ /dev/null diff --git a/ios/experimental/LibreOffice/LibreOffice/Default@2x.png b/ios/experimental/LibreOffice/LibreOffice/Default@2x.png Binary files differdeleted file mode 100644 index 35b84cffeb4d..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/Default@2x.png +++ /dev/null diff --git a/ios/experimental/LibreOffice/LibreOffice/Icon-72.png b/ios/experimental/LibreOffice/LibreOffice/Icon-72.png Binary files differdeleted file mode 100644 index 8a355c2be915..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/Icon-72.png +++ /dev/null diff --git a/ios/experimental/LibreOffice/LibreOffice/Icon.png b/ios/experimental/LibreOffice/LibreOffice/Icon.png Binary files differdeleted file mode 100644 index 04254bf73bc4..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/Icon.png +++ /dev/null diff --git a/ios/experimental/LibreOffice/LibreOffice/Icon@2x.png b/ios/experimental/LibreOffice/LibreOffice/Icon@2x.png Binary files differdeleted file mode 100644 index 6d90d1fa8199..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/Icon@2x.png +++ /dev/null diff --git a/ios/experimental/LibreOffice/LibreOffice/LibreOffice-Info.plist b/ios/experimental/LibreOffice/LibreOffice/LibreOffice-Info.plist deleted file mode 100644 index 7ac2f9de6aa7..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/LibreOffice-Info.plist +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>en</string> - <key>CFBundleDisplayName</key> - <string>${PRODUCT_NAME}</string> - <key>CFBundleExecutable</key> - <string>${EXECUTABLE_NAME}</string> - <key>CFBundleIdentifier</key> - <string>org.libreoffice.${PRODUCT_NAME:rfc1034identifier}</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundleName</key> - <string>${PRODUCT_NAME}</string> - <key>CFBundlePackageType</key> - <string>APPL</string> - <key>CFBundleShortVersionString</key> - <string>1.0</string> - <key>CFBundleSignature</key> - <string>????</string> - <key>CFBundleVersion</key> - <string>1.0</string> - <key>LSRequiresIPhoneOS</key> - <true/> - <key>UIRequiredDeviceCapabilities</key> - <array> - <string>armv7</string> - </array> - <key>CFBundleIconFile</key> - <string></string> - <key>UISupportedInterfaceOrientations~ipad</key> - <array> - <string>UIInterfaceOrientationPortrait</string> - <string>UIInterfaceOrientationPortraitUpsideDown</string> - <string>UIInterfaceOrientationLandscapeLeft</string> - <string>UIInterfaceOrientationLandscapeRight</string> - </array> - <key>CFBundleIconFiles</key> - <array> - <string>Icon.png</string> - <string>Icon-72.png</string> - <string>Icon@2x.png</string> - </array> -</dict> -</plist> diff --git a/ios/experimental/LibreOffice/LibreOffice/LibreOffice-Prefix.pch b/ios/experimental/LibreOffice/LibreOffice/LibreOffice-Prefix.pch deleted file mode 100644 index e5d717365c26..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/LibreOffice-Prefix.pch +++ /dev/null @@ -1,14 +0,0 @@ -// -// Prefix header for all source files of the 'LibreOffice' target in the 'LibreOffice' project -// - -#import <Availability.h> - -#ifndef __IPHONE_3_0 -#warning "This project uses features only available in iOS SDK 3.0 and later." -#endif - -#ifdef __OBJC__ - #import <UIKit/UIKit.h> - #import <Foundation/Foundation.h> -#endif diff --git a/ios/experimental/LibreOffice/LibreOffice/View.h b/ios/experimental/LibreOffice/LibreOffice/View.h deleted file mode 100644 index aecc606425be..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/View.h +++ /dev/null @@ -1,27 +0,0 @@ -// -*- 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> - -#import <touch/touch.h> - -@interface View : UIView -{ -@public - UITextView* textView; -} -- (void)drawRect:(CGRect)rect; -- (void)tapGesture:(UITapGestureRecognizer *)gestureRecognizer; -- (void)panGesture:(UIPanGestureRecognizer *)gestureRecognizer; -- (void)longPressGesture:(UILongPressGestureRecognizer *)gestureRecognizer; -- (void)startSelectionOfType:(MLOSelectionKind)kind withNumber:(int)number ofRectangles:(CGRect *)rects forDocument:(const void *)document; - -@end - -// vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/ios/experimental/LibreOffice/LibreOffice/View.m b/ios/experimental/LibreOffice/LibreOffice/View.m deleted file mode 100644 index 48ec11a48a28..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/View.m +++ /dev/null @@ -1,299 +0,0 @@ -// -*- 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 "View.h" - -#include <touch/touch.h> - -@interface View () -@property const void *documentHandle; -@property CGRect *selectionRectangles; -@property int selectionRectangleCount; -@end - -#define HANDLE_BLOB 20 -#define DRAG_RADIUS (HANDLE_BLOB + 20) -#define HANDLE_STEM_WIDTH 4 -#define HANDLE_STEM_HEIGHT 10 - -#define SQUARE(n) ((n)*(n)) - -@implementation View - -- (CGRect) topLeftResizeHandle -{ - if (self.selectionRectangleCount == 0) - return CGRectNull; - - return CGRectMake(self.selectionRectangles[0].origin.x - HANDLE_STEM_WIDTH/2 - HANDLE_BLOB/2, - self.selectionRectangles[0].origin.y - HANDLE_STEM_HEIGHT - HANDLE_BLOB, - HANDLE_BLOB, HANDLE_BLOB); -} - -- (CGRect) bottomRightResizeHandle -{ - const int N = self.selectionRectangleCount; - - if (N == 0) - return CGRectNull; - - return CGRectMake(self.selectionRectangles[N-1].origin.x + - self.selectionRectangles[N-1].size.width + HANDLE_STEM_WIDTH/2 - HANDLE_BLOB/2, - self.selectionRectangles[N-1].origin.y + - self.selectionRectangles[N-1].size.height + HANDLE_STEM_HEIGHT, - HANDLE_BLOB, HANDLE_BLOB); -} - -- (bool) topLeftResizeHandleIsCloseTo:(CGPoint)position -{ - if (self.selectionRectangleCount == 0) - return false; - - return ((SQUARE((self.selectionRectangles[0].origin.x - HANDLE_STEM_WIDTH/2) - position.x) + - SQUARE((self.selectionRectangles[0].origin.y - HANDLE_STEM_HEIGHT/2 - HANDLE_BLOB/2) - position.y)) < - SQUARE(DRAG_RADIUS)); -} - -- (bool) bottomRightResizeHandleIsCloseTo:(CGPoint)position -{ - const int N = self.selectionRectangleCount; - - if (N == 0) - return false; - - return ((SQUARE((self.selectionRectangles[N-1].origin.x + - self.selectionRectangles[N-1].size.width + HANDLE_STEM_WIDTH/2) - position.x) + - SQUARE((self.selectionRectangles[N-1].origin.y + - self.selectionRectangles[N-1].size.height + HANDLE_STEM_HEIGHT/2 + HANDLE_BLOB/2) - position.y)) < - SQUARE(DRAG_RADIUS)); -} - -- (void) requestSelectionRedisplay -{ - if (self.selectionRectangleCount == 0) - return; - - CGRect r = CGRectNull; - for (int i = 0; i < self.selectionRectangleCount; i++) { - r = CGRectUnion(r, self.selectionRectangles[i]); - } - r = CGRectUnion(r, [self topLeftResizeHandle]); - r = CGRectUnion(r, [self bottomRightResizeHandle]); - - [self setNeedsDisplayInRect:r]; -} - -- (void) drawSelectionIntoContext:(CGContextRef)context -{ - if (self.selectionRectangleCount == 0) - return; - - const int N = self.selectionRectangleCount; - - CGContextSetFillColorWithColor(context, [[UIColor colorWithRed:0 green:0 blue:1 alpha:0.5] CGColor]); - - CGContextSetBlendMode(context, kCGBlendModeNormal); - CGContextFillRects(context, self.selectionRectangles, self.selectionRectangleCount); - - CGContextFillRect(context, - CGRectMake(self.selectionRectangles[0].origin.x - HANDLE_STEM_WIDTH, - self.selectionRectangles[0].origin.y - HANDLE_STEM_HEIGHT, - HANDLE_STEM_WIDTH, self.selectionRectangles[0].size.height + HANDLE_STEM_HEIGHT)); - - CGContextFillRect(context, - CGRectMake(self.selectionRectangles[N-1].origin.x + - self.selectionRectangles[N-1].size.width, - self.selectionRectangles[N-1].origin.y, - HANDLE_STEM_WIDTH, self.selectionRectangles[N-1].size.height + HANDLE_STEM_HEIGHT)); - - CGContextSetFillColorWithColor(context, [[UIColor colorWithRed:0 green:0 blue:1 alpha:0.8] CGColor]); - - CGContextFillEllipseInRect(context, [self topLeftResizeHandle]); - CGContextFillEllipseInRect(context, [self bottomRightResizeHandle]); -} - -- (void)drawRect:(CGRect)rect -{ - // NSLog(@"View drawRect: %dx%d@(%d,%d)", (int) rect.size.width, (int) rect.size.height, (int) rect.origin.x, (int) rect.origin.y); - // NSLog(@" self.frame : %dx%d@(%d,%d)", (int) self.frame.size.width, (int) self.frame.size.height, (int) self.frame.origin.x, (int) self.frame.origin.y); - // NSLog(@"statusBarOrientation: %ld", (long)[[UIApplication sharedApplication] statusBarOrientation]); - - CGContextRef context = UIGraphicsGetCurrentContext(); - CGContextSaveGState(context); - - switch ([[UIApplication sharedApplication] statusBarOrientation]) { - case UIInterfaceOrientationPortrait: - CGContextTranslateCTM(context, 0, self.frame.size.height); - CGContextScaleCTM(context, 1, -1); - break; - case UIInterfaceOrientationLandscapeLeft: - CGContextTranslateCTM(context, 0, self.frame.size.width); - CGContextScaleCTM(context, 1, -1); - break; - case UIInterfaceOrientationLandscapeRight: - CGContextTranslateCTM(context, 0, self.frame.size.width); - CGContextScaleCTM(context, 1, -1); - break; - case UIInterfaceOrientationPortraitUpsideDown: - CGContextTranslateCTM(context, 0, self.frame.size.height); - CGContextScaleCTM(context, 1, -1); - break; - } - touch_lo_render_windows(context, rect.origin.y, rect.origin.y, rect.size.width, rect.size.height); - - CGContextRestoreGState(context); - - [self drawSelectionIntoContext:context]; -} - -#if 0 -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - NSLog(@"===> View touchesBegan!"); -} -#endif - -- (void)tapGesture:(UITapGestureRecognizer *)gestureRecognizer -{ - if ([gestureRecognizer state] == UIGestureRecognizerStateEnded) { - CGPoint location = [gestureRecognizer locationInView:self]; - - // NSLog(@"tapGesture: at: (%d,%d)", (int)location.x, (int)location.y); - - touch_lo_tap(location.x, location.y); - } else { - // NSLog(@"tapGesture: %@", gestureRecognizer); - } -} - -- (void)panGesture:(UIPanGestureRecognizer *)gestureRecognizer -{ - const int N = self.selectionRectangleCount; - - static enum { NONE, TOPLEFT, BOTTOMRIGHT } draggedHandle = NONE; - static CGPoint previous; - static CGPoint dragOffset; - - CGPoint location = [gestureRecognizer locationInView:self]; - CGPoint translation = [gestureRecognizer translationInView:self]; - - if (gestureRecognizer.state == UIGestureRecognizerStateBegan) { - previous = CGPointMake(0, 0); - } - - CGPoint delta = CGPointMake(translation.x - previous.x, translation.y - previous.y); - - // NSLog(@"location: (%f,%f) , drag: (%f,%f)", location.x, location.y, delta.x, delta.y); - - previous = translation; - - if (gestureRecognizer.state == UIGestureRecognizerStateBegan && - gestureRecognizer.numberOfTouches == 1) { - if ([self topLeftResizeHandleIsCloseTo:location]) { - draggedHandle = TOPLEFT; - dragOffset = CGPointMake(location.x - self.selectionRectangles[0].origin.x, - location.y - (self.selectionRectangles[0].origin.y + - self.selectionRectangles[0].size.height/2)); - } else if ([self bottomRightResizeHandleIsCloseTo:location]) { - draggedHandle = BOTTOMRIGHT; - dragOffset = CGPointMake(location.x - (self.selectionRectangles[N-1].origin.x + - self.selectionRectangles[N-1].size.width), - location.y - (self.selectionRectangles[N-1].origin.y + - self.selectionRectangles[N-1].size.height/2)); - } - } - - if (draggedHandle == TOPLEFT) { - - touch_lo_selection_start_move(self.documentHandle, - location.x - dragOffset.x, location.y - dragOffset.y); - - if (gestureRecognizer.state == UIGestureRecognizerStateEnded) - draggedHandle = NONE; - - return; - } else if (draggedHandle == BOTTOMRIGHT) { - - touch_lo_selection_end_move(self.documentHandle, - location.x - dragOffset.x, location.y - dragOffset.y); - - if (gestureRecognizer.state == UIGestureRecognizerStateEnded) - draggedHandle = NONE; - - return; - } - - if (gestureRecognizer.state != UIGestureRecognizerStateBegan) { - touch_lo_pan(delta.x, delta.y); - } -} - -- (void)pinchGesture:(UIPinchGestureRecognizer *)gestureRecognizer -{ - CGPoint location = [gestureRecognizer locationInView:self]; - CGFloat scale = gestureRecognizer.scale; - - // NSLog(@"pinchGesture: pinch: (%f) cords (%d,%d)", (float)scale, (int)location.x, (int)location.y ); - - touch_lo_zoom((int)location.x, (int)location.y, (float)scale); - - // to reset the gesture scaling - if (gestureRecognizer.state == UIGestureRecognizerStateEnded) { - touch_lo_zoom(1, 1, 0.0f); - } -} - -- (void)longPressGesture:(UILongPressGestureRecognizer *)gestureRecognizer -{ - CGPoint point = [gestureRecognizer locationInView:self]; - - if (gestureRecognizer.state == UIGestureRecognizerStateEnded) { - touch_lo_tap(point.x, point.y); - touch_lo_tap(point.x, point.y); - } -} - -static int compare_rects(const void *a, const void *b) -{ - const CGRect *ra = a; - const CGRect *rb = b; - - if (ra->origin.y != rb->origin.y) - return ra->origin.y - rb->origin.y; - else - return ra->origin.x - rb->origin.x; -} - -- (void)startSelectionOfType:(MLOSelectionKind)kind withNumber:(int)number ofRectangles:(CGRect *)rects forDocument:(const void *)document -{ - (void) kind; - - // First request the old selection area to be redisplayed - [self requestSelectionRedisplay]; - - free(self.selectionRectangles); - self.selectionRectangles = NULL; - self.selectionRectangleCount = 0; - self.documentHandle = NULL; - - if (number == 0) - return; - - self.selectionRectangles = rects; - self.selectionRectangleCount = number; - self.documentHandle = document; - - // The selection rectangle provided by LO are not sorted in any sane way - qsort(self.selectionRectangles, self.selectionRectangleCount, sizeof(self.selectionRectangles[0]), compare_rects); - - [self requestSelectionRedisplay]; -} - -@end - -// vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/ios/experimental/LibreOffice/LibreOffice/ViewController.h b/ios/experimental/LibreOffice/LibreOffice/ViewController.h deleted file mode 100644 index 42695122e126..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/ViewController.h +++ /dev/null @@ -1,16 +0,0 @@ -// -*- 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 ViewController : UIViewController - -@end - -// vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/ios/experimental/LibreOffice/LibreOffice/ViewController.m b/ios/experimental/LibreOffice/LibreOffice/ViewController.m deleted file mode 100644 index a79c6007c6b9..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/ViewController.m +++ /dev/null @@ -1,37 +0,0 @@ -// -*- 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 "ViewController.h" - -#include <touch/touch.h> - -#import "lo.h" - -@implementation ViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - CGRect rect = [self.view bounds]; - NSLog(@"viewDidLoad: bounds=%dx%d@(%d,%d)", (int)rect.size.width, (int)rect.size.height, (int)rect.origin.x, (int)rect.origin.y); - rect = [self.view frame]; - NSLog(@" frame=%dx%d@(%d,%d)", (int)rect.size.width, (int)rect.size.height, (int)rect.origin.x, (int)rect.origin.y); -} - -- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation -{ - (void) fromInterfaceOrientation; - - NSLog(@"didRotateFromInterfaceOrientation: statusBarOrientation: %ld interfaceOrientation: %ld", (long) [[UIApplication sharedApplication] statusBarOrientation], (long) [self interfaceOrientation]); -} - -@end - -// vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/ios/experimental/LibreOffice/LibreOffice/en.lproj/InfoPlist.strings b/ios/experimental/LibreOffice/LibreOffice/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff8f86..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/ios/experimental/LibreOffice/LibreOffice/iTunesArtwork b/ios/experimental/LibreOffice/LibreOffice/iTunesArtwork Binary files differdeleted file mode 100644 index ef1890b0778c..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/iTunesArtwork +++ /dev/null diff --git a/ios/experimental/LibreOffice/LibreOffice/lo.h b/ios/experimental/LibreOffice/LibreOffice/lo.h deleted file mode 100644 index 77054b039dc0..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/lo.h +++ /dev/null @@ -1,20 +0,0 @@ -// -*- Mode: C++; 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/. - -#ifdef __cplusplus -extern "C" { -#endif - -void lo_initialize(void); - -#ifdef __cplusplus -} -#endif - -// vim:set shiftwidth=4 softtabstop=4 expandtab: - diff --git a/ios/experimental/LibreOffice/LibreOffice/lo.mm b/ios/experimental/LibreOffice/LibreOffice/lo.mm deleted file mode 100644 index ca01ce0f06e6..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/lo.mm +++ /dev/null @@ -1,67 +0,0 @@ -// -*- 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/. - -#include <stdlib.h> - -#include <premac.h> -#import <UIKit/UIKit.h> -#include <postmac.h> - -#include <osl/process.h> -#include <touch/touch.h> - -extern "C" -void -lo_initialize(void) -{ - const char *argv[] = { - "placeholder-exe", - "-env:URE_INTERNAL_LIB_DIR=file:///", - "placeholder-uno-types", - "placeholder-uno-services", - "placeholder-document" - }; - - const int argc = sizeof(argv)/sizeof(*argv); - - argv[0] = [[[NSBundle mainBundle] executablePath] 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: @"offapi.rdb"]]; - - uno_types = [uno_types stringByAppendingString: @" file://"]; - uno_types = [uno_types stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"oovbaapi.rdb"]]; - - uno_types = [uno_types stringByAppendingString: @" file://"]; - uno_types = [uno_types stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"types.rdb"]]; - - assert(strcmp(argv[2], "placeholder-uno-types") == 0); - argv[2] = [uno_types UTF8String]; - - NSString *uno_services = @"-env:UNO_SERVICES="; - - uno_services = [uno_services stringByAppendingString: @"file://"]; - uno_services = [uno_services stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"ure/services.rdb"]]; - - uno_services = [uno_services stringByAppendingString: @" file://"]; - uno_services = [uno_services stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"services.rdb"]]; - - assert(strcmp(argv[3], "placeholder-uno-services") == 0); - argv[3] = [uno_services UTF8String]; - - assert(strcmp(argv[4], "placeholder-document") == 0); - NSString *file = @"file://"; - file = [file stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"test1.odt"]]; - argv[4] = [file UTF8String]; - - osl_setCommandArgs(argc, (char **) argv); -} diff --git a/ios/experimental/LibreOffice/LibreOffice/main.m b/ios/experimental/LibreOffice/LibreOffice/main.m deleted file mode 100644 index 55f0a708e905..000000000000 --- a/ios/experimental/LibreOffice/LibreOffice/main.m +++ /dev/null @@ -1,20 +0,0 @@ -// -*- 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> - -#import "AppDelegate.h" - -int main(int argc, char *argv[]) -{ - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} - -// vim:set shiftwidth=4 softtabstop=4 expandtab: |