SkyEpub SDK for iOS 7
 All Classes Functions Variables Properties
ReflowableViewController.h
1 //
2 // ReflowableViewController.h
3 // Created by SkyTree on 11. 8. 29..
4 // Copyright (c) 2011 Skytree Corporation. All rights reserved.
5 //
6 
7 #import <UIKit/UIKit.h>
8 #import "Book.h"
9 
11 @protocol ContentProvider;
12 
13 
17 @interface PageInformation :NSObject{
19  NSInteger bookCode;
21  NSInteger code;
23  NSInteger chapterIndex;
27  NSInteger pageIndex;
31  NSString* chapterTitle;
33  NSMutableArray *highlightsInPage;
39  NSString *pageDescription;
40  bool isLoadedChapter;
42  NSInteger startIndex;
44  NSInteger endIndex;
46  NSInteger pageIndexInBook;
52  NSInteger textLengthInPage;
53 }
54 
55 @property NSInteger code,bookCode;
56 @property NSInteger chapterIndex;
57 @property NSInteger numberOfChaptersInBook;
58 @property NSInteger pageIndex;
59 @property NSInteger numberOfPagesInChapter;
60 @property (nonatomic,retain) NSString* chapterTitle;
61 @property (nonatomic,retain) NSMutableArray *highlightsInPage;
62 @property double pagePositionInChapter;
63 @property double pagePositionInBook;
64 @property (nonatomic,retain) NSString* pageDescription;
65 @property bool isLoadedChapter;
66 @property NSInteger startIndex,endIndex;
67 @property NSInteger pageIndexInBook,numberOfPagesInBook;
68 @property NSInteger firstCharacterOffsetInPage,textLengthInPage;
69 @end
70 
74 @interface PagingInformation :NSObject {
75  int code;
77  NSInteger bookCode;
79  NSInteger chapterIndex;
83  NSString *fontName;
85  NSInteger fontSize;
87  int width;
89  int hegith;
91  NSInteger lineSpacing;
97  BOOL isPortrait;
100 }
101 
102 @property (nonatomic,retain) NSString *fontName;
103 @property NSInteger bookCode,chapterIndex,numberOfPagesInChapter,fontSize,lineSpacing;
104 @property double verticalGapRatio,horizontalGapRatio;
105 @property BOOL isPortrait,isDoublePagedForLandscape;
106 @property int code,width,height;
107 
108 -(BOOL)isEqualTo:(PagingInformation*)pgi;
109 @end
110 
111 
116 @optional
118 -(NSMutableArray*)reflowableViewController:(ReflowableViewController*)rvc highlightsForChapter:(NSInteger)chapterIndex;
120 -(void)reflowableViewController:(ReflowableViewController*)rvc insertHighlight:(Highlight*)highlight;
122 -(void)reflowableViewController:(ReflowableViewController*)rvc deleteHighlight:(Highlight*)highlight;
124 -(NSInteger)reflowableViewController:(ReflowableViewController*)rvc numberOfPagesForPagingInformation:(PagingInformation*)pagingInformation;
125 
126 // 3.5.5
128 -(void)reflowableViewController:(ReflowableViewController*)rvc updateHighlight:(Highlight*)highlight;
130 -(NSString*)reflowableViewController:(ReflowableViewController*)rvc scriptForChapter:(NSInteger)chapterIndex;
132 -(NSString*)reflowableViewController:(ReflowableViewController*)rvc styleForChapter:(NSInteger)chapterIndex;
134 -(BOOL)reflowableViewController:(ReflowableViewController*)rvc isBookmarked:(PageInformation*)pageInformation;
136 -(UIImage*)bookmarkImage:(ReflowableViewController*)rvc isBookmarked:(BOOL)isBookmarked;
138 -(CGRect)bookmarkRect:(ReflowableViewController*)rvc isBookmarked:(BOOL)isBookmarked;
139 @end
140 
141 @class Parallel;
146 @optional
148 -(void)reflowableViewController:(ReflowableViewController*)rvc didSelectRange:(Highlight*)highlight startRect:(CGRect)startRect endRect:(CGRect)endRect;
150 -(void)reflowableViewController:(ReflowableViewController*)rvc didDetectTapAtPosition:(CGPoint)position;
152 -(void)reflowableViewController:(ReflowableViewController*)rvc didDetectDoubleTapAtPosition:(CGPoint)position;
154 -(void)reflowableViewController:(ReflowableViewController*)rvc pageMoved:(PageInformation*)pageInformation;
156 -(void)reflowableViewController:(ReflowableViewController*)rvc didSearchKey:(SearchResult*)searchResult;
158 -(void)reflowableViewController:(ReflowableViewController*)rvc didFinishSearchForChapter:(SearchResult*)searchResult;
160 -(void)reflowableViewController:(ReflowableViewController*)rvc didFinishSearchAll:(SearchResult*)searchResult;
162 -(void)reflowableViewController:(ReflowableViewController*)rvc didStartPaging:(int)bookCode;
164 -(void)reflowableViewController:(ReflowableViewController*)rvc didPaging:(PagingInformation*)pagingInformation;
166 -(void)reflowableViewController:(ReflowableViewController*)rvc didFinishPaging:(int)bookCode;
167 
169 -(void)reflowableViewController:(ReflowableViewController*)rvc didChapterLoad:(int)chapterIndex;
170 
172 -(void)reflowableViewController:(ReflowableViewController*)rvc parallelDidStart:(Parallel*)parallel;
174 -(void)reflowableViewController:(ReflowableViewController*)rvc parallelDidEnd:(Parallel*)parallel;
176 -(void)parallesDidEnd:(ReflowableViewController*)rvc;
177 
178 // 3.5.5
180 -(void)reflowableViewController:(ReflowableViewController*)rvc didHitHighlight:(Highlight*)highlight atPosition:(CGPoint)position startRect:(CGRect)startRect endRect:(CGRect)endRect;
181 // 3.6.2
183 -(void)reflowableViewController:(ReflowableViewController*)rvc didHitLink:(NSString*)urlString;
185 -(void)reflowableViewController:(ReflowableViewController*)rvc didHitImage:(NSString*)urlString;
186 
187 // 4.2.5
189 -(void)reflowableViewController:(ReflowableViewController*)rvc didHitLinkForLinearNo:(NSString*)urlString;
190 
191 
192 -(void)pageTransitionStarted:(ReflowableViewController*)rvc;
193 -(void)pageTransitionEnded:(ReflowableViewController*)rvc;
195 -(void)reflowableViewController:(ReflowableViewController*)rvc didSelectionCanceled:(NSString*)lastSelectedText;
197 -(void)reflowableViewController:(ReflowableViewController*)rvc didSelectionChanged:(NSString*)selectedText;
198 -(void)reflowableViewController:(ReflowableViewController*)rvc didHitBookmark:(PageInformation*)pageInformation isBookmarked:(BOOL)isBookmarked;
199 
200 // 4.0
201 -(void)reflowableViewController:(ReflowableViewController*)rvc drawHighlightRect:(CGRect)highlightRect context:(CGContextRef)context highlightColor:(UIColor*)highlightColor highlight:(Highlight*)highlight;
202 
203 // 6.2.0
205 -(void)reflowableViewController:(ReflowableViewController*)rvc failedToMove:(BOOL)toForward;
206 
207 @end
208 
209 
213 @interface ReflowableViewController : UIViewController {
217  int bookCode;
219  id <ReflowableViewControllerDelegate> delegate;
221  id <ReflowableViewControllerDataSource> dataSource;
225  __weak NSString *version;
227  __weak NSString *baseDirectory;
233  __weak UIView *backgroundView;
235  UIView* customView;
237  id<ContentProvider> contentProvider;
239  Book* book;
240 }
241 
242 @property int transitionType;
243 @property int bookCode;
244 @property BOOL rotationLocked,isSearching;
245 @property (nonatomic,weak) id <ReflowableViewControllerDelegate> delegate;
246 @property (nonatomic,weak) id <ReflowableViewControllerDataSource> dataSource;
247 @property (nonatomic,weak) NSString *version;
248 @property (nonatomic,weak) NSString *baseDirectory;
249 @property (nonatomic,weak) UIView *backgroundView;
250 @property (nonatomic,retain) UIView* customView;
251 @property (nonatomic,retain) Book* book;
252 
254 -(id)initWithStartPagePositionInBook:(double)pagePositionInBook;
256 -(PageInformation*)getPageInformationAtPagePositionInBook:(double)pagePositionInBook;
258 -(PageInformation*)getPageInformation;
260 -(void)gotoPageByPagePositionInBook:(double)pagePositionInBook;
262 -(void)gotoPageByPagePositionInBook:(double)pagePositionInBook animated:(BOOL)animated;
264 -(void)gotoPageByPagePosition:(double)pagePositionInChapter inChapter:(int)chapterIndex;
266 -(void)gotoPageByUniqueIndex:(int)index inChapter:(int)chapterIndex;
268 -(void)gotoPageByNavMapIndex:(int)index;
270 -(void)gotoPageByHighlight:(Highlight*)highlight;
272 -(void)gotoPageBySearchResult:(SearchResult*)searchResult;
274 -(void)changeFontName:(NSString*)fontName fontSize:(NSInteger)fontSize;
276 -(void)changeFontName:(NSString *)fontName fontSize:(NSInteger)fontSize lineSpacing:(NSInteger)lineSpacing;
278 -(void)changeFontToDefault;
280 -(void)changeLineSpacing:(NSInteger)lineSpacing;
282 -(void)changeForegroundColor:(UIColor*)foregroundColor backgroundColor:(UIColor*)backgroundColor;
284 -(void)changeForegroundColor:(UIColor*)foregroundColor;
286 -(void)changeBackgroundColor:(UIColor *)backgroundColor;
288 -(void)setBackgroundImageForLandscape:(UIImage*)backgroundImage contentRect:(CGRect)rect;
290 -(void)setBackgroundImageForPortrait:(UIImage*)backgroundImage contentRect:(CGRect)rect;
292 -(void)setMarkerImage:(UIImage*)markerImage;
294 -(void)makeSelectionHighlight:(UIColor*)color;
296 -(void)makeSelectionNote:(UIColor*)color;
298 -(void)deleteHightlight:(Highlight*)highlight;
300 -(void)reloadData;
302 -(void)reloadHighlights;
304 -(void)reloadNCX;
306 -(void)searchKey:(NSString*)key;
308 -(void)searchMore;
310 -(void)pauseSearch;
312 -(void)stopSearch;
314 -(void)unselect;
315 -(void)normalizeAll;
317 -(NSString*)executeScript:(NSString*)script;
319 -(void)setVerticalGapRatio:(double)ratio;
321 -(void)setHorizontalGapRatio:(double)ratio;
323 -(void)setDoublePagedForLandscape:(BOOL)isDoublePagedForLandscape;
325 -(void)setGlobalPaging:(BOOL)isGlobalPaging;
326 
328 -(void)showIndicatorWhileLoadingChapter:(BOOL)show;
330 -(void)showIndicatorWhilePaging:(BOOL)show;
332 -(void)showIndicatorWhileRotating:(BOOL)show;
334 -(void)allowPageTransitionFast:(BOOL)isFast;
335 
337 -(void)gotoPageInChapter:(int)pageIndex;
339 -(void)gotoNextPageInChapter;
341 -(void)gotoPrevPageInChapter;
343 -(int)pageCountInChapter;
345 -(int)pageIndexInChapter;
347 -(void)gotoPrevChapter;
349 -(void)gotoNextChapter;
350 
351 
353 -(BOOL)isMediaOverlayAvailable;
355 -(void)playFirstParallelInPage;
357 -(void)pausePlayingParallel;
359 -(void)stopPlayingParallel;
361 -(void)playParallel:(Parallel*)parallel;
363 -(void)playParallelByIndex:(int)parallelIndex;
365 -(Parallel*)getParallelByIndex:(int)parallelIndex;
367 -(int)parallelCountInChapter;
369 -(void)playNextParallel;
371 -(void)playPrevParallel;
373 -(void)resumePlayingParallel;
375 -(BOOL)isPlayingPaused;
377 -(BOOL)isPlayingStarted;
378 
380 -(void)changeElementColor:(NSString*)colorString hash:(NSString*)hash;
382 -(void)restoreElementColor;
383 
384 -(void)debug0;
385 -(void)debug1;
386 -(void)debug2;
388 -(void)gotoChapter:(int)chapterIndex;
390 -(void)gotoPage:(int)pageIndex;
392 -(void)setContentProviderClass:(Class)contentProvider;
394 -(void)setContentProvider:(id<ContentProvider>)customProvider;
395 
397 -(void)useDOMHighlight:(BOOL)useDOM;
398 
399 // 3.5.5
401 -(void)changeHighlight:(Highlight*)highlight color:(UIColor*)color;
403 -(void)changeHighlight:(Highlight *)highlight note:(NSString *)note;
405 -(void)changeHighlight:(Highlight *)highlight color:(UIColor*)color note:(NSString *)note;
407 -(BOOL)isDoublePaged;
409 -(void)refresh;
411 -(void)repaint;
413 -(CGRect)getStartRectFromHighlight:(Highlight*)highlight;
415 -(CGRect)getEndRectFromHighlight:(Highlight*)highlight;
417 -(double)getPagePositionInBook:(int)pageIndex;
418 
420 -(void)backupPosition;
422 -(void)restorePosition;
423 
425 -(void)hidePages;
427 -(void)showPages;
429 -(BOOL)isPagesShown;
430 
432 -(void)setLicenseKey:(NSString *)licenseKey;
434 -(void)setMenuControllerEnabled:(BOOL)isEnabled;
435 
437 -(int)toWebX:(int)vx;
439 -(int)toViewX:(int)wx;
441 -(int)toWebY:(int)vy;
443 -(int)toViewY:(int)wy;
444 
445 // 3.7.1
447 -(id)initWithStartChapterIndex:(int)ci hashLocation:(NSString*)hashLocation;
449 -(void)gotoPageByChapterIndex:(int)ci hashLocation:(NSString*)hashLocation;
451 -(void)gotoPageByNavPoint:(NavPoint*)navPoint;
453 -(id)initWithStartNavPoint:(NavPoint*)np; // 5.2
454 
455 
456 // 3.8.1
458 -(int)getNumberOfChaptersInBook;
460 -(int)getPageIndexInBook;
462 -(int)getNumberOfPagesInBook;
463 
464 // 3.8.2
466 -(void)setBlankColor:(UIColor*)blankColor;
467 
468 // 3.9.0
470 -(BOOL)isRTL;
471 
472 // 3.9.2
473 -(void)setDelayTimeForProcessContentInRecalc:(double)time;
474 -(void)setDelayTimeForProcessContentInRecalcPagesForRotation:(double)time;
475 -(void)setDelayTimeForShowWebViewInProcessContent:(double)time;
476 -(void)setDelayTimeForBringContentViewToFrontInShowWebView:(double)time;
477 -(void)setDelayTimeForMakeAndResetPageImagesInShowWebViewForPaing:(double)time;
478 -(void)setDelayTimeForSetPageReadyInShowWebView:(double)time;
479 
480 // 4.0
482 -(void)setCustomDrawHighlight:(BOOL)isCustomDraw;
483 
484 // 4.2.2
486 -(void)destroy;
487 
488 // 4.2.6
490 -(void)setRTL:(BOOL)isRTL;
492 -(NavPoint*)getNavPoint:(int)navIndex;
493 
494 // 4.6.1
496 -(NSString *)getCoverURL;
497 
498 // 5.0
500 -(BOOL)isGlobalPagination;
502 -(BOOL)isPaging;
504 -(int)getChapterIndexByPageIndexInBook:(int)pageIndexInBook;
506 -(int)getPageIndexByPageIndexInBook:(int)pageIndexInBook;
508 -(int)getNumberOfPagesInChapter:(int)ci;
510 -(double)getPagePositionByPageIndexInBook:(int)pageIndexInBook;
512 -(double)getPagePositionInBookByPageIndexInBook:(int)pageIndexInBook;
513 
514 // 5.0.8
516 -(void)setMaxWebViews:(int)max;
517 
518 // 5.1.0
520 -(void)setGlobalOffset:(BOOL)isGlobalOffset;
521 
522 // 5.1.2
524 -(void)setDrawingHighlightOnFront:(BOOL)value;
525 
526 // 5.2
528 -(NSString*)executeJavascript:(NSString*)script;
529 
530 // 6.0
532 -(BOOL)isVerticalWriting;
534 -(BOOL)isPortrait;
535 
536 // 6.0.8
538 -(BOOL)isScrollMode;
540 -(void)setScrollModeEnable;
542 -(void)setScrollMode:(BOOL)value;
544 -(int)getPageIndexInBookByPagePositionInBook:(double)pagePositionInBook;
545 
546 // 6.1.3
548 -(void)keepBackgroundColor:(BOOL)value;
549 
550 // 6.2.7
552 -(void)setNavigationAreaWidthRatio:(float)navigationAreaWidthRatio;
553 
554 // 6.2.9
556 -(void)createSelectionWithStartIndex:(int)startNodeIndex withStartOffset:(int)startOffset withEndIndex:(int)endNodeIndex withEndOffset:(int)endOffset;
557 
558 // 7.0.0
560 -(void)markHighlight:(Highlight*)highlight;
562 -(void)markParallelHighlight:(Parallel*)parallel color:(UIColor*)color;
564 -(void)removeParallelHighlights;
565 
566 
567 
569 -(void)setTTSEnabled:(BOOL)enabled;
571 -(BOOL)isTTSEnabled;
572 
573 /*
574  Arabic (Saudi Arabia) - ar-SA
575  Chinese (China) - zh-CN
576  Chinese (Hong Kong SAR China) - zh-HK
577  Chinese (Taiwan) - zh-TW
578  Czech (Czech Republic) - cs-CZ
579  Danish (Denmark) - da-DK
580  Dutch (Belgium) - nl-BE
581  Dutch (Netherlands) - nl-NL
582  English (Australia) - en-AU
583  English (Ireland) - en-IE
584  English (South Africa) - en-ZA
585  English (United Kingdom) - en-GB
586  English (United States) - en-US
587  Finnish (Finland) - fi-FI
588  French (Canada) - fr-CA
589  French (France) - fr-FR
590  German (Germany) - de-DE
591  Greek (Greece) - el-GR
592  Hebrew (Israel) - he-IL
593  Hindi (India) - hi-IN
594  Hungarian (Hungary) - hu-HU
595  Indonesian (Indonesia) - id-ID
596  Italian (Italy) - it-IT
597  Japanese (Japan) - ja-JP
598  Korean (South Korea) - ko-KR
599  Norwegian (Norway) - no-NO
600  Polish (Poland) - pl-PL
601  Portuguese (Brazil) - pt-BR
602  Portuguese (Portugal) - pt-PT
603  Romanian (Romania) - ro-RO
604  Russian (Russia) - ru-RU
605  Slovak (Slovakia) - sk-SK
606  Spanish (Mexico) - es-MX
607  Spanish (Spain) - es-ES
608  Swedish (Sweden) - sv-SE
609  Thai (Thailand) - th-TH
610  Turkish (Turkey) - tr-TR
611  */
612 
614 -(BOOL)setTTSLanguage:(NSString*)language;
616 -(void)setTTSPitch:(float)pitch;
618 -(void)setTTSRate:(float)rate;
619 
620 @end