added save to ios app and removed keyboard on open
Change-Id: Ibfa9373cc82d7e2022190e158f94eb323a57f241 Reviewed-on: https://gerrit.libreoffice.org/6351 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
This commit is contained in:
committed by
Tor Lillqvist
parent
07d7be1ac8
commit
1034a2eb97
@@ -23,6 +23,7 @@ extern "C" {
|
|||||||
void mlo_get_selection(NSMutableString * mutableString);
|
void mlo_get_selection(NSMutableString * mutableString);
|
||||||
void mlo_fetch_view_data(NSMutableString * mutableString);
|
void mlo_fetch_view_data(NSMutableString * mutableString);
|
||||||
void mlo_select_all(void);
|
void mlo_select_all(void);
|
||||||
|
void mlo_save(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "com/sun/star/frame/XDispatchHelper.hpp"
|
#include "com/sun/star/frame/XDispatchHelper.hpp"
|
||||||
#include <com/sun/star/frame/DispatchHelper.hpp>
|
#include <com/sun/star/frame/DispatchHelper.hpp>
|
||||||
#include "com/sun/star/frame/XComponentLoader.hpp"
|
#include "com/sun/star/frame/XComponentLoader.hpp"
|
||||||
|
#include "com/sun/star/frame/XStorable.hpp"
|
||||||
#include "com/sun/star/awt/XScrollBar.hpp"
|
#include "com/sun/star/awt/XScrollBar.hpp"
|
||||||
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
|
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
|
||||||
#include <com/sun/star/frame/Desktop.hpp>
|
#include <com/sun/star/frame/Desktop.hpp>
|
||||||
@@ -83,6 +84,7 @@ Reference<XSearchable> openedXSearchable;
|
|||||||
Reference<XSelectionSupplier> openedXSelectionSupplier;
|
Reference<XSelectionSupplier> openedXSelectionSupplier;
|
||||||
Reference<XFrame> openedXFrame;
|
Reference<XFrame> openedXFrame;
|
||||||
Reference<XDispatchProvider> openedXDispatchProvider;
|
Reference<XDispatchProvider> openedXDispatchProvider;
|
||||||
|
Reference<XStorable> openedXStorable;
|
||||||
|
|
||||||
Reference<XIndexAccess> currentFindAll;
|
Reference<XIndexAccess> currentFindAll;
|
||||||
rtl::OUString lastSearch;
|
rtl::OUString lastSearch;
|
||||||
@@ -229,6 +231,15 @@ Reference<XDispatchHelper> getXDispatchHelper(){
|
|||||||
return helper;
|
return helper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference<XStorable> getXStorable(){
|
||||||
|
if(!openedXStorable.get()){
|
||||||
|
Reference<XStorable> stroable(getXModel(),UNO_QUERY);
|
||||||
|
openedXStorable.set(stroable);
|
||||||
|
LOG_EVAL(openedXStorable, @"XDispatchProvider");
|
||||||
|
}
|
||||||
|
return openedXStorable;
|
||||||
|
}
|
||||||
|
|
||||||
NSString * createFileUri(NSString * file){
|
NSString * createFileUri(NSString * file){
|
||||||
if(file==nil){
|
if(file==nil){
|
||||||
NSString * app_root_escaped = [[[NSBundle mainBundle] bundlePath] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
NSString * app_root_escaped = [[[NSBundle mainBundle] bundlePath] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
||||||
@@ -478,3 +489,17 @@ mlo_select_all(void){
|
|||||||
0,
|
0,
|
||||||
Sequence<PropertyValue >());
|
Sequence<PropertyValue >());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
void
|
||||||
|
mlo_save(void){
|
||||||
|
if(mlo_is_document_open()){
|
||||||
|
Reference<XStorable> storable =getXStorable();
|
||||||
|
if(storable->isReadonly()){
|
||||||
|
NSLog(@"Cannot save changes. File is read only");
|
||||||
|
}else{
|
||||||
|
storable->store();
|
||||||
|
NSLog(@"saved changes");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -15,4 +15,6 @@
|
|||||||
-(void)addToMainViewController;
|
-(void)addToMainViewController;
|
||||||
-(void)show;
|
-(void)show;
|
||||||
-(void)hide;
|
-(void)hide;
|
||||||
|
-(void)showLibreOffice;
|
||||||
|
-(void)hideLibreOffice;
|
||||||
@end
|
@end
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
@interface MLOKeyboardManager ()
|
@interface MLOKeyboardManager ()
|
||||||
@property MLOMainViewController * mainViewController;
|
@property MLOMainViewController * mainViewController;
|
||||||
@property UITextView * textView;
|
@property UITextView * textView;
|
||||||
|
@property BOOL allowLoToinvokdeKeyboard;
|
||||||
@property BOOL isShown;
|
@property BOOL isShown;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -40,6 +41,13 @@
|
|||||||
-(void)addToMainViewController{
|
-(void)addToMainViewController{
|
||||||
[self.mainViewController.canvas addSubview:self.textView];
|
[self.mainViewController.canvas addSubview:self.textView];
|
||||||
}
|
}
|
||||||
|
-(void)hideLibreOffice{
|
||||||
|
self.allowLoToinvokdeKeyboard =NO;
|
||||||
|
[self hide];
|
||||||
|
}
|
||||||
|
-(void)showLibreOffice{
|
||||||
|
self.allowLoToinvokdeKeyboard =NO;
|
||||||
|
}
|
||||||
-(void)initTextView{
|
-(void)initTextView{
|
||||||
self.textView = [[UITextView alloc] initWithFrame:CGRECT_ONE];
|
self.textView = [[UITextView alloc] initWithFrame:CGRECT_ONE];
|
||||||
self.textView.alpha = 0.0f;
|
self.textView.alpha = 0.0f;
|
||||||
@@ -77,6 +85,13 @@
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(void)loInvokeKeyboard{
|
||||||
|
if(self.allowLoToinvokdeKeyboard){
|
||||||
|
[self show];
|
||||||
|
}else{
|
||||||
|
self.allowLoToinvokdeKeyboard = YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
-(BOOL)canBecomeFirstResponder{
|
-(BOOL)canBecomeFirstResponder{
|
||||||
return YES;
|
return YES;
|
||||||
@@ -103,7 +118,7 @@
|
|||||||
void touch_ui_show_keyboard()
|
void touch_ui_show_keyboard()
|
||||||
{
|
{
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[[MLOManager getInstance].mainViewController.keyboard show];
|
[[MLOManager getInstance].mainViewController.keyboard loInvokeKeyboard];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +133,7 @@ bool touch_ui_keyboard_visible()
|
|||||||
{
|
{
|
||||||
// Should return info whether the soft keyboard is currently displayed,
|
// Should return info whether the soft keyboard is currently displayed,
|
||||||
// or a hardware keyboard is attached/paired.
|
// or a hardware keyboard is attached/paired.
|
||||||
return false;
|
return [MLOManager getInstance].mainViewController.keyboard.isShown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -88,6 +88,7 @@ static const NSTimeInterval ROTATE_FLASH_DURATION=0.5f;
|
|||||||
-(void)showLibreOffice{
|
-(void)showLibreOffice{
|
||||||
|
|
||||||
[self.mainViewController.toolbar showLibreOffice];
|
[self.mainViewController.toolbar showLibreOffice];
|
||||||
|
[self.mainViewController.keyboard showLibreOffice];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)hideLibreOffice{
|
-(void)hideLibreOffice{
|
||||||
@@ -98,7 +99,7 @@ static const NSTimeInterval ROTATE_FLASH_DURATION=0.5f;
|
|||||||
[main.gestureEngine hideLibreOffice];
|
[main.gestureEngine hideLibreOffice];
|
||||||
[main.scroller hideLibreOffice];
|
[main.scroller hideLibreOffice];
|
||||||
[main.selection reset];
|
[main.selection reset];
|
||||||
[main.keyboard hide];
|
[main.keyboard hideLibreOffice];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)initWindow:(UIWindow *) window{
|
-(void)initWindow:(UIWindow *) window{
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#import "MLOResourceImage.h"
|
#import "MLOResourceImage.h"
|
||||||
#import "MLOTopbarViewController.h"
|
#import "MLOTopbarViewController.h"
|
||||||
#import "MLOKeyboardManager.h"
|
#import "MLOKeyboardManager.h"
|
||||||
|
#import "mlo_uno.h"
|
||||||
|
|
||||||
@interface MLOToolbarViewController ()
|
@interface MLOToolbarViewController ()
|
||||||
@property NSArray * buttons;
|
@property NSArray * buttons;
|
||||||
@@ -32,9 +33,9 @@
|
|||||||
self.mainViewController = mainViewController;
|
self.mainViewController = mainViewController;
|
||||||
self.buttons=@[[self createExpandButton],
|
self.buttons=@[[self createExpandButton],
|
||||||
[self createFindButton],
|
[self createFindButton],
|
||||||
[self createEditButton]//,
|
[self createEditButton],
|
||||||
//[self createPrintButton],
|
[self createSaveButton]
|
||||||
//[self createSaveButton]
|
//[self createPrintButton]
|
||||||
];
|
];
|
||||||
self.tappable = NO;
|
self.tappable = NO;
|
||||||
|
|
||||||
@@ -129,8 +130,8 @@
|
|||||||
-(MLOToolbarButton *)createSaveButton{
|
-(MLOToolbarButton *)createSaveButton{
|
||||||
return [MLOToolbarButton
|
return [MLOToolbarButton
|
||||||
buttonWithImage: [MLOResourceImage save]
|
buttonWithImage: [MLOResourceImage save]
|
||||||
onTap: MLO_TOOLBAR_BUTTON_STUB_CALLBACK
|
onTap: ^{ mlo_save(); }
|
||||||
tapRelease: RETAP_OR_OTHER_TAPPED];
|
tapRelease: AUTOMATIC];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Reference in New Issue
Block a user