summaryrefslogtreecommitdiff
path: root/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller
diff options
context:
space:
mode:
Diffstat (limited to 'ios/shared/ios_sharedlo/objective_c/view_controllers/scroller')
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerData.h33
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerData.m209
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerGridViewController.h19
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerGridViewController.m136
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerTooltip.h16
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerTooltip.m78
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerViewController.h26
-rw-r--r--ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerViewController.m157
8 files changed, 0 insertions, 674 deletions
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerData.h b/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerData.h
deleted file mode 100644
index d47b4db00f32..000000000000
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerData.h
+++ /dev/null
@@ -1,33 +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 "MLOObject.h"
-
-static const CGFloat
- PIXEL_TO_LOGIC_RATIO = 14.978,//513885/30/MLO_IPAD_HEIGHT_IN_PIXELS,
- CANVAS_WIDTH_IN_LOGIC = 13000,
- // NOTE:
- // value keeps shifting between 14.975 and 14.984,
- // though mostly it is on the 14.975 area
-
- LO_PAGE_SEPARATOR_HEIGHT_IN_LOGIC = 18 * PIXEL_TO_LOGIC_RATIO,
- LO_HORIZONAL_BORDER_WIDTH_IN_LOGIC = 18 * PIXEL_TO_LOGIC_RATIO,
- PORTRAIT_PAGE_HEIGHT_IN_LOGIC_WITH_SEPARATOR = 513885 /30,
- PORTRAIT_PAGE_HEIGHT_IN_LOGIC_WITHOUT_SEPARATOR = PORTRAIT_PAGE_HEIGHT_IN_LOGIC_WITH_SEPARATOR - LO_PAGE_SEPARATOR_HEIGHT_IN_LOGIC;
-
-@class MLOMainViewController, MLOScrollerTooltip,MLOScrollerGridViewController;
-@interface MLOScrollerData : MLOObject
--(id)initWithMainViewController:(MLOMainViewController *) mainViewController;
--(void) onRotateWithGrid:(MLOScrollerGridViewController *) grid;
--(NSInteger) getTotalPages;
--(CGRect) getNewScrollerFrame;
--(CGRect) getShiftedScrollerFrame:(CGFloat) pixelDeltaX;
--(void) updateTooltip:(MLOScrollerTooltip *) tooltip withGrid:(MLOScrollerGridViewController *) grid;
--(void) showLibreOffice;
--(void) hideLibreOffice;
-@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerData.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerData.m
deleted file mode 100644
index 61d0f1eadb58..000000000000
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerData.m
+++ /dev/null
@@ -1,209 +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 "MLOScrollerData.h"
-#import "MLOMainViewController_Friend.h"
-#import "MLOGestureEngine_Impl.h"
-#import "MLOScrollerGridViewController.h"
-#import "MLOScrollerTooltip.h"
-#import "MLOGestureLimiter.h"
-#import "mlo_uno.h"
-#import "mlo_utils.h"
-
-@interface MLOScrollerData ()
-
-@property int left, top, zoom, visibleLeft, visibleTop, visibleRight, visibleBottom, zoomType, isBooklet;
-@property float totalPages, totalHeightInLogic, frameWidth, frameHeight, scrollerX, scrollerTotalHeight,tooltipPageHeight,tooltipX,tooltipMaxY;
-@property NSMutableString *mutableString;
-@property CGRect maxCanvas,contentCanvas,visibleCanvas;
-@property MLOMainViewController * mainViewController;
-
-@end
-
-static const float
- SCROLLER_WIDTH=10,
- SCROLLER_PADDING = 0,
-
- GRID_TO_TOOLTIP_DISTANCE = 2.0f,
-
- TOOLTIP_HEIGHT=60,
- TOOLTIP_WIDTH=100,
-
- FLOAT_RESET=-1.0f;
-
-static const int INT_RESET= -1;
-
-@implementation MLOScrollerData
-
-
--(id)initWithMainViewController:(MLOMainViewController *) mainViewController{
- self= [super init];
- if(self){
- self.mutableString = [NSMutableString stringWithString:@""];
- self.mainViewController = mainViewController;
- [self reset];
- }
- return self;
-}
-
--(void) showLibreOffice{
-}
-
--(void)hideLibreOffice{
- [self reset];
-}
-
--(void)reset{
- _tooltipMaxY= _tooltipPageHeight = _tooltipX = _totalPages = _totalHeightInLogic = _frameWidth= _frameHeight= _scrollerX= _scrollerTotalHeight = FLOAT_RESET;
- _left = _top = _zoom = _visibleLeft = _visibleTop = _visibleRight = _visibleBottom = _zoomType = _isBooklet = INT_RESET;
-
-}
-
--(void) updateViewData{
-
- mlo_fetch_view_data(_mutableString);
-
- sscanf([_mutableString UTF8String], "%d;%d;%d;%d;%d;%d;%d;%d;%d;",
- &_left,
- &_top,
- &_zoom,
- &_visibleLeft,
- &_visibleTop,
- &_visibleRight,
- &_visibleBottom,
- &_zoomType,
- &_isBooklet);
-
- if(LOG_GET_VIEW_DATA){
- NSLog(@"left=%d top=%d zoom=%d vLeft=%d vTop=%d vRight=%d vBottom=%d zoomType=%d isBooklet=%d",
- _left,
- _top,
- _zoom,
- _visibleLeft,
- _visibleTop,
- _visibleRight,
- _visibleBottom,
- _zoomType,
- _isBooklet);
- }
-}
-
--(BOOL)canCalculateDocumentSizeInLogic{
- return (_totalHeightInLogic != FLOAT_RESET);
-}
-
--(void) onRotateWithGrid:(MLOScrollerGridViewController *) grid{
- static const float SCROLLLER_X_OFFSET =SCROLLER_PADDING + SCROLLER_WIDTH ,
- DOUBLE_SCROLLER_PADDING =2*SCROLLER_PADDING,
- GRID_X_OFFSET= MLO_SCROLLER_GRID_WIDTH,
- TOOLTIP_X_OFFSET= GRID_X_OFFSET + GRID_TO_TOOLTIP_DISTANCE+ TOOLTIP_WIDTH;
-
- CGRect canvasFrame = _mainViewController.canvas.frame;
-
- _frameHeight = canvasFrame.size.height;
-
- _frameWidth = canvasFrame.size.width;
-
- _scrollerX = _frameWidth - SCROLLLER_X_OFFSET;
-
- _tooltipX = _frameWidth - TOOLTIP_X_OFFSET;
-
- _tooltipMaxY = _frameHeight - TOOLTIP_HEIGHT;
-
- _scrollerTotalHeight =_frameHeight -DOUBLE_SCROLLER_PADDING;
-
- _tooltipPageHeight = _frameHeight/_totalPages;
-
- [grid onRotate:_frameWidth - GRID_X_OFFSET];
-}
-
--(NSInteger) getTotalPages{
-
- NSInteger newTotalPages= mlo_get_page_count();
-
- if(newTotalPages!= _totalPages){
-
- _totalPages = newTotalPages;
- _totalHeightInLogic = _totalPages* PORTRAIT_PAGE_HEIGHT_IN_LOGIC_WITH_SEPARATOR;
-
- _tooltipPageHeight = _frameHeight/_totalPages;
-
- _mainViewController.gestureEngine.limiter.documentSizeInLogic = CGSizeMake(CANVAS_WIDTH_IN_LOGIC,
- _totalHeightInLogic);
- }
-
- return newTotalPages;
-}
-
-
--(CGRect) getShiftedScrollerFrame:(CGFloat) pixelDeltaX{
- pixelDeltaX *= PIXEL_TO_LOGIC_RATIO / [_mainViewController getZoom] * 100;
- CGFloat newTop = _visibleTop + pixelDeltaX;
- CGFloat newBottom = _visibleBottom + pixelDeltaX;
-
- BOOL isOverTop = newTop < 0.0f;
- BOOL isBelowBotton = newBottom > _totalHeightInLogic;
-
- if(!isOverTop && !isBelowBotton){
- _visibleTop = newTop;
- _visibleBottom = newBottom;
- }else{
- CGFloat scrollerHeightInLogic = _visibleBottom- _visibleTop;
- if(isOverTop){
- _visibleTop = 0.0f;
- _visibleBottom =scrollerHeightInLogic;
- }else{
- _visibleBottom = _totalHeightInLogic;
- _visibleTop = _totalHeightInLogic - scrollerHeightInLogic;
- }
- }
-
- return [self getNewScrollerFrame];
-}
--(CGRect)getNewScrollerFrame{
-
- [self updateViewData];
-
- CGFloat topRatio = max(_visibleTop / _totalHeightInLogic,0.0);
- CGFloat heightRatio = min((_visibleBottom / _totalHeightInLogic) - topRatio,1.0);
-
- return CGRectMake(_scrollerX,
- SCROLLER_PADDING +topRatio*_scrollerTotalHeight,
- SCROLLER_WIDTH,
- heightRatio*_scrollerTotalHeight);
-}
--(NSInteger) getCurrentPage{
-
- return min(
- max(
- ceilf(
- _visibleTop
- / PORTRAIT_PAGE_HEIGHT_IN_LOGIC_WITH_SEPARATOR
- ),
- 1),
- _totalPages);
-}
-
--(void) updateTooltip:(MLOScrollerTooltip *) tooltip withGrid:(MLOScrollerGridViewController *) grid{
- if(mlo_is_document_open() && _visibleTop>=0){
-
- NSInteger currentPage = [self getCurrentPage];
-
- if(tooltip){
-
- [tooltip updateWithFrame:CGRectMake(_tooltipX,
- min(_tooltipPageHeight * (currentPage -1),_tooltipMaxY),
- TOOLTIP_WIDTH,
- TOOLTIP_HEIGHT) inPage:currentPage];
- }
- [grid onCurrentPageChanged:currentPage];
- }
-}
-
-
-@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerGridViewController.h b/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerGridViewController.h
deleted file mode 100644
index 70bb544b6238..000000000000
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerGridViewController.h
+++ /dev/null
@@ -1,19 +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 "MLOObject.h"
-
-static const CGFloat MLO_SCROLLER_GRID_WIDTH = 20.0f;
-@class MLOMainViewController;
-@interface MLOScrollerGridViewController : MLOObject
--(id) initWithMainViewController:(MLOMainViewController *) mainViewController;
--(void) hide;
--(void) onCurrentPageChanged:(NSInteger) newCurrentPage;
--(void) onPageCountChanged:(NSInteger) newPageCount;
--(void)onRotate:(CGFloat) x;
-@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerGridViewController.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerGridViewController.m
deleted file mode 100644
index a7162453940a..000000000000
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerGridViewController.m
+++ /dev/null
@@ -1,136 +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 "MLOScrollerGridViewController.h"
-#import "MLOMainViewController.h"
-
-static const CGFloat GRID_LINE_WIDTH=1.5f,
- GRID_ACTUAL_WIDTH = MLO_SCROLLER_GRID_WIDTH- GRID_LINE_WIDTH,
- UNSELECTED_ALPHA=0.05f,
- SELECTED_ALPHA=0.15f;
-
-@interface MLOScrollerGridViewController ()
-@property MLOMainViewController * mainViewController;
-@property NSInteger pageCount,currentPage;
-@property CGFloat height,x,gridCellHeight;
-@property NSMutableArray * pages;
-@end
-
-@implementation MLOScrollerGridViewController
-
-
--(void)hide{
-
- [self resetMembers];
-
- for(UIView * cell in _pages){
- [cell removeFromSuperview];
- cell.alpha=0.0f;
- }
-
- [_pages removeAllObjects];
-
-}
-
--(void)resetMembers{
- _pageCount=-1;
- _currentPage=0;
- _height=-1.0f;
- _x=-1.0f;
- _gridCellHeight=-1.0;
-}
-
--(id) initWithMainViewController:(MLOMainViewController *) mainViewController{
- self = [super init];
- if (self) {
- self.mainViewController = mainViewController;
- [self resetMembers];
- self.pages = [NSMutableArray new];
- }
- return self;
-}
-
--(void)onRotate:(CGFloat) x{
- _height =_mainViewController.canvas.frame.size.height;
- _x=x;
- [self reshape];
-}
-
--(UIView *) getNewCell{
- UIView * cell =[UIView new];
-
- cell.backgroundColor = [UIColor blackColor];
- cell.alpha = UNSELECTED_ALPHA;
-
- [_mainViewController.canvas addSubview:cell];
-
- return cell;
-}
-
--(void)onPageCountChanged:(NSInteger) newPageCount{
- if(_pageCount!=newPageCount){
- _pageCount = newPageCount;
-
- NSInteger currentSize = [_pages count];
-
- NSInteger delta = abs(currentSize-newPageCount);
-
- if(delta>0){
- BOOL isAdd = currentSize< newPageCount;
-
- for (NSInteger i=0; i<delta; i++) {
-
- if(isAdd){
-
- [_pages addObject:[self getNewCell]];
-
- }else{
- [_pages removeLastObject];
- }
- }
-
- [self reshape];
-
- if(!isAdd){
- if(_currentPage > newPageCount){
- [self onCurrentPageChanged:newPageCount];
- }
- }
- }
- }
-}
-
--(void)reshape{
- if((_x>=0) &&(_pageCount>0)){
- _gridCellHeight= (_height - GRID_LINE_WIDTH*(_pageCount +1 ))/_pageCount;
-
- CGFloat y = GRID_LINE_WIDTH;
-
- for (UIView * cell in _pages){
-
- cell.frame = CGRectMake(_x+GRID_LINE_WIDTH, y, GRID_ACTUAL_WIDTH, _gridCellHeight);
-
- y+=_gridCellHeight +GRID_LINE_WIDTH;
- }
- }
-}
-
--(void) onCurrentPageChanged:(NSInteger) newCurrentPage{
- if(_currentPage!=newCurrentPage){
- if( (_currentPage > 0) && ([_pages count] >= _currentPage)){
- ((UIView *) [_pages objectAtIndex:_currentPage-1]).alpha = UNSELECTED_ALPHA;
- }
- if( (newCurrentPage > 0) && ([_pages count] >= newCurrentPage)){
- ((UIView *) [_pages objectAtIndex:newCurrentPage -1]).alpha = SELECTED_ALPHA;
- }
- _currentPage = newCurrentPage;
- }
-
-}
-
-@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerTooltip.h b/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerTooltip.h
deleted file mode 100644
index fdc3b4f05849..000000000000
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerTooltip.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 MLOScrollerTooltip : UITextView
-@property NSString * extension;
--(void) updateWithFrame:(CGRect) newFrame inPage:(NSInteger) page;
--(void) hide;
--(void) hideLibreOffice;
-@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerTooltip.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerTooltip.m
deleted file mode 100644
index 776f84e01f51..000000000000
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerTooltip.m
+++ /dev/null
@@ -1,78 +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 "MLOCommon.h"
-#import "MLOScrollerTooltip.h"
-#import "MLOManager.h"
-#import <QuartzCore/QuartzCore.h>
-
-@interface MLOScrollerTooltip ()
-@property NSInteger lastPage;
-@end
-
-static const CGFloat BORDER_WIDTH = 1.0f,VISIBLE_ALPHA=0.85f;
-
-@implementation MLOScrollerTooltip
-
-- (id)init{
-
- self = [super init];
- if(self){
-
- self.alpha= 0.0f;
- self.frame =CGRECT_ONE;
- self.backgroundColor = [UIColor whiteColor];
-
- self.layer.borderWidth = BORDER_WIDTH;
- self.layer.borderColor = [[UIColor grayColor] CGColor];
-
- self.extension=nil;
- _lastPage = -1;
-
- self.textAlignment = NSTextAlignmentCenter;
- self.textColor = [UIColor blackColor];
- }
- return self;
-}
-
--(void) updateWithFrame:(CGRect) newFrame inPage:(NSInteger) page{
-
- BOOL isForceUpdateFrame =NO;
-
- if(_extension==nil){
- self.extension = [[[MLOManager getInstance] extension] uppercaseString];
-
- isForceUpdateFrame = YES;
- }
-
- if((self.frame.origin.y != newFrame.origin.y) || isForceUpdateFrame){
-
- self.alpha=VISIBLE_ALPHA;
-
- self.frame = newFrame;
-
- self.text = [NSString stringWithFormat:@"Page %d This %@ is editable",page,_extension];
-
- [self setNeedsDisplay];
-
- _lastPage = page;
- }
-
-}
-
--(void) hide{
- self.frame = self.bounds=CGRECT_ONE;
- self.alpha = 0.0f;
-}
-
--(void) hideLibreOffice{
- self.extension = nil;
-}
-
-
-@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerViewController.h b/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerViewController.h
deleted file mode 100644
index 4498e1e2c363..000000000000
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerViewController.h
+++ /dev/null
@@ -1,26 +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 "MLOObject.h"
-@class MLOScrollerData;
-@class MLOMainViewController;
-@interface MLOScrollerViewController : MLOObject
-@property MLOScrollerData * data;
-
--(void)updateByLogic;
--(void)updateByPixelDeltaY:(CGFloat) pixelDeltaY;
--(void)contentHasChanged;
--(void)onRotate;
--(id)initWithMainViewController:(MLOMainViewController *) mainViewController;
--(void) reset;
--(void) fadeOut;
--(void) addToMainViewController;
--(void) hideLibreOffice;
--(void) showLibreOffice;
-
-@end
diff --git a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerViewController.m b/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerViewController.m
deleted file mode 100644
index ccb9d5df6ffd..000000000000
--- a/ios/shared/ios_sharedlo/objective_c/view_controllers/scroller/MLOScrollerViewController.m
+++ /dev/null
@@ -1,157 +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 "MLOScrollerViewController.h"
-#import "MLOMainViewController.h"
-#import "MLOSubView.h"
-#import "MLOScrollerData.h"
-#import "MLOScrollerTooltip.h"
-#import "MLOScrollerGridViewController.h"
-#import "mlo_uno.h"
-
-@interface MLOScrollerViewController ()
-@property BOOL isContentChanged,hasUpdated;
-@property MLOMainViewController * mainViewController;
-@property MLOSubView * scroller;
-@property MLOScrollerTooltip * tooltip;
-@property MLOScrollerGridViewController * grid;
-@property NSDate * fadeOutTime;
-@end
-
-static const CGFloat
-SCROLLER_CORNER_RADIUS =3.0f,
-RESHAPE_ANIMATION_DURATION= 0.05f,
-SCROLLER_FADE_OUT_DELAY=0.45f,
-SCROLLER_FADE_OUT_DURATION=1.0f,
-SCROLLER_FADE_OUT_INVOCATION =SCROLLER_FADE_OUT_DELAY+0.05f;
-
-// Tooltip is removed at request of PM
-// Maybe they'll want it back, or similar, in the future
-
-static const BOOL IS_SHOW_TOOLTIP =NO;
-
-@implementation MLOScrollerViewController
-
--(id) initWithMainViewController:(MLOMainViewController *) mainViewController{
- self = [super init];
- if(self){
- self.mainViewController = mainViewController;
- self.scroller = [[MLOSubView alloc] initHiddedWithColor:[UIColor grayColor] cornerRadius:SCROLLER_CORNER_RADIUS];
- self.data = [[MLOScrollerData alloc] initWithMainViewController:mainViewController];
- if(IS_SHOW_TOOLTIP){
- self.tooltip = [MLOScrollerTooltip new];
- }else{
- self.tooltip = nil;
- }
- self.fadeOutTime = nil;
- self.grid = [[MLOScrollerGridViewController alloc] initWithMainViewController:mainViewController];
- _isContentChanged =YES;
- _hasUpdated =NO;
-
- [_data onRotateWithGrid:_grid];
- }
- return self;
-}
-
--(void) addToMainViewController{
-
- [_mainViewController.canvas addSubview:_scroller];
- [_mainViewController.canvas addSubview:_tooltip];
-}
-
--(void) showLibreOffice{
- [_data showLibreOffice];
- [self contentHasChanged];
-
- if(mlo_is_document_open()){
- [self updateByLogic:NO];
- }
-}
-
--(void)contentHasChanged{
- self.isContentChanged = YES;
-}
-
--(void)onRotate{
- [self contentHasChanged];
- [_data onRotateWithGrid:_grid];
-
-}
-
--(void)updateByLogic{
- [self updateByLogic:YES];
-}
-
--(void)updateByPixelDeltaY:(CGFloat) pixelDeltaY{
-
- [self updateAndShowScroller:YES newScrollerFrame:[_data getShiftedScrollerFrame:pixelDeltaY]];
-}
-
--(void)updateByLogic:(BOOL) isShow {
-
- if(_isContentChanged){
-
- [_grid onPageCountChanged:[_data getTotalPages]];
-
- _isContentChanged=NO;
- }
-
- [self updateAndShowScroller:isShow newScrollerFrame:[_data getNewScrollerFrame]];
-}
-
--(void)updateAndShowScroller:(BOOL) isShow newScrollerFrame:(CGRect) newScrollerFrame{
-
- if(isShow){
-
- _scroller.alpha = 0.5;
- }
- [UIView animateWithDuration:_hasUpdated ? RESHAPE_ANIMATION_DURATION :0.0f
- animations:^{ _scroller.frame = newScrollerFrame; }
- completion:^(BOOL isCompleted){
-
- self.fadeOutTime = [NSDate dateWithTimeIntervalSinceNow:SCROLLER_FADE_OUT_DELAY];
- [self performSelector:@selector(timedFadeOut) withObject:nil afterDelay:SCROLLER_FADE_OUT_INVOCATION];
-
- }];
-
- [_data updateTooltip:_tooltip withGrid:_grid];
-
- _hasUpdated=YES;
-}
-
-
--(void) reset{
-
- [_scroller hide];
- [_tooltip hide];
-
- _hasUpdated=NO;
- [self onRotate];
-}
-
--(void) timedFadeOut {
- NSDate * date = self.fadeOutTime;
-
- if(![[date laterDate:[NSDate date]] isEqualToDate:date]){
- [self fadeOut];
- }
-}
-
--(void)fadeOut{
-
- [_scroller fade:OUT];
-}
-
--(void) hideLibreOffice{
- [_tooltip hideLibreOffice];
- [_grid hide];
- [self contentHasChanged];
- [_data hideLibreOffice];
-}
-
-@end