Kaydet (Commit) 2aa5c169 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Bin bit-rotted obsolete LibreOffice app

It's TiledLibreOffice that is the maintained and working iOS test app.

Change-Id: Id103ff90551fa753e9e5998b7c45f362497db6e2
üst 8fa8bb64
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
$(eval $(call gb_Executable_Executable,LibreOffice))
$(eval $(call gb_Executable_use_api,LibreOffice,\
udkapi \
offapi \
))
$(eval $(call gb_Executable_use_externals,LibreOffice,\
boost_headers \
iconv \
zlib \
))
$(eval $(call gb_Executable_use_system_darwin_frameworks,LibreOffice,\
Foundation \
CoreFoundation \
CoreGraphics \
CoreText \
UIKit \
))
$(eval $(call gb_Executable_add_generated_cxxobjects,LibreOffice,\
CustomTarget/ios/LibreOffice/native-code \
))
$(call gb_CustomTarget_get_workdir,ios/LibreOffice)/native-code.cxx :
mkdir -p `dirname $@`
$(SRCDIR)/solenv/bin/native-code.py \
-g core -g writer \
> $@
$(eval $(call gb_Executable_add_objcxxobjects,LibreOffice,\
ios/experimental/LibreOffice/LibreOffice/lo \
))
$(eval $(call gb_Executable_add_objcobjects,LibreOffice,\
ios/experimental/LibreOffice/LibreOffice/AppDelegate \
ios/experimental/LibreOffice/LibreOffice/main \
ios/experimental/LibreOffice/LibreOffice/View \
ios/experimental/LibreOffice/LibreOffice/ViewController \
))
# Mark the executable as depending on all libraries so that it gets
# rebuilt if any library has been rebuilt. Avoids need for "make
# ios.clean".
$(WORKDIR)/LinkTarget/Executable/LibreOffice : $(shell $(SRCDIR)/bin/lo-all-static-libs)
# vim: set ts=4 sw=4 et:
// -*- 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:
// -*- 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:
<?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>
//
// 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
// -*- 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:
// -*- 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:
// -*- 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:
// -*- 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:
// -*- 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);
}
// -*- 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:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment