Change the translation of the "Help" menu item to "?", so that the menu can be displa...
[reactos.git] / rosapps / smartpdf / src / DisplayModelSplash.h
1 /* Copyright Krzysztof Kowalczyk 2006-2007
2 License: GPLv2 */
3 #ifndef _DISPLAY_MODEL_SPLASH_H_
4 #define _DISPLAY_MODEL_SPLASH_H_
5 /* How to think of display logic: physical screen of size
6 drawAreaSize is a window into (possibly much larger)
7 total area (canvas) of size canvasSize.
8
9 In DM_SINGLE_PAGE mode total area is the size of currently displayed page
10 given current zoomLovel and rotation.
11 In DM_CONTINUOUS mode total area consist of all pages rendered sequentially
12 with a given zoomLevel and rotation. totalAreaDy is the sum of heights
13 of all pages plus spaces between them and totalAreaDx is the size of
14 the widest page.
15
16 A possible configuration could look like this:
17
18 -----------------------------------
19 | |
20 | ------------- |
21 | | screen | |
22 | | i.e. | |
23 | | drawArea | |
24 | ------------- |
25 | |
26 | |
27 | canvas |
28 | |
29 | |
30 | |
31 | |
32 -----------------------------------
33
34 We calculate the total area size and position of each page we display on the
35 canvas. Canvas has to be >= draw area.
36
37 Changing zoomLevel or rotation requires recalculation of total area and
38 position of pdf pages in it.
39
40 We keep the offset of draw area relative to total area. The offset changes
41 due to scrolling (with keys or using scrollbars).
42
43 To draw we calculate which part of each page overlaps draw area, we render
44 those pages to a bitmap and display those bitmaps.
45 */
46
47 #include "DisplayState.h"
48 #include "DisplayModel.h"
49
50 class GooString;
51 class Link;
52 class LinkDest;
53 class LinkGoTo;
54 class LinkGoToR;
55 class LinkLaunch;
56 class LinkNamed;
57 class LinkURI;
58 class Links;
59 class PDFDoc;
60 class SplashBitmap;
61 class TextOutputDev;
62 class TextPage;
63 class UGooString;
64
65 /* Information needed to drive the display of a given PDF document on a screen.
66 You can think of it as a model in the MVC pardigm.
67 All the display changes should be done through changing this model via
68 API and re-displaying things based on new display information */
69 class DisplayModelSplash : public DisplayModel
70 {
71 public:
72 DisplayModelSplash(DisplayMode displayMode);
73 virtual ~DisplayModelSplash();
74
75 PdfEnginePoppler * pdfEnginePoppler() { return (PdfEnginePoppler*)pdfEngine(); }
76
77 virtual void handleLink(PdfLink *pdfLink);
78
79 TextPage * GetTextPage(int pageNo);
80
81 void EnsureSearchHitVisible();
82
83 void handleLinkGoTo(LinkGoTo *linkGoTo);
84 void handleLinkGoToR(LinkGoToR *linkGoToR);
85 void handleLinkURI(LinkURI *linkURI);
86 void handleLinkLaunch(LinkLaunch* linkLaunch);
87 void handleLinkNamed(LinkNamed *linkNamed);
88 BOOL CanGoToNextPage();
89 BOOL CanGoToPrevPage();
90
91 void FindInit(int startPageNo);
92 BOOL FindNextForward();
93 BOOL FindNextBackward();
94
95
96 void FreeTextPages(void);
97 void RecalcLinks(void);
98 void GoToDest(LinkDest *linkDest);
99 void GoToNamedDest(UGooString *dest);
100 void FreeLinks(void);
101
102 virtual int getTextInRegion(int pageNo, RectD *region, unsigned short *buf, int buflen);
103 virtual void cvtUserToScreen(int pageNo, double *x, double *y);
104 virtual void cvtScreenToUser(int *pageNo, double *x, double *y);
105
106 public:
107 PDFDoc * pdfDoc;
108 };
109
110 DisplayModelSplash *DisplayModelSplash_CreateFromFileName(const char *fileName,
111 SizeD totalDrawAreaSize,
112 int scrollbarXDy, int scrollbarYDx,
113 DisplayMode displayMode, int startPage,
114 WindowInfo *win);
115 #endif