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:
parent
07d7be1ac8
commit
1034a2eb97
@ -23,6 +23,7 @@ extern "C" {
|
||||
void mlo_get_selection(NSMutableString * mutableString);
|
||||
void mlo_fetch_view_data(NSMutableString * mutableString);
|
||||
void mlo_select_all(void);
|
||||
void mlo_save(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "com/sun/star/frame/XDispatchHelper.hpp"
|
||||
#include <com/sun/star/frame/DispatchHelper.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/container/XContentEnumerationAccess.hpp>
|
||||
#include <com/sun/star/frame/Desktop.hpp>
|
||||
@ -83,6 +84,7 @@ Reference<XSearchable> openedXSearchable;
|
||||
Reference<XSelectionSupplier> openedXSelectionSupplier;
|
||||
Reference<XFrame> openedXFrame;
|
||||
Reference<XDispatchProvider> openedXDispatchProvider;
|
||||
Reference<XStorable> openedXStorable;
|
||||
|
||||
Reference<XIndexAccess> currentFindAll;
|
||||
rtl::OUString lastSearch;
|
||||
@ -229,6 +231,15 @@ Reference<XDispatchHelper> getXDispatchHelper(){
|
||||
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){
|
||||
if(file==nil){
|
||||
NSString * app_root_escaped = [[[NSBundle mainBundle] bundlePath] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
||||
@ -477,4 +488,18 @@ mlo_select_all(void){
|
||||
OUString("_self"),
|
||||
0,
|
||||
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)show;
|
||||
-(void)hide;
|
||||
-(void)showLibreOffice;
|
||||
-(void)hideLibreOffice;
|
||||
@end
|
||||
|
@ -15,6 +15,7 @@
|
||||
@interface MLOKeyboardManager ()
|
||||
@property MLOMainViewController * mainViewController;
|
||||
@property UITextView * textView;
|
||||
@property BOOL allowLoToinvokdeKeyboard;
|
||||
@property BOOL isShown;
|
||||
@end
|
||||
|
||||
@ -40,6 +41,13 @@
|
||||
-(void)addToMainViewController{
|
||||
[self.mainViewController.canvas addSubview:self.textView];
|
||||
}
|
||||
-(void)hideLibreOffice{
|
||||
self.allowLoToinvokdeKeyboard =NO;
|
||||
[self hide];
|
||||
}
|
||||
-(void)showLibreOffice{
|
||||
self.allowLoToinvokdeKeyboard =NO;
|
||||
}
|
||||
-(void)initTextView{
|
||||
self.textView = [[UITextView alloc] initWithFrame:CGRECT_ONE];
|
||||
self.textView.alpha = 0.0f;
|
||||
@ -77,6 +85,13 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(void)loInvokeKeyboard{
|
||||
if(self.allowLoToinvokdeKeyboard){
|
||||
[self show];
|
||||
}else{
|
||||
self.allowLoToinvokdeKeyboard = YES;
|
||||
}
|
||||
}
|
||||
|
||||
-(BOOL)canBecomeFirstResponder{
|
||||
return YES;
|
||||
@ -103,7 +118,7 @@
|
||||
void touch_ui_show_keyboard()
|
||||
{
|
||||
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,
|
||||
// or a hardware keyboard is attached/paired.
|
||||
return false;
|
||||
return [MLOManager getInstance].mainViewController.keyboard.isShown;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -88,6 +88,7 @@ static const NSTimeInterval ROTATE_FLASH_DURATION=0.5f;
|
||||
-(void)showLibreOffice{
|
||||
|
||||
[self.mainViewController.toolbar showLibreOffice];
|
||||
[self.mainViewController.keyboard showLibreOffice];
|
||||
}
|
||||
|
||||
-(void)hideLibreOffice{
|
||||
@ -98,7 +99,7 @@ static const NSTimeInterval ROTATE_FLASH_DURATION=0.5f;
|
||||
[main.gestureEngine hideLibreOffice];
|
||||
[main.scroller hideLibreOffice];
|
||||
[main.selection reset];
|
||||
[main.keyboard hide];
|
||||
[main.keyboard hideLibreOffice];
|
||||
}
|
||||
|
||||
-(void)initWindow:(UIWindow *) window{
|
||||
|
@ -15,6 +15,7 @@
|
||||
#import "MLOResourceImage.h"
|
||||
#import "MLOTopbarViewController.h"
|
||||
#import "MLOKeyboardManager.h"
|
||||
#import "mlo_uno.h"
|
||||
|
||||
@interface MLOToolbarViewController ()
|
||||
@property NSArray * buttons;
|
||||
@ -32,9 +33,9 @@
|
||||
self.mainViewController = mainViewController;
|
||||
self.buttons=@[[self createExpandButton],
|
||||
[self createFindButton],
|
||||
[self createEditButton]//,
|
||||
//[self createPrintButton],
|
||||
//[self createSaveButton]
|
||||
[self createEditButton],
|
||||
[self createSaveButton]
|
||||
//[self createPrintButton]
|
||||
];
|
||||
self.tappable = NO;
|
||||
|
||||
@ -129,8 +130,8 @@
|
||||
-(MLOToolbarButton *)createSaveButton{
|
||||
return [MLOToolbarButton
|
||||
buttonWithImage: [MLOResourceImage save]
|
||||
onTap: MLO_TOOLBAR_BUTTON_STUB_CALLBACK
|
||||
tapRelease: RETAP_OR_OTHER_TAPPED];
|
||||
onTap: ^{ mlo_save(); }
|
||||
tapRelease: AUTOMATIC];
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
x
Reference in New Issue
Block a user